Connect, collaborate, and grow with a community of TypeScript developers
[WIP] move admin stuff (#377)
bautistaaad73b656fc507
diff --git a/apps/admin/package.json b/apps/admin/package.jsonindex df801e2e..8e9ec6cf 100644--- a/apps/admin/package.json+++ b/apps/admin/package.json@@ -13,15 +13,27 @@"typecheck": "tsc --noEmit"},"dependencies": {+ "@hookform/resolvers": "^3.1.1","@repo/auth": "workspace:*","@repo/db": "workspace:*","@repo/emails": "workspace:*","@repo/lint": "workspace:*","@repo/ui": "workspace:*",+ "@tanstack/react-query": "^4.29.25",+ "@tanstack/react-table": "^8.9.3",+ "clsx": "^2.0.0","next": "13.4.19",+ "next-auth": "^4.22.1",+ "next-themes": "^0.2.1","react": "18.2.0",+ "react-dnd": "^16.0.1",+ "react-dnd-html5-backend": "^16.0.1","react-dom": "18.2.0",- "tailwindcss": "3.3.3"+ "react-hook-form": "^7.45.1",+ "react-select": "^5.7.4",+ "tailwindcss": "3.3.3",+ "tailwindcss-animate": "^1.0.6",+ "zod": "^3.21.4"},"devDependencies": {"@repo/tsconfig": "workspace:*",diff --git a/apps/web/src/components/admin/admin.actions.tsx b/apps/admin/src/app/_components/admin.actions.tsxsimilarity index 100%rename from apps/web/src/components/admin/admin.actions.tsxrename to apps/admin/src/app/_components/admin.actions.tsxdiff --git a/apps/web/src/app/admin/_components/challenge-reviews/challenge-reviews.action.ts b/apps/admin/src/app/_components/challenge-reviews/challenge-reviews.action.tssimilarity index 100%rename from apps/web/src/app/admin/_components/challenge-reviews/challenge-reviews.action.tsrename to apps/admin/src/app/_components/challenge-reviews/challenge-reviews.action.tsdiff --git a/apps/web/src/app/admin/_components/challenge-reviews/columns.tsx b/apps/admin/src/app/_components/challenge-reviews/columns.tsxsimilarity index 100%rename from apps/web/src/app/admin/_components/challenge-reviews/columns.tsxrename to apps/admin/src/app/_components/challenge-reviews/columns.tsxdiff --git a/apps/web/src/app/admin/_components/challenge-reviews/index.tsx b/apps/admin/src/app/_components/challenge-reviews/index.tsxsimilarity index 100%rename from apps/web/src/app/admin/_components/challenge-reviews/index.tsxrename to apps/admin/src/app/_components/challenge-reviews/index.tsxdiff --git a/apps/web/src/components/admin/images.tsx b/apps/admin/src/app/_components/images.tsxsimilarity index 100%rename from apps/web/src/components/admin/images.tsxrename to apps/admin/src/app/_components/images.tsxdiff --git a/apps/web/src/components/admin/reports.tsx b/apps/admin/src/app/_components/reports.tsxsimilarity index 96%rename from apps/web/src/components/admin/reports.tsxrename to apps/admin/src/app/_components/reports.tsxindex 4ca9ab51..b64a8232 100644--- a/apps/web/src/components/admin/reports.tsx+++ b/apps/admin/src/app/_components/reports.tsx@@ -3,15 +3,18 @@ import { useInfiniteQuery } from '@tanstack/react-query';import { useRouter } from 'next/navigation';import React from 'react';import {+ Pagination,Table,TableBody,TableCell,TableHead,TableHeader,TableRow,- Pagination,} from '@repo/ui';-import { getInfiniteReports, type InfiniteReports } from '../report/report.action';+import {+ getInfiniteReports,+ type InfiniteReports,+} from '../report/[id]/_components/report/report.action';export interface ReportsProps {initialReports: InfiniteReports;diff --git a/apps/web/src/app/admin/_components/tracks/action-bar.tsx b/apps/admin/src/app/_components/tracks/action-bar.tsxsimilarity index 100%rename from apps/web/src/app/admin/_components/tracks/action-bar.tsxrename to apps/admin/src/app/_components/tracks/action-bar.tsxdiff --git a/apps/web/src/app/admin/_components/tracks/add-track-form.tsx b/apps/admin/src/app/_components/tracks/add-track-form.tsxsimilarity index 100%rename from apps/web/src/app/admin/_components/tracks/add-track-form.tsxrename to apps/admin/src/app/_components/tracks/add-track-form.tsxdiff --git a/apps/web/src/app/admin/_components/tracks/columns.tsx b/apps/admin/src/app/_components/tracks/columns.tsxsimilarity index 100%rename from apps/web/src/app/admin/_components/tracks/columns.tsxrename to apps/admin/src/app/_components/tracks/columns.tsxdiff --git a/apps/web/src/app/admin/_components/tracks/index.tsx b/apps/admin/src/app/_components/tracks/index.tsxsimilarity index 100%rename from apps/web/src/app/admin/_components/tracks/index.tsxrename to apps/admin/src/app/_components/tracks/index.tsxdiff --git a/apps/web/src/app/admin/_components/tracks/tracks.actions.ts b/apps/admin/src/app/_components/tracks/tracks.actions.tssimilarity index 100%rename from apps/web/src/app/admin/_components/tracks/tracks.actions.tsrename to apps/admin/src/app/_components/tracks/tracks.actions.tsdiff --git a/apps/web/src/components/admin/users.tsx b/apps/admin/src/app/_components/users.tsxsimilarity index 91%rename from apps/web/src/components/admin/users.tsxrename to apps/admin/src/app/_components/users.tsxindex 02504649..c63eb258 100644--- a/apps/web/src/components/admin/users.tsx+++ b/apps/admin/src/app/_components/users.tsx@@ -1,7 +1,5 @@'use client';-import { useRouter } from 'next/navigation';-import { Unlock } from '@repo/ui/icons';import {ActionMenu,Badge,@@ -14,8 +12,9 @@ import {TypographyH3,toast,} from '@repo/ui';-import { getRelativeTime } from '~/utils/relativeTime';-import { unbanUser, type AdminBannedUsers } from '~/components/admin/admin.actions';+import { Unlock } from '@repo/ui/icons';+import { useRouter } from 'next/navigation';+import { unbanUser, type AdminBannedUsers } from './admin.actions';interface BannedUsersProps {data: AdminBannedUsers;@@ -66,7 +65,6 @@ export function BannedUsers({ data }: BannedUsersProps) {{data.map((user, userIdx) => {const username = user.name;const status = user.status;- const relativeTime = getRelativeTime(user.updatedAt);const absoluteTime = new Intl.DateTimeFormat('en-US', {dateStyle: 'medium',timeStyle: 'medium',@@ -78,7 +76,7 @@ export function BannedUsers({ data }: BannedUsersProps) {<TableCell><Badge>{status}</Badge></TableCell>- <TableCell title={absoluteTime}>{relativeTime}</TableCell>+ <TableCell title={absoluteTime}>{absoluteTime}</TableCell><TableCell title={banReason ?? ''}>{banReason? banReason.length > 15diff --git a/apps/admin/src/app/api/auth/[...nextauth]/route.ts b/apps/admin/src/app/api/auth/[...nextauth]/route.tsnew file mode 100644index 00000000..67c59149--- /dev/null+++ b/apps/admin/src/app/api/auth/[...nextauth]/route.ts@@ -0,0 +1,6 @@+import NextAuth from '@repo/auth/next-auth';+import { authOptions } from '@repo/auth/server';++const handler = NextAuth(authOptions);++export { handler as GET, handler as POST };diff --git a/apps/web/src/app/admin/challenge/[challengeId]/challenge-review.action.ts b/apps/admin/src/app/challenge/[challengeId]/challenge-review.action.tssimilarity index 100%rename from apps/web/src/app/admin/challenge/[challengeId]/challenge-review.action.tsrename to apps/admin/src/app/challenge/[challengeId]/challenge-review.action.tsdiff --git a/apps/web/src/app/admin/challenge/[challengeId]/challenge-review.tsx b/apps/admin/src/app/challenge/[challengeId]/challenge-review.tsxsimilarity index 91%rename from apps/web/src/app/admin/challenge/[challengeId]/challenge-review.tsxrename to apps/admin/src/app/challenge/[challengeId]/challenge-review.tsxindex b9efbb2f..e713ec97 100644--- a/apps/web/src/app/admin/challenge/[challengeId]/challenge-review.tsx+++ b/apps/admin/src/app/challenge/[challengeId]/challenge-review.tsx@@ -4,11 +4,9 @@ import Link from 'next/link';import { useRouter } from 'next/navigation';import { useSession } from '@repo/auth/react';import { useMemo } from 'react';-import { Button, DifficultyBadge, Text, useToast, UserBadge } from '@repo/ui';+import { Button, DifficultyBadge, Text, useToast, UserBadge, Markdown } from '@repo/ui';import type { ChallengeToReview } from './page';import { approveChallenge, denyChallenge } from './challenge-review.action';-import { Markdown } from '~/components/ui/markdown';-import { CodeEditor } from '~/components/ui/code-editor';interface Props {challenge: ChallengeToReview;@@ -70,7 +68,7 @@ export function ChallengeReview({ challenge }: Props) {<Markdown>{challenge.description}</Markdown></div><div className="flex-1 rounded-l-xl rounded-r-2xl border border-zinc-300 dark:border-zinc-700">- <CodeEditor value={challenge.tests} />+ {/* <CodeEditor value={challenge.tests} /> */}</div></div><div className="flex justify-end gap-3 p-4">diff --git a/apps/web/src/app/admin/challenge/[challengeId]/page.tsx b/apps/admin/src/app/challenge/[challengeId]/page.tsxsimilarity index 100%rename from apps/web/src/app/admin/challenge/[challengeId]/page.tsxrename to apps/admin/src/app/challenge/[challengeId]/page.tsxdiff --git a/apps/admin/src/app/favicon.ico b/apps/admin/src/app/favicon.icoindex 4570eb8d..98652a97 100644Binary files a/apps/admin/src/app/favicon.ico and b/apps/admin/src/app/favicon.ico differdiff --git a/apps/admin/src/app/globals.css b/apps/admin/src/app/globals.cssdeleted file mode 100644index e0936eda..00000000--- a/apps/admin/src/app/globals.css+++ /dev/null@@ -1,23 +0,0 @@-@tailwind base;-@tailwind components;-@tailwind utilities;--:root {- --foreground-rgb: 0, 0, 0;- --background-start-rgb: 214, 219, 220;- --background-end-rgb: 255, 255, 255;-}--@media (prefers-color-scheme: dark) {- :root {- --foreground-rgb: 255, 255, 255;- --background-start-rgb: 0, 0, 0;- --background-end-rgb: 0, 0, 0;- }-}--body {- color: rgb(var(--foreground-rgb));- background: linear-gradient(to bottom, transparent, rgb(var(--background-end-rgb)))- rgb(var(--background-start-rgb));-}diff --git a/apps/admin/src/app/layout.tsx b/apps/admin/src/app/layout.tsxindex ab0434f3..6b9e11e1 100644--- a/apps/admin/src/app/layout.tsx+++ b/apps/admin/src/app/layout.tsx@@ -1,18 +1,27 @@-import './globals.css';-import type { Metadata } from 'next';+import '../styles/globals.css';++import { Toaster } from '@repo/ui';import { Inter } from 'next/font/google';+import { Providers } from './providers';+import { Navigation } from '~/components/navigation';const inter = Inter({ subsets: ['latin'] });-export const metadata: Metadata = {- title: 'Create Next App',- description: 'Generated by create next app',-};-export default function RootLayout({ children }: { children: React.ReactNode }) {return (- <html lang="en">- <body className={inter.className}>{children}</body>+ <html suppressHydrationWarning lang="en">+ <head>+ <title>Type Hero Admin</title>+ </head>+ <body className={`${inter.className} flex flex-col`}>+ <Providers>+ <Navigation />+ <main className="flex-1">+ <div className="h-full">{children}</div>+ </main>+ <Toaster />+ </Providers>+ </body></html>);}diff --git a/apps/admin/src/app/page.tsx b/apps/admin/src/app/page.tsxindex 59d0437d..853a3b1f 100644--- a/apps/admin/src/app/page.tsx+++ b/apps/admin/src/app/page.tsx@@ -1,111 +1,110 @@-import Image from 'next/image';+'use server';+import { getServerAuthSession } from '@repo/auth/server';+import { RoleTypes } from '@repo/db/types';+import { Tabs, TabsContent, TabsList, TabsTrigger } from '@repo/ui';+import { Lock } from '@repo/ui/icons';+import React from 'react';+import { getBannedUsers, getUploadedImages } from './_components/admin.actions';+import { ChallengeReviews } from './_components/challenge-reviews';+import { ManageTracks } from './_components/tracks';+import { getInfiniteReports } from './report/[id]/_components/report/report.action';+import { ImageUploadReport } from './_components/images';+import { BannedUsers } from './_components/users';+import Reports from './_components/reports';-export default function Home() {- return (- <main className="flex min-h-screen flex-col items-center justify-between p-24">- <div className="z-10 w-full max-w-5xl items-center justify-between font-mono text-sm lg:flex">- <p className="fixed left-0 top-0 flex w-full justify-center border-b border-gray-300 bg-gradient-to-b from-zinc-200 pb-6 pt-8 backdrop-blur-2xl dark:border-neutral-800 dark:bg-zinc-800/30 dark:from-inherit lg:static lg:w-auto lg:rounded-xl lg:border lg:bg-gray-200 lg:p-4 lg:dark:bg-zinc-800/30">- Get started by editing - <code className="font-mono font-bold">src/app/page.tsx</code>- </p>- <div className="fixed bottom-0 left-0 flex h-48 w-full items-end justify-center bg-gradient-to-t from-white via-white dark:from-black dark:via-black lg:static lg:h-auto lg:w-auto lg:bg-none">- <a- className="pointer-events-none flex place-items-center gap-2 p-8 lg:pointer-events-auto lg:p-0"- href="https://vercel.com?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"- target="_blank"- rel="noopener noreferrer"- >- By{' '}- <Image- src="/vercel.svg"- alt="Vercel Logo"- className="dark:invert"- width={100}- height={24}- priority- />- </a>- </div>- </div>-- <div className="before:bg-gradient-radial after:bg-gradient-conic relative z-[-1] flex place-items-center before:absolute before:h-[300px] before:w-[480px] before:-translate-x-1/2 before:rounded-full before:from-white before:to-transparent before:blur-2xl before:content-[''] after:absolute after:-z-20 after:h-[180px] after:w-[240px] after:translate-x-1/3 after:from-sky-200 after:via-blue-200 after:blur-2xl after:content-[''] before:dark:bg-gradient-to-br before:dark:from-transparent before:dark:to-blue-700 before:dark:opacity-10 after:dark:from-sky-900 after:dark:via-[#0141ff] after:dark:opacity-40 before:lg:h-[360px]">- <Image- className="relative dark:drop-shadow-[0_0_0.3rem_#ffffff70] dark:invert"- src="/next.svg"- alt="Next.js Logo"- width={180}- height={37}- priority- />- </div>+async function Admin() {+ const session = await getServerAuthSession();+ const roles = session?.user.role ?? [];- <div className="mb-32 grid text-center lg:mb-0 lg:w-full lg:max-w-5xl lg:grid-cols-4 lg:text-left">- <a- href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"- className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"- target="_blank"- rel="noopener noreferrer"- >- <h2 className="mb-3 text-2xl font-semibold">- Docs{' '}- <span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">- ->- </span>- </h2>- <p className="m-0 max-w-[30ch] text-sm opacity-50">- Find in-depth information about Next.js features and API.- </p>- </a>+ const isMod = roles.includes(RoleTypes.MODERATOR);+ const isAdmin = roles.includes(RoleTypes.ADMIN);+ const isModOrAdmin = isAdmin || isMod;- <a- href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"- className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"- target="_blank"- rel="noopener noreferrer"- >- <h2 className="mb-3 text-2xl font-semibold">- Learn{' '}- <span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">- ->+ return (+ <div>+ <div className="flex flex-col gap-4">+ {isModOrAdmin ? (+ <View />+ ) : (+ <div className="flex min-h-[calc(100dvh-112px)] w-full flex-col items-center justify-center space-y-2">+ <Lock className="h-8 w-8" />+ <span className="max-w-[40ch] text-center text-black/50 dark:text-white/50">+ You do not have permissions to access the page.</span>- </h2>- <p className="m-0 max-w-[30ch] text-sm opacity-50">- Learn about Next.js in an interactive course with quizzes!- </p>- </a>+ </div>+ )}+ </div>+ </div>+ );+}- <a- href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"- className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"- target="_blank"- rel="noopener noreferrer"- >- <h2 className="mb-3 text-2xl font-semibold">- Templates{' '}- <span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">- ->- </span>- </h2>- <p className="m-0 max-w-[30ch] text-sm opacity-50">Explore the Next.js 13 playground.</p>- </a>+// TODO: i think we need nested routing here so we can only load the data when the tab is active+// 💀 this has to be a job for trash+const View = async () => {+ const allBannedUsers = await getBannedUsers();+ // This needs done because server functions are dumb and this throws A LOT of errors otherwise.+ const firstPage = await getInfiniteReports();+ const uploadedimages = await getUploadedImages();- <a- href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"- className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"- target="_blank"- rel="noopener noreferrer"- >- <h2 className="mb-3 text-2xl font-semibold">- Deploy{' '}- <span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">- ->- </span>- </h2>- <p className="m-0 max-w-[30ch] text-sm opacity-50">- Instantly deploy your Next.js site to a shareable URL with Vercel.+ return (+ <div className="container m-8 flex flex-col space-y-4">+ <div className="space-y-2">+ <div className="mx-2 flex flex-col">+ <p className="text-2xl font-semibold text-black dark:text-white">Moderation</p>+ <p className="text-start text-sm text-neutral-400 dark:text-neutral-600">+ A view of all the reports & users and all uploaded user images</p>- </a>+ </div>+ <div className="flex flex-col space-y-2">+ <Tabs className="space-x-4" defaultValue="reports">+ <TabsList className="border-border bg-background rounded-full border">+ <TabsTrigger+ className="data-[state=active]:bg-border rounded-l-2xl rounded-r-lg duration-300"+ value="reports"+ >+ Reports+ </TabsTrigger>+ <TabsTrigger+ className="data-[state=active]:bg-border duration-300"+ value="challengeReviews"+ >+ Challenge Reviews+ </TabsTrigger>+ <TabsTrigger className="data-[state=active]:bg-border duration-300" value="users">+ Users+ </TabsTrigger>+ <TabsTrigger className="data-[state=active]:bg-border duration-300" value="images">+ Images+ </TabsTrigger>+ <TabsTrigger+ className="data-[state=active]:bg-border rounded-l-lg rounded-r-2xl duration-300"+ value="tracks"+ >+ Tracks+ </TabsTrigger>+ </TabsList>+ <TabsContent value="reports">+ <React.Suspense fallback={<>Loading...</>}>+ <Reports initialReports={firstPage} />+ </React.Suspense>+ </TabsContent>+ <TabsContent value="users">+ <BannedUsers data={allBannedUsers} />+ </TabsContent>+ <TabsContent value="challengeReviews">+ <ChallengeReviews />+ </TabsContent>+ <TabsContent value="images">+ <ImageUploadReport data={uploadedimages} />+ </TabsContent>+ <TabsContent value="tracks">+ <ManageTracks />+ </TabsContent>+ </Tabs>+ </div></div>- </main>+ </div>);-}+};++export default Admin;diff --git a/apps/admin/src/app/providers.tsx b/apps/admin/src/app/providers.tsxnew file mode 100644index 00000000..80d79dc5--- /dev/null+++ b/apps/admin/src/app/providers.tsx@@ -0,0 +1,24 @@+'use client';++import { SessionProvider } from '@repo/auth/react';+import { ThemeProvider } from 'next-themes';+import { QueryClient, QueryClientProvider } from '@tanstack/react-query';+import { TooltipProvider } from '@repo/ui';++interface Props {+ children: React.ReactNode;+}++const queryClient = new QueryClient();++export function Providers({ children }: Props) {+ return (+ <QueryClientProvider client={queryClient}>+ <SessionProvider>+ <ThemeProvider attribute="class">+ <TooltipProvider>{children}</TooltipProvider>+ </ThemeProvider>+ </SessionProvider>+ </QueryClientProvider>+ );+}diff --git a/apps/web/src/components/report/types/challenge.report.tsx b/apps/admin/src/app/report/[id]/_components/report/challenge.report.tsxsimilarity index 81%rename from apps/web/src/components/report/types/challenge.report.tsxrename to apps/admin/src/app/report/[id]/_components/report/challenge.report.tsxindex 7114c52f..b0c9639d 100644--- a/apps/web/src/components/report/types/challenge.report.tsx+++ b/apps/admin/src/app/report/[id]/_components/report/challenge.report.tsx@@ -1,10 +1,8 @@import { ThumbsUp } from '@repo/ui/icons';-import { Text, UserBadge } from '@repo/ui';+import { Markdown, Text, UserBadge } from '@repo/ui';import Link from 'next/link';-import { type ReportWithInfo } from '~/app/admin/report/[id]/report.action';-import { getChallenge } from '~/components/admin/admin.actions';-import { CodeEditor } from '~/components/ui/code-editor';-import { Markdown } from '~/components/ui/markdown';+import type { ReportWithInfo } from '../../report.action';+import { getChallenge } from '~/app/_components/admin.actions';export interface ChallengeReportProps {report: NonNullable<ReportWithInfo>;@@ -39,10 +37,10 @@ export default async function ChallengeReport({ report }: ChallengeReportProps)</div><Markdown className="mt-4">{report.challenge.description}</Markdown></div>- <Text intent="h3">Tests Panel</Text>+ {/* <Text intent="h3">Tests Panel</Text><CodeEditor height="20vh" value={report.challenge.tests} /><Text intent="h3">Base code provided</Text>- <CodeEditor height="30vh" value={report.challenge.code} />+ <CodeEditor height="30vh" value={report.challenge.code} /> */}</section>);}diff --git a/apps/web/src/components/report/types/comment.report.tsx b/apps/admin/src/app/report/[id]/_components/report/comment.report.tsxsimilarity index 80%rename from apps/web/src/components/report/types/comment.report.tsxrename to apps/admin/src/app/report/[id]/_components/report/comment.report.tsxindex 6ce66758..ca1e5dbc 100644--- a/apps/web/src/components/report/types/comment.report.tsx+++ b/apps/admin/src/app/report/[id]/_components/report/comment.report.tsx@@ -1,6 +1,5 @@import Link from 'next/link';-import { type ReportWithInfo } from '~/app/admin/report/[id]/report.action';-import { Comment } from '~/app/challenge/_components/comments/comment';+import type { ReportWithInfo } from '../../report.action';export default function CommentReport({ report }: { report: NonNullable<ReportWithInfo> }) {if (report.type !== 'COMMENT' || report.commentId === null || !report.comment) return null;@@ -25,7 +24,8 @@ export default function CommentReport({ report }: { report: NonNullable<ReportWi</Link></header><section className="mt-4 rounded-lg bg-zinc-800">- <Comment comment={report.comment} readonly rootId={rootId} type={report.comment.rootType} />+ <pre>{JSON.stringify(report.comment, null, 2)}</pre>+ {/* <Comment comment={report.comment} readonly rootId={rootId} type={report.comment.rootType} /> */}</section></div>);diff --git a/apps/admin/src/app/report/[id]/_components/report/report.action.ts b/apps/admin/src/app/report/[id]/_components/report/report.action.tsnew file mode 100644index 00000000..ecb2b8e9--- /dev/null+++ b/apps/admin/src/app/report/[id]/_components/report/report.action.ts@@ -0,0 +1,96 @@+'use server';++import { prisma } from '@repo/db';++export type ReportsData = Awaited<ReturnType<typeof getReports>>;+export type InfiniteReports = Awaited<ReturnType<typeof getInfiniteReports>>;++export async function getInfiniteReports(lastCursor?: number) {+ const reports = await getReports(lastCursor);+ const nextCursor = reports.at(-1)?.id;++ let hasNextCursor = false;+ if (nextCursor) {+ const nextPage = await getReports(nextCursor);+ if (nextPage.length > 0) hasNextCursor = true;+ }++ return {+ data: reports,+ metadata: {+ hasNextPage: hasNextCursor,+ lastCursor: hasNextCursor ? nextCursor : null,+ },+ };+}++export async function getReports(lastCursor?: number, take = 3) {+ return prisma.report.findMany({+ include: {+ challenge: {+ include: {+ _count: {+ select: {+ vote: true,+ },+ },+ },+ },+ user: true,+ reporter: true,+ issues: true,+ comment: true,+ solution: true,+ },+ take,+ ...(lastCursor && {+ skip: 1,+ cursor: {+ id: lastCursor,+ },+ }),+ orderBy: [+ {+ status: 'asc',+ },+ ],+ });+}++export async function getReportedUserInformation(userId: string) {+ return await prisma.user.findFirstOrThrow({+ where: {+ id: userId,+ },+ include: {+ comment: {+ take: 10,+ include: {+ user: true,+ _count: {+ select: {+ replies: true,+ },+ },+ rootChallenge: true,+ rootSolution: true,+ },+ orderBy: {+ createdAt: 'desc',+ },+ },+ sharedSolution: {+ take: 5,+ orderBy: {+ createdAt: 'desc',+ },+ },+ challenge: {+ take: 5,+ orderBy: {+ createdAt: 'asc',+ },+ },+ },+ });+}diff --git a/apps/web/src/components/report/types/solution.report.tsx b/apps/admin/src/app/report/[id]/_components/report/solution.report.tsxsimilarity index 88%rename from apps/web/src/components/report/types/solution.report.tsxrename to apps/admin/src/app/report/[id]/_components/report/solution.report.tsxindex 646894cf..cec199ca 100644--- a/apps/web/src/components/report/types/solution.report.tsx+++ b/apps/admin/src/app/report/[id]/_components/report/solution.report.tsx@@ -2,9 +2,8 @@import Link from 'next/link';import { prisma } from '@repo/db';-import { Text } from '@repo/ui';-import { Markdown } from '~/components/ui/markdown';-import { type ReportWithInfo } from '~/app/admin/report/[id]/report.action';+import { Markdown, Text } from '@repo/ui';+import type { ReportWithInfo } from '../../report.action';async function getSolutionChallenge(challengeId: number) {return prisma.challenge.findFirstOrThrow({diff --git a/apps/admin/src/app/report/[id]/_components/report/user.report.tsx b/apps/admin/src/app/report/[id]/_components/report/user.report.tsxnew file mode 100644index 00000000..2aafadc7--- /dev/null+++ b/apps/admin/src/app/report/[id]/_components/report/user.report.tsx@@ -0,0 +1,126 @@+'use server';++import { Expandable, Markdown, Text } from '@repo/ui';+// import { Comment } from '~/app/challenge/_components/comments/comment';+import { getReportedUserInformation, type ReportWithInfo } from '../../report.action';++interface UserReportProps {+ report: NonNullable<ReportWithInfo>;+}++export default async function UserReportUi({ report }: UserReportProps) {+ if (!report.userId) return null;+ const userInfo = await getReportedUserInformation(report.userId);+ const commentRootId = report.comment?.rootChallengeId ?? report.comment?.rootSolutionId ?? -1;++ return (+ <div>+ <Text intent="h3">+ Most Recent Comments <small>(10)</small>+ </Text>++ <div className="mt-4 flex flex-col gap-4">+ {userInfo?.comment+ ? userInfo.comment.map((comment) => (+ <div+ className="rounded border border-zinc-700 bg-zinc-800 p-2"+ key={`comment-${comment.id}`}+ >+ {/*+ <Comment+ comment={comment}+ readonly+ rootId={commentRootId}+ type={comment.rootType}+ />+ */}+ <pre>{JSON.stringify(comment, null, 2)}</pre>+ </div>+ ))+ : null}++ {userInfo?.comment.length === 0 ? (+ <div className="mb-6 flex justify-center">No comments on record</div>+ ) : null}+ </div>++ <Text className="mt-4" intent="h3">+ Most Recent challenges <small>(5)</small>{' '}+ </Text>++ <div className="mt-4 flex flex-col gap-4">+ {userInfo?.challenge.length === 0 ? (+ <div className="text-center">No recent challenges.</div>+ ) : null}+ {userInfo?.challenge.map((ch, i) => (+ <Expandable+ className="rounded-xl border border-slate-600 p-3"+ header={+ <header className="flex w-full flex-col items-baseline justify-between gap-4 md:flex-row">+ <Text intent="h2">{ch.name}</Text>+ <div className="flex flex-wrap gap-2 text-xs md:flex-nowrap">+ <div className="rounded-full bg-slate-300 px-3 py-1 text-gray-800">+ <span className="font-semibold">Created at: </span>+ {ch.createdAt.toLocaleString(undefined, {+ dateStyle: 'medium',+ timeStyle: 'short',+ })}+ </div>+ <div className="rounded-full bg-slate-300 px-3 py-1 text-gray-800">+ <span className="font-semibold">Updated at: </span>+ {ch.updatedAt.toLocaleString(undefined, {+ dateStyle: 'medium',+ timeStyle: 'short',+ })}+ </div>+ </div>+ </header>+ }+ key={`challenge-${ch.id}`}+ open={i === 0}+ >+ <div className="mt-4 rounded-lg bg-zinc-800 p-4" key={`challenge-${ch.id}`}>+ <section className="mb-4 border-b border-slate-500 pb-4">+ <div className="font-semibold">Short description</div>+ <Markdown>{ch.shortDescription}</Markdown>+ </section>+ <Markdown>{ch.description}</Markdown>+ </div>+ </Expandable>+ ))}+ </div>++ <Text className="my-4" intent="h3">+ Most recent solutions <small>(5)</small>+ </Text>++ {userInfo?.sharedSolution ? (+ <div className="flex flex-col gap-4">+ {userInfo.sharedSolution.map((f) => (+ <div+ className="text:primary-foreground rounded-xl border bg-zinc-800 p-4"+ key={`solution-${f.id}`}+ >+ <header className="flex justify-between">+ <Text intent="h2" weight="bold">+ {f.title}+ </Text>+ <div>+ {f.createdAt.toLocaleString(undefined, {+ dateStyle: 'medium',+ timeStyle: 'medium',+ })}+ </div>+ </header>+ <section>+ <Markdown>{f.description}</Markdown>+ </section>+ </div>+ ))}+ </div>+ ) : null}++ {userInfo?.sharedSolution.length === 0 && <div className="mb-6">No solutions on record</div>}+ </div>+ );+}diff --git a/apps/web/src/app/admin/report/[id]/actions.tsx b/apps/admin/src/app/report/[id]/actions.tsxsimilarity index 99%rename from apps/web/src/app/admin/report/[id]/actions.tsxrename to apps/admin/src/app/report/[id]/actions.tsxindex 64fcb565..36133799 100644--- a/apps/web/src/app/admin/report/[id]/actions.tsx+++ b/apps/admin/src/app/report/[id]/actions.tsx@@ -1,28 +1,28 @@'use client';import { type User } from '@repo/db/types';-import { useRouter } from 'next/navigation';-import { useMemo, useState } from 'react';import {+ Button,Dialog,DialogContent,- DialogTitle,DialogDescription,DialogFooter,DialogHeader,- Button,+ DialogTitle,Label,Textarea,toast,} from '@repo/ui';-import { type ReportWithInfo } from './report.action';+import { useRouter } from 'next/navigation';+import { useMemo, useState } from 'react';import {+ banChallenge,banUser,deleteComment,deleteSolution,- banChallenge,dismissReport,-} from '~/components/admin/admin.actions';+} from '../../_components/admin.actions';+import { type ReportWithInfo } from './report.action';export interface ReportActionsProps {report: NonNullable<ReportWithInfo>;diff --git a/apps/web/src/app/admin/report/[id]/loading.tsx b/apps/admin/src/app/report/[id]/loading.tsxsimilarity index 100%rename from apps/web/src/app/admin/report/[id]/loading.tsxrename to apps/admin/src/app/report/[id]/loading.tsxdiff --git a/apps/web/src/app/admin/report/[id]/page.tsx b/apps/admin/src/app/report/[id]/page.tsxsimilarity index 89%rename from apps/web/src/app/admin/report/[id]/page.tsxrename to apps/admin/src/app/report/[id]/page.tsxindex c7cef956..c4e2ceb9 100644--- a/apps/web/src/app/admin/report/[id]/page.tsx+++ b/apps/admin/src/app/report/[id]/page.tsx@@ -1,14 +1,13 @@+import { Alert, AlertDescription, AlertTitle, Markdown, Text } from '@repo/ui';import { AlertCircle, ChevronLeft } from '@repo/ui/icons';import Link from 'next/link';import { redirect } from 'next/navigation';-import { Text, Alert, AlertDescription, AlertTitle } from '@repo/ui';+import ChallengeReport from './_components/report/challenge.report';+import CommentReport from './_components/report/comment.report';+import SolutionReport from './_components/report/solution.report';+import UserReportUi from './_components/report/user.report';import ReportActions from './actions';import { getReport, type ReportWithInfo } from './report.action';-import { Markdown } from '~/components/ui/markdown';-import ChallengeReport from '~/components/report/types/challenge.report';-import CommentReport from '~/components/report/types/comment.report';-import UserReportUi from '~/components/report/types/user.report';-import SolutionReport from '~/components/report/types/solution.report';export interface Props {params: {diff --git a/apps/web/src/app/admin/report/[id]/report.action.ts b/apps/admin/src/app/report/[id]/report.action.tssimilarity index 100%rename from apps/web/src/app/admin/report/[id]/report.action.tsrename to apps/admin/src/app/report/[id]/report.action.tsdiff --git a/apps/web/src/app/admin/tracks/[trackId]/_actions/update-track.action.ts b/apps/admin/src/app/tracks/[trackId]/_actions/update-track.action.tssimilarity index 100%rename from apps/web/src/app/admin/tracks/[trackId]/_actions/update-track.action.tsrename to apps/admin/src/app/tracks/[trackId]/_actions/update-track.action.tsdiff --git a/apps/web/src/app/admin/tracks/[trackId]/_components/draggable-challenge.tsx b/apps/admin/src/app/tracks/[trackId]/_components/draggable-challenge.tsxsimilarity index 100%rename from apps/web/src/app/admin/tracks/[trackId]/_components/draggable-challenge.tsxrename to apps/admin/src/app/tracks/[trackId]/_components/draggable-challenge.tsxdiff --git a/apps/web/src/app/admin/tracks/[trackId]/_components/update-track-form.tsx b/apps/admin/src/app/tracks/[trackId]/_components/update-track-form.tsxsimilarity index 99%rename from apps/web/src/app/admin/tracks/[trackId]/_components/update-track-form.tsxrename to apps/admin/src/app/tracks/[trackId]/_components/update-track-form.tsxindex bf6273a8..89629749 100644--- a/apps/web/src/app/admin/tracks/[trackId]/_components/update-track-form.tsx+++ b/apps/admin/src/app/tracks/[trackId]/_components/update-track-form.tsx@@ -26,7 +26,6 @@ import { DraggableChallenge } from './draggable-challenge';const trackChallengeSchema = z.object({challengeId: z.number(),orderId: z.number(),- // trackId: z.number(),challenge: z.any(),});diff --git a/apps/web/src/app/admin/tracks/[trackId]/layout.tsx b/apps/admin/src/app/tracks/[trackId]/layout.tsxsimilarity index 100%rename from apps/web/src/app/admin/tracks/[trackId]/layout.tsxrename to apps/admin/src/app/tracks/[trackId]/layout.tsxdiff --git a/apps/web/src/app/admin/tracks/[trackId]/page.tsx b/apps/admin/src/app/tracks/[trackId]/page.tsxsimilarity index 100%rename from apps/web/src/app/admin/tracks/[trackId]/page.tsxrename to apps/admin/src/app/tracks/[trackId]/page.tsxdiff --git a/apps/web/src/app/admin/tracks/[trackId]/providers.tsx b/apps/admin/src/app/tracks/[trackId]/providers.tsxsimilarity index 100%rename from apps/web/src/app/admin/tracks/[trackId]/providers.tsxrename to apps/admin/src/app/tracks/[trackId]/providers.tsxdiff --git a/apps/admin/src/components/navigation.tsx b/apps/admin/src/components/navigation.tsxnew file mode 100644index 00000000..d76d6c4c--- /dev/null+++ b/apps/admin/src/components/navigation.tsx@@ -0,0 +1,151 @@+'use client';++import { signIn, signOut, useSession } from '@repo/auth/react';+import { RoleTypes } from '@repo/db/types';+import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuTrigger } from '@repo/ui';+import { Loader2, LogIn, Moon, Sun, User } from '@repo/ui/icons';+import { useTheme } from 'next-themes';+import { useEffect, useState } from 'react';++export function Navigation() {+ return (+ <header className="z-10 w-full">+ <nav className="container flex h-14 items-center">+ <div className="flex w-full items-center justify-between">+ <div className="relative flex gap-3">+ <a className="flex items-center space-x-2 duration-300" href="/">+ <svg+ className="h-8 w-8 rounded-md bg-[#3178C6] p-[2px]"+ viewBox="0 0 512 512"+ xmlns="http://www.w3.org/2000/svg"+ >+ <g clipPath="url(#clip0_1_2)">+ <path+ d="M462 0H50C22.3858 0 0 22.3858 0 50V462C0 489.614 22.3858 512 50 512H462C489.614 512 512 489.614 512 462V50C512 22.3858 489.614 0 462 0Z"+ fill="#3178C6"+ />+ <path+ clipRule="evenodd"+ d="M239.78 284.082H304V243H125V284.082H188.906V467H239.78V284.082Z"+ fill="white"+ fillRule="evenodd"+ />+ <path+ d="M303.13 466.986V242.986H349.72V335.818H418.427V242.986H465.13V466.986H418.427V373.827H349.72V466.986H303.13Z"+ fill="white"+ />+ </g>+ <defs>+ <clipPath id="clip0_1_2">+ <rect fill="white" height="512" width="512" />+ </clipPath>+ </defs>+ </svg>++ <span className="font-bold leading-3">+ type+ <br />+ hero+ </span>+ </a>+ </div>+ <div className="flex">+ <div className="flex items-center justify-end gap-2">+ <ThemeButton />+ <LoginButton />+ </div>+ </div>+ </div>+ </nav>+ </header>+ );+}++function ThemeButton() {+ const [mounted, setMounted] = useState(false);+ const { setTheme, resolvedTheme } = useTheme();++ useEffect(() => {+ setMounted(true);+ }, []);++ return (+ <>+ {mounted ? (+ <button+ className="focus:bg-accent rounded-lg p-2 duration-300 focus:outline-none"+ onClick={() => {+ setTheme(resolvedTheme === 'dark' ? 'light' : 'dark');+ }}+ type="button"+ >+ {resolvedTheme === 'dark' && <Moon aria-hidden="true" className="h-5 w-5" />}+ {resolvedTheme === 'light' && <Sun aria-hidden="true" className="h-5 w-5" />}+ </button>+ ) : null}+ </>+ );+}++function LoginButton() {+ const [loading, setLoading] = useState(false);+ const { data: session, status } = useSession();++ const isAdmin = session?.user.role.includes(RoleTypes.ADMIN);+ const isMod = session?.user.role.includes(RoleTypes.MODERATOR);+ const isAdminOrMod = isAdmin || isMod;++ // NOTE: 1. loading == true -> 2. signIn() -> 3. session status == 'loading' (loading == false)+ const handleSignIn = async () => {+ try {+ setLoading(true);+ // page reloads after sign in, so no need to setLoading(false), othersiwe ugly visual glitch+ await signIn('github', { redirect: false });+ } catch (error) {+ // only set loading to false if there was an error and page didn't reload after sign in+ setLoading(false);+ }+ };+ const handleSignOut = async () => {+ await signOut({ redirect: false });+ // whatever+ window.location.reload();+ };++ return session ? (+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <button className="focus:bg-accent rounded-lg p-2 duration-300 focus:outline-none">+ <User className="h-5 w-5" />+ </button>+ </DropdownMenuTrigger>+ <DropdownMenuContent+ align="end"+ className="mt-[0.33rem] w-56 rounded-xl bg-white/50 backdrop-blur-sm dark:bg-neutral-950/50"+ >+ <Button+ className="h-8 w-full justify-start rounded-b-lg rounded-t-sm bg-opacity-50 px-2 text-red-500 hover:bg-red-500/20 hover:text-red-500"+ onClick={handleSignOut}+ variant="ghost"+ >+ <span className="text-red-500">Log out</span>+ </Button>+ </DropdownMenuContent>+ </DropdownMenu>+ ) : (+ <Button+ className="focus:bg-accent w-20 rounded-lg bg-transparent p-2 text-black duration-300 hover:bg-gray-200 focus:outline-none dark:text-white hover:dark:bg-gray-800"+ disabled={loading || status === 'loading'}+ onClick={handleSignIn}+ >+ {loading || status === 'loading' ? (+ <Loader2 className="h-5 w-5 animate-spin" />+ ) : (+ <div className="flex items-center space-x-2">+ <LogIn className="h-5 w-5" />+ <span className="dark:text-white">Login</span>+ </div>+ )}+ </Button>+ );+}diff --git a/apps/admin/src/middlewareNO.ts b/apps/admin/src/middlewareNO.tsnew file mode 100644index 00000000..d5442abc--- /dev/null+++ b/apps/admin/src/middlewareNO.ts@@ -0,0 +1,26 @@+import { getToken } from 'next-auth/jwt';+import { withAuth } from 'next-auth/middleware';+import { NextResponse } from 'next/server';++export default withAuth(+ async function middleware(req) {+ const token = await getToken({ req });+ const isAuth = Boolean(token);++ if (isAuth) {+ return NextResponse.redirect(new URL('/', req.url));+ }++ return NextResponse.redirect(new URL('/'));+ },+ {+ callbacks: {+ authorized() {+ // This is a work-around for handling redirect on auth pages.+ // We return true here so that the middleware function above+ // is always called.+ return true;+ },+ },+ },+);diff --git a/apps/admin/src/styles/globals.css b/apps/admin/src/styles/globals.cssnew file mode 100644index 00000000..4cf7d975--- /dev/null+++ b/apps/admin/src/styles/globals.css@@ -0,0 +1,180 @@+@tailwind base;+@tailwind components;+@tailwind utilities;++@layer base {+ :root {+ --gradient-angle: 360deg;++ --background: 0 0% 100%;+ --foreground: 240 10% 3.9%;++ --muted: 240 4.8% 95.9%;+ --muted-foreground: 240 3.8% 46.1%;++ --popover: 0 0% 100%;+ --popover-foreground: 240 10% 3.9%;++ --card: 0 0% 100%;+ --card-hovered: 0 0% 98%;+ --card-foreground: 240 10% 3.9%;++ --border: 240 5.9% 90%;+ --input: 240 5.9% 90%;++ --primary: 240 5.9% 10%;+ --primary-foreground: 0 0% 98%;++ --secondary: 240 4.8% 95.9%;+ --secondary-foreground: 240 5.9% 10%;++ --accent: 240 4.8% 95.9%;+ --accent-foreground: ;++ --destructive: 0 84.2% 60.2%;+ --destructive-foreground: 0 0% 98%;++ --ring: 240 5% 64.9%;++ --radius: 0.5rem;+ }++ .dark {+ --background: 240 10% 3.9%;+ --foreground: 0 0% 98%;++ --muted: 240 3.7% 15.9%;+ --muted-foreground: 240 5% 64.9%;++ --popover: 240 10% 3.9%;+ --popover-foreground: 0 0% 98%;++ --card: 240 10% 3.9%;+ --card-hovered: 240 10% 6.9%;+ --card-foreground: 0 0% 98%;++ --border: 240 3.7% 15.9%;+ --input: 240 3.7% 15.9%;++ --primary: 0 0% 98%;+ --primary-foreground: 240 5.9% 10%;++ --secondary: 240 3.7% 15.9%;+ --secondary-foreground: 0 0% 98%;++ --accent: 240 3.7% 15.9%;+ --accent-foreground: ;++ --destructive: 0 62.8% 30.6%;+ --destructive-foreground: 0 85.7% 97.3%;++ --ring: 240 3.7% 15.9%;+ }+}++@layer base {+ * {+ @apply border-border;+ }+ body {+ @apply bg-background text-foreground;+ }+}++html,+body,+#__next,+main {+ scroll-padding-top: 64px;+ scroll-behavior: smooth;+ height: 100%;+}+.w-md-editor-content {+ @apply bg-background dark:bg-muted;+}++.w-md-editor-toolbar {+ @apply flex w-full gap-2;+ /* border-b border-b-zinc-300 */+ border-bottom: 1px solid rgb(212 212 216) !important;+ /* bg-background (in light mode) */+ background: #fff !important;+}++/* dark:border-b-zinc-300 dark:bg-muted */+.dark .w-md-editor-toolbar {+ border-bottom: 1px solid rgb(63 63 70) !important;+ background: hsl(240 3.7% 15.9%) !important;+}++.w-md-editor-toolbar-divider {+ @apply bg-zinc-300 dark:bg-zinc-700;+ /* TODO: not aligned center vertically */+ height: 1.5rem !important;+}+.w-md-editor-toolbar ul {+ @apply flex items-center;+}+.w-md-editor-toolbar ul li.active button {+ @apply text-black dark:text-white;+}+.w-md-editor-toolbar ul li button {+ @apply flex h-8 w-auto min-w-[2rem] items-center justify-center rounded-md p-1 text-neutral-500 hover:bg-neutral-200 hover:text-black dark:hover:bg-zinc-700 dark:hover:text-white;+}+.w-md-editor-toolbar ul li button[disabled] {+ @apply cursor-default text-neutral-700 hover:bg-transparent hover:text-neutral-700;+}+.w-md-editor-toolbar ul li button svg {+ @apply h-4 w-4;+}+.w-md-editor {+ background: var(--muted) !important;+}++.w-md-editor-preview {+ padding: 1rem !important;+ box-shadow: inset 1px 0 0 0 rgb(212 212 216) !important;+}+.dark .w-md-editor-preview {+ box-shadow: inset 1px 0 0 0 rgb(63 63 70) !important;+}++.w-md-editor-preview .wmde-markdown {+ @apply bg-muted;+}++.custom-scrollable-element::-webkit-scrollbar {+ width: 0.6rem;+}+.custom-scrollable-element::-webkit-scrollbar-track {+ background-color: transparent;+}+.custom-scrollable-element::-webkit-scrollbar-thumb {+ @apply rounded-l-xl bg-neutral-300/50 dark:bg-zinc-700/50;+}++.custom-scrollable-element::-webkit-scrollbar-thumb:hover {+ @apply bg-neutral-300 dark:bg-zinc-600;+}++.container {+ @apply mx-auto max-w-[1400px] px-4 md:px-24;+}++/* overrides a conflicting style on the honeycomb grid */+@media (min-width: 1280px) {+ .honeycomboverride > *:first-child {+ margin-left: 2.375rem /* 38px */ !important;+ }+}++@property --gradient-angle {+ syntax: '<angle>'; /* <- defined as type angle for the transition to work */+ initial-value: 360deg;+ inherits: false;+}++.hide-scrollbar::-webkit-scrollbar {+ display: none; /* Chrome Safari */+ scrollbar-width: none; /* Firefox */+}diff --git a/apps/admin/tailwind.config.ts b/apps/admin/tailwind.config.tsindex 1af3b8f0..14a5f91d 100644--- a/apps/admin/tailwind.config.ts+++ b/apps/admin/tailwind.config.ts@@ -1,20 +1,84 @@-import type { Config } from 'tailwindcss'+const { fontFamily } =+ // eslint-disable-next-line+ require('tailwindcss/defaultTheme') as typeof import('tailwindcss/defaultTheme');-const config: Config = {+/** @type {import('tailwindcss').Config} */+module.exports = {+ darkMode: ['class'],content: [- './src/pages/**/*.{js,ts,jsx,tsx,mdx}',- './src/components/**/*.{js,ts,jsx,tsx,mdx}',- './src/app/**/*.{js,ts,jsx,tsx,mdx}',+ './app/**/*.{js,ts,jsx,tsx,mdx}',+ 'src/**/*.{ts,tsx}',+ '../../packages/ui/**/*.{ts,tsx}',],theme: {extend: {- backgroundImage: {- 'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))',- 'gradient-conic':- 'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))',+ screens: {+ // iPad Pro vertical is 1024px exactly+ lg: '1025px',+ },+ colors: {+ border: 'hsl(var(--border))',+ input: 'hsl(var(--input))',+ ring: 'hsl(var(--ring))',+ background: 'hsl(var(--background))',+ foreground: 'hsl(var(--foreground))',+ primary: {+ DEFAULT: 'hsl(var(--primary))',+ foreground: 'hsl(var(--primary-foreground))',+ },+ secondary: {+ DEFAULT: 'hsl(var(--secondary))',+ foreground: 'hsl(var(--secondary-foreground))',+ },+ destructive: {+ DEFAULT: 'hsl(var(--destructive))',+ foreground: 'hsl(var(--destructive-foreground))',+ },+ muted: {+ DEFAULT: 'hsl(var(--muted))',+ foreground: 'hsl(var(--muted-foreground))',+ },+ accent: {+ DEFAULT: 'hsl(var(--accent))',+ foreground: 'hsl(var(--accent-foreground))',+ },+ popover: {+ DEFAULT: 'hsl(var(--popover))',+ foreground: 'hsl(var(--popover-foreground))',+ },+ card: {+ DEFAULT: 'hsl(var(--card))',+ hovered: 'hsl(var(--card-hovered))',+ foreground: 'hsl(var(--card-foreground))',+ },+ },+ borderRadius: {+ lg: 'var(--radius)',+ md: 'calc(var(--radius) - 2px)',+ sm: 'calc(var(--radius) - 4px)',+ },+ fontFamily: {+ sans: ['var(--font-sans)', ...fontFamily.sans],+ },+ keyframes: {+ 'accordion-down': {+ from: { height: 0 },+ to: { height: 'var(--radix-accordion-content-height)' },+ },+ 'accordion-up': {+ from: { height: 'var(--radix-accordion-content-height)' },+ to: { height: 0 },+ },+ },+ animation: {+ 'accordion-down': 'accordion-down 0.2s ease-out',+ 'accordion-up': 'accordion-up 0.2s ease-out',},},},- plugins: [],-}-export default config+ plugins: [+ require('tailwindcss-animate'),+ require('@tailwindcss/typography'),+ require('@tailwindcss/container-queries'),+ ],+};diff --git a/apps/web/src/app/admin/page.tsx b/apps/web/src/app/admin/page.tsxdeleted file mode 100644index 94aa8ed7..00000000--- a/apps/web/src/app/admin/page.tsx+++ /dev/null@@ -1,110 +0,0 @@-'use server';-import { getServerAuthSession } from '@repo/auth/server';-import { RoleTypes } from '@repo/db/types';-import { Tabs, TabsContent, TabsList, TabsTrigger } from '@repo/ui';-import { Lock } from '@repo/ui/icons';-import React from 'react';-import { ChallengeReviews } from './_components/challenge-reviews';-import { ManageTracks } from './_components/tracks';-import { getBannedUsers, getUploadedImages } from '~/components/admin/admin.actions';-import { ImageUploadReport } from '~/components/admin/images';-import Reports from '~/components/admin/reports';-import { BannedUsers } from '~/components/admin/users';-import { getInfiniteReports } from '~/components/report/report.action';--async function Admin() {- const session = await getServerAuthSession();- const roles = session?.user.role ?? [];-- const isMod = roles.includes(RoleTypes.MODERATOR);- const isAdmin = roles.includes(RoleTypes.ADMIN);- const isModOrAdmin = isAdmin || isMod;-- return (- <div>- <div className="flex flex-col gap-4">- {isModOrAdmin ? (- <View />- ) : (- <div className="flex min-h-[calc(100dvh-112px)] w-full flex-col items-center justify-center space-y-2">- <Lock className="h-8 w-8" />- <span className="max-w-[40ch] text-center text-black/50 dark:text-white/50">- You do not have permissions to access the page.- </span>- </div>- )}- </div>- </div>- );-}--// TODO: i think we need nested routing here so we can only load the data when the tab is active-// 💀 this has to be a job for trash-const View = async () => {- const allBannedUsers = await getBannedUsers();- // This needs done because server functions are dumb and this throws A LOT of errors otherwise.- const firstPage = await getInfiniteReports();- const uploadedimages = await getUploadedImages();-- return (- <div className="container m-8 flex flex-col space-y-4">- <div className="space-y-2">- <div className="mx-2 flex flex-col">- <p className="text-2xl font-semibold text-black dark:text-white">Moderation</p>- <p className="text-start text-sm text-neutral-400 dark:text-neutral-600">- A view of all the reports & users and all uploaded user images- </p>- </div>- <div className="flex flex-col space-y-2">- <Tabs className="space-x-4" defaultValue="reports">- <TabsList className="border-border bg-background rounded-full border">- <TabsTrigger- className="data-[state=active]:bg-border rounded-l-2xl rounded-r-lg duration-300"- value="reports"- >- Reports- </TabsTrigger>- <TabsTrigger- className="data-[state=active]:bg-border duration-300"- value="challengeReviews"- >- Challenge Reviews- </TabsTrigger>- <TabsTrigger className="data-[state=active]:bg-border duration-300" value="users">- Users- </TabsTrigger>- <TabsTrigger className="data-[state=active]:bg-border duration-300" value="images">- Images- </TabsTrigger>- <TabsTrigger- className="data-[state=active]:bg-border rounded-l-lg rounded-r-2xl duration-300"- value="tracks"- >- Tracks- </TabsTrigger>- </TabsList>- <TabsContent value="reports">- <React.Suspense fallback={<>Loading...</>}>- <Reports initialReports={firstPage} />- </React.Suspense>- </TabsContent>- <TabsContent value="users">- <BannedUsers data={allBannedUsers} />- </TabsContent>- <TabsContent value="challengeReviews">- <ChallengeReviews />- </TabsContent>- <TabsContent value="images">- <ImageUploadReport data={uploadedimages} />- </TabsContent>- <TabsContent value="tracks">- <ManageTracks />- </TabsContent>- </Tabs>- </div>- </div>- </div>- );-};--export default Admin;diff --git a/apps/web/src/app/challenge/[id]/solutions/_components/solution-detail.tsx b/apps/web/src/app/challenge/[id]/solutions/_components/solution-detail.tsxindex e4cd94c3..dfc81562 100644--- a/apps/web/src/app/challenge/[id]/solutions/_components/solution-detail.tsx+++ b/apps/web/src/app/challenge/[id]/solutions/_components/solution-detail.tsx@@ -17,8 +17,8 @@ import {} from '@repo/ui';import { Comments } from '~/app/challenge/_components/comments';import { Markdown } from '~/components/ui/markdown';-import { ReportDialog } from '~/components/report';import type { ChallengeSolution } from '~/app/challenge/[id]/solutions/[solutionId]/page';+import { ReportDialog } from '~/components/ReportDialog';interface Props {solution: ChallengeSolution;diff --git a/apps/web/src/app/challenge/_components/comments/comment.tsx b/apps/web/src/app/challenge/_components/comments/comment.tsxindex 2f5e8ad0..5b41ab36 100644--- a/apps/web/src/app/challenge/_components/comments/comment.tsx+++ b/apps/web/src/app/challenge/_components/comments/comment.tsx@@ -14,8 +14,8 @@ import { replyComment, updateComment, type CommentsByChallengeId } from './commeimport { CommentDeleteDialog } from './delete';import { getPaginatedComments } from './getCommentRouteData';import { Markdown } from '~/components/ui/markdown';-import { ReportDialog } from '~/components/report';import { getRelativeTime } from '~/utils/relativeTime';+import { ReportDialog } from '~/components/ReportDialog';interface SingleCommentProps {comment: CommentsByChallengeId[number];diff --git a/apps/web/src/app/challenge/_components/description/index.tsx b/apps/web/src/app/challenge/_components/description/index.tsxindex 18cbc1b3..fd388f0d 100644--- a/apps/web/src/app/challenge/_components/description/index.tsx+++ b/apps/web/src/app/challenge/_components/description/index.tsx@@ -27,8 +27,8 @@ import { addOrRemoveBookmark } from '../bookmark.action';import { incrementOrDecrementUpvote } from '../increment.action';import { Markdown } from '~/components/ui/markdown';import { type ChallengeRouteData } from '~/app/challenge/[id]/getChallengeRouteData';-import { ReportDialog } from '~/components/report';import { getRelativeTime } from '~/utils/relativeTime';+import { ReportDialog } from '~/components/ReportDialog';interface Props {challenge: ChallengeRouteData;diff --git a/apps/web/src/components/report/index.tsx b/apps/web/src/components/ReportDialog/index.tsxsimilarity index 99%rename from apps/web/src/components/report/index.tsxrename to apps/web/src/components/ReportDialog/index.tsxindex 57eeb12e..a7a98222 100644--- a/apps/web/src/components/report/index.tsx+++ b/apps/web/src/components/ReportDialog/index.tsx@@ -23,7 +23,7 @@ import {type CommentReport,addReport,type SolutionReport,-} from '~/components/report/report.action';+} from './report-dialog.action';export interface ReportDialogPropsBase {triggerAsChild?: boolean;diff --git a/apps/web/src/components/report/report.action.ts b/apps/web/src/components/ReportDialog/report-dialog.action.tssimilarity index 57%rename from apps/web/src/components/report/report.action.tsrename to apps/web/src/components/ReportDialog/report-dialog.action.tsindex 42011d4e..a8f3e10b 100644--- a/apps/web/src/components/report/report.action.ts+++ b/apps/web/src/components/ReportDialog/report-dialog.action.ts@@ -1,8 +1,8 @@'use server';-import { type Prisma, type Report } from '@repo/db/types';-import { prisma } from '@repo/db';import { getServerAuthSession } from '@repo/auth/server';+import { prisma } from '@repo/db';+import { type Prisma, type Report } from '@repo/db/types';export interface ReportBase {issues: Prisma.ReportIssueCreateWithoutReportInput[];@@ -63,7 +63,6 @@ export type SolutionReport = Omit<| 'userId'> &ReportBase & { type: 'SOLUTION' };-/*** @param report a report object specific to a user, challenge, or comment report type* @returns 'created' if successful, 'not_logged_in' if the user is not logged in, and 'already_exists' if there's a pending report of the same type by the same user.@@ -125,96 +124,3 @@ export async function addReport(return 'created';}--export type ReportsData = Awaited<ReturnType<typeof getReports>>;-export type InfiniteReports = Awaited<ReturnType<typeof getInfiniteReports>>;--export async function getInfiniteReports(lastCursor?: number) {- const reports = await getReports(lastCursor);- const nextCursor = reports.at(-1)?.id;-- let hasNextCursor = false;- if (nextCursor) {- const nextPage = await getReports(nextCursor);- if (nextPage.length > 0) hasNextCursor = true;- }-- return {- data: reports,- metadata: {- hasNextPage: hasNextCursor,- lastCursor: hasNextCursor ? nextCursor : null,- },- };-}--export async function getReports(lastCursor?: number, take = 3) {- return prisma.report.findMany({- include: {- challenge: {- include: {- _count: {- select: {- vote: true,- },- },- },- },- user: true,- reporter: true,- issues: true,- comment: true,- solution: true,- },- take,- ...(lastCursor && {- skip: 1,- cursor: {- id: lastCursor,- },- }),- orderBy: [- {- status: 'asc',- },- ],- });-}--export async function getReportedUserInformation(userId: string) {- return await prisma.user.findFirstOrThrow({- where: {- id: userId,- },- include: {- comment: {- take: 10,- include: {- user: true,- _count: {- select: {- replies: true,- },- },- rootChallenge: true,- rootSolution: true,- },- orderBy: {- createdAt: 'desc',- },- },- sharedSolution: {- take: 5,- orderBy: {- createdAt: 'desc',- },- },- challenge: {- take: 5,- orderBy: {- createdAt: 'asc',- },- },- },- });-}diff --git a/apps/web/src/components/admin/reports/index.ts b/apps/web/src/components/admin/reports/index.tsdeleted file mode 100644index e69de29b..00000000diff --git a/apps/web/src/components/report/types/user.report.tsx b/apps/web/src/components/report/types/user.report.tsxdeleted file mode 100644index 82e8a71a..00000000--- a/apps/web/src/components/report/types/user.report.tsx+++ /dev/null@@ -1,127 +0,0 @@-'use server';--import { Text, Expandable } from '@repo/ui';-import { getReportedUserInformation } from '../report.action';-import { Markdown } from '~/components/ui/markdown';-import { type ReportWithInfo } from '~/app/admin/report/[id]/report.action';-import { Comment } from '~/app/challenge/_components/comments/comment';--interface UserReportProps {- report: NonNullable<ReportWithInfo>;-}--export default async function UserReportUi({ report }: UserReportProps) {- if (!report.userId) return null;- const userInfo = await getReportedUserInformation(report.userId);- const commentRootId = report.comment?.rootChallengeId ?? report.comment?.rootSolutionId ?? -1;-- return (- <div>- <Text intent="h3">- Most Recent Comments <small>(10)</small>- </Text>-- <div className="mt-4 flex flex-col gap-4">- {userInfo.comment- ? userInfo.comment.map((comment) => (- <div- className="rounded border border-zinc-700 bg-zinc-800 p-2"- key={`comment-${comment.id}`}- >- <Comment- comment={comment}- readonly- rootId={commentRootId}- type={comment.rootType}- />- </div>- ))- : null}-- {userInfo.comment && userInfo.comment.length === 0 ? (- <div className="mb-6 flex justify-center">No comments on record</div>- ) : null}- </div>-- <Text className="mt-4" intent="h3">- Most Recent challenges <small>(5)</small>{' '}- </Text>-- <div className="mt-4 flex flex-col gap-4">- {userInfo.challenge && userInfo.challenge.length === 0 ? (- <div className="text-center">No recent challenges.</div>- ) : null}- {userInfo.challenge- ? userInfo.challenge.map((ch, i) => (- <Expandable- className="rounded-xl border border-slate-600 p-3"- header={- <header className="flex w-full flex-col items-baseline justify-between gap-4 md:flex-row">- <Text intent="h2">{ch.name}</Text>- <div className="flex flex-wrap gap-2 text-xs md:flex-nowrap">- <div className="rounded-full bg-slate-300 px-3 py-1 text-gray-800">- <span className="font-semibold">Created at: </span>- {ch.createdAt.toLocaleString(undefined, {- dateStyle: 'medium',- timeStyle: 'short',- })}- </div>- <div className="rounded-full bg-slate-300 px-3 py-1 text-gray-800">- <span className="font-semibold">Updated at: </span>- {ch.updatedAt.toLocaleString(undefined, {- dateStyle: 'medium',- timeStyle: 'short',- })}- </div>- </div>- </header>- }- key={`challenge-${ch.id}`}- open={i === 0}- >- <div className="mt-4 rounded-lg bg-zinc-800 p-4" key={`challenge-${ch.id}`}>- <section className="mb-4 border-b border-slate-500 pb-4">- <div className="font-semibold">Short description</div>- <Markdown>{ch.shortDescription}</Markdown>- </section>- <Markdown>{ch.description}</Markdown>- </div>- </Expandable>- ))- : null}- </div>-- <Text className="my-4" intent="h3">- Most recent solutions <small>(5)</small>- </Text>-- {userInfo.sharedSolution ? (- <div className="flex flex-col gap-4">- {userInfo.sharedSolution.map((f) => (- <div- className="text:primary-foreground rounded-xl border bg-zinc-800 p-4"- key={`solution-${f.id}`}- >- <header className="flex justify-between">- <Text intent="h2" weight="bold">- {f.title}- </Text>- <div>- {f.createdAt.toLocaleString(undefined, {- dateStyle: 'medium',- timeStyle: 'medium',- })}- </div>- </header>- <section>- <Markdown>{f.description}</Markdown>- </section>- </div>- ))}- </div>- ) : null}-- {userInfo.sharedSolution.length === 0 && <div className="mb-6">No solutions on record</div>}- </div>- );-}diff --git a/apps/web/src/components/ui/navigation.tsx b/apps/web/src/components/ui/navigation.tsxindex 71037808..6514f93a 100644--- a/apps/web/src/components/ui/navigation.tsx+++ b/apps/web/src/components/ui/navigation.tsx@@ -16,6 +16,7 @@ import { useTheme } from 'next-themes';import Link from 'next/link';import { usePathname } from 'next/navigation';import { useEffect, useState } from 'react';+import { getBaseUrl } from '~/utils/getBaseUrl';export function Navigation() {const pathname = usePathname();@@ -23,9 +24,7 @@ export function Navigation() {<header className="z-10 w-full"><navclassName={`flex h-14 items-center ${- pathname?.startsWith('/challenge') || pathname?.startsWith('/admin/challenge')- ? 'px-4'- : 'container'+ pathname?.startsWith('/challenge') ? 'px-4' : 'container'}`}><div className="flex w-full items-center justify-between">@@ -161,12 +160,12 @@ function LoginButton() {</DropdownMenuItem></Link>{isAdminOrMod ? (- <Link className="block" href="/admin">+ <a className="block" href={`${getBaseUrl()}/admin`}><DropdownMenuItem className="focus:bg-accent rounded-lg p-2 duration-300 focus:outline-none dark:hover:bg-neutral-700/50"><Settings className="mr-2 h-4 w-4" /><span>Admin</span></DropdownMenuItem>- </Link>+ </a>) : null}<DropdownMenuSeparator /><Buttondiff --git a/apps/web/src/components/user/dashboard/user-header.tsx b/apps/web/src/components/user/dashboard/user-header.tsxindex fadfe1e7..b1dba489 100644--- a/apps/web/src/components/user/dashboard/user-header.tsx+++ b/apps/web/src/components/user/dashboard/user-header.tsx@@ -3,7 +3,7 @@import { type User } from '@repo/db/types';import { Flag } from '@repo/ui/icons';import { ActionMenu, Text } from '@repo/ui';-import { ReportDialog } from '~/components/report';+import { ReportDialog } from '~/components/ReportDialog';export interface UserHeaderProps {user: User;diff --git a/packages/auth/src/server.ts b/packages/auth/src/server.tsindex e4819275..753d3504 100644--- a/packages/auth/src/server.ts+++ b/packages/auth/src/server.ts@@ -101,7 +101,23 @@ export const authOptions: NextAuthOptions = {}),],};+const useSecureCookies = Boolean(process.env.VERCEL_URL);+export const adminAuthOptions: NextAuthOptions = {+ ...authOptions,+ cookies: {+ sessionToken: {+ name: `${useSecureCookies ? '__Secure-' : ''}next-auth.session-token`,+ options: {+ httpOnly: true,+ sameSite: 'lax',+ path: '/',+ domain: `${process.env.VERCEL_URL}`,+ secure: useSecureCookies,+ },+ },+ },+};/*** Wrapper for `getServerSession` so that you don't need to import the `authOptions` in every file.*diff --git a/packages/ui/package.json b/packages/ui/package.jsonindex b33ad59e..fbc5d4c8 100644--- a/packages/ui/package.json+++ b/packages/ui/package.json@@ -46,11 +46,16 @@"clsx": "^2.0.0","cmdk": "^0.2.0","lucide-react": "^0.260.0",+ "next-themes": "^0.2.1","react": "^18.2.0","react-day-picker": "^8.8.0","react-hook-form": "^7.45.1",+ "react-markdown": "^8.0.7",+ "react-syntax-highlighter": "^15.5.0",+ "remark-gfm": "^3.0.1","tailwind-merge": "^1.14.0",- "tailwindcss-animate": "^1.0.6"+ "tailwindcss-animate": "^1.0.6",+ "unist-util-visit": "^5.0.0"},"devDependencies": {"@repo/lint": "workspace:*",diff --git a/packages/ui/src/components/markdown.tsx b/packages/ui/src/components/markdown.tsxnew file mode 100644index 00000000..e31830e8--- /dev/null+++ b/packages/ui/src/components/markdown.tsx@@ -0,0 +1,87 @@+'use client';++import ReactMarkdown from 'react-markdown';+import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';+import remarkGfm from 'remark-gfm';+import { vs, vscDarkPlus } from 'react-syntax-highlighter/dist/esm/styles/prism';+import clsx from 'clsx';+import { visit, SKIP, type BuildVisitor } from 'unist-util-visit';+import type { Transformer } from 'unified';+import { useTheme } from 'next-themes';++const HTML_COMMENT_REGEX = new RegExp('<!--([\\s\\S]*?)-->', 'g');++/**+ * Remove HTML comments from Markdown+ */+function removeHtmlComments(): Transformer {+ return (tree) => {+ // TODO: PRs are welcomed to fix the any type+ // eslint-disable-next-line+ const handler: BuildVisitor<any> = (node, index, parent) => {+ const isComment = node.value.match(HTML_COMMENT_REGEX);++ if (isComment) {+ // remove node+ parent.children.splice(index, 1);+ // Do not traverse `node`, continue at the node *now* at `index`. http://unifiedjs.com/learn/recipe/remove-node/+ return [SKIP, index];+ }+ };++ visit(tree, 'html', handler);++ // TODO: is this needed+ visit(tree, 'jsx', handler);+ };+}++export function Markdown({ children, className }: { children: string; className?: string }) {+ const { theme } = useTheme();+ const syntaxHighlighterTheme = theme === 'light' ? vs : vscDarkPlus;++ return (+ <ReactMarkdown+ className={className}+ components={{+ a: ({ className, ...props }) => (+ <a className={clsx(className, 'text-blue-500')} {...props} />+ ),+ ul: ({ className, ...props }) => (+ <ul className={clsx(className, 'list-disc ps-10')} {...props} />+ ),+ h1: ({ className, ...props }) => (+ <h1 className={clsx(className, 'mb-2 pb-2 text-3xl font-bold')} {...props} />+ ),+ h2: ({ className, ...props }) => (+ <h2 className={clsx(className, 'mb-2 pb-2 text-2xl font-bold')} {...props} />+ ),+ h3: ({ className, ...props }) => (+ <h3 className={clsx(className, 'mb-2 pb-2 text-xl font-bold')} {...props} />+ ),+ p: ({ className, ...props }) => <p className={clsx(className, 'mb-4')} {...props} />,+ code({ inline, className, children, style: _, ...props }) {+ const match = /language-(\w+)/.exec(className || '');+ return !inline && match ? (+ <SyntaxHighlighter+ PreTag="section" // parent tag+ className={clsx(className, 'rounded-xl dark:rounded-md')}+ language={match[1]}+ style={syntaxHighlighterTheme} // theme+ {...props}+ >+ {String(children).replace(/\n$/, '')}+ </SyntaxHighlighter>+ ) : (+ <code className="rounded-md bg-neutral-200 p-1 font-mono dark:bg-black">+ {children}+ </code>+ );+ },+ }}+ remarkPlugins={[removeHtmlComments, remarkGfm]}+ >+ {children}+ </ReactMarkdown>+ );+}diff --git a/packages/ui/src/index.ts b/packages/ui/src/index.tsindex f6d08259..390960d7 100644--- a/packages/ui/src/index.ts+++ b/packages/ui/src/index.ts@@ -19,6 +19,7 @@ export * from './components/icon-button';export * from './components/input';export * from './components/label';export * from './components/magic-icon';+export * from './components/markdown';export * from './components/navigation-menu';export * from './components/pagination';export * from './components/paragraph';diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 1eefae69..5d9243ac 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -37,6 +37,9 @@ importers:apps/admin:dependencies:+ '@hookform/resolvers':+ specifier: ^3.1.1+ version: 3.1.1([email protected])'@repo/auth':specifier: workspace:*version: link:../../packages/auth@@ -52,18 +55,51 @@ importers:'@repo/ui':specifier: workspace:*version: link:../../packages/ui+ '@tanstack/react-query':+ specifier: ^4.29.25+ version: 4.29.25([email protected])([email protected])+ '@tanstack/react-table':+ specifier: ^8.9.3+ version: 8.9.3([email protected])([email protected])+ clsx:+ specifier: ^2.0.0+ version: 2.0.0next:specifier: 13.4.19version: 13.4.19([email protected])([email protected])+ next-auth:+ specifier: ^4.22.1+ version: 4.22.1(patch_hash=mr6pbhgbmy4dt4xo4hxm5k4ym4)([email protected])([email protected])([email protected])+ next-themes:+ specifier: ^0.2.1react:specifier: 18.2.0version: 18.2.0+ react-dnd:+ specifier: ^16.0.1+ react-dnd-html5-backend:+ specifier: ^16.0.1+ version: 16.0.1react-dom:specifier: 18.2.0version: 18.2.0([email protected])+ react-hook-form:+ specifier: ^7.45.1+ version: 7.45.1([email protected])+ react-select:+ specifier: ^5.7.4tailwindcss:specifier: 3.3.3version: 3.3.3+ tailwindcss-animate:+ specifier: ^1.0.6+ version: 1.0.6([email protected])+ zod:+ specifier: ^3.21.4+ version: 3.21.4devDependencies:'@repo/tsconfig':specifier: workspace:*@@ -504,6 +540,9 @@ importers:lucide-react:specifier: ^0.260.0version: 0.260.0([email protected])+ next-themes:+ specifier: ^0.2.1react:specifier: ^18.2.0version: 18.2.0@@ -513,12 +552,24 @@ importers:react-hook-form:specifier: ^7.45.1version: 7.45.1([email protected])+ react-markdown:+ specifier: ^8.0.7+ version: 8.0.7(@types/[email protected])([email protected])+ react-syntax-highlighter:+ specifier: ^15.5.0+ version: 15.5.0([email protected])+ remark-gfm:+ specifier: ^3.0.1+ version: 3.0.1tailwind-merge:specifier: ^1.14.0version: 1.14.0tailwindcss-animate:specifier: ^1.0.6version: 1.0.6([email protected])+ unist-util-visit:+ specifier: ^5.0.0+ version: 5.0.0devDependencies:'@repo/lint':specifier: workspace:*@@ -540,7 +591,7 @@ importers:dependencies:'@next/eslint-plugin-next':specifier: canary- version: 13.4.13-canary.13+ version: 13.4.20-canary.0'@repo/tsconfig':specifier: workspace:*version: link:../config-typescript@@ -552,7 +603,7 @@ importers:version: 5.62.0([email protected])([email protected])'@vercel/style-guide':specifier: ^4.0.2eslint:specifier: ^8.40.0version: 8.45.0@@ -1604,8 +1655,8 @@ packages:glob: 7.1.7dev: true- /@next/[email protected]:- resolution: {integrity: sha512-lEXi0QLWUuXlMQRLSk/6JUUoOcjACOKbJYPKe0R1XyF5Kf7/Czdm072UJb3betXqiWw5v54GoOOmyDaUDCn5Rw==}+ /@next/[email protected]:+ resolution: {integrity: sha512-vFC1meiw/awh2xJZMWaoECsfZbgkt2fF3HIg8f2fSM/w41Z86L1SS7SjKmpbbD87yq3tiqgqHmFv0JCych4g4g==}dependencies:glob: 7.1.7dev: false@@ -3905,7 +3956,7 @@ packages:yoga-wasm-web: 0.3.0dev: false- /@vercel/[email protected](@next/[email protected])([email protected])([email protected])([email protected]):+ /@vercel/[email protected](@next/[email protected])([email protected])([email protected])([email protected]):resolution: {integrity: sha512-FroL+oOePzhw7n/I+f7zr4WNroGHT/+2TlW6WH9+CVSjMNsEyu7Qstj2mI5gWIBjT1Y2ZImKPppCzI2cIYmNZw==}engines: {node: '>=16'}peerDependencies:@@ -3925,7 +3976,7 @@ packages:dependencies:'@babel/core': 7.22.10'@babel/eslint-parser': 7.22.10(@babel/[email protected])([email protected])- '@next/eslint-plugin-next': 13.4.13-canary.13+ '@next/eslint-plugin-next': 13.4.20-canary.0'@rushstack/eslint-patch': 1.3.2'@typescript-eslint/eslint-plugin': 5.59.1(@typescript-eslint/[email protected])([email protected])([email protected])'@typescript-eslint/parser': 5.62.0([email protected])([email protected])@@ -7677,6 +7728,18 @@ packages:react-dom: 18.2.0([email protected])dev: false+ resolution: {integrity: sha512-B+AKNfYNIzh0vqQQKqQItTS8evEouKD7H5Hj3kmuPERwddR2TxvDSFZuTj6T7Jfn1oyeUyJMydPl1Bkxkh0W7A==}+ peerDependencies:+ next: '*'+ react: '*'+ react-dom: '*'+ dependencies:+ next: 13.4.19([email protected])([email protected])+ react: 18.2.0+ react-dom: 18.2.0([email protected])+ dev: false+resolution: {integrity: sha512-4ep6aKxVTQ7rkUW2fBLhpBr/5oceCuf4KmlUpvG/aXuDTIf9mexNSpabUD6RWPspu6wiJJvozZREhXhueYO36A==}engines: {node: '>=16.8.0'}diff --git a/turbo.json b/turbo.jsonindex ee942295..47b51ea7 100644--- a/turbo.json+++ b/turbo.json@@ -9,6 +9,8 @@"DATABASE_URL","GITHUB_ID","GITHUB_SECRET",+ "GITHUB_ADMIN_ID",+ "GITHUB_ADMIN_SECRET","UPLOADTHING_SECRET","UPLOADTHING_APP_ID","NEXTAUTH_SECRET",