Refactor: 페이지 리팩토링

This commit is contained in:
정현조 2024-09-26 03:59:05 +09:00
parent 3d16081a6d
commit 04cb52e79c
2 changed files with 56 additions and 52 deletions

View File

@ -1,4 +1,4 @@
import { useState, useEffect, useRef } from 'react';
import { Suspense, useState, useEffect, useRef } from 'react';
import { useParams, Link } from 'react-router-dom';
import useReviewByStatusQuery from '@/queries/reviews/useReviewByStatusQuery';
import useAuthStore from '@/stores/useAuthStore';
@ -49,8 +49,9 @@ export default function ProjectReviewList() {
}, [hasNextPage, isFetchingNextPage, fetchNextPage]);
return (
<Suspense fallback={<div></div>}>
<div>
<header className="bg-background sticky top-0 z-10 flex h-[57px] items-center gap-1 border-b px-4">
<header className="sticky top-0 z-10 flex h-[57px] items-center gap-1 border-b bg-white px-4">
<h1 className="text-xl font-semibold"> </h1>
<Link
to={`/admin/${workspaceId}/reviews/request`}
@ -70,12 +71,13 @@ export default function ProjectReviewList() {
workspaceId={Number(workspaceId)}
/>
{isFetchingNextPage && <div className="py-4 text-center"> ...</div>}
{isFetchingNextPage}
<div
ref={loadMoreRef}
className="h-1"
/>
</div>
</Suspense>
);
}

View File

@ -4,7 +4,7 @@ import useWorkspaceReviewsQuery from '@/queries/workspaces/useWorkspaceReviewsQu
import useAuthStore from '@/stores/useAuthStore';
import ReviewList from '@/components/ReviewList';
import { Button } from '@/components/ui/button';
import { Suspense } from 'react';
export default function WorkspaceReviewList() {
const { workspaceId } = useParams<{ workspaceId: string }>();
const profile = useAuthStore((state) => state.profile);
@ -49,8 +49,9 @@ export default function WorkspaceReviewList() {
}, [hasNextPage, isFetchingNextPage, fetchNextPage]);
return (
<Suspense fallback={<div></div>}>
<div>
<header className="bg-background sticky top-0 z-10 flex h-[57px] items-center gap-1 border-b px-4">
<header className="sticky top-0 z-10 flex h-[57px] items-center gap-1 border-b bg-white px-4">
<h1 className="text-xl font-semibold"> </h1>
<Link
to={`/admin/${workspaceId}/reviews/request`}
@ -70,12 +71,13 @@ export default function WorkspaceReviewList() {
workspaceId={Number(workspaceId)}
/>
{isFetchingNextPage && <div className="py-4 text-center"> ...</div>}
{isFetchingNextPage}
<div
ref={loadMoreRef}
className="h-1"
/>
</div>
</Suspense>
);
}