forked from sk1982/actaeon
chuni: fallback no profile page
This commit is contained in:
parent
cbca0eaa44
commit
3bd7679812
@ -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 (<ChuniNoProfile />);
|
||||
|
||||
const [profile, rating, playlog] = await Promise.all([
|
||||
getUserData(user),
|
||||
getUserRating(user),
|
||||
getPlaylog({ limit: 72 })
|
||||
]);
|
||||
|
||||
if (!profile) return notFound();
|
||||
|
||||
return (<div className="flex h-full flex-col md:flex-row">
|
||||
<div>
|
||||
<ChuniNameplate className="block md:hidden w-full" profile={profile} />
|
||||
|
@ -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 (<ChuniNoProfile />);
|
||||
|
||||
return (<FilterSorter className="flex-grow"
|
||||
filterers={REMOTE_FILTERERS}
|
||||
defaultAscending={false}
|
||||
|
@ -3,6 +3,7 @@ import { getUserData } from '@/actions/chuni/profile';
|
||||
import { getUserboxItems } from '@/actions/chuni/userbox';
|
||||
import { ChuniUserbox } from './userbox';
|
||||
import { Viewport } from 'next';
|
||||
import { ChuniNoProfile } from '@/components/chuni/no-profile';
|
||||
|
||||
export const viewport: Viewport = {
|
||||
width: 'device-width',
|
||||
@ -14,6 +15,10 @@ export const dynamic = 'force-dynamic';
|
||||
|
||||
export default async function ChuniUserboxPage() {
|
||||
const user = await requireUser();
|
||||
|
||||
if (!user?.chuni)
|
||||
return (<ChuniNoProfile />);
|
||||
|
||||
const profile = await getUserData(user);
|
||||
const userboxItems = await getUserboxItems(user, profile);
|
||||
|
||||
|
14
src/components/chuni/no-profile.tsx
Normal file
14
src/components/chuni/no-profile.tsx
Normal file
@ -0,0 +1,14 @@
|
||||
import { NoSymbolIcon } from '@heroicons/react/24/outline';
|
||||
import { ChuniPenguinIcon } from './chuni-penguin-icon';
|
||||
|
||||
export const ChuniNoProfile = () => {
|
||||
return (<section className="w-full h-full flex flex-col items-center justify-center gap-3">
|
||||
<div className="w-1/2 max-w-72 aspect-square relative">
|
||||
<div className="absolute inset-0 w-full h-full flex items-center justify-center">
|
||||
<ChuniPenguinIcon className="h-[70%]" />
|
||||
</div>
|
||||
<NoSymbolIcon className="w-full h-full" />
|
||||
</div>
|
||||
<header className="mb-8">You don't have a Chunithm profile.</header>
|
||||
</section>)
|
||||
};
|
Loading…
Reference in New Issue
Block a user