diff --git a/src/app/(dashboard)/[guildId]/[roleGroupId]/page.tsx b/src/app/(dashboard)/[guildId]/[roleGroupId]/page.tsx index dfff8a2cbc..52538eda7c 100644 --- a/src/app/(dashboard)/[guildId]/[roleGroupId]/page.tsx +++ b/src/app/(dashboard)/[guildId]/[roleGroupId]/page.tsx @@ -7,7 +7,6 @@ import type { RoleGroup } from "@/lib/schemas/roleGroup"; import type { DynamicRoute, PaginatedResponse } from "@/lib/types"; import { Lock } from "@phosphor-icons/react/dist/ssr"; import { ScrollArea } from "@radix-ui/react-scroll-area"; -import { Fragment } from "react"; const RoleGroupPage = async ({ params, @@ -22,7 +21,10 @@ const RoleGroupPage = async ({ ) ).json()) as PaginatedResponse; const roleGroups = paginatedRoleGroup.items; - const roleGroup = roleGroups.find((rg) => rg.urlName === roleGroupIdParam)!; + const roleGroup = roleGroups.find( + // @ts-expect-error + (rg) => rg.urlName === roleGroupIdParam || rg.id === guild.homeRoleGroupId, + )!; const paginatedRole = (await ( await fetch( `${env.NEXT_PUBLIC_API}/role/search?customQuery=@guildId:{${guild.id}}&pageSize=${Number.MAX_SAFE_INTEGER}`, @@ -57,7 +59,7 @@ const RoleGroupPage = async ({
- {Array.from({ length: 16 }, (_, i) => ( + {/*Array.from({ length: 16 }, (_, i) => ( {i > 0 &&
}
@@ -70,7 +72,7 @@ const RoleGroupPage = async ({
- ))} + ))*/}
diff --git a/src/app/(dashboard)/[guildId]/components/GuildTabs.tsx b/src/app/(dashboard)/[guildId]/components/GuildTabs.tsx index d17a3419e6..f59715dee5 100644 --- a/src/app/(dashboard)/[guildId]/components/GuildTabs.tsx +++ b/src/app/(dashboard)/[guildId]/components/GuildTabs.tsx @@ -4,7 +4,6 @@ import { Skeleton } from "@/components/ui/Skeleton"; import { cn } from "@/lib/cssUtils"; import type { Guild } from "@/lib/schemas/guild"; import { getRoleGroups } from "../fetchers"; -import { CreateRoleGroup } from "./CreateRoleGroup"; import { RoleGroupNavLink } from "./RoleGroupNavLink"; type Props = { @@ -23,16 +22,17 @@ export const GuildTabs = async ({ guild }: Props) => { }} >
- Home {roleGroups.map((rg) => ( `/${s}`) + .join()} > {rg.name} ))} -
@@ -44,8 +44,7 @@ export const GuildTabsSkeleton = () => (
{[...Array(3)].map((_, i) => ( diff --git a/src/app/(dashboard)/[guildId]/fetchers.ts b/src/app/(dashboard)/[guildId]/fetchers.ts index f0fe83f477..fa162d6237 100644 --- a/src/app/(dashboard)/[guildId]/fetchers.ts +++ b/src/app/(dashboard)/[guildId]/fetchers.ts @@ -15,7 +15,7 @@ export const getGuild = async (urlName: string) => { export const getRoleGroups = async (guildId: string) => { const res = await fetch( - `${env.NEXT_PUBLIC_API}/role-group/search?customQuery=@guildId:{${guildId}}`, + `${env.NEXT_PUBLIC_API}/role-group/search?customQuery=@guildId:{${guildId}}&pageSize=${Number.MAX_SAFE_INTEGER}`, { next: { tags: [`role-groups-${guildId}`], diff --git a/src/app/(dashboard)/[guildId]/page.tsx b/src/app/(dashboard)/[guildId]/page.tsx index 097d6417e5..e0640bc9bb 100644 --- a/src/app/(dashboard)/[guildId]/page.tsx +++ b/src/app/(dashboard)/[guildId]/page.tsx @@ -1,22 +1,13 @@ import type { DynamicRoute } from "@/lib/types"; -import { getGuild } from "./fetchers"; +import GuildPage from "./[roleGroupId]/page"; const DefaultGuildPage = async ({ params, }: DynamicRoute<{ guildId: string }>) => { const { guildId: urlName } = await params; - const guild = await getGuild(urlName); - // const paginatedRoleGroup = (await ( - // await fetch( - // `${env.NEXT_PUBLIC_API}/role-group/search?customQuery=@guildId:{${guild.id}}`, - // ) - // ).json()) as PaginatedResponse; - // const roleGroups = paginatedRoleGroup.items; - // const roleGroup = roleGroups.at(0); - // if (roleGroup) { - // redirect(`/${guildIdParam}/${roleGroup.urlName}`); - // } - return `Default guild page - ${guild.name}`; + //const guild = await getGuild(urlName); + //return `Default guild page - ${guild.name}`; + return ; }; export default DefaultGuildPage;