From 532ead4bdf81bea78c0234532f9393cec4b8199a Mon Sep 17 00:00:00 2001 From: dvelo <52332868+DeveloLongScript@users.noreply.github.com> Date: Wed, 29 Jan 2025 21:03:20 -0600 Subject: [PATCH 1/2] feat: migrate accounts from development to production --- src/app/(main)/account/settings/page.tsx | 160 +++++++++++-------- src/app/(main)/layout.tsx | 4 +- src/components/clerk/SignInPopoverButton.tsx | 13 +- src/components/misc/Link.tsx | 7 +- src/components/misc/SwitchEnvPopup.tsx | 58 +++++++ src/components/misc/UnofficalDialog.tsx | 77 --------- src/config/version.tsx | 19 ++- 7 files changed, 181 insertions(+), 157 deletions(-) create mode 100644 src/components/misc/SwitchEnvPopup.tsx delete mode 100644 src/components/misc/UnofficalDialog.tsx diff --git a/src/app/(main)/account/settings/page.tsx b/src/app/(main)/account/settings/page.tsx index 8994353..9d253d2 100644 --- a/src/app/(main)/account/settings/page.tsx +++ b/src/app/(main)/account/settings/page.tsx @@ -39,81 +39,99 @@ import { DialogContent, DialogTrigger } from "@/components/ui/dialog"; import CodeDialog from "@/components/misc/LinkDialog"; export default function Settings() { - const clerk = useClerk(); + const clerk = useClerk(); - const { user, isSignedIn } = useUser(); - const [linked, setLinked] = useState(false); - useEffect(() => { - setLinked(user?.publicMetadata.player != undefined); - }, [user, isSignedIn]); + const { user, isSignedIn } = useUser(); + const [linked, setLinked] = useState(false); + useEffect(() => { + setLinked(user?.publicMetadata.player != undefined); + }, [user, isSignedIn]); - return ( -
- Linking -
-
- Link Account -
-

- Link a Minecraft account to customize a server you own. -
{" "} - {user?.publicMetadata.player != undefined && linked && ( - <>Currently linked to {user?.publicMetadata.player as string} - )} -

+ const forceUnlink = async () => { + if (!linked) await toast.promise(unlinkMCAccount(), { + success: "Unlinked account!", + loading: "Unlinking...", + error: "Error while unlinking account.", + }); + else + await toast.warning("Please use the normal unlink option before using the force unlink one.") + }; - - - {!linked && } - - - { - setLinked(c); - }} - /> - - + return ( +
+ Linking +
+
+ Link Account +
+

+ Link a Minecraft account to customize a server you own. +
{" "} + {user?.publicMetadata.player != undefined && linked && ( + <>Currently linked to {user?.publicMetadata.player as string} + )} +

- {linked && ( - - )} -
-
- Unlink Account -
-

Unlink your Minecraft account if you have already linked one.

+ + + {!linked && } + + + { + setLinked(c); + }} + /> + + - {!linked && ( - - )} + {linked && ( + + )} +
+
+ Unlink Account +
+

Unlink your Minecraft account if you have already linked one.

- {linked && ( - - )} -
- - All of your customizations stay the same, and can be changed if another - account links your Minecraft account. - -
- ); + {!linked && ( + + )} + + {linked && ( + + )} +
+ + All of your customizations stay the same, and can be changed if another + account links your Minecraft account.{" "} +
+ Still linked in-game? Force unlink your account. +
+
+
+ ); } diff --git a/src/app/(main)/layout.tsx b/src/app/(main)/layout.tsx index acbba34..9cfe6a2 100644 --- a/src/app/(main)/layout.tsx +++ b/src/app/(main)/layout.tsx @@ -37,13 +37,13 @@ import { ThemeProvider } from "@/components/ThemeProvider"; import { ClerkThemeProvider } from "@/components/clerk/ClerkThemeProvider"; import NewDomainDialog from "@/components/misc/NewDomainDialog"; import ThemedToaster from "@/components/misc/ThemedToaster"; -import UnofficalDialog from "@/components/misc/UnofficalDialog"; import { TooltipProvider } from "@/components/ui/tooltip"; import type { Metadata, Viewport } from "next"; import { Inter as interFont } from "next/font/google"; import LayoutPart from "@/components/feat/LayoutPart"; import AllBanners from "@/components/feat/AllBanners"; import Footer from "@/components/misc/Footer"; +import { SwitchEnvPopup } from "@/components/misc/SwitchEnvPopup"; export const extraMetadata = { twitter: { @@ -84,7 +84,7 @@ export default async function RootLayout({ - +