From a71ac889ac0ddfcf55acd2fb6d2054603c8ed0b4 Mon Sep 17 00:00:00 2001 From: Nudesuppe42 Date: Sun, 17 Dec 2023 11:37:28 +0100 Subject: [PATCH] feat(me): :sparkles: Review Page --- src/components/Header.tsx | 10 +++- src/pages/me/review.tsx | 106 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 114 insertions(+), 2 deletions(-) create mode 100644 src/pages/me/review.tsx diff --git a/src/components/Header.tsx b/src/components/Header.tsx index e7f8fc75..6ee4fef8 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -150,9 +150,15 @@ const Header = ({ links, style }: HeaderProps) => { {t('staff')} - }>{t('user.review')} + } + component={Link} + href="/me/review" + > + {t('user.review')} + - } onClick={() => signOut()}> + } color="red" onClick={() => signOut()}> {t('auth.signout')} diff --git a/src/pages/me/review.tsx b/src/pages/me/review.tsx new file mode 100644 index 00000000..f999562b --- /dev/null +++ b/src/pages/me/review.tsx @@ -0,0 +1,106 @@ +import { Avatar, Badge, Button, Group, Table, Tooltip } from '@mantine/core'; + +import { IconFileSearch } from '@tabler/icons-react'; +import Link from 'next/link'; +import { NextPage } from 'next'; +import Page from '../../components/Page'; +import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; +import useSWR from 'swr'; +import { useTranslation } from 'react-i18next'; +import { useUser } from '../../hooks/useUser'; + +var vagueTime = require('vague-time'); + +const ReviewPage: NextPage = () => { + const { t } = useTranslation('me'); + const user = useUser(); + const { data } = useSWR(`/users/${user?.user?.id}/review`); + console.log(data); + + return ( + + + + + + Id + Team + Status + Created At + + + + + {data + ?.sort( + (a: any, b: any) => + new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime(), + ) + .map((a: any) => ( + + + +

{a.id.split('-')[0]}

+
+
+ + + + + + + + + Needs Review + + + + +

{new Date(a.createdAt).toLocaleDateString()}

+
+
+ + + + + +
+ ))} +
+
+
+
+ ); +}; + +export default ReviewPage; + +export async function getStaticProps({ locale }: any) { + return { + props: { + ...(await serverSideTranslations(locale, ['common', 'me'])), + }, + }; +}