Skip to content

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

✨ Public event page redesign + RSVP submission (#2407)

Luke Vella1a87e4b54659
diff --git a/apps/web/public/locales/en/app.json b/apps/web/public/locales/en/app.json
index b0dc85af3..b281e3d15 100644
--- a/apps/web/public/locales/en/app.json
+++ b/apps/web/public/locales/en/app.json
@@ -679,5 +679,12 @@
"invited": "Invited",
"eventOrganizedBy": "Organized by {name}",
"expiredVerificationCode": "This code has expired. Request a new one to continue.",
- "tooManyVerificationAttempts": "Too many incorrect attempts. Request a new code to continue."
+ "tooManyVerificationAttempts": "Too many incorrect attempts. Request a new code to continue.",
+ "rsvpDecline": "Decline",
+ "rsvpResponseHeadingGoing": "You're going",
+ "rsvpResponseHeadingDeclining": "You're declining",
+ "rsvpChange": "Change",
+ "confirmResponse": "Confirm response",
+ "nameRequired": "Please enter your name",
+ "rsvpAlreadyResponded": "It looks like you've already responded with this email"
}
diff --git a/apps/web/src/app/[locale]/e/[id]/event-header.tsx b/apps/web/src/app/[locale]/e/[id]/event-header.tsx
index 09e8cc867..c96a150c3 100644
--- a/apps/web/src/app/[locale]/e/[id]/event-header.tsx
+++ b/apps/web/src/app/[locale]/e/[id]/event-header.tsx
@@ -1,8 +1,82 @@
"use client";
+import { cn } from "@rallly/ui";
+import { Badge } from "@rallly/ui/badge";
+import { Trans } from "@/i18n/client";
import { dayjs } from "@/lib/dayjs";
-export function EventDateLine({
+export function EventHeader({
+ children,
+ className,
+}: {
+ children: React.ReactNode;
+ className?: string;
+}) {
+ return <header className={cn("px-4 pb-6", className)}>{children}</header>;
+}
+
+export function EventTitle({
+ children,
+ className,
+}: {
+ children: React.ReactNode;
+ className?: string;
+}) {
+ return (
+ <h1
+ className={cn(
+ "text-balance font-semibold text-foreground text-xl leading-tight tracking-tight",
+ className,
+ )}
+ >
+ {children}
+ </h1>
+ );
+}
+
+export function EventSubtitle({
+ children,
+ className,
+}: {
+ children: React.ReactNode;
+ className?: string;
+}) {
+ return (
+ <p className={cn("mt-1 text-muted-foreground text-sm", className)}>
+ {children}
+ </p>
+ );
+}
+
+export function EventStatus({
+ status,
+ hasEnded,
+}: {
+ status: "confirmed" | "canceled" | "unconfirmed";
+ hasEnded: boolean;
+}) {
+ if (status === "canceled") {
+ return (
+ <Badge variant="destructive">
+ <Trans i18nKey="eventStatusCanceled" defaults="Canceled" />
+ </Badge>
+ );
+ }
+ if (hasEnded) {
+ return (
+ <Badge variant="default">
+ <Trans i18nKey="eventStatusPast" defaults="Past" />
+ </Badge>
+ );
+ }
+ return (
+ <Badge variant="green">
+ <Trans i18nKey="eventStatusUpcoming" defaults="Upcoming" />
+ </Badge>
+ );
+}
+
+export function EventDate({
start,
end,
allDay,
@@ -25,7 +99,7 @@ export function EventDateLine({
<div className="mt-3">
<p className="font-medium text-base text-foreground">{date}</p>
{time ? (
- <p className="mt-0.5 text-base text-muted-foreground">{time}</p>
+ <p className="mt-0.5 text-muted-foreground text-sm">{time}</p>
) : null}
</div>
);
diff --git a/apps/web/src/app/[locale]/e/[id]/event-wizard.tsx b/apps/web/src/app/[locale]/e/[id]/event-wizard.tsx
new file mode 100644
index 000000000..8559ca565
--- /dev/null
+++ b/apps/web/src/app/[locale]/e/[id]/event-wizard.tsx
@@ -0,0 +1,322 @@
+"use client";
+
+import { zodResolver } from "@hookform/resolvers/zod";
+import { cn } from "@rallly/ui";
+import {
+ ActionBar,
+ ActionBarButton,
+ ActionBarOffset,
+} from "@rallly/ui/action-bar";
+import { Field, FieldError, FieldGroup, FieldLabel } from "@rallly/ui/field";
+import { Input } from "@rallly/ui/input";
+import { CheckIcon, MapPinIcon, VideoIcon, XIcon } from "lucide-react";
+import React from "react";
+import { Controller, useForm } from "react-hook-form";
+import * as z from "zod";
+import TruncatedLinkify from "@/components/poll/truncated-linkify";
+import { ConferencingLink } from "@/features/conferencing/components/conferencing-link";
+import type { Conferencing } from "@/features/conferencing/schema";
+import { submitRsvpAction } from "@/features/scheduled-event/actions";
+import { Trans, useTranslation } from "@/i18n/client";
+import { useSafeAction } from "@/lib/safe-action/client";
+import type { Attendee } from "./attendee-rows";
+import { AttendeeRows } from "./attendee-rows";
+import {
+ Section,
+ SectionGroup,
+ SectionItem,
+ SectionItemLabel,
+ SectionItemValue,
+} from "./section";
+
+type RsvpStatus = "accepted" | "declined";
+
+export function EventWizard({
+ eventId,
+ description,
+ locationText,
+ conferencing,
+ attendees,
+}: {
+ eventId: string;
+ description: string | null;
+ locationText: string | null;
+ conferencing: Conferencing | null;
+ attendees: Attendee[];
+}) {
+ const [response, setResponse] = React.useState<RsvpStatus | null>(null);
+
+ if (response !== null) {
+ return (
+ <div className="space-y-6 px-3">
+ <RsvpResponseBanner
+ response={response}
+ onChange={() => setResponse(null)}
+ />
+ <RsvpForm eventId={eventId} status={response} />
+ </div>
+ );
+ }
+
+ return (
+ <>
+ <EventBody
+ description={description}
+ locationText={locationText}
+ conferencing={conferencing}
+ attendees={attendees}
+ />
+ <ActionBarOffset />
+ <RsvpActions onPick={setResponse} />
+ </>
+ );
+}
+
+function EventBody({
+ description,
+ locationText,
+ conferencing,
+ attendees,
+}: {
+ description: string | null;
+ locationText: string | null;
+ conferencing: Conferencing | null;
+ attendees: Attendee[];
+}) {
+ return (
+ <div className="px-3 pb-3">
+ <SectionGroup>
+ {locationText || conferencing ? (
+ <Section>
+ {locationText ? (
+ <SectionItem>
+ <SectionItemLabel>
+ <MapPinIcon />
+ <Trans i18nKey="location" defaults="Location" />
+ </SectionItemLabel>
+ <SectionItemValue className="text-foreground">
+ {locationText}
+ </SectionItemValue>
+ </SectionItem>
+ ) : null}
+ {conferencing ? (
+ <SectionItem>
+ <SectionItemLabel>
+ <VideoIcon />
+ <Trans i18nKey="conferencing" defaults="Conferencing" />
+ </SectionItemLabel>
+ <SectionItemValue className="overflow-hidden">
+ <ConferencingLink conferencing={conferencing} />
+ </SectionItemValue>
+ </SectionItem>
+ ) : null}
+ </Section>
+ ) : null}
+
+ {description ? (
+ <Section
+ title={<Trans i18nKey="description" defaults="Description" />}
+ >
+ <SectionItem className="py-3">
+ <p className="whitespace-pre-wrap text-pretty text-foreground text-sm leading-relaxed">
+ <TruncatedLinkify>{description}</TruncatedLinkify>
+ </p>
+ </SectionItem>
+ </Section>
+ ) : null}
+
+ {attendees.length > 0 ? (
+ <Section title={<Trans i18nKey="attendees" defaults="Attendees" />}>
+ <SectionItem>
+ <SectionItemLabel>
+ <Trans i18nKey="invited" defaults="Invited" />
+ </SectionItemLabel>
+ <SectionItemValue className="tabular-nums">
+ {attendees.length}
+ </SectionItemValue>
+ </SectionItem>
+ <AttendeeRows attendees={attendees} />
+ </Section>
+ ) : null}
+ </SectionGroup>
+ </div>
+ );
+}
+
+function RsvpActions({ onPick }: { onPick: (status: RsvpStatus) => void }) {
+ return (
+ <ActionBar>
+ <ActionBarButton
+ variant="default"
+ className="flex-1"
+ onClick={() => onPick("declined")}
+ >
+ <XIcon />
+ <Trans i18nKey="rsvpDecline" defaults="Decline" />
+ </ActionBarButton>
+ <ActionBarButton
+ variant="primary"
+ className="flex-1"
+ onClick={() => onPick("accepted")}
+ >
+ <CheckIcon />
+ <Trans i18nKey="attendeeStatusGoing" defaults="Going" />
+ </ActionBarButton>
+ </ActionBar>
+ );
+}
+
+function RsvpResponseBanner({
+ response,
+ onChange,
+}: {
+ response: RsvpStatus;
+ onChange: () => void;
+}) {
+ const isAccepted = response === "accepted";
+ return (
+ <div
+ className={cn(
+ "flex items-center gap-3 rounded-xl border p-3",
+ isAccepted
+ ? "border-green-400/20 bg-green-400/10 dark:bg-green-950/30"
+ : "border-red-400/20 bg-red-400/10 dark:bg-red-950/30",
+ )}
+ >
+ {isAccepted ? (
+ <CheckIcon className="size-4 shrink-0 text-green-600 dark:text-green-400" />
+ ) : (
+ <XIcon className="size-4 shrink-0 text-red-600 dark:text-red-400" />
+ )}
+ <p className="flex-1 text-foreground text-sm">
+ {isAccepted ? (
+ <Trans i18nKey="rsvpResponseHeadingGoing" defaults="You're going" />
+ ) : (
+ <Trans
+ i18nKey="rsvpResponseHeadingDeclining"
+ defaults="You're declining"
+ />
+ )}
+ </p>
+ <button
+ type="button"
+ onClick={onChange}
+ className="font-medium text-muted-foreground text-sm hover:text-foreground hover:underline"
+ >
+ <Trans i18nKey="rsvpChange" defaults="Change" />
+ </button>
+ </div>
+ );
+}
+
+function useRsvpFormSchema() {
+ const { t } = useTranslation();
+ return z.object({
+ name: z
+ .string()
+ .trim()
+ .min(1, t("nameRequired", { defaultValue: "Please enter your name" })),
+ email: z.email(
+ t("invalidEmail", {
+ defaultValue: "Please enter a valid email address",
+ }),
+ ),
+ });
+}
+
+function RsvpForm({
+ eventId,
+ status,
+}: {
+ eventId: string;
+ status: RsvpStatus;
+}) {
+ const { t } = useTranslation();
+ const schema = useRsvpFormSchema();
+ const submitRsvp = useSafeAction(submitRsvpAction);
+ const form = useForm({
+ resolver: zodResolver(schema),
+ defaultValues: {
+ name: "",
+ email: "",
+ },
+ });
+
+ return (
+ <form
+ onSubmit={form.handleSubmit(async (data) => {
+ const result = await submitRsvp.executeAsync({
+ eventId,
+ status,
+ name: data.name,
+ email: data.email,
+ });
+
+ if (result.data?.ok === false) {
+ if (result.data.reason === "already_responded") {
+ form.setError("email", {
+ message: t("rsvpAlreadyResponded", {
+ defaultValue:
+ "It looks like you've already responded with this email",
+ }),
+ });
+ }
+ }
+ })}
+ >
+ <FieldGroup>
+ <Controller
+ control={form.control}
+ name="name"
+ render={({ field, fieldState }) => (
+ <Field data-invalid={fieldState.invalid}>
+ <FieldLabel htmlFor={field.name}>
+ <Trans i18nKey="name" defaults="Name" />
+ </FieldLabel>
+ <Input
+ {...field}
+ id={field.name}
+ placeholder={t("namePlaceholder")}
+ autoFocus={true}
+ autoComplete="name"
+ disabled={form.formState.isSubmitting}
+ aria-invalid={fieldState.invalid}
+ />
+ {fieldState.invalid && <FieldError errors={[fieldState.error]} />}
+ </Field>
+ )}
+ />
+ <Controller
+ control={form.control}
+ name="email"
+ render={({ field, fieldState }) => (
+ <Field data-invalid={fieldState.invalid}>
+ <FieldLabel htmlFor={field.name}>
+ <Trans i18nKey="email" defaults="Email" />
+ </FieldLabel>
+ <Input
+ {...field}
+ id={field.name}
+ placeholder={t("emailPlaceholder")}
+ autoComplete="email"
+ disabled={form.formState.isSubmitting}
+ aria-invalid={fieldState.invalid}
+ />
+ {fieldState.invalid && <FieldError errors={[fieldState.error]} />}
+ </Field>
+ )}
+ />
+ </FieldGroup>
+ <ActionBar>
+ <ActionBarButton
+ variant="primary"
+ className="flex-1"
+ type="submit"
+ loading={form.formState.isSubmitting}
+ >
+ <Trans i18nKey="confirmResponse" defaults="Confirm response" />
+ </ActionBarButton>
+ </ActionBar>
+ </form>
+ );
+}
diff --git a/apps/web/src/app/[locale]/e/[id]/page.tsx b/apps/web/src/app/[locale]/e/[id]/page.tsx
index 04650f0e7..b8fe506ad 100644
--- a/apps/web/src/app/[locale]/e/[id]/page.tsx
+++ b/apps/web/src/app/[locale]/e/[id]/page.tsx
@@ -1,81 +1,31 @@
-import { prisma } from "@rallly/database";
import { buttonVariants } from "@rallly/ui";
-import {
- ActionBar,
- ActionBarOffset,
- ActionBarSpacer,
-} from "@rallly/ui/action-bar";
-import { Badge } from "@rallly/ui/badge";
-import { Button } from "@rallly/ui/button";
import { absoluteUrl } from "@rallly/utils/absolute-url";
-import { ArrowLeftIcon, MapPinIcon, VideoIcon } from "lucide-react";
+import { ArrowLeftIcon } from "lucide-react";
import type { Metadata } from "next";
import Link from "next/link";
import { notFound } from "next/navigation";
import { cache, Suspense } from "react";
import { getCurrentUser } from "@/auth/data";
-import { AddToCalendarButton } from "@/components/add-to-calendar-button";
-import TruncatedLinkify from "@/components/poll/truncated-linkify";
import { BrandingStyle } from "@/features/branding/branding-style";
-import { ConferencingLink } from "@/features/conferencing/components/conferencing-link";
import { formatLocationText } from "@/features/location/utils";
import { isScheduledEventEnabled } from "@/features/scheduled-event/constants";
-import { createScheduledEventDTO } from "@/features/scheduled-event/data";
+import {
+ createScheduledEventDTO,
+ getCachedPublicScheduledEvent,
+} from "@/features/scheduled-event/data";
import { SpaceIcon } from "@/features/space/components/space-icon";
import { Trans } from "@/i18n/client";
-import { AttendeeRows } from "./attendee-rows";
-import { EventDateLine } from "./event-header";
import {
- Section,
- SectionGroup,
- SectionItem,
- SectionItemLabel,
- SectionItemValue,
-} from "./section";
+ EventDate,
+ EventHeader,
+ EventStatus,
+ EventSubtitle,
+ EventTitle,
+} from "./event-header";
+import { EventWizard } from "./event-wizard";
const getScheduledEvent = cache(async (id: string) => {
- const event = await prisma.scheduledEvent.findUnique({
- where: { id },
- select: {
- id: true,
- title: true,
- description: true,
- location: true,
- conferencing: true,
- start: true,
- end: true,
- allDay: true,
- timeZone: true,
- status: true,
- deletedAt: true,
- hideAttendees: true,
- user: {
- select: {
- name: true,
- },
- },
- space: {
- select: {
- name: true,
- image: true,
- showBranding: true,
- primaryColor: true,
- },
- },
- invites: {
- select: {
- id: true,
- inviteeName: true,
- status: true,
- user: {
- select: {
- image: true,
- },
- },
- },
- },
- },
- });
+ const event = await getCachedPublicScheduledEvent(id);
if (!event || event.deletedAt) {
notFound();
@@ -103,31 +53,12 @@ async function EventsBackLink() {
);
}
-function StatusBadge({
- status,
- hasEnded,
-}: {
- status: "confirmed" | "canceled" | "unconfirmed";
- hasEnded: boolean;
-}) {
- if (status === "canceled") {
- return (
- <Badge variant="destructive">
- <Trans i18nKey="eventStatusCanceled" defaults="Canceled" />
- </Badge>
- );
- }
- if (hasEnded) {
- return (
- <Badge variant="default">
- <Trans i18nKey="eventStatusPast" defaults="Past" />
- </Badge>
- );
- }
+function SpaceBranding({ name, image }: { name: string; image?: string }) {
return (
- <Badge variant="green">
- <Trans i18nKey="eventStatusUpcoming" defaults="Upcoming" />
- </Badge>
+ <div className="mb-4 flex flex-col gap-2 px-4">
+ <SpaceIcon name={name} src={image} size="lg" />
+ <p className="font-medium text-muted-foreground text-sm">{name}</p>
+ </div>
);
}
@@ -150,134 +81,65 @@ export default async function EventPage({
const hasEnded = event.end < new Date();
const visibleAttendees = event.hideAttendees
? []
- : event.invites.filter((i) => i.status !== "pending");
+ : event.invites
+ .filter((i) => i.status !== "pending")
+ .map((invite) => ({
+ id: invite.id,
+ name: invite.inviteeName,
+ image: invite.user?.image ?? undefined,
+ status: invite.status,
+ }));
return (
- <div className="page-bg-gray-50 flex min-h-dvh flex-col antialiased dark:bg-gray-900">
+ <div className="min- flex h-dvh flex-col antialiased dark:bg-gray-900">
{brandingColor ? <BrandingStyle primaryColor={brandingColor} /> : null}
- <div className="flex items-center gap-4 p-3 sm:pb-6">
- <Suspense fallback={null}>
- <EventsBackLink />
- </Suspense>
+ <div className="pointer-events-none fixed inset-x-0 top-0 z-40 bg-linear-to-b from-25% from-white to-transparent dark:from-gray-900">
+ <div className="pointer-events-auto flex items-center gap-4 px-3 pt-[max(--spacing(3),env(safe-area-inset-top))] pb-12">
+ <Suspense fallback={null}>
+ <EventsBackLink />
+ </Suspense>
+ </div>
</div>
- <div className="mx-auto w-full max-w-xl flex-1">
+ <div className="mx-auto mt-12 w-full max-w-xl flex-1 py-4 sm:py-8">
{isBranded ? (
- <div className="flex items-center gap-2 p-3 py-4">
- <SpaceIcon
- name={event.space.name}
- src={event.space.image ?? undefined}
- size="md"
- />
- <p className="font-medium text-muted-foreground text-sm">
- {event.space.name}
- </p>
- </div>
+ <SpaceBranding
+ name={event.space.name}
+ image={event.space.image ?? undefined}
+ />
) : null}
- <header className="flex gap-4 px-5 pb-6">
- <div className="w-1 rounded-xs bg-primary" />
- <div className="flex-1">
- <div className="flex items-start justify-between gap-3">
- <h1 className="text-balance font-semibold text-2xl text-foreground leading-tight tracking-tight sm:text-xl">
- {event.title}
- </h1>
- <StatusBadge status={event.status} hasEnded={hasEnded} />
- </div>
- {event.user?.name ? (
- <p className="mt-1 text-muted-foreground text-sm">
- <Trans
- i18nKey="eventOrganizedBy"
- defaults="Organized by {name}"
- values={{ name: event.user.name }}
- />
- </p>
- ) : null}
- <EventDateLine
+
+ <EventHeader>
+ <EventTitle>{event.title}</EventTitle>
+ <EventSubtitle>
+ <Trans
+ i18nKey="eventOrganizedBy"
+ defaults="Organized by {name}"
+ values={{ name: event.user.name }}
+ />
+ </EventSubtitle>
+ <div className="flex items-center justify-between gap-3">
+ <EventDate
start={event.start}
end={event.end}
allDay={event.allDay}
timezone={event.displayTimeZone}
/>
+ <EventStatus status={event.status} hasEnded={hasEnded} />
</div>
- </header>
-
- <div className="px-3 pb-3">
- <SectionGroup>
- {event.location || event.conferencing ? (
- <Section>
- {event.location ? (
- <SectionItem>
- <SectionItemLabel>
- <MapPinIcon />
- <Trans i18nKey="location" defaults="Location" />
- </SectionItemLabel>
- <SectionItemValue className="text-foreground">
- {formatLocationText(event.location)}
- </SectionItemValue>
- </SectionItem>
- ) : null}
- {event.conferencing ? (
- <SectionItem>
- <SectionItemLabel>
- <VideoIcon />
- <Trans i18nKey="conferencing" defaults="Conferencing" />
- </SectionItemLabel>
- <SectionItemValue className="overflow-hidden">
- <ConferencingLink conferencing={event.conferencing} />
- </SectionItemValue>
- </SectionItem>
- ) : null}
- </Section>
- ) : null}
-
- {event.description ? (
- <Section
- title={<Trans i18nKey="description" defaults="Description" />}
- >
- <SectionItem className="py-3">
- <p className="whitespace-pre-wrap text-pretty text-foreground text-sm leading-relaxed">
- <TruncatedLinkify>{event.description}</TruncatedLinkify>
- </p>
- </SectionItem>
- </Section>
- ) : null}
-
- {visibleAttendees.length > 0 ? (
- <Section
- title={<Trans i18nKey="attendees" defaults="Attendees" />}
- >
- <SectionItem>
- <SectionItemLabel>
- <Trans i18nKey="invited" defaults="Invited" />
- </SectionItemLabel>
- <SectionItemValue className="tabular-nums">
- {visibleAttendees.length}
- </SectionItemValue>
- </SectionItem>
- <AttendeeRows
- attendees={visibleAttendees.map((invite) => ({
- id: invite.id,
- name: invite.inviteeName,
- image: invite.user?.image ?? undefined,
- status: invite.status,
- }))}
- />
- </Section>
- ) : null}
- </SectionGroup>
- <ActionBarOffset />
- </div>
+ </EventHeader>
+
+ <EventWizard
+ eventId={event.id}
+ description={event.description}
+ locationText={
+ event.location ? formatLocationText(event.location) : null
+ }
+ conferencing={event.conferencing}
+ attendees={visibleAttendees}
+ />
</div>
-
- <ActionBar>
- <AddToCalendarButton eventId={event.id} size="lg" />
- <ActionBarSpacer />
- <Button size="lg">Decline</Button>
- <Button variant="primary" size="lg">
- Accept
- </Button>
- </ActionBar>
</div>
);
}
diff --git a/apps/web/src/app/[locale]/e/[id]/section.tsx b/apps/web/src/app/[locale]/e/[id]/section.tsx
index 84d6435cc..b54ae623c 100644
--- a/apps/web/src/app/[locale]/e/[id]/section.tsx
+++ b/apps/web/src/app/[locale]/e/[id]/section.tsx
@@ -28,7 +28,7 @@ export function Section({
) : null}
<div
className={cn(
- "divide-y divide-gray-950/5 overflow-hidden rounded-2xl border border-card-border bg-card",
+ "divide-y divide-gray-950/5 overflow-hidden rounded-2xl bg-gray-100 dark:divide-foreground/5 dark:bg-foreground/5",
className,
)}
>
diff --git a/apps/web/src/features/scheduled-event/actions.ts b/apps/web/src/features/scheduled-event/actions.ts
new file mode 100644
index 000000000..e48cbd30c
--- /dev/null
+++ b/apps/web/src/features/scheduled-event/actions.ts
@@ -0,0 +1,58 @@
+"use server";
+
+import { prisma } from "@rallly/database";
+import { nanoid } from "@rallly/utils/nanoid";
+import { updateTag } from "next/cache";
+import * as z from "zod";
+import { scheduledEventTag } from "@/features/scheduled-event/constants";
+import { AppError } from "@/lib/errors";
+import { actionClient } from "@/lib/safe-action/server";
+
+export const submitRsvpAction = actionClient
+ .metadata({ actionName: "submit_rsvp" })
+ .inputSchema(
+ z.object({
+ eventId: z.string(),
+ name: z.string().trim().min(1).max(100),
+ email: z.email(),
+ status: z.enum(["accepted", "declined"]),
+ }),
+ )
+ .action(async ({ parsedInput }) => {
+ const { eventId, name, email, status } = parsedInput;
+
+ const event = await prisma.scheduledEvent.findUnique({
+ where: { id: eventId },
+ select: { id: true, deletedAt: true },
+ });
+
+ if (!event || event.deletedAt) {
+ throw new AppError({
+ code: "NOT_FOUND",
+ message: "Event not found",
+ });
+ }
+
+ const existing = await prisma.scheduledEventInvite.findFirst({
+ where: { scheduledEventId: eventId, inviteeEmail: email },
+ select: { id: true },
+ });
+
+ if (existing) {
+ return { ok: false, reason: "already_responded" } as const;
+ }
+
+ await prisma.scheduledEventInvite.create({
+ data: {
+ uid: nanoid(),
+ scheduledEventId: eventId,
+ inviteeName: name,
+ inviteeEmail: email,
+ status,
+ },
+ });
+
+ updateTag(scheduledEventTag(eventId));
+
+ return { ok: true } as const;
+ });
diff --git a/apps/web/src/features/scheduled-event/constants.ts b/apps/web/src/features/scheduled-event/constants.ts
index ec56a9ef2..5b1c08736 100644
--- a/apps/web/src/features/scheduled-event/constants.ts
+++ b/apps/web/src/features/scheduled-event/constants.ts
@@ -1 +1,3 @@
export const isScheduledEventEnabled = process.env.NODE_ENV === "development";
+
+export const scheduledEventTag = (id: string) => `scheduled-event:${id}`;
diff --git a/apps/web/src/features/scheduled-event/data.ts b/apps/web/src/features/scheduled-event/data.ts
index 810af76f1..b1e62fdbd 100644
--- a/apps/web/src/features/scheduled-event/data.ts
+++ b/apps/web/src/features/scheduled-event/data.ts
@@ -1,12 +1,65 @@
import type { Prisma, ScheduledEventStatus } from "@rallly/database";
import { prisma } from "@rallly/database";
+import { unstable_cache } from "next/cache";
import { parseConferencing } from "@/features/conferencing/data";
import type { Conferencing } from "@/features/conferencing/schema";
import { parseLocation } from "@/features/location/data";
import type { Location } from "@/features/location/schema";
import { dayjs } from "@/lib/dayjs";
+import { scheduledEventTag } from "./constants";
import type { Status } from "./schema";
+export function getCachedPublicScheduledEvent(id: string) {
+ return unstable_cache(
+ async () => {
+ return prisma.scheduledEvent.findUnique({
+ where: { id },
+ select: {
+ id: true,
+ title: true,
+ description: true,
+ location: true,
+ conferencing: true,
+ start: true,
+ end: true,
+ allDay: true,
+ timeZone: true,
+ status: true,
+ deletedAt: true,
+ hideAttendees: true,
+ user: {
+ select: {
+ name: true,
+ },
+ },
+ space: {
+ select: {
+ name: true,
+ image: true,
+ showBranding: true,
+ primaryColor: true,
+ },
+ },
+ invites: {
+ select: {
+ id: true,
+ inviteeName: true,
+ status: true,
+ user: {
+ select: {
+ image: true,
+ },
+ },
+ },
+ },
+ },
+ });
+ },
+ [`public-scheduled-event-${id}`],
+ { tags: [scheduledEventTag(id)] },
+ )();
+}
+
// Legacy fallback used when neither location nor conferencing is populated.
// Inverts the stored timeZone: stored null = "everyone sees UTC"; stored set = "viewer's TZ".
function legacyDisplayTimeZone(timeZone: string | null): string | null {
diff --git a/apps/web/src/features/space/components/space-tier.tsx b/apps/web/src/features/space/components/space-tier.tsx
index 7ec449fd8..73b950e95 100644
--- a/apps/web/src/features/space/components/space-tier.tsx
+++ b/apps/web/src/features/space/components/space-tier.tsx
@@ -7,9 +7,9 @@ import type { SpaceTier } from "@/features/space/schema";
export const SpaceTierLabel = ({ tier }: { tier: SpaceTier }) => {
switch (tier) {
case "hobby":
- return <span className="text-foreground">{PLAN_NAMES.HOBBY}</span>;
+ return <span className="text-muted-foreground">{PLAN_NAMES.HOBBY}</span>;
case "pro":
- return <span className="text-foreground">{PLAN_NAMES.PRO}</span>;
+ return <span className="text-muted-foreground">{PLAN_NAMES.PRO}</span>;
}
};
diff --git a/packages/tailwind-config/shared-styles.css b/packages/tailwind-config/shared-styles.css
index 2f65e2dea..1c4e63aa9 100644
--- a/packages/tailwind-config/shared-styles.css
+++ b/packages/tailwind-config/shared-styles.css
@@ -64,7 +64,7 @@
--background: var(--color-gray-900);
--foreground: var(--color-white);
- --button-outline: rgba(255, 255, 255, 0.1);
+ --button-outline: rgba(255, 255, 255, 0.05);
--menu-item-outline: rgba(255, 255, 255, 0.05);
--primary: var(--primary-dark, var(--color-indigo-500));
@@ -80,7 +80,7 @@
--border: oklch(0.32 0.006 286.033);
--border-muted: var(--color-gray-800);
- --input: var(--color-gray-700);
+ --input: rgba(255, 255, 255, 0.1);
--input-foreground: var(--color-gray-100);
--ring: var(--color-gray-600);
diff --git a/packages/ui/src/action-bar.tsx b/packages/ui/src/action-bar.tsx
index cf87ca198..03f90ce1f 100644
--- a/packages/ui/src/action-bar.tsx
+++ b/packages/ui/src/action-bar.tsx
@@ -1,47 +1,84 @@
-import * as React from "react";
+"use client";
+
+import { Toolbar } from "@base-ui/react/toolbar";
+import type { VariantProps } from "class-variance-authority";
+import { Loader2Icon } from "lucide-react";
+import type * as React from "react";
+import { buttonVariants } from "./button-variants";
import { cn } from "./lib/utils";
-const ActionBar = React.forwardRef<
- HTMLDivElement,
- React.HTMLAttributes<HTMLDivElement>
->(({ className, children, ...props }, ref) => (
- <div
- ref={ref}
- className={cn(
- "pointer-events-none fixed inset-x-0 bottom-0 z-40 bg-linear-to-t from-25% from-gray-100/50 to-transparent dark:from-gray-900",
- className,
- )}
- {...props}
- >
- <div className="pointer-events-auto mx-auto flex max-w-xl items-center justify-center gap-3 px-4 pt-12 pb-[max(--spacing(4),env(safe-area-inset-bottom))] sm:pb-[max(--spacing(8),env(safe-area-inset-bottom))]">
- {children}
+function ActionBar({ className, children, ...props }: Toolbar.Root.Props) {
+ return (
+ <div className="pointer-events-none fixed inset-x-0 bottom-0 z-40 bg-linear-to-t from-25% from-gray-100/50 to-transparent dark:from-gray-900">
+ <Toolbar.Root
+ data-slot="action-bar"
+ className={cn(
+ "pointer-events-auto mx-auto flex max-w-xl items-center justify-center gap-3 px-4 pt-12 pb-[max(--spacing(4),env(safe-area-inset-bottom))] sm:pb-[max(--spacing(8),env(safe-area-inset-bottom))]",
+ className,
+ )}
+ {...props}
+ >
+ {children}
+ </Toolbar.Root>
</div>
- </div>
-));
-ActionBar.displayName = "ActionBar";
+ );
+}
+
+function ActionBarButton({
+ className,
+ variant,
+ size = "lg",
+ loading,
+ disabled,
+ children,
+ ...props
+}: Toolbar.Button.Props &
+ VariantProps<typeof buttonVariants> & { loading?: boolean }) {
+ return (
+ <Toolbar.Button
+ data-slot="action-bar-button"
+ className={cn(
+ "group",
+ buttonVariants({ variant, size }),
+ { "pointer-events-none": loading },
+ className,
+ )}
+ disabled={disabled || loading}
+ aria-busy={loading || undefined}
+ {...props}
+ >
+ {loading ? (
+ <Loader2Icon
+ data-icon="inline-start"
+ className="size-4 animate-spin opacity-75"
+ />
+ ) : null}
+ {children}
+ </Toolbar.Button>
+ );
+}
-const ActionBarSpacer = React.forwardRef<
- HTMLDivElement,
- React.HTMLAttributes<HTMLDivElement>
->(({ className, ...props }, ref) => (
- <div ref={ref} className={cn("flex-1", className)} {...props} />
-));
-ActionBarSpacer.displayName = "ActionBarSpacer";
+function ActionBarSpacer({
+ className,
+ ...props
+}: React.HTMLAttributes<HTMLDivElement>) {
+ return <div className={cn("flex-1", className)} {...props} />;
+}
-const ActionBarOffset = React.forwardRef<
- HTMLDivElement,
- React.HTMLAttributes<HTMLDivElement>
->(({ className, ...props }, ref) => (
- <div
- ref={ref}
- aria-hidden
- className={cn(
- "h-[calc(--spacing(12)+max(--spacing(4),env(safe-area-inset-bottom)))] sm:h-[calc(--spacing(12)+max(--spacing(8),env(safe-area-inset-bottom)))]",
- className,
- )}
- {...props}
- />
-));
-ActionBarOffset.displayName = "ActionBarOffset";
+function ActionBarOffset({
+ className,
+ ...props
+}: React.HTMLAttributes<HTMLDivElement>) {
+ return (
+ <div
+ aria-hidden
+ className={cn(
+ "h-[calc(--spacing(12)+max(--spacing(6),env(safe-area-inset-bottom)))] sm:h-[calc(--spacing(12)+max(--spacing(12),env(safe-area-inset-bottom)))]",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
-export { ActionBar, ActionBarOffset, ActionBarSpacer };
+export { ActionBar, ActionBarButton, ActionBarOffset, ActionBarSpacer };
diff --git a/packages/ui/src/avatar.tsx b/packages/ui/src/avatar.tsx
index 32e86c693..0f20de8cf 100644
--- a/packages/ui/src/avatar.tsx
+++ b/packages/ui/src/avatar.tsx
@@ -54,7 +54,7 @@ const AvatarFallback = React.forwardRef<
<AvatarPrimitive.Fallback
ref={ref}
className={cn(
- "flex h-full w-full items-center justify-center bg-gray-200 font-medium text-muted-foreground dark:bg-gray-800",
+ "flex h-full w-full items-center justify-center bg-foreground/10 font-medium text-muted-foreground dark:bg-foreground/10",
className,
)}
{...props}
diff --git a/packages/ui/src/badge.tsx b/packages/ui/src/badge.tsx
index 8fbcee4eb..3167f0a73 100644
--- a/packages/ui/src/badge.tsx
+++ b/packages/ui/src/badge.tsx
@@ -5,7 +5,7 @@ import type * as React from "react";
import { cn } from "./lib/utils";
const badgeVariants = cva(
- "group inline-flex items-center justify-center whitespace-nowrap rounded-lg transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2",
+ "group inline-flex shrink-0 items-center justify-center whitespace-nowrap rounded-lg transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2",
{
variants: {
variant: {
diff --git a/packages/ui/src/button-variants.ts b/packages/ui/src/button-variants.ts
index d977c5bec..4696504a6 100644
--- a/packages/ui/src/button-variants.ts
+++ b/packages/ui/src/button-variants.ts
@@ -4,17 +4,17 @@ import { cn } from "./lib/utils";
export const buttonVariants = cva(
cn(
- "group inline-flex shrink-0 items-center justify-center whitespace-nowrap font-normal outline-none active:scale-[0.98] active:opacity-80 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=open]:scale-[0.98] data-[state=open]:opacity-80 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 font-normal outline-none transition-colors active:opacity-80 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: {
variant: {
primary:
- "bg-primary text-primary-foreground ring-1 ring-button-outline ring-inset hover:bg-primary/90",
+ "bg-primary text-primary-foreground ring-1 ring-button-outline ring-inset hover:bg-primary/90 dark:bg-primary/80",
destructive:
- "bg-destructive text-destructive-foreground ring-1 ring-button-outline ring-inset hover:bg-destructive/90",
+ "bg-destructive text-destructive-foreground ring-1 ring-button-outline ring-inset hover:bg-destructive/90 dark:bg-destructive/80",
default:
- "bg-background/80 ring-1 ring-button-outline ring-inset backdrop-blur-lg hover:bg-accent",
+ "bg-background/80 ring-1 ring-button-outline ring-inset backdrop-blur-lg hover:bg-accent data-[state=open]:bg-accent dark:bg-foreground/5",
ghost:
"border-transparent bg-transparent text-foreground ring-1 ring-transparent ring-inset hover:bg-accent data-[state=open]:bg-accent [&>svg]:opacity-75",
actionBar:
@@ -23,7 +23,7 @@ export const buttonVariants = cva(
},
size: {
default:
- "h-8 gap-1.5 rounded-lg px-2.5 text-sm has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
+ "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-1.5 has-data-[icon=inline-start]:pl-1 [&_svg:not([class*='size-'])]:size-3.5",
lg: "h-10 gap-1.5 rounded-xl px-3 text-sm has-data-[icon=inline-end]:pr-2.5 has-data-[icon=inline-start]:pl-2.5",
diff --git a/packages/ui/src/input.tsx b/packages/ui/src/input.tsx
index cbe283fd7..e527a8fef 100644
--- a/packages/ui/src/input.tsx
+++ b/packages/ui/src/input.tsx
@@ -12,12 +12,12 @@ function Input({
type={type}
data-slot="input"
className={cn(
- "w-full min-w-0 border border-input bg-transparent outline-none transition-[color,box-shadow] selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:font-medium file:text-foreground file:text-sm placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
+ "w-full min-w-0 border border-input bg-background/80 outline-none transition-[color,box-shadow] selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:font-medium file:text-foreground file:text-sm placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 dark:bg-foreground/5",
"focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
"aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",
large
? "h-12 rounded-lg px-3 text-base"
- : "h-8 rounded-lg px-2.5 py-1 text-sm",
+ : "h-9 rounded-lg px-2.5 py-1 text-sm",
className,
)}
{...props}
diff --git a/packages/ui/src/textarea.tsx b/packages/ui/src/textarea.tsx
index 623bc7965..cc4a1ac99 100644
--- a/packages/ui/src/textarea.tsx
+++ b/packages/ui/src/textarea.tsx
@@ -9,7 +9,8 @@ const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
return (
<textarea
className={cn(
- "field-sizing-content flex min-h-16 w-full rounded-lg border border-input bg-transparent px-2 py-2 text-sm shadow-xs outline-none transition-[color,box-shadow] placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",
+ "field-sizing-content flex min-h-24 w-full rounded-lg border border-input bg-transparent px-2 py-2 text-sm shadow-xs outline-none transition-[color,box-shadow] placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",
+ className,
)}
ref={ref}
{...props}