-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
本の追加ページ(グローバル詳細ページ)の実装 #127
Conversation
<BookDetailEditButton bookId={id} /> | ||
<Button | ||
color="red" | ||
leftSection={<MdDeleteForever />} | ||
fz="lg" | ||
onClick={() => | ||
fetcher.submit( | ||
{ bookId: id }, | ||
{ action: '/home/books/$bookId', method: 'DELETE' }, | ||
) | ||
} | ||
disabled={fetcher.state === 'submitting'} | ||
> | ||
削除 | ||
</Button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
粒度が揃ってなくて気持ち悪いと思ってしまった.
コンポーネントにするか直書きするか揃えた方がよくない?
}: BookDetailControlPanelProps) => { | ||
const [user] = useAtom(userAtom); | ||
const fetcher = useFetcher(); | ||
const location = useLocation(); | ||
console.log('本の総数は', totalBook); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
消しておこう
<BookDetailTitle title={book.title} /> | ||
<GlobalBookDetailContentTable book={book} /> | ||
<BookDetailDescription description={book.description ?? ''} /> | ||
{bookId > 0 && <GlobalBookDetailLink bookId={bookId} />} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
すでに登録されているか判定する分岐だと思う.
登録されていない場合bookId
の値は -1 になるんだね.
undefinedの方が直感的だと思ったけどどう?
onCanPlay={() => | ||
fetcher.submit(addBookData, { | ||
action: '/home/global/books/$bookId', | ||
method: 'POST', | ||
}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onClick
を使わなかった理由を教えて欲しい
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
エディターのサポートで別のにしてたわ
// Google Books APIでisbnの味の検索ができるまではコメントアウト | ||
// id={book.isbn ? Number(book.isbn) : undefined} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FIXME
をつけておきたい
|
||
interface LoaderData { | ||
searchBooksResponse: searchBooksResponse; | ||
storageTotalBook: number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ヒットした書籍の冊数だと理解した.
単純に totalBook
ではダメなんだろうか?
// 書籍の情報を取得する | ||
const isbn = params.isbn ?? ''; | ||
const searchBooksResponse = await searchBooks({ isbn: isbn }); | ||
// 蔵書追加処理実装をするため蔵書の情報を取得する |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
コメントの内容
「既に登録済みであるか確認するため」の方がよくない?
}); | ||
} | ||
} else { | ||
// ログイン済みでない場合は、APIを呼び出す回数を減らすために蔵書の情報を取得しない |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
そもそも追加する権限を持ってないから最初からAPIを叩かないってことね
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
そうです
やったこと
確認した方法
pnpm run dev
スクリーンショット
自動生成したコード