Skip to content

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

💄 Reorganize navigation and update page styles (#1958)

Luke Vellaabd890bdefcd
diff --git a/apps/web/next.config.js b/apps/web/next.config.js
index 52a4eea49..e1f36b8a6 100644
--- a/apps/web/next.config.js
+++ b/apps/web/next.config.js
@@ -56,21 +56,6 @@ const nextConfig = {
destination: "/api/notifications/unsubscribe",
permanent: true,
},
- {
- source: "/settings/profile",
- destination: "/account/profile",
- permanent: true,
- },
- {
- source: "/settings/preferences",
- destination: "/account/preferences",
- permanent: true,
- },
- {
- source: "/account/billing",
- destination: "/settings/billing",
- permanent: false,
- },
];
},
devIndicators: {
diff --git a/apps/web/public/locales/en/app.json b/apps/web/public/locales/en/app.json
index d4a521ad4..0c229561b 100644
--- a/apps/web/public/locales/en/app.json
+++ b/apps/web/public/locales/en/app.json
@@ -412,8 +412,6 @@
"spaceUpdatedSuccess": "Space updated successfully",
"spaceUpdatedError": "Failed to update space",
"generalSettings": "General Settings",
- "spaceInformation": "Space Information",
- "spaceInformationDescription": "Update your space name and basic settings.",
"general": "General",
"generalSettingsDescription": "Manage your space settings, including name, description, and other general preferences.",
"membersDescription": "Members have access to your space",
@@ -476,7 +474,6 @@
"prioritySupportDescription": "Get faster response times and dedicated assistance",
"cancelEventConfirmDescription": "Are you sure you want to cancel this event?",
"confirmSpaceName": "Please type the space name to confirm:",
- "mySpaces": "My Spaces",
"spacesDescription": "Manage the spaces you belong to",
"noSpaces": "No spaces found",
"noSpacesDescription": "You are not a member of any spaces yet",
@@ -495,5 +492,11 @@
"noSeatsAvailableAlertSelfHostedDescription": "You will need to <a>upgrade</a> to increase the number of seats in this space.",
"seatsUpdatedAlertTitle": "Seats Updated",
"seatsUpdatedAlertDescription": "Your seat allocation has been successfully updated. The changes will be reflected in your next billing cycle.",
- "memberCount": "{count, plural, =0 {No members} one {1 member} other {# members}}"
+ "memberCount": "{count, plural, =0 {No members} one {1 member} other {# members}}",
+ "billingDescription": "Manage your billing information and subscription.",
+ "generalDescription": "Change the settings of your current space",
+ "space": "Space",
+ "preferencesDescription": "Manage your preferences",
+ "spaceSettings": "Space Settings",
+ "generalSettingsAdminRoleRequired": "You need to be an admin to make changes to this space."
}
diff --git a/apps/web/src/app/[locale]/(optional-space)/new/page.tsx b/apps/web/src/app/[locale]/(optional-space)/new/page.tsx
index d3614530a..2c2ecf173 100644
--- a/apps/web/src/app/[locale]/(optional-space)/new/page.tsx
+++ b/apps/web/src/app/[locale]/(optional-space)/new/page.tsx
@@ -18,7 +18,7 @@ export default async function Page() {
]);
return (
- <div>
+ <div className="absolute inset-0 h-dvh overflow-auto bg-gray-100">
<div className="sticky top-0 z-20 border-b bg-gray-100/90 p-3 backdrop-blur-md sm:grid-cols-3">
<div className="mx-auto flex items-center justify-between gap-x-2">
<div className="flex items-center gap-x-4 sm:flex-1">
diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/components/nav-user.tsx b/apps/web/src/app/[locale]/(space)/(dashboard)/components/nav-user.tsx
index 627814ff6..43d742862 100644
--- a/apps/web/src/app/[locale]/(space)/(dashboard)/components/nav-user.tsx
+++ b/apps/web/src/app/[locale]/(space)/(dashboard)/components/nav-user.tsx
@@ -12,7 +12,6 @@ import {
import { Icon } from "@rallly/ui/icon";
import {
ChevronDownIcon,
- LayersIcon,
LogOutIcon,
Settings2Icon,
UserIcon,
@@ -62,7 +61,7 @@ export function NavUser({
<Trans i18nKey="account" defaults="Account" />
</DropdownMenuLabel>
<DropdownMenuItem asChild>
- <Link href="/account/profile">
+ <Link href="/settings/profile">
<Icon>
<UserIcon />
</Icon>
@@ -70,21 +69,13 @@ export function NavUser({
</Link>
</DropdownMenuItem>
<DropdownMenuItem asChild>
- <Link href="/account/preferences">
+ <Link href="/settings/preferences">
<Icon>
<Settings2Icon />
</Icon>
<Trans i18nKey="preferences" defaults="Preferences" />
</Link>
</DropdownMenuItem>
- <DropdownMenuItem asChild>
- <Link href="/account/spaces">
- <Icon>
- <LayersIcon />
- </Icon>
- <Trans i18nKey="spaces" defaults="Spaces" />
- </Link>
- </DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem
onClick={() => {
diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/events/page.tsx b/apps/web/src/app/[locale]/(space)/(dashboard)/events/page.tsx
index 329ba5f94..882969cf3 100644
--- a/apps/web/src/app/[locale]/(space)/(dashboard)/events/page.tsx
+++ b/apps/web/src/app/[locale]/(space)/(dashboard)/events/page.tsx
@@ -128,7 +128,7 @@ export default async function Page(props: {
</PageHeader>
<PageContent>
<EventsTabbedView>
- <div className="mb-6 flex gap-x-2">
+ <div className="mb-4 flex gap-x-2">
<SearchInput
placeholder={t("searchEventsPlaceholder", {
defaultValue: "Search events by title...",
diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/layout.tsx b/apps/web/src/app/[locale]/(space)/(dashboard)/layout.tsx
index 70bd6b684..71854f2ee 100644
--- a/apps/web/src/app/[locale]/(space)/(dashboard)/layout.tsx
+++ b/apps/web/src/app/[locale]/(space)/(dashboard)/layout.tsx
@@ -1,3 +1,4 @@
+import { Icon } from "@rallly/ui/icon";
import {
Sidebar,
SidebarContent,
@@ -7,14 +8,19 @@ import {
SidebarHeader,
SidebarInset,
SidebarMenu,
+ SidebarMenuButton,
+ SidebarMenuItem,
SidebarSeparator,
} from "@rallly/ui/sidebar";
+import { Settings2Icon } from "lucide-react";
import type { Metadata } from "next";
+import Link from "next/link";
import { FeedbackMenuItem } from "@/app/[locale]/(space)/(dashboard)/components/feedback-menu-item";
import { NavUser } from "@/app/[locale]/(space)/(dashboard)/components/nav-user";
import { SpaceSidebarMenu } from "@/app/[locale]/(space)/(dashboard)/components/space-sidebar-menu";
import { UpgradeMenuItem } from "@/app/[locale]/(space)/(dashboard)/components/upgrade-menu-item";
import { requireSpace, requireUser } from "@/auth/data";
+import { Trans } from "@/components/trans";
import { LicenseLimitWarning } from "@/features/licensing/components/license-limit-warning";
import { CommandMenu } from "@/features/navigation/command-menu";
import { SpaceDropdown } from "@/features/space/components/space-dropdown";
@@ -36,7 +42,7 @@ export default async function Layout({
return (
<SpaceSidebarProvider>
<CommandMenu />
- <Sidebar variant="inset">
+ <Sidebar>
<SidebarHeader>
<SpaceDropdown spaces={spaces} initialSpaceId={activeSpace.id} />
</SidebarHeader>
@@ -51,6 +57,16 @@ export default async function Layout({
<IfFeatureEnabled feature="feedback">
<FeedbackMenuItem />
</IfFeatureEnabled>
+ <SidebarMenuItem>
+ <SidebarMenuButton asChild>
+ <Link href="/settings/preferences">
+ <Icon>
+ <Settings2Icon />
+ </Icon>
+ <Trans i18nKey="preferences" defaults="Preferences" />
+ </Link>
+ </SidebarMenuButton>
+ </SidebarMenuItem>
</SidebarMenu>
</SidebarGroupContent>
</SidebarGroup>
diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/polls/page.tsx b/apps/web/src/app/[locale]/(space)/(dashboard)/polls/page.tsx
index 3d0b42eb1..86159635e 100644
--- a/apps/web/src/app/[locale]/(space)/(dashboard)/polls/page.tsx
+++ b/apps/web/src/app/[locale]/(space)/(dashboard)/polls/page.tsx
@@ -1,7 +1,8 @@
import type { PollStatus } from "@rallly/database";
import { Button } from "@rallly/ui/button";
+import { Icon } from "@rallly/ui/icon";
import { dehydrate, HydrationBoundary } from "@tanstack/react-query";
-import { InboxIcon } from "lucide-react";
+import { InboxIcon, PlusIcon } from "lucide-react";
import type { Metadata } from "next";
import Link from "next/link";
import { PollsTabbedView } from "@/app/[locale]/(space)/(dashboard)/polls/polls-tabbed-view";
@@ -116,7 +117,10 @@ export default async function Page(props: {
<PageHeaderActions>
<Button variant="primary" asChild>
<Link href="/new">
- <Trans i18nKey="create" defaults="Create" />
+ <Icon>
+ <PlusIcon />
+ </Icon>
+ <Trans i18nKey="newPoll" defaults="New Poll" />
</Link>
</Button>
</PageHeaderActions>
diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/settings/components/settings-tabs.tsx b/apps/web/src/app/[locale]/(space)/(dashboard)/settings/components/settings-tabs.tsx
deleted file mode 100644
index afcb8ba76..000000000
--- a/apps/web/src/app/[locale]/(space)/(dashboard)/settings/components/settings-tabs.tsx
+++ /dev/null
@@ -1,38 +0,0 @@
-"use client";
-
-import { Tabs, TabsContent, TabsList, TabsTrigger } from "@rallly/ui/page-tabs";
-import Link from "next/link";
-import { useSelectedLayoutSegments } from "next/navigation";
-import { Trans } from "@/components/trans";
-import { IfFeatureEnabled } from "@/lib/feature-flags/client";
-
-export function SettingsTabs({ children }: { children: React.ReactNode }) {
- const segments = useSelectedLayoutSegments();
- const value = segments[0] || "general";
- return (
- <Tabs value={value} className="w-full">
- <TabsList>
- <TabsTrigger value="general" asChild>
- <Link href="/settings/general">
- <Trans i18nKey="general" defaults="General" />
- </Link>
- </TabsTrigger>
- <TabsTrigger value="members" asChild>
- <Link href="/settings/members">
- <Trans i18nKey="members" defaults="Members" />
- </Link>
- </TabsTrigger>
- <IfFeatureEnabled feature="billing">
- <TabsTrigger value="billing" asChild>
- <Link href="/settings/billing">
- <Trans i18nKey="billing" defaults="Billing" />
- </Link>
- </TabsTrigger>
- </IfFeatureEnabled>
- </TabsList>
- <TabsContent tabIndex={-1} value={value}>
- {children}
- </TabsContent>
- </Tabs>
- );
-}
diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/settings/general/components/leave-space-button.tsx b/apps/web/src/app/[locale]/(space)/(dashboard)/settings/general/components/leave-space-button.tsx
deleted file mode 100644
index b3b58d9c8..000000000
--- a/apps/web/src/app/[locale]/(space)/(dashboard)/settings/general/components/leave-space-button.tsx
+++ /dev/null
@@ -1,164 +0,0 @@
-"use client";
-
-import { Button } from "@rallly/ui/button";
-import type { DialogProps } from "@rallly/ui/dialog";
-import {
- Dialog,
- DialogClose,
- DialogContent,
- DialogDescription,
- DialogFooter,
- DialogHeader,
- DialogTitle,
- DialogTrigger,
-} from "@rallly/ui/dialog";
-import {
- Form,
- FormControl,
- FormField,
- FormItem,
- FormLabel,
- FormMessage,
-} from "@rallly/ui/form";
-import { Icon } from "@rallly/ui/icon";
-import { Input } from "@rallly/ui/input";
-import { toast } from "@rallly/ui/sonner";
-import { LogOutIcon } from "lucide-react";
-import { useRouter } from "next/navigation";
-import { useForm } from "react-hook-form";
-import { Trans } from "@/components/trans";
-import { leaveSpaceAction } from "@/features/space/actions";
-import { useTranslation } from "@/i18n/client";
-import { useSafeAction } from "@/lib/safe-action/client";
-
-interface LeaveSpaceDialogProps extends DialogProps {
- spaceName: string;
- spaceId: string;
-}
-
-function LeaveSpaceDialog({
- spaceName,
- spaceId,
- children,
- ...rest
-}: LeaveSpaceDialogProps) {
- const form = useForm<{ spaceName: string }>({
- defaultValues: {
- spaceName: "",
- },
- });
-
- const leaveSpace = useSafeAction(leaveSpaceAction, {
- onSuccess: () => {
- toast.success(
- t("leftSpaceSuccess", {
- defaultValue: "You have left the space",
- }),
- );
- router.push("/");
- },
- });
-
- const router = useRouter();
- const { t } = useTranslation();
-
- return (
- <Form {...form}>
- <Dialog {...rest}>
- {children}
- <form
- onSubmit={form.handleSubmit(() => {
- leaveSpace.execute();
- })}
- >
- <DialogContent>
- <DialogHeader>
- <DialogTitle>
- <Trans i18nKey="leaveSpaceDialogTitle" defaults="Leave Space" />
- </DialogTitle>
- <DialogDescription>
- <Trans
- i18nKey="leaveSpaceDialogDescription"
- defaults="Are you sure you want to leave this space?"
- />
- </DialogDescription>
- </DialogHeader>
- <div className="space-y-4">
- <FormField
- control={form.control}
- name="spaceName"
- rules={{
- validate: (value) => {
- if (value !== spaceName) {
- return t("spaceNameMismatch", {
- defaultValue: "Space name does not match",
- });
- }
- return true;
- },
- }}
- render={({ field }) => (
- <FormItem>
- <FormLabel>
- <Trans
- i18nKey="leaveSpaceInstruction"
- defaults="Please type the space name to confirm:"
- />
- </FormLabel>
- <FormControl>
- <Input
- autoComplete="off"
- data-1p-ignore
- error={!!form.formState.errors.spaceName}
- placeholder={spaceName}
- {...field}
- />
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
- </div>
- <DialogFooter>
- <DialogClose asChild>
- <Button>
- <Trans i18nKey="cancel" defaults="Cancel" />
- </Button>
- </DialogClose>
- <Button
- type="submit"
- loading={leaveSpace.isExecuting}
- variant="destructive"
- >
- <Trans i18nKey="leaveSpace" defaults="Leave Space" />
- </Button>
- </DialogFooter>
- </DialogContent>
- </form>
- </Dialog>
- </Form>
- );
-}
-
-interface LeaveSpaceButtonProps {
- spaceName: string;
- spaceId: string;
-}
-
-export function LeaveSpaceButton({
- spaceName,
- spaceId,
-}: LeaveSpaceButtonProps) {
- return (
- <LeaveSpaceDialog spaceName={spaceName} spaceId={spaceId}>
- <DialogTrigger asChild>
- <Button>
- <Icon>
- <LogOutIcon />
- </Icon>
- <Trans i18nKey="leaveSpace" defaults="Leave Space" />
- </Button>
- </DialogTrigger>
- </LeaveSpaceDialog>
- );
-}
diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/settings/general/page.tsx b/apps/web/src/app/[locale]/(space)/(dashboard)/settings/general/page.tsx
deleted file mode 100644
index b6526bde7..000000000
--- a/apps/web/src/app/[locale]/(space)/(dashboard)/settings/general/page.tsx
+++ /dev/null
@@ -1,95 +0,0 @@
-import { subject } from "@casl/ability";
-import type { Metadata } from "next";
-import {
- PageSection,
- PageSectionContent,
- PageSectionDescription,
- PageSectionGroup,
- PageSectionHeader,
- PageSectionTitle,
-} from "@/app/components/page-layout";
-import { requireSpace, requireUser } from "@/auth/data";
-import { Trans } from "@/components/trans";
-import { defineAbilityForMember } from "@/features/space/member/ability";
-import { getTranslation } from "@/i18n/server";
-import { DeleteSpaceButton } from "./components/delete-space-button";
-import { LeaveSpaceButton } from "./components/leave-space-button";
-import { SpaceSettingsForm } from "./components/space-settings-form";
-
-export default async function GeneralSettingsPage() {
- const [space, user] = await Promise.all([requireSpace(), requireUser()]);
- const ability = defineAbilityForMember({ space, user });
- const isAdmin = space.role === "admin";
- const canDeleteSpace = ability.can("delete", subject("Space", { ...space }));
-
- const isOwner = space.ownerId === user.id;
- return (
- <PageSectionGroup>
- <PageSection>
- <PageSectionHeader>
- <PageSectionTitle>
- <Trans i18nKey="spaceInformation" defaults="Space Information" />
- </PageSectionTitle>
- <PageSectionDescription>
- <Trans
- i18nKey="spaceInformationDescription"
- defaults="Update your space name and basic settings."
- />
- </PageSectionDescription>
- </PageSectionHeader>
- <PageSectionContent>
- <SpaceSettingsForm space={space} disabled={!isAdmin} />
- </PageSectionContent>
- </PageSection>
- {!isOwner ? (
- <PageSection>
- <PageSectionHeader>
- <PageSectionTitle>
- <Trans i18nKey="leaveSpace" defaults="Leave Space" />
- </PageSectionTitle>
- <PageSectionDescription>
- <Trans
- i18nKey="leaveSpaceDescription"
- defaults="Remove yourself from this space. You'll lose access to all polls in this space."
- />
- </PageSectionDescription>
- </PageSectionHeader>
- <PageSectionContent>
- <LeaveSpaceButton spaceName={space.name} spaceId={space.id} />
- </PageSectionContent>
- </PageSection>
- ) : null}
- {canDeleteSpace ? (
- <PageSection>
- <PageSectionHeader>
- <PageSectionTitle>
- <Trans i18nKey="deleteSpace" defaults="Delete Space" />
- </PageSectionTitle>
- <PageSectionDescription>
- <Trans
- i18nKey="deleteSpaceDescription"
- defaults="Permanently delete this space and all its content. This action cannot be undone."
- />
- </PageSectionDescription>
- </PageSectionHeader>
- <PageSectionContent>
- <DeleteSpaceButton spaceName={space.name} spaceId={space.id} />
- </PageSectionContent>
- </PageSection>
- ) : null}
- </PageSectionGroup>
- );
-}
-
-export async function generateMetadata(): Promise<Metadata> {
- const { t } = await getTranslation();
- return {
- title: t("generalSettings", {
- defaultValue: "General Settings",
- }),
- description: t("generalSettingsDescription", {
- defaultValue:
- "Manage your space settings, including name, description, and other general preferences.",
- }),
- };
-}
diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/settings/layout.tsx b/apps/web/src/app/[locale]/(space)/(dashboard)/settings/layout.tsx
deleted file mode 100644
index 823ca2934..000000000
--- a/apps/web/src/app/[locale]/(space)/(dashboard)/settings/layout.tsx
+++ /dev/null
@@ -1,27 +0,0 @@
-import {
- PageContainer,
- PageContent,
- PageHeader,
- PageTitle,
-} from "@/app/components/page-layout";
-import { Trans } from "@/components/trans";
-import { SettingsTabs } from "./components/settings-tabs";
-
-export default function SettingsLayout({
- children,
-}: {
- children: React.ReactNode;
-}) {
- return (
- <PageContainer>
- <PageHeader>
- <PageTitle>
- <Trans i18nKey="settings" defaults="Settings" />
- </PageTitle>
- </PageHeader>
- <PageContent>
- <SettingsTabs>{children}</SettingsTabs>
- </PageContent>
- </PageContainer>
- );
-}
diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/settings/loading.tsx b/apps/web/src/app/[locale]/(space)/(dashboard)/settings/loading.tsx
deleted file mode 100644
index 8516dc873..000000000
--- a/apps/web/src/app/[locale]/(space)/(dashboard)/settings/loading.tsx
+++ /dev/null
@@ -1,5 +0,0 @@
-import { Spinner } from "@/components/spinner";
-
-export default function Loading() {
- return <Spinner />;
-}
diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/settings/members/page.tsx b/apps/web/src/app/[locale]/(space)/(dashboard)/settings/members/page.tsx
deleted file mode 100644
index f77451a5b..000000000
--- a/apps/web/src/app/[locale]/(space)/(dashboard)/settings/members/page.tsx
+++ /dev/null
@@ -1,195 +0,0 @@
-import { Alert, AlertDescription } from "@rallly/ui/alert";
-import { Badge } from "@rallly/ui/badge";
-import { InfoIcon } from "lucide-react";
-import type { Metadata } from "next";
-import Link from "next/link";
-import {
- PageSection,
- PageSectionContent,
- PageSectionDescription,
- PageSectionGroup,
- PageSectionHeader,
- PageSectionTitle,
-} from "@/app/components/page-layout";
-import { requireSpace } from "@/auth/data";
-import { OptimizedAvatarImage } from "@/components/optimized-avatar-image";
-import { StackedList, StackedListItem } from "@/components/stacked-list";
-import { Trans } from "@/components/trans";
-import { IfCloudHosted, IfSelfHosted } from "@/contexts/environment";
-import { SpaceRole } from "@/features/space/components/space-role";
-import { loadInvites, loadMembers } from "@/features/space/data";
-import { getTotalSeatsForSpace } from "@/features/space/utils";
-import { getTranslation } from "@/i18n/server";
-import { InviteDropdownMenu } from "./components/invite-dropdown-menu";
-import { InviteMemberButton } from "./components/invite-member-button";
-import { MemberDropdownMenu } from "./components/member-dropdown-menu";
-
-export default async function MembersSettingsPage() {
- const space = await requireSpace();
- const [members, invites, totalSeats] = await Promise.all([
- loadMembers(),
- loadInvites(),
- getTotalSeatsForSpace(space.id),
- ]);
-
- const usedSeats = members.total;
-
- return (
- <PageSectionGroup>
- <PageSection>
- <PageSectionHeader>
- <PageSectionTitle>
- <Trans i18nKey="members" />
- </PageSectionTitle>
- <PageSectionDescription>
- <Trans
- i18nKey="membersDescription"
- defaults="Members have access to your space"
- />
- </PageSectionDescription>
- </PageSectionHeader>
- <PageSectionContent>
- <StackedList>
- {members.data.map((member) => (
- <StackedListItem key={member.id}>
- <div className="flex flex-1 items-center gap-4">
- <OptimizedAvatarImage
- src={member.image ?? undefined}
- name={member.name}
- size="lg"
- />
- <div>
- <div className="flex items-center gap-x-2">
- <div className="font-semibold text-sm">{member.name}</div>
- <div>
- {member.isOwner ? (
- <Badge>
- <Trans i18nKey="owner" defaults="Owner" />
- </Badge>
- ) : null}
- </div>
- </div>
- <div className="text-muted-foreground text-sm">
- {member.email}
- </div>
- </div>
- </div>
- <div className="text-sm">
- <SpaceRole role={member.role} />
- </div>
- <MemberDropdownMenu member={member} />
- </StackedListItem>
- ))}
- </StackedList>
- </PageSectionContent>
- </PageSection>
- <PageSection>
- <PageSectionHeader>
- <PageSectionTitle>
- <Trans i18nKey="pendingInvites" defaults="Pending Invites" />
- </PageSectionTitle>
- <PageSectionDescription>
- <Trans
- i18nKey="pendingInvitesDescription"
- defaults="Invite other users to share your space."
- />
- </PageSectionDescription>
- </PageSectionHeader>
- <PageSectionContent>
- {invites.length > 0 ? (
- <StackedList>
- {invites.map((invite) => (
- <StackedListItem key={invite.id}>
- <div className="flex flex-1 items-center gap-4">
- <OptimizedAvatarImage name={invite.email} size="md" />
- <div>
- <div className="flex items-center gap-x-2">
- <div className="font-semibold text-sm">
- {invite.email}
- </div>
- </div>
- <div className="text-muted-foreground text-sm">
- <Trans
- i18nKey="memberInvitedBy"
- defaults="Invited by {inviterName}"
- values={{ inviterName: invite.invitedBy.name }}
- />
- </div>
- </div>
- </div>
- <div className="text-sm">
- <SpaceRole role={invite.role} />
- </div>
- <InviteDropdownMenu invite={invite} />
- </StackedListItem>
- ))}
- </StackedList>
- ) : null}
- <div className="flex items-center gap-4">
- <InviteMemberButton usedSeats={usedSeats} totalSeats={totalSeats} />
- <p className="font-medium text-sm">
- <Trans
- i18nKey="seatUsage"
- defaults="{usedSeats} of {totalSeats} seats used"
- values={{ usedSeats, totalSeats }}
- />
- </p>
- </div>
- {totalSeats - usedSeats <= 0 ? (
- <Alert variant="info">
- <InfoIcon />
- <AlertDescription>
- <IfCloudHosted>
- <p>
- <Trans
- i18nKey="noSeatsAvailableAlertBillingDescription"
- defaults="Increase the number of seats in this space from the <a>billing page</a>."
- components={{
- a: (
- <Link
- className="underline"
- href="/settings/billing"
- />
- ),
- }}
- />
- </p>
- </IfCloudHosted>
- <IfSelfHosted>
- <p>
- <Trans
- i18nKey="noSeatsAvailableAlertSelfHostedDescription"
- defaults="You will need to <a>upgrade</a> to increase the number of seats in this space."
- components={{
- a: (
- <Link
- className="underline"
- prefetch={false}
- href="https://support.rallly.co/self-hosting/licensing"
- />
- ),
- }}
- />
- </p>
- </IfSelfHosted>
- </AlertDescription>
- </Alert>
- ) : null}
- </PageSectionContent>
- </PageSection>
- </PageSectionGroup>
- );
-}
-
-export async function generateMetadata(): Promise<Metadata> {
- const { t } = await getTranslation();
- return {
- title: t("members", {
- defaultValue: "Members",
- }),
- description: t("membersSettingsDescription", {
- defaultValue:
- "Manage space members, invite new users, and control access permissions.",
- }),
- };
-}
diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/settings/page.tsx b/apps/web/src/app/[locale]/(space)/(dashboard)/settings/page.tsx
deleted file mode 100644
index a90952cee..000000000
--- a/apps/web/src/app/[locale]/(space)/(dashboard)/settings/page.tsx
+++ /dev/null
@@ -1,5 +0,0 @@
-import { redirect } from "next/navigation";
-
-export default function Page() {
- redirect("/settings/general");
-}
diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/settings/billing/components/billing-plan.tsx b/apps/web/src/app/[locale]/(space)/settings/billing/components/billing-plan.tsx
similarity index 100%
rename from apps/web/src/app/[locale]/(space)/(dashboard)/settings/billing/components/billing-plan.tsx
rename to apps/web/src/app/[locale]/(space)/settings/billing/components/billing-plan.tsx
diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/settings/billing/components/manage-seats-dialog.tsx b/apps/web/src/app/[locale]/(space)/settings/billing/components/manage-seats-dialog.tsx
similarity index 100%
rename from apps/web/src/app/[locale]/(space)/(dashboard)/settings/billing/components/manage-seats-dialog.tsx
rename to apps/web/src/app/[locale]/(space)/settings/billing/components/manage-seats-dialog.tsx
diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/settings/billing/page-client.tsx b/apps/web/src/app/[locale]/(space)/settings/billing/page-client.tsx
similarity index 96%
rename from apps/web/src/app/[locale]/(space)/(dashboard)/settings/billing/page-client.tsx
rename to apps/web/src/app/[locale]/(space)/settings/billing/page-client.tsx
index c9711b126..aa36778ac 100644
--- a/apps/web/src/app/[locale]/(space)/(dashboard)/settings/billing/page-client.tsx
+++ b/apps/web/src/app/[locale]/(space)/settings/billing/page-client.tsx
@@ -14,12 +14,11 @@ import {
} from "lucide-react";
import { useSearchParams } from "next/navigation";
import { Trans } from "react-i18next";
-import { BillingPlan } from "@/app/[locale]/(space)/(dashboard)/settings/billing/components/billing-plan";
-import { ManageSeatsDialog } from "@/app/[locale]/(space)/(dashboard)/settings/billing/components/manage-seats-dialog";
import {
PageSection,
PageSectionContent,
PageSectionDescription,
+ PageSectionDivider,
PageSectionGroup,
PageSectionHeader,
PageSectionTitle,
@@ -27,6 +26,8 @@ import {
import { PayWallButton } from "@/features/billing/client";
import { SubscriptionStatusLabel } from "@/features/billing/components/subscription-status-label";
import type { SpaceTier } from "@/features/space/schema";
+import { BillingPlan } from "./components/billing-plan";
+import { ManageSeatsDialog } from "./components/manage-seats-dialog";
export function BillingPageClient({
tier,
@@ -150,6 +151,7 @@ export function BillingPageClient({
) : null}
</PageSectionContent>
</PageSection>
+ <PageSectionDivider />
<PageSection>
<PageSectionHeader>
<PageSectionTitle>
diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/settings/billing/page.tsx b/apps/web/src/app/[locale]/(space)/settings/billing/page.tsx
similarity index 69%
rename from apps/web/src/app/[locale]/(space)/(dashboard)/settings/billing/page.tsx
rename to apps/web/src/app/[locale]/(space)/settings/billing/page.tsx
index eb1596f1f..4adb1eb14 100644
--- a/apps/web/src/app/[locale]/(space)/(dashboard)/settings/billing/page.tsx
+++ b/apps/web/src/app/[locale]/(space)/settings/billing/page.tsx
@@ -1,7 +1,13 @@
import { ShieldXIcon } from "lucide-react";
import type { Metadata } from "next";
import { notFound } from "next/navigation";
-import { BillingPageClient } from "@/app/[locale]/(space)/(dashboard)/settings/billing/page-client";
+import {
+ SettingsPage,
+ SettingsPageContent,
+ SettingsPageDescription,
+ SettingsPageHeader,
+ SettingsPageTitle,
+} from "@/app/components/settings-layout";
import { requireSpace, requireUser } from "@/auth/data";
import {
EmptyState,
@@ -16,6 +22,7 @@ import { defineAbilityForMember } from "@/features/space/member/ability";
import { getTotalSeatsForSpace } from "@/features/space/utils";
import { getTranslation } from "@/i18n/server";
import { isFeatureEnabled } from "@/lib/feature-flags/server";
+import { BillingPageClient } from "./page-client";
export default async function BillingSettingsPage() {
if (!isFeatureEnabled("billing")) {
@@ -28,7 +35,7 @@ export default async function BillingSettingsPage() {
if (!canManageBilling) {
return (
- <EmptyState>
+ <EmptyState className="h-full">
<EmptyStateIcon>
<ShieldXIcon />
</EmptyStateIcon>
@@ -54,12 +61,27 @@ export default async function BillingSettingsPage() {
const usedSeats = members.total;
return (
- <BillingPageClient
- tier={space.tier}
- subscription={subscription ?? undefined}
- totalSeats={totalSeats}
- usedSeats={usedSeats}
- />
+ <SettingsPage>
+ <SettingsPageHeader>
+ <SettingsPageTitle>
+ <Trans i18nKey="billing" defaults="Billing" />
+ </SettingsPageTitle>
+ <SettingsPageDescription>
+ <Trans
+ i18nKey="billingDescription"
+ defaults="Manage your billing information and subscription."
+ />
+ </SettingsPageDescription>
+ </SettingsPageHeader>
+ <SettingsPageContent>
+ <BillingPageClient
+ tier={space.tier}
+ subscription={subscription ?? undefined}
+ totalSeats={totalSeats}
+ usedSeats={usedSeats}
+ />
+ </SettingsPageContent>
+ </SettingsPage>
);
}
diff --git a/apps/web/src/app/[locale]/account/components/settings-layout.tsx b/apps/web/src/app/[locale]/(space)/settings/components/settings-layout.tsx
similarity index 100%
rename from apps/web/src/app/[locale]/account/components/settings-layout.tsx
rename to apps/web/src/app/[locale]/(space)/settings/components/settings-layout.tsx
diff --git a/apps/web/src/app/[locale]/account/components/sidebar.tsx b/apps/web/src/app/[locale]/(space)/settings/components/sidebar.tsx
similarity index 51%
rename from apps/web/src/app/[locale]/account/components/sidebar.tsx
rename to apps/web/src/app/[locale]/(space)/settings/components/sidebar.tsx
index 16d06f65b..e1b79d374 100644
--- a/apps/web/src/app/[locale]/account/components/sidebar.tsx
+++ b/apps/web/src/app/[locale]/(space)/settings/components/sidebar.tsx
@@ -7,10 +7,12 @@ import {
SidebarMenuItem,
} from "@rallly/ui/sidebar";
import {
+ BoltIcon,
CreditCardIcon,
- LayersIcon,
+ PanelsTopLeftIcon,
Settings2Icon,
UserIcon,
+ UsersIcon,
} from "lucide-react";
import Link from "next/link";
import { usePathname } from "next/navigation";
@@ -19,37 +21,72 @@ import { useFeatureFlag } from "@/lib/feature-flags/client";
export function AccountSidebarMenu() {
const { t } = useTranslation();
- const isBillingEnabled = useFeatureFlag("billing");
const pathname = usePathname();
const menuItems = [
{
id: "profile",
label: t("profile", { defaultValue: "Profile" }),
icon: <UserIcon />,
- href: "/account/profile",
+ href: "/settings/profile",
},
{
id: "preferences",
label: t("preferences", { defaultValue: "Preferences" }),
icon: <Settings2Icon />,
- href: "/account/preferences",
+ href: "/settings/preferences",
},
{
id: "spaces",
label: t("spaces", { defaultValue: "Spaces" }),
- icon: <LayersIcon />,
- href: "/account/spaces",
+ icon: <PanelsTopLeftIcon />,
+ href: "/settings/spaces",
},
];
- if (isBillingEnabled) {
- menuItems.push({
- id: "billing",
- label: t("billing", { defaultValue: "Billing" }),
- icon: <CreditCardIcon />,
- href: "/account/billing",
- });
- }
+ return (
+ <SidebarMenu>
+ {menuItems.map((item) => (
+ <SidebarMenuItem key={item.id}>
+ <SidebarMenuButton asChild isActive={pathname.startsWith(item.href)}>
+ <Link href={item.href} className="flex items-center gap-x-2">
+ <Icon>{item.icon}</Icon>
+ {item.label}
+ </Link>
+ </SidebarMenuButton>
+ </SidebarMenuItem>
+ ))}
+ </SidebarMenu>
+ );
+}
+
+export function SpaceSidebarMenu() {
+ const { t } = useTranslation();
+ const pathname = usePathname();
+ const isBillingEnabled = useFeatureFlag("billing");
+ const menuItems = [
+ {
+ id: "general",
+ label: t("general", { defaultValue: "General" }),
+ icon: <BoltIcon />,
+ href: "/settings/general",
+ },
+ {
+ id: "members",
+ label: t("members", { defaultValue: "Members" }),
+ icon: <UsersIcon />,
+ href: "/settings/members",
+ },
+ ...(isBillingEnabled
+ ? [
+ {
+ id: "billing",
+ label: t("billing", { defaultValue: "Billing" }),
+ icon: <CreditCardIcon />,
+ href: "/settings/billing",
+ },
+ ]
+ : []),
+ ];
return (
<SidebarMenu>
diff --git a/apps/web/src/app/[locale]/account/components/sign-out-button.tsx b/apps/web/src/app/[locale]/(space)/settings/components/sign-out-button.tsx
similarity index 100%
rename from apps/web/src/app/[locale]/account/components/sign-out-button.tsx
rename to apps/web/src/app/[locale]/(space)/settings/components/sign-out-button.tsx
diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/settings/general/components/delete-space-button.tsx b/apps/web/src/app/[locale]/(space)/settings/general/components/delete-space-button.tsx
similarity index 100%
rename from apps/web/src/app/[locale]/(space)/(dashboard)/settings/general/components/delete-space-button.tsx
rename to apps/web/src/app/[locale]/(space)/settings/general/components/delete-space-button.tsx
diff --git a/apps/web/src/app/[locale]/(space)/settings/general/components/leave-space-button.tsx b/apps/web/src/app/[locale]/(space)/settings/general/components/leave-space-button.tsx
new file mode 100644
index 000000000..4435354fe
--- /dev/null
+++ b/apps/web/src/app/[locale]/(space)/settings/general/components/leave-space-button.tsx
@@ -0,0 +1,167 @@
+"use client";
+
+import { Button } from "@rallly/ui/button";
+import type { DialogProps } from "@rallly/ui/dialog";
+import {
+ Dialog,
+ DialogClose,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+ DialogTrigger,
+} from "@rallly/ui/dialog";
+import {
+ Form,
+ FormControl,
+ FormField,
+ FormItem,
+ FormLabel,
+ FormMessage,
+} from "@rallly/ui/form";
+import { Icon } from "@rallly/ui/icon";
+import { Input } from "@rallly/ui/input";
+import { toast } from "@rallly/ui/sonner";
+import { LogOutIcon } from "lucide-react";
+import { useRouter } from "next/navigation";
+import { useForm } from "react-hook-form";
+import { Trans } from "@/components/trans";
+import { leaveSpaceAction } from "@/features/space/actions";
+import { useTranslation } from "@/i18n/client";
+import { useSafeAction } from "@/lib/safe-action/client";
+
+interface LeaveSpaceDialogProps extends DialogProps {
+ spaceName: string;
+ spaceId: string;
+}
+
+const formName = "leave-space-form";
+
+function LeaveSpaceDialog({
+ spaceName,
+ spaceId,
+ children,
+ ...rest
+}: LeaveSpaceDialogProps) {
+ const form = useForm<{ spaceName: string }>({
+ defaultValues: {
+ spaceName: "",
+ },
+ });
+
+ const leaveSpace = useSafeAction(leaveSpaceAction, {
+ onSuccess: () => {
+ toast.success(
+ t("leftSpaceSuccess", {
+ defaultValue: "You have left the space",
+ }),
+ );
+ router.push("/");
+ },
+ });
+
+ const router = useRouter();
+ const { t } = useTranslation();
+
+ return (
+ <Form {...form}>
+ <Dialog {...rest}>
+ {children}
+
+ <DialogContent>
+ <DialogHeader>
+ <DialogTitle>
+ <Trans i18nKey="leaveSpaceDialogTitle" defaults="Leave Space" />
+ </DialogTitle>
+ <DialogDescription>
+ <Trans
+ i18nKey="leaveSpaceDialogDescription"
+ defaults="Are you sure you want to leave this space?"
+ />
+ </DialogDescription>
+ </DialogHeader>
+ <form
+ id={formName}
+ onSubmit={form.handleSubmit(() => {
+ leaveSpace.execute();
+ })}
+ >
+ <FormField
+ control={form.control}
+ name="spaceName"
+ rules={{
+ validate: (value) => {
+ if (value !== spaceName) {
+ return t("spaceNameMismatch", {
+ defaultValue: "Space name does not match",
+ });
+ }
+ return true;
+ },
+ }}
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>
+ <Trans
+ i18nKey="leaveSpaceInstruction"
+ defaults="Please type the space name to confirm:"
+ />
+ </FormLabel>
+ <FormControl>
+ <Input
+ autoComplete="off"
+ data-1p-ignore
+ error={!!form.formState.errors.spaceName}
+ placeholder={spaceName}
+ {...field}
+ />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ </form>
+ <DialogFooter>
+ <DialogClose asChild>
+ <Button>
+ <Trans i18nKey="cancel" defaults="Cancel" />
+ </Button>
+ </DialogClose>
+ <Button
+ form={formName}
+ type="submit"
+ loading={leaveSpace.isExecuting}
+ variant="destructive"
+ >
+ <Trans i18nKey="leaveSpace" defaults="Leave Space" />
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+ </Form>
+ );
+}
+
+interface LeaveSpaceButtonProps {
+ spaceName: string;
+ spaceId: string;
+}
+
+export function LeaveSpaceButton({
+ spaceName,
+ spaceId,
+}: LeaveSpaceButtonProps) {
+ return (
+ <LeaveSpaceDialog spaceName={spaceName} spaceId={spaceId}>
+ <DialogTrigger asChild>
+ <Button>
+ <Icon>
+ <LogOutIcon />
+ </Icon>
+ <Trans i18nKey="leaveSpace" defaults="Leave Space" />
+ </Button>
+ </DialogTrigger>
+ </LeaveSpaceDialog>
+ );
+}
diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/settings/general/components/space-settings-form.tsx b/apps/web/src/app/[locale]/(space)/settings/general/components/space-settings-form.tsx
similarity index 100%
rename from apps/web/src/app/[locale]/(space)/(dashboard)/settings/general/components/space-settings-form.tsx
rename to apps/web/src/app/[locale]/(space)/settings/general/components/space-settings-form.tsx
diff --git a/apps/web/src/app/[locale]/(space)/settings/general/page.tsx b/apps/web/src/app/[locale]/(space)/settings/general/page.tsx
new file mode 100644
index 000000000..e7195c8b2
--- /dev/null
+++ b/apps/web/src/app/[locale]/(space)/settings/general/page.tsx
@@ -0,0 +1,119 @@
+import { subject } from "@casl/ability";
+import { Alert, AlertDescription } from "@rallly/ui/alert";
+import { EyeIcon } from "lucide-react";
+import type { Metadata } from "next";
+import {
+ PageSection,
+ PageSectionContent,
+ PageSectionDescription,
+ PageSectionGroup,
+ PageSectionHeader,
+ PageSectionTitle,
+} from "@/app/components/page-layout";
+import {
+ SettingsPage,
+ SettingsPageContent,
+ SettingsPageDescription,
+ SettingsPageHeader,
+ SettingsPageTitle,
+} from "@/app/components/settings-layout";
+import { requireSpace, requireUser } from "@/auth/data";
+import { Trans } from "@/components/trans";
+import { defineAbilityForMember } from "@/features/space/member/ability";
+import { getTranslation } from "@/i18n/server";
+import { DeleteSpaceButton } from "./components/delete-space-button";
+import { LeaveSpaceButton } from "./components/leave-space-button";
+import { SpaceSettingsForm } from "./components/space-settings-form";
+
+export default async function GeneralSettingsPage() {
+ const [space, user] = await Promise.all([requireSpace(), requireUser()]);
+ const ability = defineAbilityForMember({ space, user });
+ const isAdmin = space.role === "admin";
+ const canDeleteSpace = ability.can("delete", subject("Space", { ...space }));
+
+ const isOwner = space.ownerId === user.id;
+ return (
+ <SettingsPage>
+ <SettingsPageHeader>
+ <SettingsPageTitle>
+ <Trans i18nKey="general" defaults="General" />
+ </SettingsPageTitle>
+ <SettingsPageDescription>
+ <Trans
+ i18nKey="generalDescription"
+ defaults="Change the settings of your current space"
+ />
+ </SettingsPageDescription>
+ </SettingsPageHeader>
+ <SettingsPageContent>
+ <PageSectionGroup>
+ {!isAdmin ? (
+ <Alert variant="note">
+ <EyeIcon />
+ <AlertDescription>
+ <Trans
+ i18nKey="generalSettingsAdminRoleRequired"
+ defaults="You need to be an admin to make changes to this space."
+ />
+ </AlertDescription>
+ </Alert>
+ ) : null}
+ <PageSection variant="card">
+ <PageSectionContent>
+ <SpaceSettingsForm space={space} disabled={!isAdmin} />
+ </PageSectionContent>
+ </PageSection>
+ {!isOwner ? (
+ <PageSection variant="card">
+ <PageSectionHeader>
+ <PageSectionTitle>
+ <Trans i18nKey="leaveSpace" defaults="Leave Space" />
+ </PageSectionTitle>
+ <PageSectionDescription>
+ <Trans
+ i18nKey="leaveSpaceDescription"
+ defaults="Remove yourself from this space. You'll lose access to all polls in this space."
+ />
+ </PageSectionDescription>
+ </PageSectionHeader>
+ <PageSectionContent>
+ <LeaveSpaceButton spaceName={space.name} spaceId={space.id} />
+ </PageSectionContent>
+ </PageSection>
+ ) : null}
+ {canDeleteSpace ? (
+ <PageSection variant="card">
+ <PageSectionHeader>
+ <PageSectionTitle>
+ <Trans i18nKey="deleteSpace" defaults="Delete Space" />
+ </PageSectionTitle>
+ <PageSectionDescription>
+ <Trans
+ i18nKey="deleteSpaceDescription"
+ defaults="Permanently delete this space and all its content. This action cannot be undone."
+ />
+ </PageSectionDescription>
+ </PageSectionHeader>
+ <PageSectionContent>
+ <DeleteSpaceButton spaceName={space.name} spaceId={space.id} />
+ </PageSectionContent>
+ </PageSection>
+ ) : null}
+ </PageSectionGroup>
+ </SettingsPageContent>
+ </SettingsPage>
+ );
+}
+
+export async function generateMetadata(): Promise<Metadata> {
+ const { t } = await getTranslation();
+ return {
+ title: t("generalSettings", {
+ defaultValue: "General Settings",
+ }),
+ description: t("generalSettingsDescription", {
+ defaultValue:
+ "Manage your space settings, including name, description, and other general preferences.",
+ }),
+ };
+}
diff --git a/apps/web/src/app/[locale]/(space)/settings/layout.tsx b/apps/web/src/app/[locale]/(space)/settings/layout.tsx
new file mode 100644
index 000000000..4a918beae
--- /dev/null
+++ b/apps/web/src/app/[locale]/(space)/settings/layout.tsx
@@ -0,0 +1,94 @@
+import { Button } from "@rallly/ui/button";
+import { Icon } from "@rallly/ui/icon";
+import {
+ Sidebar,
+ SidebarContent,
+ SidebarGroup,
+ SidebarGroupContent,
+ SidebarGroupLabel,
+ SidebarHeader,
+ SidebarInset,
+ SidebarMenu,
+ SidebarMenuItem,
+ SidebarProvider,
+ SidebarSeparator,
+ SidebarTrigger,
+} from "@rallly/ui/sidebar";
+import { ArrowLeftIcon, SettingsIcon } from "lucide-react";
+import Link from "next/link";
+import type React from "react";
+import { Trans } from "@/components/trans";
+import { BillingProvider } from "@/features/billing/client";
+import { AccountSidebarMenu, SpaceSidebarMenu } from "./components/sidebar";
+
+export default async function ProfileLayout({
+ children,
+}: {
+ children?: React.ReactNode;
+}) {
+ return (
+ <BillingProvider>
+ <SidebarProvider>
+ <Sidebar>
+ <SidebarHeader>
+ <SidebarGroup>
+ <SidebarGroupContent>
+ <SidebarMenu>
+ <SidebarMenuItem className="flex items-center gap-3">
+ <Button variant="ghost" size="icon" asChild>
+ <Link href="/">
+ <Icon>
+ <ArrowLeftIcon />
+ </Icon>
+ </Link>
+ </Button>
+ <span className="font-medium text-sm">
+ <Trans i18nKey="settings" defaults="Settings" />
+ </span>
+ </SidebarMenuItem>
+ </SidebarMenu>
+ </SidebarGroupContent>
+ </SidebarGroup>
+ </SidebarHeader>
+ <SidebarSeparator />
+ <SidebarContent>
+ <SidebarGroup>
+ <SidebarGroupLabel>
+ <Trans i18nKey="account" defaults="Account" />
+ </SidebarGroupLabel>
+ <SidebarGroupContent>
+ <AccountSidebarMenu />
+ </SidebarGroupContent>
+ </SidebarGroup>
+ <SidebarGroup>
+ <SidebarGroupLabel>
+ <Trans i18nKey="space" defaults="Space" />
+ </SidebarGroupLabel>
+ <SidebarGroupContent>
+ <SpaceSidebarMenu />
+ </SidebarGroupContent>
+ </SidebarGroup>
+ </SidebarContent>
+ </Sidebar>
+ <SidebarInset>
+ <div className="flex flex-1 flex-col">
+ <header className="sticky top-0 z-10 border-b bg-background/90 p-3 backdrop-blur-sm md:hidden">
+ <div className="flex items-center gap-4">
+ <SidebarTrigger />
+ <div className="flex items-center gap-2">
+ <Icon>
+ <SettingsIcon />
+ </Icon>
+ <span className="font-medium text-sm">
+ <Trans i18nKey="settings" defaults="Settings" />
+ </span>
+ </div>
+ </div>
+ </header>
+ <main className="flex-1 p-4 lg:py-12">{children}</main>
+ </div>
+ </SidebarInset>
+ </SidebarProvider>
+ </BillingProvider>
+ );
+}
diff --git a/apps/web/src/app/[locale]/(space)/settings/loading.tsx b/apps/web/src/app/[locale]/(space)/settings/loading.tsx
new file mode 100644
index 000000000..03e55bd0a
--- /dev/null
+++ b/apps/web/src/app/[locale]/(space)/settings/loading.tsx
@@ -0,0 +1,5 @@
+import { RouterLoadingIndicator } from "@/components/router-loading-indicator";
+
+export default async function Loading() {
+ return <RouterLoadingIndicator />;
+}
diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/settings/members/components/invite-dropdown-menu.tsx b/apps/web/src/app/[locale]/(space)/settings/members/components/invite-dropdown-menu.tsx
similarity index 100%
rename from apps/web/src/app/[locale]/(space)/(dashboard)/settings/members/components/invite-dropdown-menu.tsx
rename to apps/web/src/app/[locale]/(space)/settings/members/components/invite-dropdown-menu.tsx
diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/settings/members/components/invite-member-button.tsx b/apps/web/src/app/[locale]/(space)/settings/members/components/invite-member-button.tsx
similarity index 100%
rename from apps/web/src/app/[locale]/(space)/(dashboard)/settings/members/components/invite-member-button.tsx
rename to apps/web/src/app/[locale]/(space)/settings/members/components/invite-member-button.tsx
diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/settings/members/components/invite-member-dialog.tsx b/apps/web/src/app/[locale]/(space)/settings/members/components/invite-member-dialog.tsx
similarity index 100%
rename from apps/web/src/app/[locale]/(space)/(dashboard)/settings/members/components/invite-member-dialog.tsx
rename to apps/web/src/app/[locale]/(space)/settings/members/components/invite-member-dialog.tsx
diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/settings/members/components/member-dropdown-menu.tsx b/apps/web/src/app/[locale]/(space)/settings/members/components/member-dropdown-menu.tsx
similarity index 100%
rename from apps/web/src/app/[locale]/(space)/(dashboard)/settings/members/components/member-dropdown-menu.tsx
rename to apps/web/src/app/[locale]/(space)/settings/members/components/member-dropdown-menu.tsx
diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/settings/members/components/tabs.tsx b/apps/web/src/app/[locale]/(space)/settings/members/components/tabs.tsx
similarity index 100%
rename from apps/web/src/app/[locale]/(space)/(dashboard)/settings/members/components/tabs.tsx
rename to apps/web/src/app/[locale]/(space)/settings/members/components/tabs.tsx
diff --git a/apps/web/src/app/[locale]/(space)/settings/members/page.tsx b/apps/web/src/app/[locale]/(space)/settings/members/page.tsx
new file mode 100644
index 000000000..6233fb87b
--- /dev/null
+++ b/apps/web/src/app/[locale]/(space)/settings/members/page.tsx
@@ -0,0 +1,213 @@
+import { Alert, AlertDescription } from "@rallly/ui/alert";
+import { Badge } from "@rallly/ui/badge";
+import { InfoIcon } from "lucide-react";
+import type { Metadata } from "next";
+import Link from "next/link";
+import {
+ PageSection,
+ PageSectionContent,
+ PageSectionDescription,
+ PageSectionDivider,
+ PageSectionGroup,
+ PageSectionHeader,
+ PageSectionTitle,
+} from "@/app/components/page-layout";
+import {
+ SettingsPage,
+ SettingsPageContent,
+ SettingsPageDescription,
+ SettingsPageHeader,
+ SettingsPageTitle,
+} from "@/app/components/settings-layout";
+import { requireSpace } from "@/auth/data";
+import { OptimizedAvatarImage } from "@/components/optimized-avatar-image";
+import { StackedList, StackedListItem } from "@/components/stacked-list";
+import { Trans } from "@/components/trans";
+import { IfCloudHosted, IfSelfHosted } from "@/contexts/environment";
+import { SpaceRole } from "@/features/space/components/space-role";
+import { loadInvites, loadMembers } from "@/features/space/data";
+import { getTotalSeatsForSpace } from "@/features/space/utils";
+import { getTranslation } from "@/i18n/server";
+import { InviteDropdownMenu } from "./components/invite-dropdown-menu";
+import { InviteMemberButton } from "./components/invite-member-button";
+import { MemberDropdownMenu } from "./components/member-dropdown-menu";
+
+export default async function MembersSettingsPage() {
+ const space = await requireSpace();
+ const [members, invites, totalSeats] = await Promise.all([
+ loadMembers(),
+ loadInvites(),
+ getTotalSeatsForSpace(space.id),
+ ]);
+
+ const usedSeats = members.total;
+
+ return (
+ <SettingsPage>
+ <SettingsPageHeader>
+ <SettingsPageTitle>
+ <Trans i18nKey="members" />
+ </SettingsPageTitle>
+ <SettingsPageDescription>
+ <Trans
+ i18nKey="membersDescription"
+ defaults="Members have access to your space"
+ />
+ </SettingsPageDescription>
+ </SettingsPageHeader>
+ <SettingsPageContent>
+ <PageSectionGroup>
+ <PageSection>
+ <PageSectionContent>
+ <StackedList>
+ {members.data.map((member) => (
+ <StackedListItem key={member.id}>
+ <div className="flex flex-1 items-center gap-4">
+ <OptimizedAvatarImage
+ src={member.image ?? undefined}
+ name={member.name}
+ size="lg"
+ />
+ <div>
+ <div className="flex items-center gap-x-2">
+ <div className="font-semibold text-sm">
+ {member.name}
+ </div>
+ <div>
+ {member.isOwner ? (
+ <Badge>
+ <Trans i18nKey="owner" defaults="Owner" />
+ </Badge>
+ ) : null}
+ </div>
+ </div>
+ <div className="text-muted-foreground text-sm">
+ {member.email}
+ </div>
+ </div>
+ </div>
+ <div className="text-sm">
+ <SpaceRole role={member.role} />
+ </div>
+ <MemberDropdownMenu member={member} />
+ </StackedListItem>
+ ))}
+ </StackedList>
+ </PageSectionContent>
+ </PageSection>
+ <PageSectionDivider />
+ <PageSection>
+ <PageSectionHeader>
+ <PageSectionTitle>
+ <Trans i18nKey="pendingInvites" defaults="Pending Invites" />
+ </PageSectionTitle>
+ <PageSectionDescription>
+ <Trans
+ i18nKey="pendingInvitesDescription"
+ defaults="Invite other users to share your space."
+ />
+ </PageSectionDescription>
+ </PageSectionHeader>
+ <PageSectionContent>
+ {invites.length > 0 ? (
+ <StackedList>
+ {invites.map((invite) => (
+ <StackedListItem key={invite.id}>
+ <div className="flex flex-1 items-center gap-4">
+ <OptimizedAvatarImage name={invite.email} size="md" />
+ <div>
+ <div className="flex items-center gap-x-2">
+ <div className="font-semibold text-sm">
+ {invite.email}
+ </div>
+ </div>
+ <div className="text-muted-foreground text-sm">
+ <Trans
+ i18nKey="memberInvitedBy"
+ defaults="Invited by {inviterName}"
+ values={{ inviterName: invite.invitedBy.name }}
+ />
+ </div>
+ </div>
+ </div>
+ <div className="text-sm">
+ <SpaceRole role={invite.role} />
+ </div>
+ <InviteDropdownMenu invite={invite} />
+ </StackedListItem>
+ ))}
+ </StackedList>
+ ) : null}
+ <div className="flex items-center gap-4">
+ <InviteMemberButton
+ usedSeats={usedSeats}
+ totalSeats={totalSeats}
+ />
+ <p className="font-medium text-sm">
+ <Trans
+ i18nKey="seatUsage"
+ defaults="{usedSeats} of {totalSeats} seats used"
+ values={{ usedSeats, totalSeats }}
+ />
+ </p>
+ </div>
+ {totalSeats - usedSeats <= 0 ? (
+ <Alert variant="info">
+ <InfoIcon />
+ <AlertDescription>
+ <IfCloudHosted>
+ <p>
+ <Trans
+ i18nKey="noSeatsAvailableAlertBillingDescription"
+ defaults="Increase the number of seats in this space from the <a>billing page</a>."
+ components={{
+ a: (
+ <Link
+ className="underline"
+ href="/settings/billing"
+ />
+ ),
+ }}
+ />
+ </p>
+ </IfCloudHosted>
+ <IfSelfHosted>
+ <p>
+ <Trans
+ i18nKey="noSeatsAvailableAlertSelfHostedDescription"
+ defaults="You will need to <a>upgrade</a> to increase the number of seats in this space."
+ components={{
+ a: (
+ <Link
+ className="underline"
+ prefetch={false}
+ href="https://support.rallly.co/self-hosting/licensing"
+ />
+ ),
+ }}
+ />
+ </p>
+ </IfSelfHosted>
+ </AlertDescription>
+ </Alert>
+ ) : null}
+ </PageSectionContent>
+ </PageSection>
+ </PageSectionGroup>
+ </SettingsPageContent>
+ </SettingsPage>
+ );
+}
+
+export async function generateMetadata(): Promise<Metadata> {
+ const { t } = await getTranslation();
+ return {
+ title: t("members", {
+ defaultValue: "Members",
+ }),
+ description: t("membersSettingsDescription", {
+ defaultValue:
+ "Manage space members, invite new users, and control access permissions.",
+ }),
+ };
+}
diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/settings/members/schema.ts b/apps/web/src/app/[locale]/(space)/settings/members/schema.ts
similarity index 100%
rename from apps/web/src/app/[locale]/(space)/(dashboard)/settings/members/schema.ts
rename to apps/web/src/app/[locale]/(space)/settings/members/schema.ts
diff --git a/apps/web/src/app/[locale]/account/preferences/actions.ts b/apps/web/src/app/[locale]/(space)/settings/preferences/actions.ts
similarity index 100%
rename from apps/web/src/app/[locale]/account/preferences/actions.ts
rename to apps/web/src/app/[locale]/(space)/settings/preferences/actions.ts
diff --git a/apps/web/src/app/[locale]/account/preferences/components/date-time-preferences.tsx b/apps/web/src/app/[locale]/(space)/settings/preferences/components/date-time-preferences.tsx
similarity index 100%
rename from apps/web/src/app/[locale]/account/preferences/components/date-time-preferences.tsx
rename to apps/web/src/app/[locale]/(space)/settings/preferences/components/date-time-preferences.tsx
diff --git a/apps/web/src/app/[locale]/account/preferences/components/language-preference.tsx b/apps/web/src/app/[locale]/(space)/settings/preferences/components/language-preference.tsx
similarity index 100%
rename from apps/web/src/app/[locale]/account/preferences/components/language-preference.tsx
rename to apps/web/src/app/[locale]/(space)/settings/preferences/components/language-preference.tsx
diff --git a/apps/web/src/app/[locale]/account/preferences/page.tsx b/apps/web/src/app/[locale]/(space)/settings/preferences/page.tsx
similarity index 53%
rename from apps/web/src/app/[locale]/account/preferences/page.tsx
rename to apps/web/src/app/[locale]/(space)/settings/preferences/page.tsx
index 626e41c77..17a98c3e4 100644
--- a/apps/web/src/app/[locale]/account/preferences/page.tsx
+++ b/apps/web/src/app/[locale]/(space)/settings/preferences/page.tsx
@@ -1,27 +1,34 @@
import type { Metadata } from "next";
import type { Params } from "@/app/[locale]/types";
import {
- PageContainer,
- PageContent,
- PageHeader,
- PageTitle,
-} from "@/app/components/page-layout";
+ SettingsPage,
+ SettingsPageContent,
+ SettingsPageDescription,
+ SettingsPageHeader,
+ SettingsPageTitle,
+} from "@/app/components/settings-layout";
import { Trans } from "@/components/trans";
import { getTranslation } from "@/i18n/server";
import { PreferencesPage } from "./preferences-page";
export default async function Page() {
return (
- <PageContainer>
- <PageHeader>
- <PageTitle>
+ <SettingsPage>
+ <SettingsPageHeader>
+ <SettingsPageTitle>
<Trans i18nKey="preferences" defaults="Preferences" />
- </PageTitle>
- </PageHeader>
- <PageContent>
+ </SettingsPageTitle>
+ <SettingsPageDescription>
+ <Trans
+ i18nKey="preferencesDescription"
+ defaults="Manage your preferences"
+ />
+ </SettingsPageDescription>
+ </SettingsPageHeader>
+ <SettingsPageContent>
<PreferencesPage />
- </PageContent>
- </PageContainer>
+ </SettingsPageContent>
+ </SettingsPage>
);
}
diff --git a/apps/web/src/app/[locale]/account/preferences/preferences-page.tsx b/apps/web/src/app/[locale]/(space)/settings/preferences/preferences-page.tsx
similarity index 95%
rename from apps/web/src/app/[locale]/account/preferences/preferences-page.tsx
rename to apps/web/src/app/[locale]/(space)/settings/preferences/preferences-page.tsx
index acece4620..ad86b9895 100644
--- a/apps/web/src/app/[locale]/account/preferences/preferences-page.tsx
+++ b/apps/web/src/app/[locale]/(space)/settings/preferences/preferences-page.tsx
@@ -15,7 +15,7 @@ import { LanguagePreference } from "./components/language-preference";
export function PreferencesPage() {
return (
<PageSectionGroup>
- <PageSection>
+ <PageSection variant="card">
<PageSectionHeader>
<PageSectionTitle>
<Trans i18nKey="language" defaults="Language" />
@@ -32,7 +32,7 @@ export function PreferencesPage() {
</PageSectionContent>
</PageSection>
- <PageSection>
+ <PageSection variant="card">
<PageSectionHeader>
<PageSectionTitle>
<Trans i18nKey="dateAndTime" defaults="Date & Time" />
diff --git a/apps/web/src/app/[locale]/account/profile/actions.ts b/apps/web/src/app/[locale]/(space)/settings/profile/actions.ts
similarity index 100%
rename from apps/web/src/app/[locale]/account/profile/actions.ts
rename to apps/web/src/app/[locale]/(space)/settings/profile/actions.ts
diff --git a/apps/web/src/app/[locale]/account/profile/delete-account-dialog.tsx b/apps/web/src/app/[locale]/(space)/settings/profile/delete-account-dialog.tsx
similarity index 100%
rename from apps/web/src/app/[locale]/account/profile/delete-account-dialog.tsx
rename to apps/web/src/app/[locale]/(space)/settings/profile/delete-account-dialog.tsx
diff --git a/apps/web/src/app/[locale]/account/profile/logout-button.tsx b/apps/web/src/app/[locale]/(space)/settings/profile/logout-button.tsx
similarity index 100%
rename from apps/web/src/app/[locale]/account/profile/logout-button.tsx
rename to apps/web/src/app/[locale]/(space)/settings/profile/logout-button.tsx
diff --git a/apps/web/src/app/[locale]/account/profile/page.tsx b/apps/web/src/app/[locale]/(space)/settings/profile/page.tsx
similarity index 79%
rename from apps/web/src/app/[locale]/account/profile/page.tsx
rename to apps/web/src/app/[locale]/(space)/settings/profile/page.tsx
index 61584498f..b8e368650 100644
--- a/apps/web/src/app/[locale]/account/profile/page.tsx
+++ b/apps/web/src/app/[locale]/(space)/settings/profile/page.tsx
@@ -5,17 +5,20 @@ import type { Metadata } from "next";
import type { Params } from "@/app/[locale]/types";
import {
- PageContainer,
- PageContent,
- PageHeader,
PageSection,
PageSectionContent,
PageSectionDescription,
PageSectionGroup,
PageSectionHeader,
PageSectionTitle,
- PageTitle,
} from "@/app/components/page-layout";
+import {
+ SettingsPage,
+ SettingsPageContent,
+ SettingsPageDescription,
+ SettingsPageHeader,
+ SettingsPageTitle,
+} from "@/app/components/settings-layout";
import { requireUser } from "@/auth/data";
import { Trans } from "@/components/trans";
import { getTranslation } from "@/i18n/server";
@@ -26,32 +29,27 @@ import { ProfileSettings } from "./profile-settings";
export default async function Page() {
const user = await requireUser();
return (
- <PageContainer>
- <PageHeader>
- <PageTitle>
+ <SettingsPage>
+ <SettingsPageHeader>
+ <SettingsPageTitle>
<Trans i18nKey="profile" defaults="Profile" />
- </PageTitle>
- </PageHeader>
- <PageContent>
+ </SettingsPageTitle>
+ <SettingsPageDescription>
+ <Trans
+ i18nKey="profileDescription"
+ defaults="Set your public profile information"
+ />
+ </SettingsPageDescription>
+ </SettingsPageHeader>
+ <SettingsPageContent>
<PageSectionGroup>
- <PageSection>
- <PageSectionHeader>
- <PageSectionTitle>
- <Trans i18nKey="profile" defaults="Profile" />
- </PageSectionTitle>
- <PageSectionDescription>
- <Trans
- i18nKey="profileDescription"
- defaults="Set your public profile information"
- />
- </PageSectionDescription>
- </PageSectionHeader>
+ <PageSection variant="card">
<PageSectionContent>
<ProfileSettings name={user.name} image={user.image} />
</PageSectionContent>
</PageSection>
- <PageSection>
+ <PageSection variant="card">
<PageSectionHeader>
<PageSectionTitle>
<Trans i18nKey="profileEmailAddress" defaults="Email Address" />
@@ -68,7 +66,7 @@ export default async function Page() {
</PageSectionContent>
</PageSection>
- <PageSection>
+ <PageSection variant="card">
<PageSectionHeader>
<PageSectionTitle>
<Trans i18nKey="dangerZone" defaults="Danger Zone" />
@@ -92,8 +90,8 @@ export default async function Page() {
</PageSectionContent>
</PageSection>
</PageSectionGroup>
- </PageContent>
- </PageContainer>
+ </SettingsPageContent>
+ </SettingsPage>
);
}
diff --git a/apps/web/src/app/[locale]/account/profile/profile-email-address.tsx b/apps/web/src/app/[locale]/(space)/settings/profile/profile-email-address.tsx
similarity index 100%
rename from apps/web/src/app/[locale]/account/profile/profile-email-address.tsx
rename to apps/web/src/app/[locale]/(space)/settings/profile/profile-email-address.tsx
diff --git a/apps/web/src/app/[locale]/account/profile/profile-picture.tsx b/apps/web/src/app/[locale]/(space)/settings/profile/profile-picture.tsx
similarity index 100%
rename from apps/web/src/app/[locale]/account/profile/profile-picture.tsx
rename to apps/web/src/app/[locale]/(space)/settings/profile/profile-picture.tsx
diff --git a/apps/web/src/app/[locale]/account/profile/profile-settings.tsx b/apps/web/src/app/[locale]/(space)/settings/profile/profile-settings.tsx
similarity index 100%
rename from apps/web/src/app/[locale]/account/profile/profile-settings.tsx
rename to apps/web/src/app/[locale]/(space)/settings/profile/profile-settings.tsx
diff --git a/apps/web/src/app/[locale]/account/spaces/components/leave-space-dialog.test.tsx b/apps/web/src/app/[locale]/(space)/settings/spaces/components/leave-space-dialog.test.tsx
similarity index 100%
rename from apps/web/src/app/[locale]/account/spaces/components/leave-space-dialog.test.tsx
rename to apps/web/src/app/[locale]/(space)/settings/spaces/components/leave-space-dialog.test.tsx
diff --git a/apps/web/src/app/[locale]/account/spaces/components/leave-space-dialog.tsx b/apps/web/src/app/[locale]/(space)/settings/spaces/components/leave-space-dialog.tsx
similarity index 100%
rename from apps/web/src/app/[locale]/account/spaces/components/leave-space-dialog.tsx
rename to apps/web/src/app/[locale]/(space)/settings/spaces/components/leave-space-dialog.tsx
diff --git a/apps/web/src/app/[locale]/account/spaces/components/spaces-list.tsx b/apps/web/src/app/[locale]/(space)/settings/spaces/components/spaces-list.tsx
similarity index 100%
rename from apps/web/src/app/[locale]/account/spaces/components/spaces-list.tsx
rename to apps/web/src/app/[locale]/(space)/settings/spaces/components/spaces-list.tsx
diff --git a/apps/web/src/app/[locale]/(space)/settings/spaces/page.tsx b/apps/web/src/app/[locale]/(space)/settings/spaces/page.tsx
new file mode 100644
index 000000000..f3a0b9786
--- /dev/null
+++ b/apps/web/src/app/[locale]/(space)/settings/spaces/page.tsx
@@ -0,0 +1,53 @@
+import type { Metadata } from "next";
+
+import type { Params } from "@/app/[locale]/types";
+import { PageSection, PageSectionGroup } from "@/app/components/page-layout";
+import {
+ SettingsPage,
+ SettingsPageContent,
+ SettingsPageDescription,
+ SettingsPageHeader,
+ SettingsPageTitle,
+} from "@/app/components/settings-layout";
+import { requireUser } from "@/auth/data";
+import { Trans } from "@/components/trans";
+import { loadSpaces } from "@/features/space/data";
+import { getTranslation } from "@/i18n/server";
+import { SpacesList } from "./components/spaces-list";
+
+export default async function Page() {
+ const [spaces, user] = await Promise.all([loadSpaces(), requireUser()]);
+
+ return (
+ <SettingsPage>
+ <SettingsPageHeader>
+ <SettingsPageTitle>
+ <Trans i18nKey="spaces" defaults="Spaces" />
+ </SettingsPageTitle>
+ <SettingsPageDescription>
+ <Trans
+ i18nKey="spacesDescription"
+ defaults="Manage the spaces you belong to"
+ />
+ </SettingsPageDescription>
+ </SettingsPageHeader>
+ <SettingsPageContent>
+ <PageSectionGroup>
+ <PageSection>
+ <SpacesList spaces={spaces} currentUserId={user.id} />
+ </PageSection>
+ </PageSectionGroup>
+ </SettingsPageContent>
+ </SettingsPage>
+ );
+}
+
+export async function generateMetadata(props: {
+ params: Promise<Params>;
+}): Promise<Metadata> {
+ const params = await props.params;
+ const { t } = await getTranslation(params.locale);
+ return {
+ title: t("spaces", { defaultValue: "Spaces" }),
+ };
+}
diff --git a/apps/web/src/app/[locale]/account/layout.tsx b/apps/web/src/app/[locale]/account/layout.tsx
deleted file mode 100644
index d3bc7a53d..000000000
--- a/apps/web/src/app/[locale]/account/layout.tsx
+++ /dev/null
@@ -1,58 +0,0 @@
-import { Icon } from "@rallly/ui/icon";
-import {
- Sidebar,
- SidebarContent,
- SidebarGroup,
- SidebarGroupContent,
- SidebarGroupLabel,
- SidebarInset,
- SidebarMenu,
- SidebarMenuButton,
- SidebarMenuItem,
- SidebarProvider,
-} from "@rallly/ui/sidebar";
-import { ArrowLeftIcon } from "lucide-react";
-import Link from "next/link";
-import type React from "react";
-import { Trans } from "@/components/trans";
-import { AccountSidebarMenu } from "./components/sidebar";
-
-export default async function ProfileLayout({
- children,
-}: {
- children?: React.ReactNode;
-}) {
- return (
- <SidebarProvider>
- <Sidebar variant="inset">
- <SidebarContent>
- <SidebarGroup>
- <SidebarGroupContent>
- <SidebarMenu>
- <SidebarMenuItem>
- <SidebarMenuButton asChild>
- <Link href="/">
- <Icon>
- <ArrowLeftIcon />
- </Icon>
- <Trans i18nKey="back" defaults="Back" />
- </Link>
- </SidebarMenuButton>
- </SidebarMenuItem>
- </SidebarMenu>
- </SidebarGroupContent>
- </SidebarGroup>
- <SidebarGroup>
- <SidebarGroupLabel>
- <Trans i18nKey="settings" defaults="Settings" />
- </SidebarGroupLabel>
- <SidebarGroupContent>
- <AccountSidebarMenu />
- </SidebarGroupContent>
- </SidebarGroup>
- </SidebarContent>
- </Sidebar>
- <SidebarInset>{children}</SidebarInset>
- </SidebarProvider>
- );
-}
diff --git a/apps/web/src/app/[locale]/account/loading.tsx b/apps/web/src/app/[locale]/account/loading.tsx
deleted file mode 100644
index fdf5e4f64..000000000
--- a/apps/web/src/app/[locale]/account/loading.tsx
+++ /dev/null
@@ -1,11 +0,0 @@
-import { PageSkeleton } from "@/app/components/page-layout";
-import { RouterLoadingIndicator } from "@/components/router-loading-indicator";
-
-export default async function Loading() {
- return (
- <>
- <RouterLoadingIndicator />
- <PageSkeleton />
- </>
- );
-}
diff --git a/apps/web/src/app/[locale]/account/spaces/page.tsx b/apps/web/src/app/[locale]/account/spaces/page.tsx
deleted file mode 100644
index 1592dc971..000000000
--- a/apps/web/src/app/[locale]/account/spaces/page.tsx
+++ /dev/null
@@ -1,64 +0,0 @@
-import type { Metadata } from "next";
-
-import type { Params } from "@/app/[locale]/types";
-import {
- PageContainer,
- PageContent,
- PageHeader,
- PageSection,
- PageSectionContent,
- PageSectionDescription,
- PageSectionGroup,
- PageSectionHeader,
- PageSectionTitle,
- PageTitle,
-} from "@/app/components/page-layout";
-import { requireUser } from "@/auth/data";
-import { Trans } from "@/components/trans";
-import { loadSpaces } from "@/features/space/data";
-import { getTranslation } from "@/i18n/server";
-import { SpacesList } from "./components/spaces-list";
-
-export default async function Page() {
- const [spaces, user] = await Promise.all([loadSpaces(), requireUser()]);
-
- return (
- <PageContainer>
- <PageHeader>
- <PageTitle>
- <Trans i18nKey="spaces" defaults="Spaces" />
- </PageTitle>
- </PageHeader>
- <PageContent>
- <PageSectionGroup>
- <PageSection>
- <PageSectionHeader>
- <PageSectionTitle>
- <Trans i18nKey="mySpaces" defaults="My Spaces" />
- </PageSectionTitle>
- <PageSectionDescription>
- <Trans
- i18nKey="spacesDescription"
- defaults="Manage the spaces you belong to"
- />
- </PageSectionDescription>
- </PageSectionHeader>
- <PageSectionContent>
- <SpacesList spaces={spaces} currentUserId={user.id} />
- </PageSectionContent>
- </PageSection>
- </PageSectionGroup>
- </PageContent>
- </PageContainer>
- );
-}
-
-export async function generateMetadata(props: {
- params: Promise<Params>;
-}): Promise<Metadata> {
- const params = await props.params;
- const { t } = await getTranslation(params.locale);
- return {
- title: t("spaces", { defaultValue: "Spaces" }),
- };
-}
diff --git a/apps/web/src/app/[locale]/control-panel/sidebar.tsx b/apps/web/src/app/[locale]/control-panel/sidebar.tsx
index a0dc10ccb..ddc604214 100644
--- a/apps/web/src/app/[locale]/control-panel/sidebar.tsx
+++ b/apps/web/src/app/[locale]/control-panel/sidebar.tsx
@@ -23,7 +23,7 @@ export async function ControlPanelSidebar({
...props
}: React.ComponentProps<typeof Sidebar>) {
return (
- <Sidebar variant="inset" {...props}>
+ <Sidebar {...props}>
<SidebarHeader>
<SidebarMenu>
<NavItem href="/">
diff --git a/apps/web/src/app/api/user/verify-email-change/route.ts b/apps/web/src/app/api/user/verify-email-change/route.ts
index 9b5c552e6..d034dc888 100644
--- a/apps/web/src/app/api/user/verify-email-change/route.ts
+++ b/apps/web/src/app/api/user/verify-email-change/route.ts
@@ -87,5 +87,5 @@ export const GET = async (request: NextRequest) => {
await handleEmailChange(token);
- return NextResponse.redirect(new URL("/account/profile", request.url));
+ return NextResponse.redirect(new URL("/settings/profile", request.url));
};
diff --git a/apps/web/src/app/components/page-icons.tsx b/apps/web/src/app/components/page-icons.tsx
index 9ecdd184f..a4d1ad6ff 100644
--- a/apps/web/src/app/components/page-icons.tsx
+++ b/apps/web/src/app/components/page-icons.tsx
@@ -21,15 +21,16 @@ import type React from "react";
const pageIconVariants = cva("inline-flex items-center justify-center", {
variants: {
color: {
- darkGray: "bg-gray-700 text-white",
+ darkGray: "bg-gray-700 text-gray-300",
indigo: "bg-indigo-500 text-white",
gray: "bg-gray-200 text-gray-600",
lime: "bg-lime-500 text-white",
blue: "bg-blue-500 text-white",
- rose: "bg-rose-500 text-white",
- purple: "bg-purple-500 text-white",
+ rose: "bg-rose-500 text-rose-50",
+ purple: "bg-purple-500 text-purple-50",
},
size: {
+ xs: "size-5 rounded-md [&_svg]:size-3",
sm: "size-7 rounded-md [&_svg]:size-4",
md: "size-8 rounded-lg [&_svg]:size-4",
lg: "size-9 rounded-lg [&_svg]:size-5",
diff --git a/apps/web/src/app/components/page-layout.tsx b/apps/web/src/app/components/page-layout.tsx
index 8c426053b..db80ef526 100644
--- a/apps/web/src/app/components/page-layout.tsx
+++ b/apps/web/src/app/components/page-layout.tsx
@@ -3,6 +3,8 @@
import { cn } from "@rallly/ui";
import { SidebarTrigger } from "@rallly/ui/sidebar";
import { Skeleton } from "@rallly/ui/skeleton";
+import type { VariantProps } from "class-variance-authority";
+import { cva } from "class-variance-authority";
export function PageContainer({
children,
@@ -118,20 +120,33 @@ export function PageSkeleton() {
}
export function PageSectionGroup({ children }: { children?: React.ReactNode }) {
- return <div className="space-y-6 lg:space-y-12">{children}</div>;
+ return <div className="space-y-6">{children}</div>;
}
+const pageSectionVariants = cva("flex flex-col gap-4", {
+ variants: {
+ variant: {
+ card: "rounded-2xl border p-4",
+ default: "",
+ },
+ },
+ defaultVariants: {
+ variant: "default",
+ },
+});
+
+export const PageSectionDivider = () => <hr />;
+
export function PageSection({
children,
className,
+ variant,
}: {
children?: React.ReactNode;
className?: string;
-}) {
+} & VariantProps<typeof pageSectionVariants>) {
return (
- <section
- className={cn("grid gap-4 lg:grid-cols-[320px_1fr] lg:gap-12", className)}
- >
+ <section className={cn(pageSectionVariants({ variant }), className)}>
{children}
</section>
);
@@ -171,7 +186,7 @@ export function PageSectionDescription({
return (
<p
className={cn(
- "mt-1 text-pretty text-muted-foreground text-sm leading-normal",
+ "mt-0.5 text-pretty text-muted-foreground text-sm leading-normal",
className,
)}
>
diff --git a/apps/web/src/app/components/settings-layout.tsx b/apps/web/src/app/components/settings-layout.tsx
new file mode 100644
index 000000000..6f01b787a
--- /dev/null
+++ b/apps/web/src/app/components/settings-layout.tsx
@@ -0,0 +1,72 @@
+import { cn } from "@rallly/ui";
+
+export function SettingsPage({
+ children,
+ className,
+}: {
+ children?: React.ReactNode;
+ className?: string;
+}) {
+ return (
+ <div
+ className={cn("mx-auto flex w-full max-w-3xl flex-col gap-6", className)}
+ >
+ {children}
+ </div>
+ );
+}
+
+export function SettingsPageHeader({
+ children,
+ className,
+}: {
+ children?: React.ReactNode;
+ className?: string;
+}) {
+ return (
+ <div className={cn("flex flex-col items-start", className)}>{children}</div>
+ );
+}
+
+export function SettingsPageTitle({
+ children,
+ className,
+}: {
+ children?: React.ReactNode;
+ className?: string;
+}) {
+ return (
+ <h1
+ className={cn(
+ "font-semibold text-xl leading-tight tracking-tight",
+ className,
+ )}
+ >
+ {children}
+ </h1>
+ );
+}
+
+export function SettingsPageDescription({
+ children,
+ className,
+}: {
+ children?: React.ReactNode;
+ className?: string;
+}) {
+ return (
+ <p className={cn("mt-1 text-muted-foreground text-sm", className)}>
+ {children}
+ </p>
+ );
+}
+
+export function SettingsPageContent({
+ children,
+ className,
+}: {
+ children?: React.ReactNode;
+ className?: string;
+}) {
+ return <div className={cn("flex flex-col gap-6", className)}>{children}</div>;
+}
diff --git a/apps/web/src/components/layouts/poll-layout.tsx b/apps/web/src/components/layouts/poll-layout.tsx
index de1459157..dee409413 100644
--- a/apps/web/src/components/layouts/poll-layout.tsx
+++ b/apps/web/src/components/layouts/poll-layout.tsx
@@ -28,7 +28,7 @@ const Layout = ({ children }: React.PropsWithChildren) => {
const pollLink = `/poll/${poll.id}`;
const pathname = usePathname();
return (
- <div>
+ <div className="absolute inset-0 overflow-auto bg-gray-100">
<div className="sticky top-0 z-40 border-b bg-gray-100/90 p-3 backdrop-blur-md sm:flex-row">
<div className="mx-auto flex max-w-4xl justify-between">
<div className="flex min-w-0 items-center gap-x-2.5">
diff --git a/apps/web/src/components/user-dropdown.tsx b/apps/web/src/components/user-dropdown.tsx
index 895870990..e10e78c70 100644
--- a/apps/web/src/components/user-dropdown.tsx
+++ b/apps/web/src/components/user-dropdown.tsx
@@ -68,14 +68,14 @@ export const UserDropdown = ({ className }: { className?: string }) => {
</Link>
</DropdownMenuItem>
<DropdownMenuItem asChild={true}>
- <Link href="/account/profile" className="flex items-center gap-x-2">
+ <Link href="/settings/profile" className="flex items-center gap-x-2">
<UserIcon className="size-4 text-muted-foreground" />
<Trans i18nKey="profile" defaults="Profile" />
</Link>
</DropdownMenuItem>
<DropdownMenuItem asChild={true}>
<Link
- href="/account/preferences"
+ href="/settings/preferences"
className="flex items-center gap-x-2"
>
<Settings2Icon className="size-4 text-muted-foreground" />
diff --git a/apps/web/src/features/navigation/command-menu/command-menu.tsx b/apps/web/src/features/navigation/command-menu/command-menu.tsx
index fd7d1010d..c31549cd5 100644
--- a/apps/web/src/features/navigation/command-menu/command-menu.tsx
+++ b/apps/web/src/features/navigation/command-menu/command-menu.tsx
@@ -92,11 +92,11 @@ export function CommandMenu() {
<CommandGroup
heading={<Trans i18nKey="settings" defaults="Settings" />}
>
- <CommandItem onSelect={() => handleSelect("/account/profile")}>
+ <CommandItem onSelect={() => handleSelect("/settings/profile")}>
<ProfilePageIcon size="sm" />
<NavigationCommandLabel label={t("profile")} />
</CommandItem>
- <CommandItem onSelect={() => handleSelect("/account/preferences")}>
+ <CommandItem onSelect={() => handleSelect("/settings/preferences")}>
<PreferencesPageIcon size="sm" />
<NavigationCommandLabel label={t("preferences")} />
</CommandItem>
diff --git a/apps/web/src/features/navigation/config.tsx b/apps/web/src/features/navigation/config.tsx
index 96807a2f2..494d69b72 100644
--- a/apps/web/src/features/navigation/config.tsx
+++ b/apps/web/src/features/navigation/config.tsx
@@ -1,15 +1,9 @@
"use client";
import type { LucideIcon } from "lucide-react";
-import {
- BarChart2Icon,
- CalendarIcon,
- HomeIcon,
- SettingsIcon,
-} from "lucide-react";
+import { BarChart2Icon, CalendarIcon, HomeIcon } from "lucide-react";
import { usePathname } from "next/navigation";
import React from "react";
-import { useSpace } from "@/features/space/client";
import { useTranslation } from "@/i18n/client";
export interface NavigationItem {
@@ -35,7 +29,6 @@ export interface NavigationConfig {
export const useSpaceMenu = () => {
const { t } = useTranslation();
- const space = useSpace();
const pathname = usePathname();
const config = React.useMemo<NavigationConfig>(
() => ({
@@ -72,26 +65,9 @@ export const useSpaceMenu = () => {
},
],
},
- ...(space.data.role === "admin"
- ? [
- {
- id: "manage",
- title: t("manage", { defaultValue: "Manage" }),
- items: [
- {
- id: "settings",
- label: t("settings", { defaultValue: "Settings" }),
- href: "/settings/general",
- icon: SettingsIcon,
- isActive: pathname.startsWith("/settings"),
- },
- ],
- },
- ]
- : []),
],
}),
- [pathname, t, space],
+ [pathname, t],
);
return React.useMemo(
diff --git a/apps/web/src/features/space/actions.ts b/apps/web/src/features/space/actions.ts
index b40b4c000..18e18db60 100644
--- a/apps/web/src/features/space/actions.ts
+++ b/apps/web/src/features/space/actions.ts
@@ -101,6 +101,8 @@ export const createSpaceAction = authActionClient
trackSpaceCreated({ space, userId: ctx.user.id });
+ revalidatePath("/", "layout");
+
return space;
});
diff --git a/apps/web/src/features/space/components/space-dropdown.tsx b/apps/web/src/features/space/components/space-dropdown.tsx
index 427085d22..b2b274587 100644
--- a/apps/web/src/features/space/components/space-dropdown.tsx
+++ b/apps/web/src/features/space/components/space-dropdown.tsx
@@ -14,7 +14,8 @@ import {
DropdownMenuTrigger,
} from "@rallly/ui/dropdown-menu";
import { Icon } from "@rallly/ui/icon";
-import { ChevronsUpDownIcon, CirclePlusIcon } from "lucide-react";
+import { ChevronsUpDownIcon, PlusIcon, SettingsIcon } from "lucide-react";
+import Link from "next/link";
import React from "react";
import { RouterLoadingIndicator } from "@/components/router-loading-indicator";
import { Trans } from "@/components/trans";
@@ -100,13 +101,21 @@ export function SpaceDropdown({
</DropdownMenuRadioItem>
))}
</DropdownMenuRadioGroup>
- <DropdownMenuSeparator />
<DropdownMenuItem onClick={newSpaceDialog.trigger}>
<Icon>
- <CirclePlusIcon />
+ <PlusIcon />
</Icon>
<Trans i18nKey="createSpace" defaults="Create Space" />
</DropdownMenuItem>
+ <DropdownMenuSeparator />
+ <DropdownMenuItem asChild>
+ <Link href="/settings/general">
+ <Icon>
+ <SettingsIcon />
+ </Icon>
+ <Trans i18nKey="spaceSettings" defaults="Space Settings" />
+ </Link>
+ </DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
{isPending ? <RouterLoadingIndicator /> : null}
diff --git a/apps/web/src/style.css b/apps/web/src/style.css
index a81ecb0a7..a26deb909 100644
--- a/apps/web/src/style.css
+++ b/apps/web/src/style.css
@@ -11,7 +11,7 @@
@apply border-border;
}
body {
- @apply text-foreground bg-gray-100;
+ @apply text-foreground bg-background;
font-feature-settings:
"rlig" 1,
"calt" 1;