-
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a903b21
commit 7f4020d
Showing
10 changed files
with
824 additions
and
771 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,4 +83,4 @@ | |
"typescript": "^5.4.5" | ||
}, | ||
"prettier": "@mc/prettier-config" | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,56 @@ | ||
"use client"; | ||
|
||
import { MenuButton } from "./Menu"; | ||
import { useEffect } from "react"; | ||
import { useParams, useRouter } from "next/navigation"; | ||
import { Trans } from "react-i18next"; | ||
|
||
import { LinkUnderlined } from "@mc/ui/LinkUnderlined"; | ||
|
||
import { Routes } from "~/other/routes"; | ||
import { api } from "~/trpc/react"; | ||
import { TypographyH3 } from "@mc/ui/TypographyH3"; | ||
import { TypographyH4 } from "@mc/ui/TypographyH4"; | ||
|
||
export default function Page() { | ||
const router = useRouter(); | ||
const selected = useParams(); | ||
const userGuildsQuery = api.discord.userGuilds.useQuery(); | ||
|
||
const hasAnythingSelected = Object.keys(selected).length > 0; | ||
|
||
// Autoselect the first guild if no guild is selected yet. | ||
useEffect(() => { | ||
console.log(userGuildsQuery.data); | ||
|
||
if (!userGuildsQuery.data) return; | ||
if (!userGuildsQuery.data.userGuilds.size) return; | ||
if (hasAnythingSelected) return; | ||
|
||
const firstGuildId = [...userGuildsQuery.data.userGuilds.keys()][0]; | ||
|
||
router.replace(Routes.DashboardServers(firstGuildId)); | ||
}, [hasAnythingSelected, router, userGuildsQuery.data]); | ||
|
||
return ( | ||
<div className="flex flex-col p-1"> | ||
<MenuButton /> | ||
{"// TODO auto select first guild"} | ||
<div className="flex flex-col p-1 grow justify-center items-center h-full "> | ||
{!userGuildsQuery.isLoading && !userGuildsQuery.data?.userGuilds.size && ( | ||
<> | ||
<TypographyH3> | ||
<Trans i18nKey="pages.dashboard.noServers.heading" /> | ||
</TypographyH3> | ||
<TypographyH4> | ||
<Trans | ||
i18nKey="pages.dashboard.noServers.subheading" | ||
components={{ | ||
CreateServerLink: ( | ||
<LinkUnderlined href={Routes.CreateDiscordServer} /> | ||
), | ||
JoinSupportServerLink: <LinkUnderlined href={Routes.Support} />, | ||
}} | ||
/> | ||
</TypographyH4> | ||
</ > | ||
)} | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters