Skip to content

Commit

Permalink
Merge branch 'feat/#591' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
hanyugeon committed May 22, 2024
2 parents 3c9f8c5 + 63a8976 commit fb7d5b2
Showing 1 changed file with 13 additions and 19 deletions.
32 changes: 13 additions & 19 deletions src/app/bookshelf/[bookshelfId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useEffect } from 'react';
import Link from 'next/link';
import { useInView } from 'react-intersection-observer';

import type { APIBookshelf, APIBookshelfInfo } from '@/types/bookshelf';
import type { APIBookshelf } from '@/types/bookshelf';

import useBookShelfBooksQuery from '@/queries/bookshelf/useBookShelfBookListQuery';
import useBookShelfInfoQuery from '@/queries/bookshelf/useBookShelfInfoQuery';
Expand Down Expand Up @@ -99,7 +99,6 @@ const BookShelfContent = ({
bookshelfId,
}: {
bookshelfId: APIBookshelf['bookshelfId'];
userNickname?: APIBookshelfInfo['userNickname'];
}) => {
const isAuthenticated = checkAuthentication();
const { ref, inView } = useInView();
Expand All @@ -121,28 +120,23 @@ const BookShelfContent = ({
// TODO: Suspense 적용
if (!isSuccess) return null;

return (
return isAuthenticated ? (
<>
{isAuthenticated ? (
<>
{booksData.pages.map(page =>
page.books.map((rowBooks, idx) => (
<BookShelfRow key={idx} books={rowBooks} />
))
)}
{!isFetchingNextPage && <div ref={ref} />}
</>
) : (
<>
<BookShelfRow books={booksData.pages[0].books[0]} />
<DummyBookShelfRow />
<BookShelfLoginBox bookshelfId={bookshelfId} />
</>
{booksData.pages.map(page =>
page.books.map((rowBooks, idx) => (
<BookShelfRow key={idx} books={rowBooks} />
))
)}
{!isFetchingNextPage && <div ref={ref} />}
</>
) : (
<>
<BookShelfRow books={booksData.pages[0].books[0]} />
<DummyBookShelfRow />
<BookShelfLoginBox bookshelfId={bookshelfId} />
</>
);
};

const DummyBookShelfRow = () => (
<div className="pointer-events-none blur-sm">
<BookShelfRow books={initialBookImageUrl} />
Expand Down

0 comments on commit fb7d5b2

Please sign in to comment.