Skip to content

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

💄 Redesign the polls, events, members and home pages as list views (#3349)

Luke Vella7bd3281a9a22
diff --git a/apps/web/biome.json b/apps/web/biome.json
index 30b695ac1..97d2ef478 100644
--- a/apps/web/biome.json
+++ b/apps/web/biome.json
@@ -356,7 +356,6 @@
"src/features/poll/components/types.ts",
"src/features/poll/components/vote-icon.tsx",
"src/features/poll/components/vote-selector.tsx",
- "src/features/scheduled-event/components/scheduled-event-list.tsx",
"src/features/scheduled-event/utils.ts",
"src/features/setup/utils.ts",
"src/features/space/actions.ts",
diff --git a/apps/web/public/locales/en/app.json b/apps/web/public/locales/en/app.json
index 36f6c29b6..36bda3454 100644
--- a/apps/web/public/locales/en/app.json
+++ b/apps/web/public/locales/en/app.json
@@ -305,7 +305,6 @@
"emailMismatch": "Email does not match the account email",
"emailPlaceholder": "[email protected]",
"enabled": "Enabled",
- "endOfList": "You've reached the end of the list",
"errorBackToHome": "Back to home",
"errorDescription": "An unexpected error occurred. Please try again or visit one of the pages below.",
"errorLabel": "Error",
@@ -329,6 +328,11 @@
"eventRegisterSuccessTitle": "You're registered",
"eventRegisterYourDetails": "Your details",
"events": "Events",
+ "eventsListActions": "Actions",
+ "eventsListAttendees": "Attendees",
+ "eventsListHost": "Host",
+ "eventsListStatusFilter": "Filter by status",
+ "eventsListTime": "Time",
"eventStatusCanceled": "Canceled",
"eventStatusPast": "Past",
"eventStatusUnconfirmed": "Unconfirmed",
@@ -520,6 +524,11 @@
"members": "Members",
"membersInactiveAlertDescription": "These members lost access when this space's Pro subscription ended. Their seats are kept and access is restored when the space is upgraded again.",
"membersInactiveAlertTitle": "Members are inactive",
+ "membersListActions": "Actions",
+ "membersListAvatar": "Avatar",
+ "membersListEmail": "Email",
+ "membersListName": "Name",
+ "membersListRole": "Role",
"membersSettingsDescription": "Manage space members, invite new users, and control access permissions.",
"microsoft365": "Microsoft 365",
"minutesAbbreviation": "min",
@@ -530,7 +539,6 @@
"mixedOptionsTitle": "Wait a minute… 🤔",
"monthView": "Month view",
"moreOptions": "More options",
- "moreParticipants": "{count, plural, other {# more…}}",
"muteNotifications": "Mute notifications",
"mutePollConfirmDescription": "You will stop receiving emails about new responses and comments on <b>{pollTitle}</b>. Your other polls are not affected.",
"mutePollConfirmTitle": "Mute this poll?",
@@ -716,6 +724,11 @@
"pollRemovedWarningTitle": "Weren't expecting this link?",
"pollReopened": "Poll reopened",
"polls": "Polls",
+ "pollsListActions": "Actions",
+ "pollsListDates": "Dates",
+ "pollsListOrganizer": "Organizer",
+ "pollsListStatus": "Status",
+ "pollsListStatusFilter": "Filter by status",
"pollStatusCanceled": "Canceled",
"pollStatusClosed": "Closed",
"pollStatusOpen": "Open",
@@ -814,6 +827,7 @@
"scrollLeft": "Scroll left",
"scrollRight": "Scroll right",
"searchEventsPlaceholder": "Search events by title...",
+ "searching": "Searching…",
"searchPollsPlaceholder": "Search polls by title...",
"searchUsers": "Search users...",
"seatCount": "{count, plural, one {# seat} other {# seats}}",
diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/dashboard-home.tsx b/apps/web/src/app/[locale]/(space)/(dashboard)/dashboard-home.tsx
index eced14fc0..9789b3339 100644
--- a/apps/web/src/app/[locale]/(space)/(dashboard)/dashboard-home.tsx
+++ b/apps/web/src/app/[locale]/(space)/(dashboard)/dashboard-home.tsx
@@ -1,6 +1,13 @@
import { Tile, TileDescription, TileGrid, TileTitle } from "@rallly/ui/tile";
import { Trans } from "react-i18next/TransWithoutContext";
import { HoverPrefetchLink } from "@/components/hover-prefetch-link";
+import {
+ ListView,
+ ListViewContent,
+ ListViewHeader,
+ ListViewTitle,
+ ListViewTitleBar,
+} from "@/components/list-view";
import {
BillingPageIcon,
CreatePageIcon,
@@ -9,12 +16,6 @@ import {
PollPageIcon,
SettingsPageIcon,
} from "@/components/page-icons";
-import {
- PageContainer,
- PageContent,
- PageHeader,
- PageTitle,
-} from "@/components/page-layout";
import { getTranslation } from "@/i18n/server";
import { isFeatureEnabled } from "@/lib/feature-flags/server";
import { PasswordSetupAlert } from "./password-setup-alert";
@@ -39,13 +40,15 @@ export async function DashboardHome({
const { t, i18n } = await getTranslation();
return (
- <PageContainer>
- <PageHeader>
- <PageTitle>
- <Trans t={t} i18n={i18n} ns="app" i18nKey="home" defaults="Home" />
- </PageTitle>
- </PageHeader>
- <PageContent className="space-y-8">
+ <ListView>
+ <ListViewHeader>
+ <ListViewTitleBar>
+ <ListViewTitle>
+ <Trans t={t} i18n={i18n} ns="app" i18nKey="home" defaults="Home" />
+ </ListViewTitle>
+ </ListViewTitleBar>
+ </ListViewHeader>
+ <ListViewContent className="space-y-8 px-4 pt-4 pb-8 md:pl-6">
{hasNoAccounts && isFeatureEnabled("emailLogin") ? (
<PasswordSetupAlert />
) : null}
@@ -207,7 +210,7 @@ export async function DashboardHome({
) : null}
</TileGrid>
</div>
- </PageContent>
- </PageContainer>
+ </ListViewContent>
+ </ListView>
);
}
diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/events/events-infinite-list.tsx b/apps/web/src/app/[locale]/(space)/(dashboard)/events/events-infinite-list.tsx
index 342d03992..eaf162935 100644
--- a/apps/web/src/app/[locale]/(space)/(dashboard)/events/events-infinite-list.tsx
+++ b/apps/web/src/app/[locale]/(space)/(dashboard)/events/events-infinite-list.tsx
@@ -1,20 +1,183 @@
"use client";
-import { StickerIcon } from "lucide-react";
+import { cn } from "@rallly/ui";
+import { Skeleton } from "@rallly/ui/skeleton";
+import { Tooltip, TooltipContent, TooltipTrigger } from "@rallly/ui/tooltip";
+import {
+ createColumnHelper,
+ getCoreRowModel,
+ useReactTable,
+} from "@tanstack/react-table";
+import { UsersIcon } from "lucide-react";
import React from "react";
+import { DataList } from "@/components/data-list";
+import { ListViewContent } from "@/components/list-view";
+import { OptimizedAvatarImage } from "@/components/optimized-avatar-image";
import { Spinner } from "@/components/spinner";
-import { StackedList, StackedListItem } from "@/components/stacked-list";
-import { ScheduledEventListItem } from "@/features/scheduled-event/components/scheduled-event-list";
-import type { Status } from "@/features/scheduled-event/schema";
+import { EventTimeRange } from "@/features/scheduled-event/components/event-date-time";
+import { ScheduledEventRowActions } from "@/features/scheduled-event/components/scheduled-event-row";
+import type {
+ ScheduledEventStatus,
+ Status,
+} from "@/features/scheduled-event/schema";
import { Trans } from "@/i18n/client";
+import { CalendarDate } from "@/lib/datetime/calendar-date";
+import { useDateTimeConfig } from "@/lib/datetime/client";
+import type { DateInput } from "@/lib/datetime/types";
+import {
+ calendarDateToUTCMidnight,
+ getCalendarDate,
+} from "@/lib/datetime/utils";
import { getBrowserTimeZone } from "@/lib/utils/date-time-utils";
import { trpc } from "@/trpc/client";
-interface EventsInfiniteListProps {
- status?: Status;
- search?: string;
- member?: string;
- emptyState: React.ReactNode;
+type EventRow = {
+ id: string;
+ title: string;
+ status: ScheduledEventStatus;
+ start: DateInput;
+ end: DateInput;
+ allDay: boolean;
+ timeZone: string | null;
+ invites: { id: string }[];
+ createdBy: { name: string; image?: string };
+};
+
+const columnHelper = createColumnHelper<EventRow>();
+
+const columns = [
+ columnHelper.accessor("end", {
+ header: () => <Trans i18nKey="eventsListTime" defaults="Time" />,
+ meta: {
+ className:
+ "justify-end whitespace-nowrap text-right text-muted-foreground text-sm tabular-nums",
+ },
+ cell: ({ row }) => (
+ <EventTimeRange
+ start={row.original.start}
+ end={row.original.end}
+ allDay={row.original.allDay}
+ timeZone={row.original.timeZone}
+ />
+ ),
+ }),
+ columnHelper.accessor("title", {
+ header: () => <Trans i18nKey="title" defaults="Title" />,
+ cell: ({ row }) => (
+ <span
+ className={cn("truncate text-sm", {
+ "text-muted-foreground line-through":
+ row.original.status === "canceled",
+ })}
+ >
+ {row.original.title}
+ </span>
+ ),
+ }),
+ columnHelper.accessor((event) => event.invites.length, {
+ id: "attendees",
+ header: () => <Trans i18nKey="eventsListAttendees" defaults="Attendees" />,
+ meta: {
+ className: "hidden justify-end text-muted-foreground text-sm sm:flex",
+ },
+ cell: ({ getValue }) => (
+ <span className="flex items-center gap-1.5 tabular-nums">
+ <UsersIcon aria-hidden className="size-4" />
+ <span aria-hidden>{getValue()}</span>
+ <span className="sr-only">
+ <Trans
+ i18nKey="attendeeCount"
+ defaults="{count, plural, =0 {No attendees} one {1 attendee} other {# attendees}}"
+ values={{ count: getValue() }}
+ />
+ </span>
+ </span>
+ ),
+ }),
+ columnHelper.accessor("createdBy", {
+ header: () => <Trans i18nKey="eventsListHost" defaults="Host" />,
+ meta: { className: "hidden sm:flex" },
+ cell: ({ getValue }) => (
+ <Tooltip>
+ <TooltipTrigger className="relative z-10">
+ <OptimizedAvatarImage
+ size="sm"
+ name={getValue().name}
+ src={getValue().image}
+ />
+ </TooltipTrigger>
+ <TooltipContent>{getValue().name}</TooltipContent>
+ </Tooltip>
+ ),
+ }),
+ columnHelper.display({
+ id: "actions",
+ header: () => <Trans i18nKey="eventsListActions" defaults="Actions" />,
+ cell: ({ row }) => (
+ <ScheduledEventRowActions
+ eventId={row.original.id}
+ status={row.original.status}
+ />
+ ),
+ }),
+];
+
+/**
+ * The calendar day an event falls on, as YYYY-MM-DD. All-day and floating
+ * events are stored as UTC wall time; fixed instants use the viewer's zone.
+ */
+function getDayKey(event: EventRow, viewerTimeZone: string) {
+ const timeZone =
+ event.allDay || event.timeZone === null ? "UTC" : viewerTimeZone;
+ return getCalendarDate(new Date(event.start), timeZone);
+}
+
+/**
+ * Groups events by day, keeping the order the days arrive in, with all-day
+ * events first within each day and the rest by start time.
+ */
+function groupByDay(events: EventRow[], viewerTimeZone: string) {
+ const days = new Map<string, EventRow[]>();
+ for (const event of events) {
+ const key = getDayKey(event, viewerTimeZone);
+ const day = days.get(key);
+ if (day) {
+ day.push(event);
+ } else {
+ days.set(key, [event]);
+ }
+ }
+ const dayKeyById = new Map<string, string>();
+ const sorted: EventRow[] = [];
+ for (const [key, day] of days) {
+ day.sort(
+ (a, b) =>
+ Number(b.allDay) - Number(a.allDay) ||
+ new Date(a.start).getTime() - new Date(b.start).getTime(),
+ );
+ for (const event of day) {
+ dayKeyById.set(event.id, key);
+ sorted.push(event);
+ }
+ }
+ return { sorted, dayKeyById };
+}
+
+function EventsListSkeleton() {
+ return (
+ <div aria-hidden className="py-2">
+ {Array.from({ length: 6 }).map((_, i) => (
+ <div
+ // biome-ignore lint/suspicious/noArrayIndexKey: static placeholders
+ key={i}
+ className="flex h-12 items-center gap-3 px-8"
+ >
+ <Skeleton className="size-4 rounded-full" />
+ <Skeleton className="h-4 w-48" />
+ </div>
+ ))}
+ </div>
+ );
}
export function EventsInfiniteList({
@@ -22,7 +185,14 @@ export function EventsInfiniteList({
search,
member,
emptyState,
-}: EventsInfiniteListProps) {
+}: {
+ status?: Status;
+ search?: string;
+ member?: string;
+ emptyState: React.ReactNode;
+}) {
+ // Classifying upcoming/past depends on the viewer's clock and zone, so this
+ // list is fetched on the client only (never server-prefetched).
const {
data,
error,
@@ -42,7 +212,23 @@ export function EventsInfiniteList({
},
);
- const events = data?.pages?.flatMap((page) => page.events) ?? [];
+ const events = React.useMemo(
+ () => data?.pages.flatMap((page) => page.events) ?? [],
+ [data],
+ );
+
+ const viewerTimeZone = useDateTimeConfig().timeZone ?? getBrowserTimeZone();
+ const { sorted, dayKeyById } = React.useMemo(
+ () => groupByDay(events, viewerTimeZone),
+ [events, viewerTimeZone],
+ );
+
+ const table = useReactTable({
+ data: sorted,
+ columns,
+ getCoreRowModel: getCoreRowModel(),
+ getRowId: (event) => event.id,
+ });
const loadMoreRef = React.useRef<HTMLDivElement>(null);
@@ -76,39 +262,53 @@ export function EventsInfiniteList({
}, [handleLoadMore]);
if (queryStatus === "pending") {
- return <Spinner />;
+ return (
+ <ListViewContent>
+ <EventsListSkeleton />
+ </ListViewContent>
+ );
}
if (queryStatus === "error") {
return (
- <div className="py-8 text-center text-red-600">
- Error loading events: {error?.message}
- </div>
+ <ListViewContent>
+ <div className="py-8 text-center text-red-600">
+ Error loading events: {error?.message}
+ </div>
+ </ListViewContent>
);
}
if (events.length === 0) {
- return <>{emptyState}</>;
+ return <ListViewContent>{emptyState}</ListViewContent>;
}
return (
- <StackedList>
- {events.map((event) => (
- <StackedListItem key={event.id}>
- <ScheduledEventListItem
- eventId={event.id}
- title={event.title}
- start={event.start}
- timeZone={event.timeZone}
- end={event.end}
- allDay={event.allDay}
- invites={event.invites}
- status={event.status}
- createdBy={event.createdBy}
- />
- </StackedListItem>
- ))}
-
+ <ListViewContent>
+ <DataList
+ table={table}
+ getGroup={(event) => {
+ const key = dayKeyById.get(event.id) ?? "";
+ return {
+ id: key,
+ label: (
+ <>
+ <CalendarDate
+ value={calendarDateToUTCMidnight(key)}
+ preset="weekday"
+ className="font-medium text-foreground"
+ />
+ <CalendarDate
+ value={calendarDateToUTCMidnight(key)}
+ preset="dateLong"
+ className="text-muted-foreground"
+ />
+ </>
+ ),
+ };
+ }}
+ className="grid-cols-[auto_minmax(0,1fr)_auto] sm:grid-cols-[auto_minmax(0,1fr)_auto_auto_auto]"
+ />
{hasNextPage && (
<div ref={loadMoreRef} className="flex justify-center py-4">
{isFetchingNextPage && (
@@ -121,16 +321,6 @@ export function EventsInfiniteList({
)}
</div>
)}
-
- {!hasNextPage && data.pages.length > 1 && (
- <div className="flex items-center justify-center gap-2 py-4 text-muted-foreground text-sm">
- <StickerIcon className="size-4 shrink-0 text-muted-foreground" />
- <Trans
- i18nKey="endOfList"
- defaults="You've reached the end of the list"
- />
- </div>
- )}
- </StackedList>
+ </ListViewContent>
);
}
diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/events/events-page.tsx b/apps/web/src/app/[locale]/(space)/(dashboard)/events/events-page.tsx
index 7087165d7..074557322 100644
--- a/apps/web/src/app/[locale]/(space)/(dashboard)/events/events-page.tsx
+++ b/apps/web/src/app/[locale]/(space)/(dashboard)/events/events-page.tsx
@@ -1,7 +1,6 @@
"use client";
import { CalendarIcon } from "lucide-react";
-import dynamic from "next/dynamic";
import { useSearchParams } from "next/navigation";
import type React from "react";
import {
@@ -10,21 +9,21 @@ import {
EmptyStateIcon,
EmptyStateTitle,
} from "@/components/empty-state";
-import { MemberSelector } from "@/components/member-selector";
+import { FilterPills } from "@/components/filter-pills";
import {
- PageContainer,
- PageContent,
- PageHeader,
- PageSkeleton,
- PageTitle,
-} from "@/components/page-layout";
+ ListView,
+ ListViewHeader,
+ ListViewTitle,
+ ListViewTitleBar,
+ ListViewToolbar,
+} from "@/components/list-view";
+import { MemberSelector } from "@/components/member-selector";
import { SearchInput } from "@/components/search-input";
import type { Status } from "@/features/scheduled-event/schema";
import { useSpace } from "@/features/space/client";
import { Trans, useTranslation } from "@/i18n/client";
import { trpc } from "@/trpc/client";
import { EventsInfiniteList } from "./events-infinite-list";
-import { EventsTabbedView } from "./events-tabbed-view";
import { eventsSearchParamsSchema } from "./schema";
function EventsEmptyState({ status }: { status: Status }) {
@@ -100,7 +99,7 @@ function EventsEmptyState({ status }: { status: Status }) {
);
}
-function EventsPageContent() {
+export function EventsPage() {
const searchParams = useSearchParams();
const { t } = useTranslation();
const { data: space } = useSpace();
@@ -118,35 +117,57 @@ function EventsPageContent() {
const visibleMember = showMemberFilter ? member : undefined;
return (
- <PageContainer>
- <PageHeader>
- <PageTitle>
- <Trans i18nKey="events" defaults="Events" />
- </PageTitle>
- </PageHeader>
- <PageContent>
- <EventsTabbedView>
- <div className="mb-4 flex gap-x-2">
+ <ListView>
+ <ListViewHeader>
+ <ListViewTitleBar>
+ <ListViewTitle>
+ <Trans i18nKey="events" defaults="Events" />
+ </ListViewTitle>
+ </ListViewTitleBar>
+ <ListViewToolbar>
+ <FilterPills
+ param="status"
+ value={status}
+ label={t("eventsListStatusFilter", {
+ defaultValue: "Filter by status",
+ })}
+ options={[
+ {
+ value: "upcoming",
+ label: <Trans i18nKey="upcoming" defaults="Upcoming" />,
+ },
+ {
+ value: "past",
+ label: <Trans i18nKey="past" defaults="Past" />,
+ },
+ {
+ value: "canceled",
+ label: <Trans i18nKey="canceled" defaults="Canceled" />,
+ },
+ ]}
+ />
+ <div className="flex w-full items-center gap-2 sm:ml-auto sm:w-auto">
<SearchInput
+ className="w-auto min-w-0 flex-1 sm:w-56 sm:flex-none"
placeholder={t("searchEventsPlaceholder", {
defaultValue: "Search events by title...",
})}
/>
- {showMemberFilter ? <MemberSelector members={members} /> : null}
+ {showMemberFilter ? (
+ <MemberSelector
+ members={members}
+ className="min-w-0 sm:min-w-40"
+ />
+ ) : null}
</div>
- <EventsInfiniteList
- status={status}
- search={q}
- member={visibleMember}
- emptyState={<EventsEmptyState status={status || "upcoming"} />}
- />
- </EventsTabbedView>
- </PageContent>
- </PageContainer>
+ </ListViewToolbar>
+ </ListViewHeader>
+ <EventsInfiniteList
+ status={status}
+ search={q}
+ member={visibleMember}
+ emptyState={<EventsEmptyState status={status} />}
+ />
+ </ListView>
);
}
-
-export const EventsPage = dynamic(() => Promise.resolve(EventsPageContent), {
- ssr: false,
- loading: () => <PageSkeleton />,
-});
diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/events/events-tabbed-view.tsx b/apps/web/src/app/[locale]/(space)/(dashboard)/events/events-tabbed-view.tsx
deleted file mode 100644
index a53e7175b..000000000
--- a/apps/web/src/app/[locale]/(space)/(dashboard)/events/events-tabbed-view.tsx
+++ /dev/null
@@ -1,61 +0,0 @@
-"use client";
-import { cn } from "@rallly/ui";
-import { Tabs, TabsContent, TabsList, TabsTrigger } from "@rallly/ui/page-tabs";
-import { useRouter, useSearchParams } from "next/navigation";
-import React from "react";
-
-import { Trans } from "@/i18n/client";
-
-export function EventsTabbedView({ children }: { children: React.ReactNode }) {
- const searchParams = useSearchParams();
- const name = "status";
- const router = useRouter();
- const [isPending, startTransition] = React.useTransition();
- const [tab, setTab] = React.useState(searchParams.get(name) ?? "upcoming");
- const handleTabChange = React.useCallback(
- (value: string) => {
- const params = new URLSearchParams(searchParams);
- params.set(name, value);
-
- params.delete("page");
-
- setTab(value);
-
- startTransition(() => {
- const newUrl = `?${params.toString()}`;
- router.replace(newUrl, { scroll: false });
- });
- },
- [router, searchParams],
- );
-
- return (
- <Tabs value={tab} onValueChange={handleTabChange}>
- <TabsList>
- <TabsTrigger value="upcoming">
- <Trans i18nKey="upcoming" defaults="Upcoming" />
- </TabsTrigger>
- <TabsTrigger value="past">
- <Trans i18nKey="past" defaults="Past" />
- </TabsTrigger>
- <TabsTrigger value="canceled">
- <Trans i18nKey="canceled" defaults="Canceled" />
- </TabsTrigger>
- </TabsList>
- <TabsContent
- tabIndex={-1}
- value={tab}
- key={tab}
- aria-busy={isPending}
- className={cn(
- isPending ? "pointer-events-none animate-pulse opacity-50" : "",
- )}
- >
- {children}
- </TabsContent>
- <output aria-live="polite" className="sr-only">
- {isPending ? <Trans i18nKey="loading" defaults="Loading..." /> : null}
- </output>
- </Tabs>
- );
-}
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 15441c569..bc93f2305 100644
--- a/apps/web/src/app/[locale]/(space)/(dashboard)/events/page.tsx
+++ b/apps/web/src/app/[locale]/(space)/(dashboard)/events/page.tsx
@@ -1,30 +1,15 @@
import { dehydrate, HydrationBoundary } from "@tanstack/react-query";
import type { Metadata } from "next";
import { getTranslation } from "@/i18n/server";
-import { getBrowserTimeZone } from "@/lib/utils/date-time-utils";
import { createPrivateSSRHelper } from "@/trpc/server/create-ssr-helper";
import { EventsPage } from "./events-page";
-import { eventsSearchParamsSchema } from "./schema";
-
-export default async function Page(props: {
- searchParams?: Promise<{ [key: string]: string | string[] | undefined }>;
-}) {
- const searchParams = await props.searchParams;
- const { status, q, member } = eventsSearchParamsSchema.parse(searchParams);
+export default async function Page() {
const helpers = await createPrivateSSRHelper();
- await Promise.all([
- helpers.spaces.listMembers.prefetch(),
- helpers.events.infiniteList.prefetchInfinite({
- status,
- search: q,
- member,
- // Server zone, matching what the SSR pass of EventsInfiniteList
- // computes; the client refetches with the browser zone if it differs.
- timeZone: getBrowserTimeZone(),
- }),
- ]);
+ // The events list itself is fetched on the client: upcoming/past depends on
+ // the viewer's clock and zone, which the server doesn't know.
+ await helpers.spaces.listMembers.prefetch();
return (
<HydrationBoundary state={dehydrate(helpers.queryClient)}>
diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/layout.tsx b/apps/web/src/app/[locale]/(space)/(dashboard)/layout.tsx
index ddb07ffef..bdfc2a840 100644
--- a/apps/web/src/app/[locale]/(space)/(dashboard)/layout.tsx
+++ b/apps/web/src/app/[locale]/(space)/(dashboard)/layout.tsx
@@ -89,11 +89,14 @@ export default async function Layout({
<NavUser />
</SidebarFooter>
</Sidebar>
- <SidebarInset id="main-content" tabIndex={-1} className="min-w-0">
+ {/* Bounded to the viewport so a page can own its scroll area (list
+ views scroll their rows under a fixed header); other pages scroll
+ the wrapper below instead of the window. */}
+ <SidebarInset id="main-content" tabIndex={-1} className="h-svh min-w-0">
<LicenseLimitWarning />
<PastDueAlert />
- <div className="flex flex-1 flex-col">
- <div className="flex flex-1 flex-col">{children}</div>
+ <div className="flex min-h-0 flex-1 flex-col overflow-y-auto">
+ <div className="flex min-h-0 flex-1 flex-col">{children}</div>
</div>
</SidebarInset>
</SpaceSidebarProvider>
diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/members/components/member-dropdown-menu.tsx b/apps/web/src/app/[locale]/(space)/(dashboard)/members/components/member-dropdown-menu.tsx
index df658b743..787b4811b 100644
--- a/apps/web/src/app/[locale]/(space)/(dashboard)/members/components/member-dropdown-menu.tsx
+++ b/apps/web/src/app/[locale]/(space)/(dashboard)/members/components/member-dropdown-menu.tsx
@@ -19,7 +19,7 @@ import {
DropdownMenuTrigger,
} from "@rallly/ui/dropdown-menu";
import { toast } from "@rallly/ui/sonner";
-import { MoreVerticalIcon, ShieldIcon, UserIcon, XIcon } from "lucide-react";
+import { MoreHorizontalIcon, ShieldIcon, UserIcon, XIcon } from "lucide-react";
import {
changeMemberRoleAction,
removeMemberAction,
@@ -78,10 +78,11 @@ export function MemberDropdownMenu({
aria-label={t("moreOptions", { defaultValue: "More options" })}
variant="ghost"
size="icon"
+ className="size-8"
/>
}
>
- <MoreVerticalIcon className="text-muted-foreground" />
+ <MoreHorizontalIcon />
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
{member.role === "member" ? (
diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/members/components/members-list.tsx b/apps/web/src/app/[locale]/(space)/(dashboard)/members/components/members-list.tsx
new file mode 100644
index 000000000..391a025dc
--- /dev/null
+++ b/apps/web/src/app/[locale]/(space)/(dashboard)/members/components/members-list.tsx
@@ -0,0 +1,104 @@
+"use client";
+
+import { Badge } from "@rallly/ui/badge";
+import {
+ createColumnHelper,
+ getCoreRowModel,
+ useReactTable,
+} from "@tanstack/react-table";
+import { DataList } from "@/components/data-list";
+import { OptimizedAvatarImage } from "@/components/optimized-avatar-image";
+import { SpaceRole } from "@/features/space/components/space-role";
+import type { MemberDTO } from "@/features/space/member/types";
+import { Trans } from "@/i18n/client";
+import { MemberDropdownMenu } from "./member-dropdown-menu";
+
+type MemberRow = {
+ member: MemberDTO;
+ canUpdate: boolean;
+ canDelete: boolean;
+ inactive: boolean;
+};
+
+const columnHelper = createColumnHelper<MemberRow>();
+
+const columns = [
+ columnHelper.accessor((row) => row.member.name, {
+ id: "avatar",
+ header: () => <Trans i18nKey="membersListAvatar" defaults="Avatar" />,
+ cell: ({ row }) => (
+ <OptimizedAvatarImage
+ src={row.original.member.image}
+ name={row.original.member.name}
+ size="sm"
+ />
+ ),
+ }),
+ columnHelper.accessor((row) => row.member.name, {
+ id: "name",
+ header: () => <Trans i18nKey="membersListName" defaults="Name" />,
+ meta: { className: "gap-2" },
+ cell: ({ row }) => (
+ <>
+ <span className="truncate text-sm">{row.original.member.name}</span>
+ {row.original.member.isOwner ? (
+ <Badge size="sm" className="shrink-0">
+ <Trans i18nKey="owner" defaults="Owner" />
+ </Badge>
+ ) : null}
+ {row.original.inactive ? (
+ <Badge size="sm" className="shrink-0">
+ <Trans i18nKey="memberInactive" defaults="Inactive" />
+ </Badge>
+ ) : null}
+ </>
+ ),
+ }),
+ columnHelper.accessor((row) => row.member.email, {
+ id: "email",
+ header: () => <Trans i18nKey="membersListEmail" defaults="Email" />,
+ meta: {
+ className: "hidden justify-end text-muted-foreground text-sm md:flex",
+ },
+ cell: ({ getValue }) => <span className="truncate">{getValue()}</span>,
+ }),
+ columnHelper.accessor((row) => row.member.role, {
+ id: "role",
+ header: () => <Trans i18nKey="membersListRole" defaults="Role" />,
+ meta: {
+ className: "hidden justify-end text-muted-foreground text-sm sm:flex",
+ },
+ cell: ({ getValue }) => (
+ <Badge variant={getValue() === "admin" ? "secondary" : "default"}>
+ <SpaceRole role={getValue()} />
+ </Badge>
+ ),
+ }),
+ columnHelper.display({
+ id: "actions",
+ header: () => <Trans i18nKey="membersListActions" defaults="Actions" />,
+ cell: ({ row }) => (
+ <MemberDropdownMenu
+ member={row.original.member}
+ canUpdate={row.original.canUpdate}
+ canDelete={row.original.canDelete}
+ />
+ ),
+ }),
+];
+
+export function MembersList({ rows }: { rows: MemberRow[] }) {
+ const table = useReactTable({
+ data: rows,
+ columns,
+ getCoreRowModel: getCoreRowModel(),
+ getRowId: (row) => row.member.id,
+ });
+
+ return (
+ <DataList
+ table={table}
+ className="grid-cols-[auto_minmax(0,1fr)_auto] sm:grid-cols-[auto_minmax(0,1fr)_auto_auto] md:grid-cols-[auto_minmax(0,1fr)_minmax(0,auto)_auto_auto]"
+ />
+ );
+}
diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/members/members-page.tsx b/apps/web/src/app/[locale]/(space)/(dashboard)/members/members-page.tsx
index 5a0d1fe6b..99d0e7efb 100644
--- a/apps/web/src/app/[locale]/(space)/(dashboard)/members/members-page.tsx
+++ b/apps/web/src/app/[locale]/(space)/(dashboard)/members/members-page.tsx
@@ -5,14 +5,10 @@ import {
AlertDescription,
AlertTitle,
} from "@rallly/ui/alert";
-import { Badge } from "@rallly/ui/badge";
import { InfoIcon, SparklesIcon } from "lucide-react";
import { Link } from "@/components/link";
-import { OptimizedAvatarImage } from "@/components/optimized-avatar-image";
-import { PageHeaderActions } from "@/components/page-layout";
-import { StackedList, StackedListItem } from "@/components/stacked-list";
+import { ListViewActions } from "@/components/list-view";
import { defineAbilityForSpace } from "@/features/space/ability";
-import { SpaceRole } from "@/features/space/components/space-role";
import { loadActiveSpace, loadSeatUsage } from "@/features/space/loaders";
import { defineAbilityForMember } from "@/features/space/member/ability";
import {
@@ -24,7 +20,7 @@ import { Trans } from "@/i18n/client";
import { IfFeatureEnabled } from "@/lib/feature-flags/client";
import { isFeatureEnabled } from "@/lib/feature-flags/server";
import { InviteMemberButton } from "./components/invite-member-button";
-import { MemberDropdownMenu } from "./components/member-dropdown-menu";
+import { MembersList } from "./components/members-list";
import { PendingInvites } from "./components/pending-invites";
import { UpgradeToProButton } from "./components/upgrade-to-pro-button";
@@ -51,8 +47,8 @@ export async function MembersPageActions() {
const availableSeats = Math.max(seatUsage.total - seatUsage.used, 0);
return (
- <PageHeaderActions>
- <p className="mr-2 text-muted-foreground text-sm">
+ <ListViewActions>
+ <p className="mr-2 hidden text-muted-foreground text-sm sm:block">
<Trans
i18nKey="seatsAvailable"
defaults="{count, plural, =0 {No seats available} one {# seat available} other {# seats available}}"
@@ -63,7 +59,7 @@ export async function MembersPageActions() {
disabled={availableSeats <= 0}
canCreateInvite={memberAbility.can("create", "SpaceMemberInvite")}
/>
- </PageHeaderActions>
+ </ListViewActions>
);
}
@@ -79,142 +75,110 @@ export async function MembersPageContent() {
const invites = canInviteMembers ? await loadPendingInvites() : [];
const availableSeats = Math.max(seatUsage.total - seatUsage.used, 0);
const hasInactiveMembers = space.tier === "hobby" && members.length > 1;
+ const showInactive = isFeatureEnabled("billing") && space.tier === "hobby";
return (
<>
- {canInviteMembers ? (
- <PendingInvites
- invites={invites}
- canCancelInvite={memberAbility.can("delete", "SpaceMemberInvite")}
- />
- ) : null}
- {canInviteMembers && availableSeats <= 0 ? (
- <Alert variant="info">
- <InfoIcon />
- <AlertDescription>
- {isFeatureEnabled("billing") ? (
- <p>
+ <div className="space-y-2 px-4 empty:hidden">
+ {canInviteMembers ? (
+ <PendingInvites
+ invites={invites}
+ canCancelInvite={memberAbility.can("delete", "SpaceMemberInvite")}
+ />
+ ) : null}
+ {canInviteMembers && availableSeats <= 0 ? (
+ <Alert variant="info">
+ <InfoIcon />
+ <AlertDescription>
+ {isFeatureEnabled("billing") ? (
+ <p>
+ <Trans
+ i18nKey="noSeatsAvailableAlertBillingDescription"
+ defaults="Increase the number of seats in this space from the <a>billing page</a>."
+ components={{
+ a: (
+ <Link
+ className="underline hover:text-foreground"
+ href="/settings/billing"
+ />
+ ),
+ }}
+ />
+ </p>
+ ) : (
+ <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 hover:text-foreground"
+ prefetch={false}
+ href="https://support.rallly.co/self-hosting/licensing"
+ />
+ ),
+ }}
+ />
+ </p>
+ )}
+ </AlertDescription>
+ </Alert>
+ ) : null}
+ <IfFeatureEnabled feature="billing">
+ {hasInactiveMembers ? (
+ <Alert>
+ <InfoIcon />
+ <AlertTitle>
<Trans
- i18nKey="noSeatsAvailableAlertBillingDescription"
- defaults="Increase the number of seats in this space from the <a>billing page</a>."
- components={{
- a: (
- <Link
- className="underline hover:text-foreground"
- href="/settings/billing"
- />
- ),
- }}
+ i18nKey="membersInactiveAlertTitle"
+ defaults="Members are inactive"
/>
- </p>
- ) : (
- <p>
+ </AlertTitle>
+ <AlertDescription>
<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 hover:text-foreground"
- prefetch={false}
- href="https://support.rallly.co/self-hosting/licensing"
- />
- ),
- }}
+ i18nKey="membersInactiveAlertDescription"
+ defaults="These members lost access when this space's Pro subscription ended. Their seats are kept and access is restored when the space is upgraded again."
/>
- </p>
- )}
- </AlertDescription>
- </Alert>
- ) : null}
- <IfFeatureEnabled feature="billing">
- {hasInactiveMembers ? (
- <Alert>
- <InfoIcon />
- <AlertTitle>
- <Trans
- i18nKey="membersInactiveAlertTitle"
- defaults="Members are inactive"
- />
- </AlertTitle>
+ </AlertDescription>
+ <AlertAction>
+ <UpgradeToProButton action="reactivate" />
+ </AlertAction>
+ </Alert>
+ ) : null}
+ </IfFeatureEnabled>
+ {!canInviteMembers && !hasInactiveMembers ? (
+ <Alert variant="primary">
+ <SparklesIcon />
<AlertDescription>
<Trans
- i18nKey="membersInactiveAlertDescription"
- defaults="These members lost access when this space's Pro subscription ended. Their seats are kept and access is restored when the space is upgraded again."
+ i18nKey="inviteMembersUpsellDescription"
+ defaults="Invite members to manage polls and events together in this space."
/>
</AlertDescription>
<AlertAction>
- <UpgradeToProButton action="reactivate" />
+ <UpgradeToProButton action="invite" variant="link" />
</AlertAction>
</Alert>
) : null}
- </IfFeatureEnabled>
- {!canInviteMembers && !hasInactiveMembers ? (
- <Alert variant="primary">
- <SparklesIcon />
- <AlertDescription>
- <Trans
- i18nKey="inviteMembersUpsellDescription"
- defaults="Invite members to manage polls and events together in this space."
- />
- </AlertDescription>
- <AlertAction>
- <UpgradeToProButton action="invite" variant="link" />
- </AlertAction>
- </Alert>
- ) : null}
- <StackedList>
- {members.map((member) => (
- <StackedListItem key={member.id}>
- <div className="flex flex-1 items-center gap-4">
- <OptimizedAvatarImage
- src={member.image}
- name={member.name}
- size="xl"
- />
- <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}
- <IfFeatureEnabled feature="billing">
- {space.tier === "hobby" && !member.isOwner ? (
- <Badge>
- <Trans i18nKey="memberInactive" defaults="Inactive" />
- </Badge>
- ) : null}
- </IfFeatureEnabled>
- </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}
- // subject() brands the object it's given in place, which would
- // make `member` fail React's plain-object check when serialized
- // as a client component prop — hence the copies.
- canUpdate={memberAbility.can(
- "update",
- subject("SpaceMember", { ...member }),
- )}
- canDelete={memberAbility.can(
- "delete",
- subject("SpaceMember", { ...member }),
- )}
- />
- </StackedListItem>
- ))}
- </StackedList>
+ </div>
+ <MembersList
+ rows={members.map((member) => ({
+ member,
+ // subject() brands the object it's given in place, which would
+ // make `member` fail React's plain-object check when serialized
+ // as a client component prop — hence the copies.
+ canUpdate: memberAbility.can(
+ "update",
+ subject("SpaceMember", { ...member }),
+ ),
+ canDelete: memberAbility.can(
+ "delete",
+ subject("SpaceMember", { ...member }),
+ ),
+ inactive: showInactive && !member.isOwner,
+ }))}
+ />
</>
);
}
diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/members/page.tsx b/apps/web/src/app/[locale]/(space)/(dashboard)/members/page.tsx
index 0beec0b68..423c3b44d 100644
--- a/apps/web/src/app/[locale]/(space)/(dashboard)/members/page.tsx
+++ b/apps/web/src/app/[locale]/(space)/(dashboard)/members/page.tsx
@@ -2,43 +2,50 @@ import { Skeleton } from "@rallly/ui/skeleton";
import type { Metadata } from "next";
import { Suspense } from "react";
import {
- PageContainer,
- PageContent,
- PageHeader,
- PageHeaderContent,
- PageTitle,
-} from "@/components/page-layout";
+ ListView,
+ ListViewContent,
+ ListViewHeader,
+ ListViewTitle,
+ ListViewTitleBar,
+} from "@/components/list-view";
import { Trans } from "@/i18n/client";
import { getTranslation } from "@/i18n/server";
import { MembersPageActions, MembersPageContent } from "./members-page";
export default function Page() {
return (
- <PageContainer>
- <PageHeader>
- <PageHeaderContent>
- <PageTitle>
+ <ListView>
+ <ListViewHeader>
+ <ListViewTitleBar>
+ <ListViewTitle>
<Trans i18nKey="members" defaults="Members" />
- </PageTitle>
- </PageHeaderContent>
- <Suspense>
- <MembersPageActions />
- </Suspense>
- </PageHeader>
- <PageContent className="space-y-4">
+ </ListViewTitle>
+ <Suspense>
+ <MembersPageActions />
+ </Suspense>
+ </ListViewTitleBar>
+ </ListViewHeader>
+ <ListViewContent className="pt-2">
<Suspense
fallback={
- <div className="space-y-4">
- <Skeleton className="h-7 w-full" />
- <Skeleton className="h-7 w-full" />
- <Skeleton className="h-7 w-1/2" />
+ <div aria-hidden className="py-2">
+ {Array.from({ length: 3 }).map((_, i) => (
+ <div
+ // biome-ignore lint/suspicious/noArrayIndexKey: static placeholders
+ key={i}
+ className="flex h-12 items-center gap-3 px-8"
+ >
+ <Skeleton className="size-6 rounded-full" />
+ <Skeleton className="h-4 w-48" />
+ </div>
+ ))}
</div>
}
>
<MembersPageContent />
</Suspense>
- </PageContent>
- </PageContainer>
+ </ListViewContent>
+ </ListView>
);
}
diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/polls/polls-page.tsx b/apps/web/src/app/[locale]/(space)/(dashboard)/polls/polls-page.tsx
index b9fe52485..602aa66ec 100644
--- a/apps/web/src/app/[locale]/(space)/(dashboard)/polls/polls-page.tsx
+++ b/apps/web/src/app/[locale]/(space)/(dashboard)/polls/polls-page.tsx
@@ -10,23 +10,23 @@ import {
EmptyStateIcon,
EmptyStateTitle,
} from "@/components/empty-state";
+import { FilterPills } from "@/components/filter-pills";
import { Link } from "@/components/link";
-import { MemberSelector } from "@/components/member-selector";
import {
- PageContainer,
- PageContent,
- PageHeader,
- PageHeaderActions,
- PageHeaderContent,
- PageTitle,
-} from "@/components/page-layout";
+ ListView,
+ ListViewActions,
+ ListViewHeader,
+ ListViewTitle,
+ ListViewTitleBar,
+ ListViewToolbar,
+} from "@/components/list-view";
+import { MemberSelector } from "@/components/member-selector";
import { SearchInput } from "@/components/search-input";
import { PollsInfiniteList } from "@/features/poll/components/polls-infinite-list";
import type { PollStatus } from "@/features/poll/schema";
import { useSpace } from "@/features/space/client";
import { Trans, useTranslation } from "@/i18n/client";
import { trpc } from "@/trpc/client";
-import { PollsTabbedView } from "./polls-tabbed-view";
import { searchParamsSchema } from "./schema";
function NoOpenPollsEmptyState({ closedCount }: { closedCount: number }) {
@@ -106,44 +106,74 @@ export function PollsPage({ counts }: { counts: Record<PollStatus, number> }) {
status === "open" && !hasFilters && counts.closed > 0;
return (
- <PageContainer>
- <PageHeader>
- <PageHeaderContent>
- <PageTitle>
+ <ListView>
+ <ListViewHeader>
+ <ListViewTitleBar>
+ <ListViewTitle>
<Trans i18nKey="polls" defaults="Polls" />
- </PageTitle>
- </PageHeaderContent>
- <PageHeaderActions>
- <Link href="/new" className={buttonVariants({ variant: "primary" })}>
- <PlusIcon data-icon="inline-start" />
- <Trans i18nKey="newPoll" defaults="New poll" />
- </Link>
- </PageHeaderActions>
- </PageHeader>
- <PageContent>
- <PollsTabbedView counts={counts}>
- <div className="mb-6 flex gap-x-2">
+ </ListViewTitle>
+ <ListViewActions>
+ <Link
+ href="/new"
+ className={buttonVariants({ variant: "primary" })}
+ >
+ <PlusIcon data-icon="inline-start" />
+ <Trans i18nKey="createPoll" defaults="Create poll" />
+ </Link>
+ </ListViewActions>
+ </ListViewTitleBar>
+ <ListViewToolbar>
+ <FilterPills
+ param="status"
+ value={status}
+ label={t("pollsListStatusFilter", {
+ defaultValue: "Filter by status",
+ })}
+ options={[
+ {
+ value: "open",
+ label: <Trans i18nKey="pollStatusOpen" defaults="Open" />,
+ },
+ {
+ value: "closed",
+ label: <Trans i18nKey="pollStatusClosed" defaults="Closed" />,
+ },
+ {
+ value: "scheduled",
+ label: (
+ <Trans i18nKey="pollStatusScheduled" defaults="Scheduled" />
+ ),
+ },
+ ]}
+ />
+ <div className="flex w-full items-center gap-2 sm:ml-auto sm:w-auto">
<SearchInput
+ className="w-auto min-w-0 flex-1 sm:w-56 sm:flex-none"
placeholder={t("searchPollsPlaceholder", {
defaultValue: "Search polls by title...",
})}
/>
- {showMemberFilter ? <MemberSelector members={members} /> : null}
+ {showMemberFilter ? (
+ <MemberSelector
+ members={members}
+ className="min-w-0 sm:min-w-40"
+ />
+ ) : null}
</div>
- <PollsInfiniteList
- status={status}
- search={q}
- member={visibleMember}
- emptyState={
- showClosedPollsPointer ? (
- <NoOpenPollsEmptyState closedCount={counts.closed} />
- ) : (
- <PollsEmptyState />
- )
- }
- />
- </PollsTabbedView>
- </PageContent>
- </PageContainer>
+ </ListViewToolbar>
+ </ListViewHeader>
+ <PollsInfiniteList
+ status={status}
+ search={q}
+ member={visibleMember}
+ emptyState={
+ showClosedPollsPointer ? (
+ <NoOpenPollsEmptyState closedCount={counts.closed} />
+ ) : (
+ <PollsEmptyState />
+ )
+ }
+ />
+ </ListView>
);
}
diff --git a/apps/web/src/app/[locale]/(space)/(dashboard)/polls/polls-tabbed-view.tsx b/apps/web/src/app/[locale]/(space)/(dashboard)/polls/polls-tabbed-view.tsx
deleted file mode 100644
index 8c6cb94b7..000000000
--- a/apps/web/src/app/[locale]/(space)/(dashboard)/polls/polls-tabbed-view.tsx
+++ /dev/null
@@ -1,83 +0,0 @@
-"use client";
-
-import { cn } from "@rallly/ui";
-import { Tabs, TabsContent, TabsList, TabsTrigger } from "@rallly/ui/page-tabs";
-import { useRouter, useSearchParams } from "next/navigation";
-import React from "react";
-import { Trans } from "@/i18n/client";
-import { statusSchema } from "./schema";
-
-function TabCount({ count }: { count: number }) {
- return (
- <span className="ml-2 rounded-full bg-muted px-2 py-0.5 text-muted-foreground text-xs tabular-nums">
- {count}
- </span>
- );
-}
-
-export function PollsTabbedView({
- counts,
- children,
-}: {
- counts: { open: number; closed: number; scheduled: number };
- children: React.ReactNode;
-}) {
- const searchParams = useSearchParams();
- const name = "status";
- const router = useRouter();
- const [isPending, startTransition] = React.useTransition();
- const status = statusSchema.parse(searchParams.get("status"));
- const [tab, setTab] = React.useState(status);
-
- React.useEffect(() => {
- setTab(status);
- }, [status]);
-
- const handleTabChange = React.useCallback(
- (value: string) => {
- const params = new URLSearchParams(searchParams);
- params.set(name, value);
-
- params.delete("page");
-
- setTab(statusSchema.parse(value));
-
- startTransition(() => {
- const newUrl = `?${params.toString()}`;
- router.replace(newUrl, { scroll: false });
- });
- },
- [router, searchParams],
- );
-
- return (
- <Tabs value={tab} onValueChange={handleTabChange}>
- <TabsList>
- <TabsTrigger value="open">
- <Trans i18nKey="pollStatusOpen" defaults="Open" />
- <TabCount count={counts.open} />
- </TabsTrigger>
- <TabsTrigger value="closed">
- <Trans i18nKey="pollStatusClosed" defaults="Closed" />
- <TabCount count={counts.closed} />
- </TabsTrigger>
- <TabsTrigger value="scheduled">
- <Trans i18nKey="pollStatusScheduled" defaults="Scheduled" />
- <TabCount count={counts.scheduled} />
- </TabsTrigger>
- </TabsList>
- <TabsContent
- tabIndex={-1}
- value={tab}
- key={tab}
- aria-busy={isPending}
- className={cn(isPending ? "pointer-events-none opacity-50" : "")}
- >
- {children}
- </TabsContent>
- <output aria-live="polite" className="sr-only">
- {isPending ? <Trans i18nKey="loading" defaults="Loading..." /> : null}
- </output>
- </Tabs>
- );
-}
diff --git a/apps/web/src/app/[locale]/globals.css b/apps/web/src/app/[locale]/globals.css
index e1431f3ca..21ecaedfd 100644
--- a/apps/web/src/app/[locale]/globals.css
+++ b/apps/web/src/app/[locale]/globals.css
@@ -3,6 +3,11 @@
/* Any app specific overrides will go here */
+/* Inter Display: the same family at its largest optical size */
+@utility font-display {
+ font-variation-settings: "opsz" 32;
+}
+
/*
* The skip-to-content link moves focus to the page's #main-content landmark.
* The link itself is the visible focus indicator, so suppress the outline on
diff --git a/apps/web/src/app/[locale]/layout.tsx b/apps/web/src/app/[locale]/layout.tsx
index 15d073872..81ae0d166 100644
--- a/apps/web/src/app/[locale]/layout.tsx
+++ b/apps/web/src/app/[locale]/layout.tsx
@@ -27,6 +27,8 @@ import { TRPCProvider } from "@/trpc/client/provider";
const inter = Inter({
subsets: ["latin"],
display: "swap",
+ // The optical size axis gives headings the Inter Display cut
+ axes: ["opsz"],
});
export const viewport: Viewport = {
diff --git a/apps/web/src/components/data-list.tsx b/apps/web/src/components/data-list.tsx
new file mode 100644
index 000000000..09f52f14b
--- /dev/null
+++ b/apps/web/src/components/data-list.tsx
@@ -0,0 +1,100 @@
+"use client";
+
+import { cn } from "@rallly/ui";
+import type { Row, RowData, Table } from "@tanstack/react-table";
+import { flexRender } from "@tanstack/react-table";
+import type React from "react";
+
+declare module "@tanstack/react-table" {
+ interface ColumnMeta<TData extends RowData, TValue> {
+ /** Classes for the column's cells, e.g. to hide it on small screens */
+ className?: string;
+ }
+}
+
+type DataListGroup = { id: string; label: React.ReactNode };
+
+function DataListRow<TData>({ row }: { row: Row<TData> }) {
+ return (
+ <li className="relative col-span-full grid h-12 grid-cols-subgrid items-center rounded-lg pr-3 pl-4 hover:bg-accent/60 has-[a:focus-visible]:bg-accent/60">
+ {row.getVisibleCells().map((cell) => (
+ <div
+ key={cell.id}
+ className={cn(
+ "flex min-w-0 items-center",
+ cell.column.columnDef.meta?.className,
+ )}
+ >
+ {flexRender(cell.column.columnDef.cell, cell.getContext())}
+ </div>
+ ))}
+ </li>
+ );
+}
+
+/**
+ * Renders a TanStack table as a list laid out on a CSS grid. Rows are
+ * subgrids of the root, so `className` sets `grid-cols-*` once and every
+ * row's columns line up. A cell hidden with `display: none` gives up its
+ * track, so the template must list only the columns visible at each
+ * breakpoint.
+ *
+ * `getGroup` splits the rows into labelled groups. Rows are grouped where
+ * they are adjacent, so sort them by group first.
+ *
+ * To make a whole row clickable, render a link in one cell with an
+ * `after:absolute after:inset-0` overlay and give other interactive cells
+ * `relative z-10` so they sit above it.
+ */
+export function DataList<TData>({
+ table,
+ getGroup,
+ className,
+}: {
+ table: Table<TData>;
+ getGroup?: (row: TData) => DataListGroup;
+ className?: string;
+}) {
+ const rows = table.getRowModel().rows;
+
+ if (!getGroup) {
+ return (
+ <ul className={cn("grid gap-x-5 px-4 py-2", className)}>
+ {rows.map((row) => (
+ <DataListRow key={row.id} row={row} />
+ ))}
+ </ul>
+ );
+ }
+
+ const groups: { group: DataListGroup; rows: Row<TData>[] }[] = [];
+ for (const row of rows) {
+ const group = getGroup(row.original);
+ const last = groups[groups.length - 1];
+ if (last?.group.id === group.id) {
+ last.rows.push(row);
+ } else {
+ groups.push({ group, rows: [row] });
+ }
+ }
+
+ return (
+ <ul className={cn("grid gap-x-5 px-4 py-2", className)}>
+ {groups.map(({ group, rows }) => (
+ <li
+ key={group.id}
+ className="col-span-full not-first:mt-5 grid grid-cols-subgrid"
+ >
+ <h2 className="col-span-full mb-1 flex h-12 items-center gap-2 rounded-lg bg-muted/60 px-4 text-sm">
+ {group.label}
+ </h2>
+ <ul className="col-span-full grid grid-cols-subgrid">
+ {rows.map((row) => (
+ <DataListRow key={row.id} row={row} />
+ ))}
+ </ul>
+ </li>
+ ))}
+ </ul>
+ );
+}
diff --git a/apps/web/src/components/filter-pills.tsx b/apps/web/src/components/filter-pills.tsx
new file mode 100644
index 000000000..b1250e5f2
--- /dev/null
+++ b/apps/web/src/components/filter-pills.tsx
@@ -0,0 +1,58 @@
+"use client";
+
+import { cn } from "@rallly/ui";
+import { useSearchParams } from "next/navigation";
+import { Link } from "@/components/link";
+
+/**
+ * A single-select filter kept in a URL search param. Each option is a link,
+ * so the selection survives reloads and can be shared.
+ */
+export function FilterPills<T extends string>({
+ param,
+ value,
+ options,
+ label,
+}: {
+ param: string;
+ value: T;
+ options: {
+ value: T;
+ label: React.ReactNode;
+ }[];
+ label: string;
+}) {
+ const searchParams = useSearchParams();
+
+ const hrefFor = (optionValue: T) => {
+ const params = new URLSearchParams(searchParams);
+ params.set(param, optionValue);
+ params.delete("page");
+ return `?${params.toString()}`;
+ };
+
+ return (
+ <nav aria-label={label} className="flex items-center gap-1">
+ {options.map((option) => {
+ const selected = option.value === value;
+ return (
+ <Link
+ key={option.value}
+ href={hrefFor(option.value)}
+ replace
+ scroll={false}
+ aria-current={selected ? "page" : undefined}
+ className={cn(
+ "inline-flex h-9 shrink-0 items-center gap-2 whitespace-nowrap rounded-full px-3.5 text-sm ring-1 ring-transparent ring-inset transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
+ selected
+ ? "bg-white text-sidebar-accent-foreground ring-button-outline dark:bg-muted"
+ : "text-muted-foreground hover:bg-white dark:hover:bg-muted",
+ )}
+ >
+ {option.label}
+ </Link>
+ );
+ })}
+ </nav>
+ );
+}
diff --git a/apps/web/src/components/list-view.tsx b/apps/web/src/components/list-view.tsx
new file mode 100644
index 000000000..b929e63eb
--- /dev/null
+++ b/apps/web/src/components/list-view.tsx
@@ -0,0 +1,99 @@
+import { cn } from "@rallly/ui";
+import { SidebarTrigger } from "@rallly/ui/sidebar";
+
+// Fills the dashboard shell's bounded main area: the header stays put and
+// ListViewContent is the scroll area.
+export function ListView({
+ children,
+ className,
+}: React.PropsWithChildren<{ className?: string }>) {
+ return (
+ <div className={cn("flex min-h-0 flex-1 flex-col", className)}>
+ {children}
+ </div>
+ );
+}
+
+export function ListViewHeader({
+ children,
+ className,
+}: React.PropsWithChildren<{ className?: string }>) {
+ return (
+ <div className={cn("shrink-0 bg-background", className)}>{children}</div>
+ );
+}
+
+export function ListViewTitleBar({
+ children,
+ className,
+}: React.PropsWithChildren<{ className?: string }>) {
+ return (
+ <div
+ className={cn(
+ "flex h-16 items-end justify-between gap-4 pr-4 pb-1 pl-4 md:pl-6",
+ className,
+ )}
+ >
+ <div className="flex h-9 min-w-0 flex-1 items-center gap-2">
+ <SidebarTrigger className="md:hidden" />
+ {children}
+ </div>
+ </div>
+ );
+}
+
+// Same type as PageTitle on the other dashboard pages; the sidebar trigger
+// lives in ListViewTitleBar instead.
+export function ListViewTitle({
+ children,
+ className,
+}: React.PropsWithChildren<{ className?: string }>) {
+ return (
+ <h1
+ className={cn(
+ "truncate font-display font-semibold text-foreground text-lg tracking-tight",
+ className,
+ )}
+ >
+ {children}
+ </h1>
+ );
+}
+
+export function ListViewActions({
+ children,
+ className,
+}: React.PropsWithChildren<{ className?: string }>) {
+ return (
+ <div className={cn("ml-auto flex shrink-0 items-center gap-2", className)}>
+ {children}
+ </div>
+ );
+}
+
+export function ListViewToolbar({
+ children,
+ className,
+}: React.PropsWithChildren<{ className?: string }>) {
+ return (
+ <div
+ className={cn(
+ "flex flex-wrap items-center gap-x-2 gap-y-4 px-4 pt-4 pb-3",
+ className,
+ )}
+ >
+ {children}
+ </div>
+ );
+}
+
+export function ListViewContent({
+ children,
+ className,
+}: React.PropsWithChildren<{ className?: string }>) {
+ return (
+ <div className={cn("min-h-0 flex-1 overflow-y-auto", className)}>
+ {children}
+ </div>
+ );
+}
diff --git a/apps/web/src/components/member-selector.tsx b/apps/web/src/components/member-selector.tsx
index 4d08a5d80..dfd8d5d42 100644
--- a/apps/web/src/components/member-selector.tsx
+++ b/apps/web/src/components/member-selector.tsx
@@ -1,5 +1,6 @@
"use client";
+import { cn } from "@rallly/ui";
import {
Select,
SelectContent,
@@ -15,9 +16,10 @@ import { Trans } from "@/i18n/client";
interface MemberSelectorProps {
members: { userId: string; name: string; image?: string }[];
+ className?: string;
}
-export function MemberSelector({ members }: MemberSelectorProps) {
+export function MemberSelector({ members, className }: MemberSelectorProps) {
const router = useRouter();
const searchParams = useSearchParams();
const [isPending, startTransition] = useTransition();
@@ -79,7 +81,7 @@ export function MemberSelector({ members }: MemberSelectorProps) {
}}
disabled={isPending}
>
- <SelectTrigger className="min-w-48">
+ <SelectTrigger className={cn("min-w-48", className)}>
<SelectValue />
</SelectTrigger>
<SelectContent>
diff --git a/apps/web/src/components/page-layout.tsx b/apps/web/src/components/page-layout.tsx
index 667fccf99..115331d44 100644
--- a/apps/web/src/components/page-layout.tsx
+++ b/apps/web/src/components/page-layout.tsx
@@ -27,7 +27,7 @@ export function PageTitle({
return (
<h1
className={cn(
- "flex h-9 items-center gap-3 truncate font-semibold text-foreground text-lg tracking-tight",
+ "flex h-9 items-center gap-3 truncate font-display font-semibold text-foreground text-lg tracking-tight",
className,
)}
>
diff --git a/apps/web/src/components/search-input.tsx b/apps/web/src/components/search-input.tsx
index a3948dfbc..c685b29d9 100644
--- a/apps/web/src/components/search-input.tsx
+++ b/apps/web/src/components/search-input.tsx
@@ -1,12 +1,25 @@
"use client";
-import { Input } from "@rallly/ui/input";
+import { cn } from "@rallly/ui";
+import {
+ InputGroup,
+ InputGroupAddon,
+ InputGroupInput,
+} from "@rallly/ui/input-group";
import debounce from "lodash/debounce";
import { SearchIcon } from "lucide-react";
import { usePathname, useRouter, useSearchParams } from "next/navigation";
import React from "react";
+import { Spinner } from "@/components/spinner";
+import { Trans } from "@/i18n/client";
-export function SearchInput({ placeholder }: { placeholder: string }) {
+export function SearchInput({
+ placeholder,
+ className,
+}: {
+ placeholder: string;
+ className?: string;
+}) {
const searchParams = useSearchParams();
const pathname = usePathname();
const router = useRouter();
@@ -20,6 +33,11 @@ export function SearchInput({ placeholder }: { placeholder: string }) {
// Track input value in state
const [inputValue, setInputValue] = React.useState(currentSearchValue);
+ // Searching covers the debounce wait and the navigation that follows
+ const [isDebouncing, setIsDebouncing] = React.useState(false);
+ const [isPending, startTransition] = React.useTransition();
+ const isSearching = isDebouncing || isPending;
+
// Create a debounced function to update the URL
// biome-ignore lint/correctness/useExhaustiveDependencies: Fix this later
const debouncedUpdateUrl = React.useCallback(
@@ -33,7 +51,10 @@ export function SearchInput({ placeholder }: { placeholder: string }) {
params.delete("page");
- router.replace(`${pathname}?${params.toString()}`, { scroll: false });
+ setIsDebouncing(false);
+ startTransition(() => {
+ router.replace(`${pathname}?${params.toString()}`, { scroll: false });
+ });
}, 500),
[pathname, router, searchParams],
);
@@ -42,29 +63,41 @@ export function SearchInput({ placeholder }: { placeholder: string }) {
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const newValue = e.target.value;
setInputValue(newValue);
+ setIsDebouncing(true);
debouncedUpdateUrl(newValue);
};
return (
<form
- className="relative w-72"
+ className={cn("w-72", className)}
onSubmit={(e) => {
e.preventDefault();
debouncedUpdateUrl.flush();
}}
>
- <div className="pointer-events-none absolute inset-y-0 left-0 flex items-center pl-2.5">
- <SearchIcon className="size-4 shrink-0 text-muted-foreground" />
- </div>
- <Input
- ref={inputRef}
- type="search"
- autoFocus={searchParams.get("q") !== null}
- placeholder={placeholder}
- className="pl-8"
- value={inputValue}
- onChange={handleChange}
- />
+ <InputGroup>
+ <InputGroupAddon>
+ <SearchIcon className="text-muted-foreground" />
+ </InputGroupAddon>
+ <InputGroupInput
+ ref={inputRef}
+ type="search"
+ autoFocus={searchParams.get("q") !== null}
+ placeholder={placeholder}
+ value={inputValue}
+ onChange={handleChange}
+ />
+ {isSearching ? (
+ <InputGroupAddon align="inline-end">
+ <Spinner className="size-4" />
+ </InputGroupAddon>
+ ) : null}
+ </InputGroup>
+ <output aria-live="polite" className="sr-only">
+ {isSearching ? (
+ <Trans i18nKey="searching" defaults="Searching…" />
+ ) : null}
+ </output>
</form>
);
}
diff --git a/apps/web/src/features/poll/components/poll-status-icon.tsx b/apps/web/src/features/poll/components/poll-status-icon.tsx
index 645516d3d..8d6cecb9b 100644
--- a/apps/web/src/features/poll/components/poll-status-icon.tsx
+++ b/apps/web/src/features/poll/components/poll-status-icon.tsx
@@ -69,5 +69,10 @@ export function PollStatusIcon({
);
}
- return <span className={cn("inline-flex", className)}>{icon}</span>;
+ return (
+ <span className={cn("inline-flex", className)}>
+ {icon}
+ <span className="sr-only">{label}</span>
+ </span>
+ );
}
diff --git a/apps/web/src/features/poll/components/polls-infinite-list.tsx b/apps/web/src/features/poll/components/polls-infinite-list.tsx
index 293763bcc..f52f95e6d 100644
--- a/apps/web/src/features/poll/components/polls-infinite-list.tsx
+++ b/apps/web/src/features/poll/components/polls-infinite-list.tsx
@@ -21,210 +21,189 @@ import {
import { toast } from "@rallly/ui/sonner";
import { Tooltip, TooltipContent, TooltipTrigger } from "@rallly/ui/tooltip";
import { absoluteUrl, shortUrl } from "@rallly/utils/absolute-url";
+import {
+ createColumnHelper,
+ getCoreRowModel,
+ useReactTable,
+} from "@tanstack/react-table";
import {
CircleStopIcon,
MoreHorizontalIcon,
PlayIcon,
- StickerIcon,
TrashIcon,
+ UsersIcon,
} from "lucide-react";
import { useRouter } from "next/navigation";
import React from "react";
import { CopyLinkButton } from "@/components/copy-link-button";
+import { DataList } from "@/components/data-list";
import { HoverPrefetchLink } from "@/components/hover-prefetch-link";
+import { ListViewContent } from "@/components/list-view";
import { OptimizedAvatarImage } from "@/components/optimized-avatar-image";
import { Spinner } from "@/components/spinner";
-import { StackedList, StackedListItem } from "@/components/stacked-list";
import { PollStatusIcon } from "@/features/poll/components/poll-status-icon";
import type { PollClosedReason, PollStatus } from "@/features/poll/schema";
import { Trans, useTranslation } from "@/i18n/client";
+import { TimeRange } from "@/lib/datetime/time";
+import type { DateInput } from "@/lib/datetime/types";
import { useFeatureFlag } from "@/lib/feature-flags/client";
import { trpc } from "@/trpc/client";
-interface PollsInfiniteListProps {
- status?: PollStatus;
- search?: string;
- member?: string;
- emptyState: React.ReactNode;
+type PollRow = {
+ id: string;
+ title: string;
+ status: PollStatus;
+ closedReason: PollClosedReason | null;
+ timeZone: string | null;
+ participantCount: number;
+ dateRange: { start: DateInput; end: DateInput } | null;
+ user: { name: string; image: string | null } | null;
+};
+
+function PollDateRange({
+ start,
+ end,
+ timeZone,
+}: {
+ start: DateInput;
+ end: DateInput;
+ timeZone: string | null;
+}) {
+ // A poll without a zone stores floating times (and all-day dates) as UTC
+ // wall time, so show them as stored. Otherwise use the viewer's zone.
+ return (
+ <TimeRange
+ start={start}
+ end={end}
+ preset="date"
+ timeZone={timeZone === null ? "UTC" : undefined}
+ className="truncate"
+ />
+ );
}
-function PollListItem({
+function PollTitleLink({
id,
title,
status,
closedReason,
- participants,
- user,
}: {
id: string;
title: string;
status: PollStatus;
closedReason: PollClosedReason | null;
- participants: { id: string; name: string }[];
- user: { name: string; image: string | null } | null;
+}) {
+ const isPollAdminEnabled = useFeatureFlag("pollAdmin");
+ return (
+ <div className="flex min-w-0 items-center gap-2">
+ <HoverPrefetchLink
+ className="min-w-0 truncate text-sm outline-none after:absolute after:inset-0"
+ href={isPollAdminEnabled ? `/polls/${id}` : absoluteUrl(`/poll/${id}`)}
+ >
+ {title}
+ </HoverPrefetchLink>
+ {status === "closed" && closedReason === "auto" && (
+ <Tooltip>
+ <TooltipTrigger
+ render={
+ <Badge
+ size="sm"
+ className="relative z-10 hidden shrink-0 cursor-help sm:inline-flex"
+ >
+ <Trans
+ i18nKey="pollAutoClosedBadge"
+ defaults="Automatically closed"
+ />
+ </Badge>
+ }
+ />
+ <TooltipContent>
+ <Trans
+ i18nKey="pollAutoClosedTooltip"
+ defaults="This poll was closed automatically because all of its dates have passed. You can reopen it at any time."
+ />
+ </TooltipContent>
+ </Tooltip>
+ )}
+ </div>
+ );
+}
+
+function PollRowActions({
+ id,
+ title,
+ status,
+}: {
+ id: string;
+ title: string;
+ status: PollStatus;
}) {
const { t } = useTranslation();
const router = useRouter();
- const isPollAdminEnabled = useFeatureFlag("pollAdmin");
const deletePollDialog = useDialog();
// Refresh server components so server-fetched data that depends on poll
- // status (e.g. the status tab counts) stays in sync with the list.
+ // status (e.g. the status filter counts) stays in sync with the list.
const refresh = { onSuccess: () => router.refresh() };
const deletePoll = trpc.polls.markAsDeleted.useMutation(refresh);
const closePoll = trpc.polls.close.useMutation(refresh);
const reopenPoll = trpc.polls.reopen.useMutation(refresh);
return (
- <>
- <div className="grid w-full grid-cols-[1fr_auto] gap-2">
- <div className="relative -m-4 flex min-w-0 flex-1 items-center gap-2 p-4">
- <PollStatusIcon status={status} showTooltip={false} />
- <HoverPrefetchLink
- className="min-w-0 text-sm hover:underline focus:ring-ring focus-visible:ring-2"
- href={
- isPollAdminEnabled ? `/polls/${id}` : absoluteUrl(`/poll/${id}`)
- }
- >
- <span className="absolute inset-0" />
- <span className="block truncate">{title}</span>
- </HoverPrefetchLink>
- {status === "closed" && closedReason === "auto" && (
- <Tooltip>
- <TooltipTrigger
- render={
- <Badge size="sm" className="relative cursor-help">
- <Trans
- i18nKey="pollAutoClosedBadge"
- defaults="Automatically closed"
- />
- </Badge>
- }
- />
- <TooltipContent>
- <Trans
- i18nKey="pollAutoClosedTooltip"
- defaults="This poll was closed automatically because all of its dates have passed. You can reopen it at any time."
- />
- </TooltipContent>
- </Tooltip>
- )}
- </div>
- <div className="hidden items-center justify-end gap-4 sm:flex">
- {participants.length > 0 ? (
- <Tooltip>
- <TooltipTrigger
- render={
- <span className="cursor-help text-muted-foreground text-sm">
- <Trans
- i18nKey="participantCount"
- defaults="{count, plural, =0 {No participants} one {1 participant} other {# participants}}"
- values={{ count: participants.length }}
- />
- </span>
- }
- />
- <TooltipContent>
- <ul>
- {participants.slice(0, 10).map((participant) => (
- <li key={participant.id}>{participant.name}</li>
- ))}
- {participants.length > 10 && (
- <li>
- <Trans
- i18nKey="moreParticipants"
- values={{ count: participants.length - 10 }}
- defaults="{count, plural, other {# more…}}"
- />
- </li>
- )}
- </ul>
- </TooltipContent>
- </Tooltip>
- ) : (
- <span className="text-muted-foreground text-sm">
- <Trans
- i18nKey="participantCount"
- defaults="{count, plural, =0 {No participants} one {1 participant} other {# participants}}"
- values={{ count: participants.length }}
- />
- </span>
+ <div className="relative z-10 flex items-center gap-x-1">
+ <CopyLinkButton href={shortUrl(`/invite/${id}`)} className="size-8" />
+ <DropdownMenu>
+ <DropdownMenuTrigger
+ render={
+ <Button
+ aria-label={t("moreOptions", {
+ defaultValue: "More options",
+ })}
+ variant="ghost"
+ size="icon"
+ className="size-8"
+ />
+ }
+ >
+ <MoreHorizontalIcon />
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ {status === "open" && (
+ <DropdownMenuItem
+ onClick={() => {
+ toast.promise(closePoll.mutateAsync({ pollId: id }), {
+ loading: <Trans i18nKey="loading" defaults="Loading..." />,
+ success: (
+ <Trans i18nKey="pollClosed" defaults="Poll closed" />
+ ),
+ });
+ }}
+ >
+ <CircleStopIcon />
+ <Trans i18nKey="closePoll" defaults="Close" />
+ </DropdownMenuItem>
)}
- {user && (
- <Tooltip>
- <TooltipTrigger>
- <OptimizedAvatarImage
- size="sm"
- name={user.name}
- src={user.image ?? undefined}
- />
- </TooltipTrigger>
- <TooltipContent>{user.name}</TooltipContent>
- </Tooltip>
+ {status === "closed" && (
+ <DropdownMenuItem
+ onClick={() => {
+ toast.promise(reopenPoll.mutateAsync({ pollId: id }), {
+ loading: <Trans i18nKey="loading" defaults="Loading..." />,
+ success: (
+ <Trans i18nKey="pollReopened" defaults="Poll reopened" />
+ ),
+ });
+ }}
+ >
+ <PlayIcon />
+ <Trans i18nKey="reopenPoll" defaults="Reopen poll" />
+ </DropdownMenuItem>
)}
- <div className="flex items-center gap-x-1">
- <CopyLinkButton href={shortUrl(`/invite/${id}`)} />
- <DropdownMenu>
- <DropdownMenuTrigger
- render={
- <Button
- aria-label={t("moreOptions", {
- defaultValue: "More options",
- })}
- variant="ghost"
- size="icon"
- />
- }
- >
- <MoreHorizontalIcon />
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end">
- {status === "open" && (
- <DropdownMenuItem
- onClick={() => {
- toast.promise(closePoll.mutateAsync({ pollId: id }), {
- loading: (
- <Trans i18nKey="loading" defaults="Loading..." />
- ),
- success: (
- <Trans i18nKey="pollClosed" defaults="Poll closed" />
- ),
- });
- }}
- >
- <CircleStopIcon />
- <Trans i18nKey="closePoll" defaults="Close" />
- </DropdownMenuItem>
- )}
- {status === "closed" && (
- <DropdownMenuItem
- onClick={() => {
- toast.promise(reopenPoll.mutateAsync({ pollId: id }), {
- loading: (
- <Trans i18nKey="loading" defaults="Loading..." />
- ),
- success: (
- <Trans
- i18nKey="pollReopened"
- defaults="Poll reopened"
- />
- ),
- });
- }}
- >
- <PlayIcon />
- <Trans i18nKey="reopenPoll" defaults="Reopen poll" />
- </DropdownMenuItem>
- )}
- <DropdownMenuItem onClick={() => deletePollDialog.trigger()}>
- <TrashIcon />
- <span>
- <Trans i18nKey="deleteMenuItem" defaults="Delete" />
- </span>
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
- </div>
- </div>
- </div>
+ <DropdownMenuItem onClick={() => deletePollDialog.trigger()}>
+ <TrashIcon />
+ <span>
+ <Trans i18nKey="deleteMenuItem" defaults="Delete" />
+ </span>
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
<Dialog {...deletePollDialog.dialogProps}>
<DialogContent>
<DialogHeader>
@@ -270,16 +249,108 @@ function PollListItem({
</DialogFooter>
</DialogContent>
</Dialog>
- </>
+ </div>
);
}
+const columnHelper = createColumnHelper<PollRow>();
+
+const columns = [
+ columnHelper.accessor("status", {
+ header: () => <Trans i18nKey="pollsListStatus" defaults="Status" />,
+ cell: ({ getValue }) => (
+ <PollStatusIcon status={getValue()} showTooltip={false} />
+ ),
+ }),
+ columnHelper.accessor("title", {
+ header: () => <Trans i18nKey="title" defaults="Title" />,
+ cell: ({ row }) => (
+ <PollTitleLink
+ id={row.original.id}
+ title={row.original.title}
+ status={row.original.status}
+ closedReason={row.original.closedReason}
+ />
+ ),
+ }),
+ columnHelper.accessor("dateRange", {
+ header: () => <Trans i18nKey="pollsListDates" defaults="Dates" />,
+ meta: {
+ className: "hidden justify-end text-muted-foreground text-xs md:flex",
+ },
+ cell: ({ getValue, row }) => {
+ const range = getValue();
+ return range ? (
+ <PollDateRange
+ start={range.start}
+ end={range.end}
+ timeZone={row.original.timeZone}
+ />
+ ) : null;
+ },
+ }),
+ columnHelper.accessor("participantCount", {
+ header: () => <Trans i18nKey="participants" defaults="Participants" />,
+ meta: {
+ className: "hidden justify-end text-muted-foreground text-sm sm:flex",
+ },
+ cell: ({ getValue }) => (
+ <span className="flex items-center gap-1.5 tabular-nums">
+ <UsersIcon aria-hidden className="size-4" />
+ <span aria-hidden>{getValue()}</span>
+ <span className="sr-only">
+ <Trans
+ i18nKey="participantCount"
+ defaults="{count, plural, =0 {No participants} one {1 participant} other {# participants}}"
+ values={{ count: getValue() }}
+ />
+ </span>
+ </span>
+ ),
+ }),
+ columnHelper.accessor("user", {
+ header: () => <Trans i18nKey="pollsListOrganizer" defaults="Organizer" />,
+ meta: { className: "hidden sm:flex" },
+ cell: ({ getValue }) => {
+ const user = getValue();
+ return user ? (
+ <Tooltip>
+ <TooltipTrigger className="relative z-10">
+ <OptimizedAvatarImage
+ size="sm"
+ name={user.name}
+ src={user.image ?? undefined}
+ />
+ </TooltipTrigger>
+ <TooltipContent>{user.name}</TooltipContent>
+ </Tooltip>
+ ) : null;
+ },
+ }),
+ columnHelper.display({
+ id: "actions",
+ header: () => <Trans i18nKey="pollsListActions" defaults="Actions" />,
+ cell: ({ row }) => (
+ <PollRowActions
+ id={row.original.id}
+ title={row.original.title}
+ status={row.original.status}
+ />
+ ),
+ }),
+];
+
export function PollsInfiniteList({
status,
search,
member,
emptyState,
-}: PollsInfiniteListProps) {
+}: {
+ status?: PollStatus;
+ search?: string;
+ member?: string;
+ emptyState: React.ReactNode;
+}) {
const [data, { fetchNextPage, hasNextPage, isFetchingNextPage }] =
trpc.polls.infiniteChronological.useSuspenseInfiniteQuery(
{
@@ -292,7 +363,17 @@ export function PollsInfiniteList({
},
);
- const polls = data.pages.flatMap((page) => page.polls);
+ const polls = React.useMemo(
+ () => data.pages.flatMap((page) => page.polls),
+ [data],
+ );
+
+ const table = useReactTable({
+ data: polls,
+ columns,
+ getCoreRowModel: getCoreRowModel(),
+ getRowId: (poll) => poll.id,
+ });
const loadMoreRef = React.useRef<HTMLDivElement>(null);
@@ -326,24 +407,15 @@ export function PollsInfiniteList({
}, [handleLoadMore]);
if (polls.length === 0) {
- return <>{emptyState}</>;
+ return <ListViewContent>{emptyState}</ListViewContent>;
}
return (
- <StackedList>
- {polls.map(({ id, title, status, closedReason, participants, user }) => (
- <StackedListItem key={id}>
- <PollListItem
- id={id}
- title={title}
- status={status}
- closedReason={closedReason}
- participants={participants}
- user={user}
- />
- </StackedListItem>
- ))}
-
+ <ListViewContent>
+ <DataList
+ table={table}
+ className="grid-cols-[auto_minmax(0,1fr)_auto] sm:grid-cols-[auto_minmax(0,1fr)_auto_auto_auto] md:grid-cols-[auto_minmax(0,1fr)_auto_auto_auto_auto]"
+ />
{hasNextPage && (
<div ref={loadMoreRef} className="flex justify-center py-4">
{isFetchingNextPage && (
@@ -356,16 +428,6 @@ export function PollsInfiniteList({
)}
</div>
)}
-
- {!hasNextPage && data.pages.length > 1 && (
- <div className="flex items-center justify-center gap-2 py-4 text-muted-foreground text-sm">
- <StickerIcon className="size-4 shrink-0 text-muted-foreground" />
- <Trans
- i18nKey="endOfList"
- defaults="You've reached the end of the list"
- />
- </div>
- )}
- </StackedList>
+ </ListViewContent>
);
}
diff --git a/apps/web/src/features/poll/data.test.ts b/apps/web/src/features/poll/data.test.ts
index 8ba83228d..6a4f27404 100644
--- a/apps/web/src/features/poll/data.test.ts
+++ b/apps/web/src/features/poll/data.test.ts
@@ -3,17 +3,24 @@ import { beforeEach, describe, expect, it, vi } from "vitest";
vi.mock("server-only", () => ({}));
const mockFindMany = vi.fn();
+const mockCount = vi.fn();
+const mockOptionGroupBy = vi.fn();
vi.mock("@rallly/database", () => ({
prisma: {
poll: {
findMany: (...args: unknown[]) => mockFindMany(...args),
+ count: (...args: unknown[]) => mockCount(...args),
},
+ option: {
+ groupBy: (...args: unknown[]) => mockOptionGroupBy(...args),
+ },
+ $transaction: (operations: Promise<unknown>[]) => Promise.all(operations),
},
}));
import type { AuthorizedSpaceId } from "@/features/space/types";
-import { listPolls } from "./data";
+import { getPolls, listPolls } from "./data";
const spaceId = "test-space-id" as AuthorizedSpaceId;
@@ -103,3 +110,55 @@ describe("listPolls", () => {
);
});
});
+
+describe("getPolls", () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+ });
+
+ const makeListedPoll = (id: string, participants: number) => ({
+ id,
+ title: `Poll ${id}`,
+ status: "open",
+ closedReason: null,
+ timeZone: "Europe/London",
+ createdAt: new Date("2025-01-10T12:00:00Z"),
+ updatedAt: new Date("2025-01-11T12:00:00Z"),
+ user: null,
+ _count: { participants },
+ });
+
+ it("returns each poll's participant count and option date range", async () => {
+ const start = new Date("2025-02-03T09:00:00Z");
+ const end = new Date("2025-02-07T15:00:00Z");
+ mockCount.mockResolvedValue(2);
+ mockFindMany.mockResolvedValue([
+ makeListedPoll("p1", 3),
+ makeListedPoll("p2", 0),
+ ]);
+ mockOptionGroupBy.mockResolvedValue([
+ { pollId: "p1", _min: { startTime: start }, _max: { startTime: end } },
+ ]);
+
+ const result = await getPolls({ scope: { spaceId } });
+
+ expect(mockOptionGroupBy).toHaveBeenCalledWith({
+ by: ["pollId"],
+ where: { pollId: { in: ["p1", "p2"] } },
+ _min: { startTime: true },
+ _max: { startTime: true },
+ });
+ expect(result.polls[0]).toMatchObject({
+ id: "p1",
+ participantCount: 3,
+ timeZone: "Europe/London",
+ dateRange: { start, end },
+ });
+ // A poll with no options has no range to show
+ expect(result.polls[1]).toMatchObject({
+ id: "p2",
+ participantCount: 0,
+ dateRange: null,
+ });
+ });
+});
diff --git a/apps/web/src/features/poll/data.ts b/apps/web/src/features/poll/data.ts
index 044f68dc9..bf7b5aeff 100644
--- a/apps/web/src/features/poll/data.ts
+++ b/apps/web/src/features/poll/data.ts
@@ -354,6 +354,7 @@ export const getPolls = async ({
title: true,
status: true,
closedReason: true,
+ timeZone: true,
createdAt: true,
updatedAt: true,
user: {
@@ -363,15 +364,9 @@ export const getPolls = async ({
image: true,
},
},
- participants: {
+ _count: {
select: {
- id: true,
- name: true,
- user: {
- select: {
- image: true,
- },
- },
+ participants: true,
},
},
},
@@ -381,26 +376,41 @@ export const getPolls = async ({
}),
]);
- const transformedPolls = polls.map((poll) => ({
- id: poll.id,
- title: poll.title,
- status: poll.status,
- closedReason: poll.closedReason,
- createdAt: poll.createdAt,
- updatedAt: poll.updatedAt,
- user: poll.user
- ? {
- id: poll.user.id,
- name: poll.user.name,
- image: poll.user.image,
- }
- : null,
- participants: poll.participants.map((participant) => ({
- id: participant.id,
- name: participant.name,
- image: participant.user?.image ?? undefined,
- })),
- }));
+ const optionRanges = await prisma.option.groupBy({
+ by: ["pollId"],
+ where: { pollId: { in: polls.map((poll) => poll.id) } },
+ _min: { startTime: true },
+ _max: { startTime: true },
+ });
+ const rangeByPollId = new Map(
+ optionRanges.map((range) => [range.pollId, range]),
+ );
+
+ const transformedPolls = polls.map((poll) => {
+ const range = rangeByPollId.get(poll.id);
+ return {
+ id: poll.id,
+ title: poll.title,
+ status: poll.status,
+ closedReason: poll.closedReason,
+ // Null means the poll's times are floating: shown as stored to everyone
+ timeZone: poll.timeZone,
+ createdAt: poll.createdAt,
+ updatedAt: poll.updatedAt,
+ user: poll.user
+ ? {
+ id: poll.user.id,
+ name: poll.user.name,
+ image: poll.user.image,
+ }
+ : null,
+ participantCount: poll._count.participants,
+ dateRange:
+ range?._min.startTime && range._max.startTime
+ ? { start: range._min.startTime, end: range._max.startTime }
+ : null,
+ };
+ });
const totalPages = Math.ceil(totalCount / pageSize);
const hasNextPage = page < totalPages;
diff --git a/apps/web/src/features/scheduled-event/components/scheduled-event-list.tsx b/apps/web/src/features/scheduled-event/components/scheduled-event-list.tsx
deleted file mode 100644
index c11c64c2f..000000000
--- a/apps/web/src/features/scheduled-event/components/scheduled-event-list.tsx
+++ /dev/null
@@ -1,236 +0,0 @@
-"use client";
-
-import type { ScheduledEventStatus } from "@rallly/database";
-import { cn } from "@rallly/ui";
-import { Badge } from "@rallly/ui/badge";
-import { Button } from "@rallly/ui/button";
-import {
- Dialog,
- DialogClose,
- DialogContent,
- DialogDescription,
- DialogFooter,
- DialogHeader,
- DialogTitle,
- useDialog,
-} from "@rallly/ui/dialog";
-import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuSeparator,
- DropdownMenuSub,
- DropdownMenuSubContent,
- DropdownMenuSubTrigger,
- DropdownMenuTrigger,
-} from "@rallly/ui/dropdown-menu";
-import { Tooltip, TooltipContent, TooltipTrigger } from "@rallly/ui/tooltip";
-import { shortUrl } from "@rallly/utils/absolute-url";
-import { CalendarPlusIcon, MoreVerticalIcon } from "lucide-react";
-import { CopyLinkButton } from "@/components/copy-link-button";
-import { OptimizedAvatarImage } from "@/components/optimized-avatar-image";
-import { StackedList } from "@/components/stacked-list";
-import { AddToCalendarMenuItems } from "@/features/calendars/components/add-to-calendar-menu-items";
-import {
- EventDate,
- EventTimeRange,
-} from "@/features/scheduled-event/components/event-date-time";
-import { isScheduledEventEnabled } from "@/features/scheduled-event/constants";
-import { Trans, useTranslation } from "@/i18n/client";
-import { trpc } from "@/trpc/client";
-
-export const ScheduledEventList = StackedList;
-
-export function ScheduledEventListItem({
- eventId,
- title,
- start,
- end,
- allDay,
- invites,
- timeZone,
- status,
- createdBy,
-}: {
- eventId: string;
- title: string;
- status: ScheduledEventStatus;
- start: Date;
- end: Date;
- timeZone: string | null;
- allDay: boolean;
- invites: { id: string; inviteeName: string; inviteeImage?: string }[];
- createdBy: { name: string; image?: string };
-}) {
- const { t } = useTranslation();
- const dialog = useDialog();
- const cancelEvent = trpc.events.cancel.useMutation({
- onSuccess: () => {
- dialog.dismiss();
- },
- });
-
- return (
- <div className="flex w-full gap-6">
- <div className="flex flex-1 flex-col gap-y-1 lg:flex-row-reverse lg:justify-end lg:gap-x-4">
- <div className="flex items-center gap-4 text-sm">
- <div className="flex flex-1 items-center gap-2">
- <div className="flex flex-col gap-1">
- <span
- className={cn("font-medium", {
- "line-through": status === "canceled",
- })}
- >
- {title}
- </span>
- <div className="text-muted-foreground text-sm">
- {invites.length > 0 ? (
- <Tooltip>
- <TooltipTrigger
- render={
- <span className="cursor-help">
- <Trans
- i18nKey="attendeeCount"
- defaults="{count, plural, =0 {No attendees} one {1 attendee} other {# attendees}}"
- values={{ count: invites.length }}
- />
- </span>
- }
- />
- <TooltipContent>
- <ul>
- {invites.slice(0, 10).map((invite) => (
- <li key={invite.id}>{invite.inviteeName}</li>
- ))}
- {invites.length > 10 && (
- <li>
- <Trans
- i18nKey="moreParticipants"
- values={{ count: invites.length - 10 }}
- defaults="{count, plural, other {# more…}}"
- />
- </li>
- )}
- </ul>
- </TooltipContent>
- </Tooltip>
- ) : (
- <Trans
- i18nKey="attendeeCount"
- defaults="{count, plural, =0 {No attendees} one {1 attendee} other {# attendees}}"
- values={{ count: invites.length }}
- />
- )}
- </div>
- </div>
- </div>
- </div>
- <div className="flex items-center whitespace-nowrap text-sm lg:min-w-48">
- <div>
- <div className="font-medium">
- <EventDate value={start} allDay={allDay} timeZone={timeZone} />
- </div>
- <div className="text-muted-foreground">
- <EventTimeRange
- start={start}
- end={end}
- allDay={allDay}
- timeZone={timeZone}
- />
- </div>
- </div>
- </div>
- </div>
- <div className="flex items-center gap-4">
- <div className="flex items-center gap-2">
- <Tooltip>
- <TooltipTrigger>
- <OptimizedAvatarImage
- size="sm"
- name={createdBy.name}
- src={createdBy.image}
- />
- </TooltipTrigger>
- <TooltipContent>{createdBy.name}</TooltipContent>
- </Tooltip>
- </div>
- {isScheduledEventEnabled && (
- <CopyLinkButton href={shortUrl(`/e/${eventId}`)} />
- )}
- {status === "canceled" && (
- <Badge>
- <Trans i18nKey="canceled" defaults="Canceled" />
- </Badge>
- )}
- <DropdownMenu>
- <DropdownMenuTrigger
- render={
- <Button
- aria-label={t("moreOptions", {
- defaultValue: "More options",
- })}
- variant="ghost"
- size="icon"
- />
- }
- >
- <MoreVerticalIcon className="text-muted-foreground" />
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end">
- <DropdownMenuSub>
- <DropdownMenuSubTrigger>
- <CalendarPlusIcon />
- <Trans i18nKey="addToCalendar" defaults="Add to calendar" />
- </DropdownMenuSubTrigger>
- <DropdownMenuSubContent>
- <AddToCalendarMenuItems eventId={eventId} />
- </DropdownMenuSubContent>
- </DropdownMenuSub>
- {status !== "canceled" && (
- <>
- <DropdownMenuSeparator />
- <DropdownMenuItem
- variant="destructive"
- onClick={() => dialog.trigger()}
- >
- <Trans i18nKey="cancelEvent" defaults="Cancel event" />
- </DropdownMenuItem>
- </>
- )}
- </DropdownMenuContent>
- </DropdownMenu>
- </div>
- <Dialog {...dialog.dialogProps}>
- <DialogContent size="sm">
- <DialogHeader>
- <DialogTitle>
- <Trans i18nKey="cancelEvent" defaults="Cancel event" />
- </DialogTitle>
- <DialogDescription>
- <Trans
- i18nKey="cancelEventConfirmDescription"
- defaults="Are you sure you want to cancel this event?"
- />
- </DialogDescription>
- </DialogHeader>
- <DialogFooter>
- <DialogClose render={<Button variant="default" />}>
- <Trans i18nKey="cancel" defaults="Cancel" />
- </DialogClose>
- <Button
- variant="destructive"
- loading={cancelEvent.isPending}
- onClick={() =>
- cancelEvent.mutate({
- eventId,
- })
- }
- >
- <Trans i18nKey="cancelEvent" defaults="Cancel event" />
- </Button>
- </DialogFooter>
- </DialogContent>
- </Dialog>
- </div>
- );
-}
diff --git a/apps/web/src/features/scheduled-event/components/scheduled-event-row.tsx b/apps/web/src/features/scheduled-event/components/scheduled-event-row.tsx
new file mode 100644
index 000000000..aebfcf66f
--- /dev/null
+++ b/apps/web/src/features/scheduled-event/components/scheduled-event-row.tsx
@@ -0,0 +1,124 @@
+"use client";
+
+import { Button } from "@rallly/ui/button";
+import {
+ Dialog,
+ DialogClose,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+ useDialog,
+} from "@rallly/ui/dialog";
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuSeparator,
+ DropdownMenuSub,
+ DropdownMenuSubContent,
+ DropdownMenuSubTrigger,
+ DropdownMenuTrigger,
+} from "@rallly/ui/dropdown-menu";
+import { shortUrl } from "@rallly/utils/absolute-url";
+import { CalendarPlusIcon, MoreHorizontalIcon } from "lucide-react";
+import { CopyLinkButton } from "@/components/copy-link-button";
+import { AddToCalendarMenuItems } from "@/features/calendars/components/add-to-calendar-menu-items";
+import { isScheduledEventEnabled } from "@/features/scheduled-event/constants";
+import type { ScheduledEventStatus } from "@/features/scheduled-event/schema";
+import { Trans, useTranslation } from "@/i18n/client";
+import { trpc } from "@/trpc/client";
+
+export function ScheduledEventRowActions({
+ eventId,
+ status,
+}: {
+ eventId: string;
+ status: ScheduledEventStatus;
+}) {
+ const { t } = useTranslation();
+ const dialog = useDialog();
+ const cancelEvent = trpc.events.cancel.useMutation({
+ onSuccess: () => {
+ dialog.dismiss();
+ },
+ });
+
+ return (
+ <div className="relative z-10 flex items-center gap-x-1">
+ {isScheduledEventEnabled && (
+ <CopyLinkButton href={shortUrl(`/e/${eventId}`)} className="size-8" />
+ )}
+ <DropdownMenu>
+ <DropdownMenuTrigger
+ render={
+ <Button
+ aria-label={t("moreOptions", {
+ defaultValue: "More options",
+ })}
+ variant="ghost"
+ size="icon"
+ className="size-8"
+ />
+ }
+ >
+ <MoreHorizontalIcon />
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ <DropdownMenuSub>
+ <DropdownMenuSubTrigger>
+ <CalendarPlusIcon />
+ <Trans i18nKey="addToCalendar" defaults="Add to calendar" />
+ </DropdownMenuSubTrigger>
+ <DropdownMenuSubContent>
+ <AddToCalendarMenuItems eventId={eventId} />
+ </DropdownMenuSubContent>
+ </DropdownMenuSub>
+ {status !== "canceled" && (
+ <>
+ <DropdownMenuSeparator />
+ <DropdownMenuItem
+ variant="destructive"
+ onClick={() => dialog.trigger()}
+ >
+ <Trans i18nKey="cancelEvent" defaults="Cancel event" />
+ </DropdownMenuItem>
+ </>
+ )}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ <Dialog {...dialog.dialogProps}>
+ <DialogContent size="sm">
+ <DialogHeader>
+ <DialogTitle>
+ <Trans i18nKey="cancelEvent" defaults="Cancel event" />
+ </DialogTitle>
+ <DialogDescription>
+ <Trans
+ i18nKey="cancelEventConfirmDescription"
+ defaults="Are you sure you want to cancel this event?"
+ />
+ </DialogDescription>
+ </DialogHeader>
+ <DialogFooter>
+ <DialogClose render={<Button variant="default" />}>
+ <Trans i18nKey="cancel" defaults="Cancel" />
+ </DialogClose>
+ <Button
+ variant="destructive"
+ loading={cancelEvent.isPending}
+ onClick={() =>
+ cancelEvent.mutate({
+ eventId,
+ })
+ }
+ >
+ <Trans i18nKey="cancelEvent" defaults="Cancel event" />
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+ </div>
+ );
+}
diff --git a/apps/web/src/features/scheduled-event/schema.ts b/apps/web/src/features/scheduled-event/schema.ts
index 79f3027df..a2bb7e07f 100644
--- a/apps/web/src/features/scheduled-event/schema.ts
+++ b/apps/web/src/features/scheduled-event/schema.ts
@@ -8,3 +8,11 @@ export const statusSchema = z.enum([
]);
export type Status = z.infer<typeof statusSchema>;
+
+export const scheduledEventStatusSchema = z.enum([
+ "confirmed",
+ "unconfirmed",
+ "canceled",
+]);
+
+export type ScheduledEventStatus = z.infer<typeof scheduledEventStatusSchema>;
diff --git a/packages/ui/src/badge.tsx b/packages/ui/src/badge.tsx
index 04dbfa743..8f362a474 100644
--- a/packages/ui/src/badge.tsx
+++ b/packages/ui/src/badge.tsx
@@ -10,7 +10,7 @@ const badgeVariants = cva(
variants: {
variant: {
primary: "bg-primary text-primary-foreground",
- default: "border border-card-border bg-card text-muted-foreground",
+ default: "bg-gray-100 text-muted-foreground dark:bg-gray-800",
destructive:
"bg-rose-600/10 text-rose-600 dark:bg-rose-500/10 dark:text-rose-500",
outline: "text-foreground",
diff --git a/packages/ui/src/button-variants.ts b/packages/ui/src/button-variants.ts
index 32e213e82..b173a3ca2 100644
--- a/packages/ui/src/button-variants.ts
+++ b/packages/ui/src/button-variants.ts
@@ -4,7 +4,7 @@ import { cn } from "./lib/utils";
export const buttonVariants = cva(
cn(
- "group inline-flex shrink-0 items-center justify-center whitespace-nowrap font-normal transition-[background-color,color,transform] ease-out disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg]:opacity-90",
+ "group inline-flex shrink-0 items-center justify-center whitespace-nowrap in-data-[slot=button-group]:rounded-lg font-normal tracking-tight transition-[background-color,color,transform] ease-out disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg]:opacity-90",
),
{
variants: {
@@ -23,16 +23,15 @@ export const buttonVariants = cva(
},
size: {
default:
- "h-9 gap-1.5 rounded-lg px-2.5 text-sm has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
- xs: "h-6 gap-1 in-data-[slot=button-group]:rounded-lg rounded-[min(var(--radius-md),10px)] px-2 text-sm text-xs has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
- sm: "h-7 gap-1.5 in-data-[slot=button-group]:rounded-lg rounded-lg px-2.5 text-[0.8rem] text-sm has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2 [&_svg:not([class*='size-'])]:size-3.5",
- lg: "h-10 gap-1.5 rounded-lg px-3 text-sm has-data-[icon=inline-end]:pr-2.5 has-data-[icon=inline-start]:pl-2.5",
- xl: "h-12 gap-2 rounded-xl px-4 text-base has-data-[icon=inline-end]:pr-3.5 has-data-[icon=inline-start]:pl-3.5",
+ "h-9 gap-1.5 rounded-lg px-3.5 text-sm has-data-[icon=inline-end]:pr-2.5 has-data-[icon=inline-start]:pl-2.5",
+ xs: "h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 text-sm text-xs has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
+ sm: "h-7 gap-1.5 rounded-lg px-3 text-[0.8rem] text-sm has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2 [&_svg:not([class*='size-'])]:size-3.5",
+ lg: "h-10 gap-1.5 rounded-lg px-4 text-sm has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3",
+ xl: "h-12 gap-2 rounded-xl px-5 text-base has-data-[icon=inline-end]:pr-4 has-data-[icon=inline-start]:pl-4",
icon: "size-9 rounded-lg",
"icon-xs":
- "size-6 in-data-[slot=button-group]:rounded-lg rounded-[min(var(--radius-md),10px)] [&_svg:not([class*='size-'])]:size-3",
- "icon-sm":
- "size-7 in-data-[slot=button-group]:rounded-lg rounded-[min(var(--radius-md),12px)]",
+ "size-6 rounded-[min(var(--radius-md),10px)] [&_svg:not([class*='size-'])]:size-3",
+ "icon-sm": "size-7 rounded-[min(var(--radius-md),12px)]",
"icon-lg": "size-10 rounded-lg",
},
},