Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

♻️ Move admin setup out of space (#1795)

Luke Vella56e0ca0151de
diff --git a/apps/web/src/app/[locale]/(space)/admin-setup/page.tsx b/apps/web/src/app/[locale]/(space)/admin-setup/page.tsx
deleted file mode 100644
index 8630c12f9..000000000
--- a/apps/web/src/app/[locale]/(space)/admin-setup/page.tsx
+++ /dev/null
@@ -1,71 +0,0 @@
-import { PageIcon } from "@/app/components/page-icons";
-import {
- PageContainer,
- PageContent,
- PageHeader,
- PageTitle,
-} from "@/app/components/page-layout";
-import { isInitialAdmin, requireUser } from "@/auth/queries";
-import {
- EmptyState,
- EmptyStateDescription,
- EmptyStateFooter,
- EmptyStateIcon,
- EmptyStateTitle,
-} from "@/components/empty-state";
-import { Trans } from "@/components/trans";
-import { Button } from "@rallly/ui/button";
-import { CrownIcon } from "lucide-react";
-import Link from "next/link";
-import { notFound, redirect } from "next/navigation";
-import { MakeMeAdminButton } from "./make-me-admin-button";
-
-export default async function AdminSetupPage() {
- const user = await requireUser();
-
- if (user.role === "admin") {
- // User is already an admin
- redirect("/control-panel");
- }
-
- if (!isInitialAdmin(user.email)) {
- notFound();
- }
-
- return (
- <PageContainer>
- <PageHeader>
- <PageTitle>
- <PageIcon color="indigo">
- <CrownIcon />
- </PageIcon>
- <Trans i18nKey="adminSetup" defaults="Admin Setup" />
- </PageTitle>
- </PageHeader>
- <PageContent>
- <EmptyState className="h-full">
- <EmptyStateIcon>
- <CrownIcon />
- </EmptyStateIcon>
- <EmptyStateTitle>
- <Trans i18nKey="adminSetupTitle" defaults="Are you the admin?" />
- </EmptyStateTitle>
- <EmptyStateDescription>
- <Trans
- i18nKey="adminSetupDescription"
- defaults="Click the button below to make yourself an admin user."
- />
- </EmptyStateDescription>
- <EmptyStateFooter className="flex gap-2">
- <Button asChild>
- <Link href="/">
- <Trans i18nKey="cancel" defaults="Cancel" />
- </Link>
- </Button>
- <MakeMeAdminButton />
- </EmptyStateFooter>
- </EmptyState>
- </PageContent>
- </PageContainer>
- );
-}
diff --git a/apps/web/src/app/[locale]/(space)/admin-setup/actions.ts b/apps/web/src/app/[locale]/admin-setup/actions.ts
similarity index 100%
rename from apps/web/src/app/[locale]/(space)/admin-setup/actions.ts
rename to apps/web/src/app/[locale]/admin-setup/actions.ts
diff --git a/apps/web/src/app/[locale]/(space)/admin-setup/make-me-admin-button.tsx b/apps/web/src/app/[locale]/admin-setup/make-me-admin-button.tsx
similarity index 100%
rename from apps/web/src/app/[locale]/(space)/admin-setup/make-me-admin-button.tsx
rename to apps/web/src/app/[locale]/admin-setup/make-me-admin-button.tsx
diff --git a/apps/web/src/app/[locale]/admin-setup/page.tsx b/apps/web/src/app/[locale]/admin-setup/page.tsx
new file mode 100644
index 000000000..ff49ff13f
--- /dev/null
+++ b/apps/web/src/app/[locale]/admin-setup/page.tsx
@@ -0,0 +1,54 @@
+import { isInitialAdmin, requireUser } from "@/auth/queries";
+import {
+ EmptyState,
+ EmptyStateDescription,
+ EmptyStateFooter,
+ EmptyStateIcon,
+ EmptyStateTitle,
+} from "@/components/empty-state";
+import { Trans } from "@/components/trans";
+import { Button } from "@rallly/ui/button";
+import { CrownIcon } from "lucide-react";
+import Link from "next/link";
+import { notFound, redirect } from "next/navigation";
+import { MakeMeAdminButton } from "./make-me-admin-button";
+
+export default async function AdminSetupPage() {
+ const user = await requireUser();
+
+ if (user.role === "admin") {
+ // User is already an admin
+ redirect("/control-panel");
+ }
+
+ if (!isInitialAdmin(user.email)) {
+ notFound();
+ }
+
+ return (
+ <div className="flex h-dvh items-center justify-center">
+ <EmptyState className="h-full">
+ <EmptyStateIcon>
+ <CrownIcon />
+ </EmptyStateIcon>
+ <EmptyStateTitle>
+ <Trans i18nKey="adminSetupTitle" defaults="Are you the admin?" />
+ </EmptyStateTitle>
+ <EmptyStateDescription>
+ <Trans
+ i18nKey="adminSetupDescription"
+ defaults="Click the button below to make yourself an admin user."
+ />
+ </EmptyStateDescription>
+ <EmptyStateFooter className="flex gap-2">
+ <Button asChild>
+ <Link href="/">
+ <Trans i18nKey="cancel" defaults="Cancel" />
+ </Link>
+ </Button>
+ <MakeMeAdminButton />
+ </EmptyStateFooter>
+ </EmptyState>
+ </div>
+ );
+}