The first commit, the core and all files is adding to repo
This commit is contained in:
19
app/dashboard/[id]/page.tsx
Normal file
19
app/dashboard/[id]/page.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import { Header, Footer } from "@/components/Shell";
|
||||
import { DraftEditor } from "@/components/DraftEditor";
|
||||
export default async function Draft({
|
||||
params,
|
||||
}: {
|
||||
params: Promise<{ id: string }>;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<Header />
|
||||
<main className="section page-content">
|
||||
<span className="eyebrow">YOUR WORLD, BEFORE THE WORLD SEES IT</span>
|
||||
<h1>At the drawing board.</h1>
|
||||
<DraftEditor id={(await params).id} />
|
||||
</main>
|
||||
<Footer />
|
||||
</>
|
||||
);
|
||||
}
|
||||
55
app/dashboard/page.tsx
Normal file
55
app/dashboard/page.tsx
Normal file
@@ -0,0 +1,55 @@
|
||||
import { Header, Footer } from "@/components/Shell";
|
||||
import { SignIn } from "@/components/SignIn";
|
||||
import { Dashboard } from "@/components/Dashboard";
|
||||
import { admin, user, required } from "@/lib/supabase";
|
||||
import Link from "next/link";
|
||||
export const dynamic = "force-dynamic";
|
||||
export default async function DashboardPage() {
|
||||
const account = await user();
|
||||
const history = account
|
||||
? required(
|
||||
await admin()
|
||||
.from("game_sessions")
|
||||
.select("id,difficulty,created_at,current_round")
|
||||
.eq("owner_id", account.id)
|
||||
.order("created_at", { ascending: false })
|
||||
.limit(20),
|
||||
)
|
||||
: [];
|
||||
return (
|
||||
<>
|
||||
<Header />
|
||||
<main className="section page-content">
|
||||
{account ? (
|
||||
<>
|
||||
<span className="eyebrow">THE CARTOGRAPHER’S DESK</span>
|
||||
<h1>My expedition.</h1>
|
||||
<Dashboard />
|
||||
{history.length > 0 && (
|
||||
<section className="token-box">
|
||||
<h2>Recent journeys</h2>
|
||||
{history.map((s) => (
|
||||
<div className="draft-row" key={s.id}>
|
||||
<span>
|
||||
{new Date(s.created_at).toLocaleDateString("en-GB")} ·{" "}
|
||||
{s.difficulty} · {s.current_round}/5 rounds
|
||||
</span>
|
||||
<Link
|
||||
className="button"
|
||||
href={`/${s.current_round >= 5 ? "results" : "play"}/${s.id}`}
|
||||
>
|
||||
Open →
|
||||
</Link>
|
||||
</div>
|
||||
))}
|
||||
</section>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<SignIn />
|
||||
)}
|
||||
</main>
|
||||
<Footer />
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user