diff --git a/apps/portal/src/components/resumes/browse/BrowseListItem.tsx b/apps/portal/src/components/resumes/browse/ResumeListItem.tsx similarity index 100% rename from apps/portal/src/components/resumes/browse/BrowseListItem.tsx rename to apps/portal/src/components/resumes/browse/ResumeListItem.tsx diff --git a/apps/portal/src/components/resumes/browse/ResumeListItems.tsx b/apps/portal/src/components/resumes/browse/ResumeListItems.tsx new file mode 100644 index 00000000..9e1203a5 --- /dev/null +++ b/apps/portal/src/components/resumes/browse/ResumeListItems.tsx @@ -0,0 +1,35 @@ +import { Spinner } from '@tih/ui'; + +import ResumseListItem from './ResumeListItem'; + +import type { Resume } from '~/types/resume'; + +type Props = Readonly<{ + isLoading: boolean; + resumes: Array; +}>; + +export default function ResumeListItems({ isLoading, resumes }: Props) { + if (isLoading) { + return ( +
+ +
+ ); + } + + return ( +
+ +
+ ); +} diff --git a/apps/portal/src/components/resumes/browse/constants.ts b/apps/portal/src/components/resumes/browse/constants.ts index e08358b6..6996538a 100644 --- a/apps/portal/src/components/resumes/browse/constants.ts +++ b/apps/portal/src/components/resumes/browse/constants.ts @@ -54,7 +54,7 @@ export const EXPERIENCE = [ export const LOCATION = [ { checked: false, label: 'Singapore', value: 'Singapore' }, - { checked: false, label: 'United States', value: 'US' }, + { checked: false, label: 'United States', value: 'United States' }, { checked: false, label: 'India', value: 'India' }, ]; diff --git a/apps/portal/src/components/resumes/comments/CommentListItems.tsx b/apps/portal/src/components/resumes/comments/CommentListItems.tsx new file mode 100644 index 00000000..f043b78c --- /dev/null +++ b/apps/portal/src/components/resumes/comments/CommentListItems.tsx @@ -0,0 +1,35 @@ +import { useSession } from 'next-auth/react'; +import { Spinner } from '@tih/ui'; + +import Comment from './comment/Comment'; + +import type { ResumeComment } from '~/types/resume-comments'; + +type Props = Readonly<{ + comments: Array; + isLoading: boolean; +}>; + +export default function CommentListItems({ comments, isLoading }: Props) { + const { data: session } = useSession(); + + if (isLoading) { + return ( +
+ +
+ ); + } + + return ( +
+ {comments.map((comment) => ( + + ))} +
+ ); +} diff --git a/apps/portal/src/components/resumes/comments/CommentsList.tsx b/apps/portal/src/components/resumes/comments/CommentsList.tsx index 56a1affa..d40b500a 100644 --- a/apps/portal/src/components/resumes/comments/CommentsList.tsx +++ b/apps/portal/src/components/resumes/comments/CommentsList.tsx @@ -1,10 +1,9 @@ -import { useSession } from 'next-auth/react'; import { useState } from 'react'; import { Tabs } from '@tih/ui'; import { trpc } from '~/utils/trpc'; -import Comment from './comment/Comment'; +import CommentListItems from './CommentListItems'; import CommentsListButton from './CommentsListButton'; import { COMMENTS_SECTIONS } from './constants'; @@ -18,12 +17,9 @@ export default function CommentsList({ setShowCommentsForm, }: CommentsListProps) { const [tab, setTab] = useState(COMMENTS_SECTIONS[0].value); - const { data: session } = useSession(); const commentsQuery = trpc.useQuery(['resumes.reviews.list', { resumeId }]); - // TODO: Add loading prompt - return (
@@ -33,20 +29,10 @@ export default function CommentsList({ value={tab} onChange={(value) => setTab(value)} /> - -
- {commentsQuery.data - ?.filter((c) => c.section === tab) - .map((comment) => { - return ( - - ); - })} -
+ c.section === tab) ?? []} + isLoading={commentsQuery.isFetching} + />
); } diff --git a/apps/portal/src/pages/resumes/index.tsx b/apps/portal/src/pages/resumes/index.tsx index 357c4852..fab32bfe 100644 --- a/apps/portal/src/pages/resumes/index.tsx +++ b/apps/portal/src/pages/resumes/index.tsx @@ -10,9 +10,8 @@ import { PlusIcon, } from '@heroicons/react/20/solid'; import { MagnifyingGlassIcon } from '@heroicons/react/24/outline'; -import { Spinner, Tabs, TextInput } from '@tih/ui'; +import { Tabs, TextInput } from '@tih/ui'; -import BrowseListItem from '~/components/resumes/browse/BrowseListItem'; import { BROWSE_TABS_VALUES, EXPERIENCE, @@ -22,8 +21,11 @@ import { TOP_HITS, } from '~/components/resumes/browse/constants'; import FilterPill from '~/components/resumes/browse/FilterPill'; +import ResumeListItems from '~/components/resumes/browse/ResumeListItems'; import ResumeReviewsTitle from '~/components/resumes/ResumeReviewsTitle'; +import { trpc } from '~/utils/trpc'; + import type { Resume } from '~/types/resume'; const filters = [ @@ -44,8 +46,6 @@ const filters = [ }, ]; -import { trpc } from '~/utils/trpc'; - export default function ResumeHomePage() { const { data: sessionData } = useSession(); const router = useRouter(); @@ -140,6 +140,7 @@ export default function ResumeHomePage() {
+ {/* TODO: Sort logic */} Sort
- {allResumesQuery.isLoading || - starredResumesQuery.isLoading || - myResumesQuery.isLoading ? ( -
- -
- ) : ( -
-
    - {resumes.map((resumeObj) => ( -
  • - -
  • - ))} -
-
- )} +