diff --git a/src/app/(with-header)/chuni/dashboard/page.tsx b/src/app/(with-header)/chuni/dashboard/page.tsx index 84fa276..4cd9a4d 100644 --- a/src/app/(with-header)/chuni/dashboard/page.tsx +++ b/src/app/(with-header)/chuni/dashboard/page.tsx @@ -3,23 +3,25 @@ import { ChuniNameplate } from '@/components/chuni/nameplate'; import { ChuniPlaylogCard } from '@/components/chuni/playlog-card'; import { getUserData, getUserRating } from '@/actions/chuni/profile'; import { requireUser } from '@/actions/auth'; -import { notFound } from 'next/navigation'; import { ChuniTopRatingSidebar } from './top-rating-sidebar'; import { Button } from '@nextui-org/react'; import Link from 'next/link'; +import { ChuniNoProfile } from '@/components/chuni/no-profile'; export const dynamic = 'force-dynamic'; export default async function ChuniDashboard() { const user = await requireUser(); + + if (!user.chuni) + return (); + const [profile, rating, playlog] = await Promise.all([ getUserData(user), getUserRating(user), getPlaylog({ limit: 72 }) ]); - if (!profile) return notFound(); - return (
diff --git a/src/app/(with-header)/chuni/playlog/page.tsx b/src/app/(with-header)/chuni/playlog/page.tsx index 86b6226..2485579 100644 --- a/src/app/(with-header)/chuni/playlog/page.tsx +++ b/src/app/(with-header)/chuni/playlog/page.tsx @@ -9,6 +9,8 @@ import { ChuniPlaylog, getPlaylog } from '@/actions/chuni/playlog'; import { WindowScrollerGrid } from '@/components/window-scroller-grid'; import { ChuniPlaylogCard } from '@/components/chuni/playlog-card'; import { useBreakpoint } from '@/helpers/use-breakpoint'; +import { useUser } from '@/helpers/use-user'; +import { ChuniNoProfile } from '@/components/chuni/no-profile'; const FILTERERS = ([ CHUNI_FILTER_DIFFICULTY, @@ -90,6 +92,11 @@ const ChuniPlaylogGrid = ({ items }: { items: ChuniPlaylog['data']; }) => { }; export default function ChuniPlaylogList() { + const user = useUser(); + + if (!user?.chuni) + return (); + return (); + const profile = await getUserData(user); const userboxItems = await getUserboxItems(user, profile); diff --git a/src/components/chuni/no-profile.tsx b/src/components/chuni/no-profile.tsx new file mode 100644 index 0000000..952c9b6 --- /dev/null +++ b/src/components/chuni/no-profile.tsx @@ -0,0 +1,14 @@ +import { NoSymbolIcon } from '@heroicons/react/24/outline'; +import { ChuniPenguinIcon } from './chuni-penguin-icon'; + +export const ChuniNoProfile = () => { + return (
+
+
+ +
+ +
+
You don't have a Chunithm profile.
+
) +};