diff --git a/src/app/(stats)/guild/[value]/_components/sidebar.tsx b/src/app/(stats)/guild/[value]/_components/sidebar.tsx new file mode 100644 index 0000000..d92dbff --- /dev/null +++ b/src/app/(stats)/guild/[value]/_components/sidebar.tsx @@ -0,0 +1,48 @@ +import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" +import { Separator } from "@/components/ui/separator" +import { getColor } from "@/lib/colors" +import { Guild } from "@/lib/schema/guild" +import { cn } from "@/lib/utils" +import Link from "next/link" + +type SidebarProps = { guild: Guild["guild"] } + +export default function Sidebar({ guild }: SidebarProps) { + const tagColor = getColor(guild.tagColor, "text", "gray") + + return ( + + + + {guild.tag !== undefined ? `[${guild.tag}]` : "No Guild Tag"} + + + + {guild.description !== undefined ? + : +

No guild description.

} + +
+
+ ) +} + +function ReplaceLinks({ text }: { text: string }) { + const regex = /(https?:\/\/[^\s/$.?#].[^\s]*)/g + const parts = text.split(regex) + + return ( +
+ {parts.map((part, index) => { + if (regex.test(part)) { + return ( + + {part} + + ) + } + return part + })} +
+ ) +} diff --git a/src/app/(stats)/guild/[value]/page.tsx b/src/app/(stats)/guild/[value]/page.tsx index e3abe0d..bacf541 100644 --- a/src/app/(stats)/guild/[value]/page.tsx +++ b/src/app/(stats)/guild/[value]/page.tsx @@ -8,6 +8,7 @@ import { Loader2Icon, ShieldAlert } from "lucide-react" import { Suspense } from "react" import z from "zod" import { GuildPageLoadText } from "./_client" +import Sidebar from "./_components/sidebar" export default function GuildPage({ params, searchParams }: PageProps<"/guild/[value]">) { const maintenance = env.MAINTENANCE_MODE @@ -100,6 +101,12 @@ async function SuspendedPage({ params, searchParams }: Pick{guild.name} +
+ +
+ Hello +
+
) } diff --git a/src/lib/schema/guild.ts b/src/lib/schema/guild.ts index 52556b5..2493441 100644 --- a/src/lib/schema/guild.ts +++ b/src/lib/schema/guild.ts @@ -19,7 +19,8 @@ export const guildSchema = z.object({ tag: z.string().nullish().optional(), created: z.number(), priority: z.number() - })).optional() + })).optional(), + description: z.string().optional() }) })