Skip to content

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

✨ Add sheets list page + nav entry (RAL-1191) (#2394)

Luke Vellab4e56e56cd29
diff --git a/apps/web/public/locales/en/app.json b/apps/web/public/locales/en/app.json
index 58e0ff032..b998e42d4 100644
--- a/apps/web/public/locales/en/app.json
+++ b/apps/web/public/locales/en/app.json
@@ -653,5 +653,17 @@
"maxAttendeesInvalid": "Must be a positive integer",
"requiredField": "Required",
"urlInvalid": "Must be a valid URL",
- "locationDisplayTextPlaceholder": "Meeting link"
+ "locationDisplayTextPlaceholder": "Meeting link",
+ "eventTypeActionsLabel": "Event type actions",
+ "edit": "Edit",
+ "sheetUpdatedRelative": "Updated {relativeTime}",
+ "deleteEventTypeTitle": "Delete event type?",
+ "deleteEventTypeDescription": "<b>{name}</b> will be hidden from creation pickers. This cannot be undone.",
+ "deleteEventTypeError": "Failed to delete event type",
+ "editEventTypeTitle": "Edit Event Type",
+ "updateEventTypeError": "Failed to update event type",
+ "signupSheets": "Sign-up Sheets",
+ "signupSheetsEmptyTitle": "No sign-up sheets yet",
+ "signupSheetsEmptyDescription": "Create a sign-up sheet so people can book the time slots you offer.",
+ "newSignupSheet": "New Sign-up Sheet"
}
diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/sheets/page.tsx b/apps/web/src/app/[locale]/(space)/(dashboard)/sheets/page.tsx
new file mode 100644
index 000000000..f960ec4ac
--- /dev/null
+++ b/apps/web/src/app/[locale]/(space)/(dashboard)/sheets/page.tsx
@@ -0,0 +1,31 @@
+import { dehydrate, HydrationBoundary } from "@tanstack/react-query";
+import type { Metadata } from "next";
+import { notFound } from "next/navigation";
+import { getTranslation } from "@/i18n/server";
+import { isFeatureEnabled } from "@/lib/feature-flags/server";
+import { createPrivateSSRHelper } from "@/trpc/server/create-ssr-helper";
+import { SheetsPage } from "./sheets-page";
+
+export default async function Page() {
+ if (!isFeatureEnabled("signupSheets")) {
+ notFound();
+ }
+
+ const helpers = await createPrivateSSRHelper();
+ await helpers.sheets.list.prefetch();
+
+ return (
+ <HydrationBoundary state={dehydrate(helpers.queryClient)}>
+ <SheetsPage />
+ </HydrationBoundary>
+ );
+}
+
+export async function generateMetadata(): Promise<Metadata> {
+ const { t } = await getTranslation();
+ return {
+ title: t("signupSheets", {
+ defaultValue: "Sign-up Sheets",
+ }),
+ };
+}
diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/sheets/sheets-page.tsx b/apps/web/src/app/[locale]/(space)/(dashboard)/sheets/sheets-page.tsx
new file mode 100644
index 000000000..18551bea4
--- /dev/null
+++ b/apps/web/src/app/[locale]/(space)/(dashboard)/sheets/sheets-page.tsx
@@ -0,0 +1,136 @@
+"use client";
+
+import { buttonVariants } from "@rallly/ui";
+import { shortUrl } from "@rallly/utils/absolute-url";
+import { ClipboardListIcon, PlusIcon } from "lucide-react";
+import Link from "next/link";
+import {
+ PageContainer,
+ PageContent,
+ PageHeader,
+ PageHeaderActions,
+ PageHeaderContent,
+ PageTitle,
+} from "@/app/components/page-layout";
+import { CopyLinkButton } from "@/components/copy-link-button";
+import {
+ EmptyState,
+ EmptyStateDescription,
+ EmptyStateFooter,
+ EmptyStateIcon,
+ EmptyStateTitle,
+} from "@/components/empty-state";
+import { HoverPrefetchLink } from "@/components/hover-prefetch-link";
+import { StackedList, StackedListItem } from "@/components/stacked-list";
+import { Trans } from "@/i18n/client";
+import { dayjs } from "@/lib/dayjs";
+import { trpc } from "@/trpc/client";
+
+function SheetsEmptyState() {
+ return (
+ <EmptyState className="h-96">
+ <EmptyStateIcon>
+ <ClipboardListIcon />
+ </EmptyStateIcon>
+ <EmptyStateTitle>
+ <Trans
+ i18nKey="signupSheetsEmptyTitle"
+ defaults="No sign-up sheets yet"
+ />
+ </EmptyStateTitle>
+ <EmptyStateDescription>
+ <Trans
+ i18nKey="signupSheetsEmptyDescription"
+ defaults="Create a sign-up sheet so people can book the time slots you offer."
+ />
+ </EmptyStateDescription>
+ <EmptyStateFooter>
+ <Link
+ href="/sheets/new"
+ className={buttonVariants({ variant: "primary" })}
+ >
+ <PlusIcon data-icon="inline-start" />
+ <Trans i18nKey="newSignupSheet" defaults="New Sign-up Sheet" />
+ </Link>
+ </EmptyStateFooter>
+ </EmptyState>
+ );
+}
+
+function SheetListItem({
+ id,
+ title,
+ urlId,
+ updatedAt,
+}: {
+ id: string;
+ title: string;
+ urlId: string;
+ updatedAt: Date;
+}) {
+ return (
+ <StackedListItem>
+ <div className="relative -m-4 flex min-w-0 flex-1 items-center gap-2 p-4">
+ <HoverPrefetchLink
+ className="min-w-0 text-sm hover:underline focus:ring-ring focus-visible:ring-2"
+ href={`/sheets/${id}`}
+ >
+ <span className="absolute inset-0" />
+ <span className="block truncate font-medium">{title}</span>
+ </HoverPrefetchLink>
+ </div>
+ <div className="flex items-center gap-4">
+ <span className="hidden text-muted-foreground text-sm sm:inline">
+ <Trans
+ i18nKey="sheetUpdatedRelative"
+ defaults="Updated {relativeTime}"
+ values={{ relativeTime: dayjs(updatedAt).fromNow() }}
+ />
+ </span>
+ <CopyLinkButton href={shortUrl(`/sheet/${urlId}`)} />
+ </div>
+ </StackedListItem>
+ );
+}
+
+export function SheetsPage() {
+ const [{ sheets }] = trpc.sheets.list.useSuspenseQuery();
+
+ return (
+ <PageContainer>
+ <PageHeader>
+ <PageHeaderContent>
+ <PageTitle>
+ <Trans i18nKey="signupSheets" defaults="Sign-up Sheets" />
+ </PageTitle>
+ </PageHeaderContent>
+ <PageHeaderActions>
+ <Link
+ href="/sheets/new"
+ className={buttonVariants({ variant: "primary" })}
+ >
+ <PlusIcon data-icon="inline-start" />
+ <Trans i18nKey="newSignupSheet" defaults="New Sign-up Sheet" />
+ </Link>
+ </PageHeaderActions>
+ </PageHeader>
+ <PageContent>
+ {sheets.length === 0 ? (
+ <SheetsEmptyState />
+ ) : (
+ <StackedList>
+ {sheets.map((sheet) => (
+ <SheetListItem
+ key={sheet.id}
+ id={sheet.id}
+ title={sheet.title}
+ urlId={sheet.urlId}
+ updatedAt={sheet.updatedAt}
+ />
+ ))}
+ </StackedList>
+ )}
+ </PageContent>
+ </PageContainer>
+ );
+}
diff --git a/apps/web/src/features/navigation/config.tsx b/apps/web/src/features/navigation/config.tsx
index 6e7c05f8e..40f7485f6 100644
--- a/apps/web/src/features/navigation/config.tsx
+++ b/apps/web/src/features/navigation/config.tsx
@@ -5,6 +5,7 @@ import {
BarChart2Icon,
CalendarDaysIcon,
CalendarIcon,
+ ClipboardListIcon,
HomeIcon,
ShapesIcon,
} from "lucide-react";
@@ -39,6 +40,7 @@ export const useSpaceMenu = () => {
const pathname = usePathname();
const isCalendarsEnabled = useFeatureFlag("calendars");
const isEventTypesEnabled = useFeatureFlag("eventTypes");
+ const isSignupSheetsEnabled = useFeatureFlag("signupSheets");
const config = React.useMemo<NavigationConfig>(
() => ({
sections: [
@@ -96,11 +98,31 @@ export const useSpaceMenu = () => {
},
]
: []),
+ ...(isSignupSheetsEnabled
+ ? [
+ {
+ id: "sheets",
+ label: t("signupSheets", {
+ defaultValue: "Sign-up Sheets",
+ }),
+ href: "/sheets",
+ icon: ClipboardListIcon,
+ isActive:
+ pathname === "/sheets" || pathname.startsWith("/sheets/"),
+ },
+ ]
+ : []),
],
},
],
}),
- [pathname, t, isCalendarsEnabled, isEventTypesEnabled],
+ [
+ pathname,
+ t,
+ isCalendarsEnabled,
+ isEventTypesEnabled,
+ isSignupSheetsEnabled,
+ ],
);
return React.useMemo(
diff --git a/packages/database/prisma/seed.ts b/packages/database/prisma/seed.ts
index 64f4523c9..857aede60 100644
--- a/packages/database/prisma/seed.ts
+++ b/packages/database/prisma/seed.ts
@@ -4,6 +4,7 @@ import {
eventTypes,
polls,
scheduledEvents,
+ sheets,
spaceMembers,
spaces,
users,
@@ -190,6 +191,20 @@ async function main() {
})),
});
console.info(`✓ ${eventTypes.length} event types`);
+
+ // 7. Sheets
+ await prisma.sheet.createMany({
+ data: sheets.map((sheet, i) => ({
+ id: sheet.id,
+ spaceId: sheet.spaceId,
+ hostId: sheet.hostId,
+ title: sheet.title,
+ description: sheet.description,
+ urlId: sheet.urlId,
+ updatedAt: new Date(now - i * 60_000),
+ })),
+ });
+ console.info(`✓ ${sheets.length} sheets`);
}
main()
diff --git a/packages/database/prisma/seed/data.ts b/packages/database/prisma/seed/data.ts
index 2cc94940b..910c4664e 100644
--- a/packages/database/prisma/seed/data.ts
+++ b/packages/database/prisma/seed/data.ts
@@ -1020,6 +1020,61 @@ export type EventTypeDef = {
location: EventTypeLocation | null;
};
+export type SheetDef = {
+ id: string;
+ spaceId: string;
+ hostId: string;
+ title: string;
+ description: string | null;
+ urlId: string;
+};
+
+export const sheets: SheetDef[] = [
+ // ── Personal space (space-1) ─────────────────────────────────────────────
+ {
+ id: "sheet-1",
+ spaceId: "space-1",
+ hostId: "user-1",
+ title: "Coffee chat sign-ups",
+ description: "Pick a slot for a 30 minute coffee chat next week.",
+ urlId: "personal-coffee-chats",
+ },
+ {
+ id: "sheet-2",
+ spaceId: "space-1",
+ hostId: "user-1",
+ title: "Mentorship office hours",
+ description: null,
+ urlId: "personal-mentorship",
+ },
+
+ // ── Acme Inc (space-2) ───────────────────────────────────────────────────
+ {
+ id: "sheet-3",
+ spaceId: "space-2",
+ hostId: "user-3",
+ title: "Engineering office hours",
+ description: "Drop in for help with code reviews or architecture.",
+ urlId: "acme-eng-office-hours",
+ },
+ {
+ id: "sheet-4",
+ spaceId: "space-2",
+ hostId: "user-2",
+ title: "Design critique slots",
+ description: "30 minute critiques of in-progress designs.",
+ urlId: "acme-design-critiques",
+ },
+ {
+ id: "sheet-5",
+ spaceId: "space-2",
+ hostId: "user-1",
+ title: "New hire intro chats",
+ description: "Welcome chat with our newest team members.",
+ urlId: "acme-new-hire-intros",
+ },
+];
+
export const eventTypes: EventTypeDef[] = [
// ── Personal space (space-1) ─────────────────────────────────────────────
{