+
+
+
@@ -26,9 +20,7 @@ export default function AMAPage() {
Manage AMAs
-
- Create, edit, and manage AMAs in your community
-
+
Create, and manage AMAs in your community
diff --git a/apps/website/src/app/dashboard/[id]/layout.tsx b/apps/website/src/app/dashboard/[id]/layout.tsx
index e94e7bf0..429a3fc6 100644
--- a/apps/website/src/app/dashboard/[id]/layout.tsx
+++ b/apps/website/src/app/dashboard/[id]/layout.tsx
@@ -1,4 +1,3 @@
-import { HydrationBoundary } from '@tanstack/react-query';
import type { Metadata } from 'next';
import { NavGateCheck } from '@/components/common/NavGate';
import { server } from '@/data/server';
@@ -21,12 +20,6 @@ export async function generateMetadata({ params }: LayoutProps<'/dashboard/[id]'
};
}
-export default async function Layout({ children, params }: LayoutProps<'/dashboard/[id]'>) {
- // const { id } = await params;
-
- return (
-
- {children}
-
- );
+export default async function GuildLayout({ children }: LayoutProps<'/dashboard/[id]'>) {
+ return
{children};
}
diff --git a/apps/website/src/app/dashboard/[id]/page.tsx b/apps/website/src/app/dashboard/[id]/page.tsx
index 4569ac01..aa2c89ad 100644
--- a/apps/website/src/app/dashboard/[id]/page.tsx
+++ b/apps/website/src/app/dashboard/[id]/page.tsx
@@ -4,7 +4,6 @@ import { BOTS } from '@chatsift/core';
import Link from 'next/link';
import { notFound, useParams } from 'next/navigation';
import { DashboardCrumbs } from '../_components/DashboardCrumbs';
-import { GuildIcon } from '@/components/common/GuildIcon';
import { Heading } from '@/components/common/Heading';
import { Skeleton } from '@/components/common/Skeleton';
import { client } from '@/data/client';
@@ -27,34 +26,8 @@ export default function GuildPage() {
return (
-
-
-
-
-
0} />
-
-
- {guild.name}
-
-
{guild.bots.length} bot(s) active
-
-
-
-
- {guild.approximate_member_count !== undefined && (
-
- {guild.approximate_member_count.toLocaleString()} member(s)
-
- )}
- {guild.approximate_presence_count !== undefined && (
-
- {guild.approximate_presence_count?.toLocaleString() ?? '0'} online
-
- )}
-
-
-
+
{BOTS.map((bot, index) => {
diff --git a/apps/website/src/app/dashboard/_components/DashboardCrumbs.tsx b/apps/website/src/app/dashboard/_components/DashboardCrumbs.tsx
index 3ad8fc79..3196a5be 100644
--- a/apps/website/src/app/dashboard/_components/DashboardCrumbs.tsx
+++ b/apps/website/src/app/dashboard/_components/DashboardCrumbs.tsx
@@ -1,22 +1,70 @@
'use client';
-import { useParams } from 'next/navigation';
+import { useParams, usePathname } from 'next/navigation';
+import { useMemo } from 'react';
import { Breadcrumb } from '@/components/common/Breadcrumb';
+import { GuildIcon } from '@/components/common/GuildIcon';
import { client } from '@/data/client';
import { sortGuilds } from '@/utils/util';
-export interface DashboardCrumbSegment {
- readonly href?: string;
- readonly label: string;
-}
-
-interface DashboardCrumbProps {
- readonly segments: DashboardCrumbSegment[];
-}
+const SEGMENT_LABELS: Record
= {
+ ama: 'AMA Bot',
+ amas: 'AMA Sessions',
+ new: 'New',
+} as const;
-export function DashboardCrumbs({ segments }: DashboardCrumbProps) {
+export function DashboardCrumbs() {
const { data: me } = client.auth.useMe();
- const params = useParams<{ id: string }>();
+ const params = useParams<{ id?: string }>();
+ const pathname = usePathname();
+
+ const segments = useMemo(() => {
+ if (!params.id || !pathname) {
+ return [];
+ }
+
+ // Split the pathname and remove empty strings
+ const pathParts = pathname.split('/').filter(Boolean);
+
+ // Find where the guild ID is in the path
+ const guildIdIndex = pathParts.indexOf(params.id);
+ if (guildIdIndex === -1) {
+ return [];
+ }
+
+ // Get all segments after the guild ID
+ const relevantParts = pathParts.slice(guildIdIndex + 1);
+
+ // Build segments with proper hrefs
+ const result = [];
+ for (let i = 0; i < relevantParts.length; i++) {
+ const part = relevantParts[i];
+ if (!part) {
+ continue;
+ }
+
+ const label = SEGMENT_LABELS[part] ?? part;
+
+ // Don't create an href for the last segment (current page)
+ const isLastSegment = i === relevantParts.length - 1;
+ if (isLastSegment) {
+ result.push({ label });
+ } else {
+ // Build the href up to this segment
+ const pathUpToHere = pathParts.slice(0, guildIdIndex + 2 + i).join('/');
+ result.push({
+ label,
+ href: `/${pathUpToHere}`,
+ });
+ }
+ }
+
+ return result;
+ }, [params.id, pathname]);
+
+ if (!params.id) {
+ throw new Error('id param not found, should not be rendering this component');
+ }
const guild = me?.guilds.find((g) => g.id === params.id);
@@ -39,19 +87,10 @@ export function DashboardCrumbs({ segments }: DashboardCrumbProps) {
{
label: guild.name,
href: segments.length === 0 ? undefined : `/dashboard/${guild.id}`,
- highlight: true,
- ...(guildOptions.length > 0 && { options: guildOptions }),
+ icon: ,
+ options: guildOptions,
},
- ...segments.map(({ href, ...rest }) => {
- if (href) {
- return {
- href: href.replace('[id]', guild.id),
- ...rest,
- };
- }
-
- return rest;
- }),
+ ...segments,
]}
/>
);
diff --git a/apps/website/src/app/dashboard/_components/GuildCard.tsx b/apps/website/src/app/dashboard/_components/GuildCard.tsx
index fc2b4248..32ca5afb 100644
--- a/apps/website/src/app/dashboard/_components/GuildCard.tsx
+++ b/apps/website/src/app/dashboard/_components/GuildCard.tsx
@@ -15,7 +15,7 @@ export default function GuildCard({ data }: GuildCardProps) {
return (
diff --git a/apps/website/src/app/dashboard/_components/RefreshGuildsButton.tsx b/apps/website/src/app/dashboard/_components/RefreshGuildsButton.tsx
index f1db1ba4..23a5c10e 100644
--- a/apps/website/src/app/dashboard/_components/RefreshGuildsButton.tsx
+++ b/apps/website/src/app/dashboard/_components/RefreshGuildsButton.tsx
@@ -5,7 +5,7 @@ import { SvgRefresh } from '@/components/icons/SvgRefresh';
import { client } from '@/data/client';
export function RefreshGuildsButton() {
- const { refetch, isLoading } = client.auth.useMe({ force_fresh: true });
+ const { refetch, isLoading } = client.auth.useMe({ force_fresh: 'true' });
return (