Skip to content

Conversation

@Kosei805
Copy link
Contributor

@Kosei805 Kosei805 commented Nov 10, 2024

やったこと

  • やったこと (コミットのハッシュ)
  • 詳細ページの左側を再利用できるように書き換えた de8b556
  • グローバル検索での詳細ページを実装した ee57df8
  • actionでレスポンスを返せるよう、レスポンスの型を参照できるようにした b8dc79c
  • isbnのみでのGoogle Books APIが動かないので、詳細ページを開かないようにした 3260d34

確認した方法

  • モックサーバを起動し、pnpm run dev

スクリーンショット

image

自動生成したコード

  • ファイル名

@Kosei805 Kosei805 added the frontend frontend development label Nov 10, 2024
@Kosei805 Kosei805 requested a review from kimurash November 10, 2024 09:41
@Kosei805 Kosei805 self-assigned this Nov 10, 2024
@Kosei805 Kosei805 changed the title 69 book add page 本の追加ページ(グローバル詳細ページ)の実装 Nov 10, 2024
Comment on lines 14 to 28
<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>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

粒度が揃ってなくて気持ち悪いと思ってしまった.

コンポーネントにするか直書きするか揃えた方がよくない?

const [user] = useAtom(userAtom);
const fetcher = useFetcher();
const location = useLocation();
console.log('本の総数は', totalBook);
Copy link
Member

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} />}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

すでに登録されているか判定する分岐だと思う.

登録されていない場合bookId の値は -1 になるんだね.
undefinedの方が直感的だと思ったけどどう?

Comment on lines 32 to 37
onCanPlay={() =>
fetcher.submit(addBookData, {
action: '/home/global/books/$bookId',
method: 'POST',
})
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

onClick を使わなかった理由を教えて欲しい

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

エディターのサポートで別のにしてたわ

Comment on lines 14 to 15
// Google Books APIでisbnの味の検索ができるまではコメントアウト
// id={book.isbn ? Number(book.isbn) : undefined}
Copy link
Member

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;
Copy link
Member

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 });
// 蔵書追加処理実装をするため蔵書の情報を取得する
Copy link
Member

@kimurash kimurash Nov 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

コメントの内容
「既に登録済みであるか確認するため」の方がよくない?

});
}
} else {
// ログイン済みでない場合は、APIを呼び出す回数を減らすために蔵書の情報を取得しない
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

そもそも追加する権限を持ってないから最初からAPIを叩かないってことね

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

そうです

@Kosei805 Kosei805 merged commit 8c9bf9c into main Nov 13, 2024
3 checks passed
@Kosei805 Kosei805 deleted the 69-book-add-page branch November 13, 2024 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend frontend development

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

書籍追加ページの実装

3 participants