Skip to content

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

♻️ Rebuild preference settings on Setting primitives with auto-save (#2838)

Luke Vella02e5da23077b
diff --git a/apps/web/public/locales/en/app.json b/apps/web/public/locales/en/app.json
index 34b4b79e8..6af553cf1 100644
--- a/apps/web/public/locales/en/app.json
+++ b/apps/web/public/locales/en/app.json
@@ -137,7 +137,6 @@
"commentsSettingLegacyBadge": "Legacy",
"commentsSettingPhaseOutHint": "Comments are being phased out. Participants can include a note with their response instead.",
"commentsSettingTitle": "Comments",
- "common_language": "Language",
"configuredByEnvironmentVariable": "This setting has been configured by environment variable.",
"confirm": "Confirm",
"confirmSpaceName": "Please type the space name to confirm:",
@@ -184,8 +183,6 @@
"customBrandingPromptTitle": "Custom Branding",
"dangerZone": "Danger Zone",
"dangerZoneAccountDeletion": "Delete your account and all data associated with it",
- "dateAndTime": "Date & Time",
- "dateAndTimeDescription": "Change your preferred date and time settings",
"dates": "Dates",
"decreaseSeats": "Decrease seats",
"defaultCalendar": "Default Calendar",
@@ -366,7 +363,9 @@
"joinSpace": "Join {spaceName}",
"keyBenefits": "Key Benefits",
"language": "Language",
- "languageDescription": "Change your preferred language",
+ "languageAndRegion": "Language & Region",
+ "languageAndRegionDescription": "Set your language, time zone, and date and time formats",
+ "languageSettingDescription": "The language the app is displayed in.",
"lastUsedAt": "Last used {date}",
"learnMore": "Learn more",
"leaveSpace": "Leave Space",
@@ -488,6 +487,7 @@
"notFoundDescription": "Sorry, we couldn't find the page you're looking for. Here are some helpful links instead.",
"notFoundLabel": "404",
"notFoundTitle": "Page not found",
+ "notificationPreferenceSaveError": "Failed to save your notification preference",
"notifications": "Notifications",
"notificationsDescription": "Choose which email notifications you receive",
"notificationToggleMutedToast": "Notifications are off for this poll",
@@ -695,6 +695,7 @@
"spaceUpdatedSuccess": "Space updated successfully",
"ssoAuthenticationOnly": "Authentication is managed through Single Sign-On (SSO). Password management is not available.",
"startOfWeek": "Start of week",
+ "startOfWeekSettingDescription": "The day calendars start the week on.",
"subscriptionCardAmountDiscount": "{amount} discount applied",
"subscriptionCardEndsOn": "Ends {date}",
"subscriptionCardPercentDiscount": "{percent}% discount applied",
@@ -726,12 +727,14 @@
"thirtyDayPollRetention": "30 Day Poll Retention",
"thirtyDayPollRetentionDescription": "Polls are kept for 30 days after their final date",
"timeFormat": "Time format",
+ "timeFormatSettingDescription": "Show times in 12-hour or 24-hour format.",
"timePickerSelectTime": "Select time",
"timeZone": "Time zone",
"timezoneInputPlaceholder": "Search timezone…",
"timeZoneMismatchDialogMessage": "It looks like you are in <b>{currentTimeZone}</b> but your timezone is set to <b>{homeTimeZone}</b>. Do you want to update it?",
"timeZoneMismatchDialogTitle": "Timezone Mismatch Detected",
"timeZoneSelect__noOption": "No option found",
+ "timeZoneSettingDescription": "Dates and times are shown in this time zone.",
"title": "Title",
"titlePlaceholder": "Monthly Meetup",
"today": "Today",
diff --git a/apps/web/src/app/[locale]/(space)/settings/notifications/notifications-page.tsx b/apps/web/src/app/[locale]/(space)/settings/notifications/notifications-page.tsx
index fb73179fb..2fd6ae77c 100644
--- a/apps/web/src/app/[locale]/(space)/settings/notifications/notifications-page.tsx
+++ b/apps/web/src/app/[locale]/(space)/settings/notifications/notifications-page.tsx
@@ -1,5 +1,6 @@
"use client";
+import { toast } from "@rallly/ui/sonner";
import { Switch } from "@rallly/ui/switch";
import { InboxIcon, MessageCircleIcon } from "lucide-react";
import {
@@ -18,10 +19,11 @@ import {
SettingsGroup,
SettingTitle,
} from "@/components/setting";
-import { Trans } from "@/i18n/client";
+import { Trans, useTranslation } from "@/i18n/client";
import { trpc } from "@/trpc/client";
export function NotificationsPage() {
+ const { t } = useTranslation();
const utils = trpc.useUtils();
const [preferences] = trpc.user.getNotificationPreferences.useSuspenseQuery();
const updatePreference = trpc.user.updateNotificationPreference.useMutation({
@@ -33,6 +35,9 @@ export function NotificationsPage() {
);
return { previous };
},
+ onSuccess: () => {
+ toast.success(t("saved", { defaultValue: "Saved" }));
+ },
onError: (_err, _vars, context) => {
if (context?.previous) {
utils.user.getNotificationPreferences.setData(
@@ -40,6 +45,11 @@ export function NotificationsPage() {
context.previous,
);
}
+ toast.error(
+ t("notificationPreferenceSaveError", {
+ defaultValue: "Failed to save your notification preference",
+ }),
+ );
},
});
diff --git a/apps/web/src/app/[locale]/(space)/settings/preferences/components/date-time-preferences.tsx b/apps/web/src/app/[locale]/(space)/settings/preferences/components/date-time-preferences.tsx
deleted file mode 100644
index b5713774b..000000000
--- a/apps/web/src/app/[locale]/(space)/settings/preferences/components/date-time-preferences.tsx
+++ /dev/null
@@ -1,161 +0,0 @@
-"use client";
-
-import { zodResolver } from "@hookform/resolvers/zod";
-import type { TimeFormat } from "@rallly/database";
-import { Button } from "@rallly/ui/button";
-import {
- Form,
- FormControl,
- FormField,
- FormItem,
- FormLabel,
-} from "@rallly/ui/form";
-import {
- Select,
- SelectContent,
- SelectItem,
- SelectTrigger,
- SelectValue,
-} from "@rallly/ui/select";
-import { useForm } from "react-hook-form";
-import * as z from "zod";
-import { TimeFormatPicker } from "@/components/time-format-picker";
-import { TimeZoneSelect } from "@/components/time-zone-picker/time-zone-select";
-import { updateLocalizationAction } from "@/features/user/actions";
-import { Trans } from "@/i18n/client";
-import { useDateTime } from "@/lib/datetime/client";
-import { getLocaleDefaults } from "@/lib/datetime/locales";
-import { useLocale } from "@/lib/locale/client";
-import { useSafeAction } from "@/lib/safe-action/client";
-import { getBrowserTimeZone } from "@/lib/utils/date-time-utils";
-
-const formSchema = z.object({
- timeFormat: z.enum(["hours12", "hours24"]),
- timeZone: z.string(),
- weekStart: z.number().min(0).max(6),
-});
-
-export const DateTimePreferences = ({
- initialValues,
-}: {
- initialValues: {
- timeFormat?: TimeFormat;
- timeZone?: string;
- weekStart?: number;
- };
-}) => {
- const updateLocalization = useSafeAction(updateLocalizationAction);
- const { locale } = useLocale();
- const localeDefaults = getLocaleDefaults(locale);
- const { weekdays } = useDateTime();
-
- const form = useForm({
- resolver: zodResolver(formSchema),
- defaultValues: {
- timeFormat: initialValues.timeFormat ?? localeDefaults.timeFormat,
- weekStart: initialValues.weekStart ?? localeDefaults.weekStart,
- timeZone: initialValues.timeZone ?? getBrowserTimeZone(),
- },
- });
-
- const { handleSubmit, formState } = form;
-
- return (
- <Form {...form}>
- <form
- onSubmit={handleSubmit(async (data) => {
- const result = await updateLocalization.executeAsync(data);
- if (!result?.serverError && !result?.validationErrors) {
- form.reset(data);
- }
- })}
- >
- <div className="space-y-6">
- <FormField
- control={form.control}
- name="timeZone"
- render={({ field }) => {
- return (
- <FormItem>
- <FormLabel>
- <Trans i18nKey="timeZone" />
- </FormLabel>
- <TimeZoneSelect
- className="w-fit"
- value={field.value}
- onValueChange={field.onChange}
- />
- </FormItem>
- );
- }}
- />
- <FormField
- control={form.control}
- name="timeFormat"
- render={({ field }) => {
- return (
- <FormItem>
- <FormLabel>
- <Trans i18nKey="timeFormat" />
- </FormLabel>
- <FormControl>
- <TimeFormatPicker
- value={field.value}
- onChange={field.onChange}
- />
- </FormControl>
- </FormItem>
- );
- }}
- />
- <FormField
- control={form.control}
- name="weekStart"
- render={({ field }) => {
- const options = weekdays().map(({ day, label }) => ({
- value: day.toString(),
- label,
- }));
- return (
- <FormItem>
- <FormLabel>
- <Trans i18nKey="startOfWeek" />
- </FormLabel>
- <Select
- items={options}
- value={field.value.toString()}
- onValueChange={(value) => {
- if (value) {
- field.onChange(Number.parseInt(value, 10));
- }
- }}
- >
- <SelectTrigger className="w-fit min-w-32">
- <SelectValue />
- </SelectTrigger>
- <SelectContent>
- {options.map((option) => (
- <SelectItem key={option.value} value={option.value}>
- {option.label}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- </FormItem>
- );
- }}
- />
- </div>
- <div className="mt-6 flex gap-x-2">
- <Button
- loading={formState.isSubmitting}
- type="submit"
- disabled={!formState.isDirty}
- >
- <Trans i18nKey="save" />
- </Button>
- </div>
- </form>
- </Form>
- );
-};
diff --git a/apps/web/src/app/[locale]/(space)/settings/preferences/components/language-preference.tsx b/apps/web/src/app/[locale]/(space)/settings/preferences/components/language-preference.tsx
deleted file mode 100644
index d02494886..000000000
--- a/apps/web/src/app/[locale]/(space)/settings/preferences/components/language-preference.tsx
+++ /dev/null
@@ -1,118 +0,0 @@
-"use client";
-
-import { zodResolver } from "@hookform/resolvers/zod";
-import { buttonVariants } from "@rallly/ui";
-import { Button } from "@rallly/ui/button";
-import {
- Form,
- FormControl,
- FormField,
- FormItem,
- FormLabel,
-} from "@rallly/ui/form";
-import { ArrowUpRight } from "lucide-react";
-import Link from "next/link";
-import { useForm } from "react-hook-form";
-import * as z from "zod";
-import { LanguageSelect } from "@/components/language-selector";
-import { updateLocalizationAction } from "@/features/user/actions";
-import { Trans } from "@/i18n/client";
-import { setLocaleCookie, useLocale } from "@/lib/locale/client";
-import { useSafeAction } from "@/lib/safe-action/client";
-
-const formSchema = z.object({
- language: z.string(),
-});
-
-export const LanguagePreference = ({
- defaultValue,
-}: {
- defaultValue?: string;
-}) => {
- const { locale } = useLocale();
- const updateLocalization = useSafeAction(updateLocalizationAction);
-
- // The saved preference can differ from the locale the app is rendered in
- // (e.g. the cookie was reset on this device). Saving must be possible in
- // that state even though the field matches its default.
- const savedLanguage = defaultValue ?? locale;
-
- const form = useForm({
- defaultValues: {
- language: savedLanguage,
- },
- resolver: zodResolver(formSchema),
- });
-
- return (
- <Form {...form}>
- <form
- onSubmit={form.handleSubmit(async (data) => {
- // Set the cookie before executing: useSafeAction refreshes the router
- // on success, and that refresh must read the new locale. Writing the
- // cookie server-side would collide with updateUser's session cookie
- // and drop it. Nothing reconciles the cookie against the saved value
- // on load, so roll it back to the locale this page is rendered in if
- // the save doesn't land.
- const previousLocale = locale;
- setLocaleCookie(data.language);
-
- let result: Awaited<
- ReturnType<typeof updateLocalization.executeAsync>
- >;
- try {
- result = await updateLocalization.executeAsync({
- locale: data.language,
- });
- } catch (error) {
- setLocaleCookie(previousLocale);
- throw error;
- }
-
- if (result?.serverError || result?.validationErrors) {
- setLocaleCookie(previousLocale);
- return;
- }
-
- form.reset({ language: data.language });
- })}
- >
- <FormField
- control={form.control}
- name="language"
- render={({ field }) => (
- <FormItem>
- <FormLabel>
- <Trans i18nKey="common_language" />
- </FormLabel>
- <FormControl>
- <LanguageSelect
- className="w-fit min-w-32"
- value={field.value}
- onChange={field.onChange}
- />
- </FormControl>
- </FormItem>
- )}
- />
- <div className="mt-6 flex flex-wrap gap-2">
- <Button
- disabled={!form.formState.isDirty && savedLanguage === locale}
- loading={form.formState.isSubmitting}
- type="submit"
- >
- <Trans i18nKey="save" />
- </Button>
- <Link
- target="_blank"
- href="https://support.rallly.co/contribute/translations"
- className={buttonVariants({ variant: "ghost" })}
- >
- <Trans i18nKey="becomeATranslator" defaults="Help translate" />
- <ArrowUpRight className="size-4" />
- </Link>
- </div>
- </form>
- </Form>
- );
-};
diff --git a/apps/web/src/app/[locale]/(space)/settings/preferences/components/localization-preferences.tsx b/apps/web/src/app/[locale]/(space)/settings/preferences/components/localization-preferences.tsx
new file mode 100644
index 000000000..edef15463
--- /dev/null
+++ b/apps/web/src/app/[locale]/(space)/settings/preferences/components/localization-preferences.tsx
@@ -0,0 +1,268 @@
+"use client";
+
+import { buttonVariants } from "@rallly/ui";
+import {
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+} from "@rallly/ui/select";
+import { toast } from "@rallly/ui/sonner";
+import {
+ ArrowUpRight,
+ CalendarIcon,
+ ClockIcon,
+ GlobeIcon,
+ LanguagesIcon,
+} from "lucide-react";
+import Link from "next/link";
+import React from "react";
+import { LanguageSelect } from "@/components/language-selector";
+import {
+ Setting,
+ SettingControl,
+ SettingDescription,
+ SettingIcon,
+ SettingsGroup,
+ SettingTitle,
+} from "@/components/setting";
+import { TimeZoneSelect } from "@/components/time-zone-picker/time-zone-select";
+import { updateLocalizationAction } from "@/features/user/actions";
+import { Trans, useTranslation } from "@/i18n/client";
+import { useDateTime } from "@/lib/datetime/client";
+import { getLocaleDefaults } from "@/lib/datetime/locales";
+import type { TimeFormat } from "@/lib/datetime/types";
+import { setLocaleCookie, useLocale } from "@/lib/locale/client";
+import { useSafeAction } from "@/lib/safe-action/client";
+import { getBrowserTimeZone } from "@/lib/utils/date-time-utils";
+
+export const LocalizationPreferences = ({
+ initialValues,
+}: {
+ initialValues: {
+ locale?: string;
+ timeFormat?: TimeFormat;
+ timeZone?: string;
+ weekStart?: number;
+ };
+}) => {
+ const { t } = useTranslation();
+ const { locale } = useLocale();
+ const localeDefaults = getLocaleDefaults(locale);
+ const { weekdays } = useDateTime();
+ const updateLocalization = useSafeAction(updateLocalizationAction);
+
+ const [language, setLanguage] = React.useState(
+ initialValues.locale ?? locale,
+ );
+ const [timeZone, setTimeZone] = React.useState(
+ initialValues.timeZone ?? getBrowserTimeZone(),
+ );
+ const [timeFormat, setTimeFormat] = React.useState(
+ initialValues.timeFormat ?? localeDefaults.timeFormat,
+ );
+ const [weekStart, setWeekStart] = React.useState(
+ initialValues.weekStart ?? localeDefaults.weekStart,
+ );
+
+ const save = async (input: {
+ locale?: string;
+ timeZone?: string;
+ timeFormat?: TimeFormat;
+ weekStart?: number;
+ }) => {
+ const result = await updateLocalization.executeAsync(input);
+ const saved = !result?.serverError && !result?.validationErrors;
+ if (saved) {
+ toast.success(t("saved", { defaultValue: "Saved" }));
+ }
+ return saved;
+ };
+
+ const weekStartOptions = weekdays().map(({ day, label }) => ({
+ value: day.toString(),
+ label,
+ }));
+
+ const timeFormatOptions = [
+ { value: "hours12", label: t("12h") },
+ { value: "hours24", label: t("24h") },
+ ];
+
+ return (
+ <div>
+ <SettingsGroup>
+ <Setting>
+ <SettingIcon>
+ <LanguagesIcon />
+ </SettingIcon>
+ <SettingTitle>
+ <Trans i18nKey="language" defaults="Language" />
+ </SettingTitle>
+ <SettingDescription>
+ <Trans
+ i18nKey="languageSettingDescription"
+ defaults="The language the app is displayed in."
+ />
+ </SettingDescription>
+ <SettingControl>
+ <LanguageSelect
+ className="min-w-32"
+ value={language}
+ onChange={async (nextLanguage) => {
+ if (nextLanguage === language) {
+ return;
+ }
+ const previousLanguage = language;
+ setLanguage(nextLanguage);
+ // Set the cookie before executing: useSafeAction refreshes the
+ // router on success, and that refresh must read the new locale.
+ // Writing the cookie server-side would collide with
+ // updateUser's session cookie and drop it. Roll it back to the
+ // locale this page is rendered in if the save doesn't land.
+ setLocaleCookie(nextLanguage);
+ let saved = false;
+ try {
+ saved = await save({ locale: nextLanguage });
+ } finally {
+ if (!saved) {
+ setLocaleCookie(locale);
+ setLanguage(previousLanguage);
+ }
+ }
+ }}
+ />
+ </SettingControl>
+ </Setting>
+ <Setting>
+ <SettingIcon>
+ <GlobeIcon />
+ </SettingIcon>
+ <SettingTitle>
+ <Trans i18nKey="timeZone" defaults="Time Zone" />
+ </SettingTitle>
+ <SettingDescription>
+ <Trans
+ i18nKey="timeZoneSettingDescription"
+ defaults="Dates and times are shown in this time zone."
+ />
+ </SettingDescription>
+ <SettingControl>
+ <TimeZoneSelect
+ className="min-w-56"
+ value={timeZone}
+ onValueChange={async (nextTimeZone) => {
+ if (nextTimeZone === timeZone) {
+ return;
+ }
+ const previousTimeZone = timeZone;
+ setTimeZone(nextTimeZone);
+ if (!(await save({ timeZone: nextTimeZone }))) {
+ setTimeZone(previousTimeZone);
+ }
+ }}
+ />
+ </SettingControl>
+ </Setting>
+ <Setting>
+ <SettingIcon>
+ <ClockIcon />
+ </SettingIcon>
+ <SettingTitle>
+ <Trans i18nKey="timeFormat" defaults="Time Format" />
+ </SettingTitle>
+ <SettingDescription>
+ <Trans
+ i18nKey="timeFormatSettingDescription"
+ defaults="Show times in 12-hour or 24-hour format."
+ />
+ </SettingDescription>
+ <SettingControl>
+ <Select
+ items={timeFormatOptions}
+ value={timeFormat}
+ onValueChange={async (value) => {
+ if (!value || value === timeFormat) {
+ return;
+ }
+ const previousTimeFormat = timeFormat;
+ const nextTimeFormat = value as TimeFormat;
+ setTimeFormat(nextTimeFormat);
+ if (!(await save({ timeFormat: nextTimeFormat }))) {
+ setTimeFormat(previousTimeFormat);
+ }
+ }}
+ >
+ <SelectTrigger className="min-w-32">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {timeFormatOptions.map((option) => (
+ <SelectItem key={option.value} value={option.value}>
+ {option.label}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </SettingControl>
+ </Setting>
+ <Setting>
+ <SettingIcon>
+ <CalendarIcon />
+ </SettingIcon>
+ <SettingTitle>
+ <Trans i18nKey="startOfWeek" defaults="Start of Week" />
+ </SettingTitle>
+ <SettingDescription>
+ <Trans
+ i18nKey="startOfWeekSettingDescription"
+ defaults="The day calendars start the week on."
+ />
+ </SettingDescription>
+ <SettingControl>
+ <Select
+ items={weekStartOptions}
+ value={weekStart.toString()}
+ onValueChange={async (value) => {
+ if (!value) {
+ return;
+ }
+ const previousWeekStart = weekStart;
+ const nextWeekStart = Number.parseInt(value, 10);
+ if (nextWeekStart === previousWeekStart) {
+ return;
+ }
+ setWeekStart(nextWeekStart);
+ if (!(await save({ weekStart: nextWeekStart }))) {
+ setWeekStart(previousWeekStart);
+ }
+ }}
+ >
+ <SelectTrigger className="min-w-32">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {weekStartOptions.map((option) => (
+ <SelectItem key={option.value} value={option.value}>
+ {option.label}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </SettingControl>
+ </Setting>
+ </SettingsGroup>
+ <div className="mt-4 border-t pt-4">
+ <Link
+ target="_blank"
+ href="https://support.rallly.co/contribute/translations"
+ className={buttonVariants({ variant: "ghost" })}
+ >
+ <Trans i18nKey="becomeATranslator" defaults="Help translate" />
+ <ArrowUpRight className="size-4" />
+ </Link>
+ </div>
+ </div>
+ );
+};
diff --git a/apps/web/src/app/[locale]/(space)/settings/preferences/page.tsx b/apps/web/src/app/[locale]/(space)/settings/preferences/page.tsx
index e192517b7..70a2ebb71 100644
--- a/apps/web/src/app/[locale]/(space)/settings/preferences/page.tsx
+++ b/apps/web/src/app/[locale]/(space)/settings/preferences/page.tsx
@@ -1,6 +1,5 @@
import type { Metadata } from "next";
-import { DateTimePreferences } from "@/app/[locale]/(space)/settings/preferences/components/date-time-preferences";
-import { LanguagePreference } from "@/app/[locale]/(space)/settings/preferences/components/language-preference";
+import { LocalizationPreferences } from "@/app/[locale]/(space)/settings/preferences/components/localization-preferences";
import { ThemePreference } from "@/app/[locale]/(space)/settings/preferences/components/theme-preference";
import type { Params } from "@/app/[locale]/types";
import {
@@ -43,17 +42,27 @@ export default async function Page() {
<PageSection variant="card">
<PageSectionHeader>
<PageSectionTitle>
- <Trans i18nKey="language" defaults="Language" />
+ <Trans
+ i18nKey="languageAndRegion"
+ defaults="Language & Region"
+ />
</PageSectionTitle>
<PageSectionDescription>
<Trans
- i18nKey="languageDescription"
- defaults="Change your preferred language"
+ i18nKey="languageAndRegionDescription"
+ defaults="Set your language, time zone, and date and time formats"
/>
</PageSectionDescription>
</PageSectionHeader>
<PageSectionContent>
- <LanguagePreference defaultValue={user.locale} />
+ <LocalizationPreferences
+ initialValues={{
+ locale: user.locale,
+ timeFormat: user.timeFormat,
+ timeZone: user.timeZone,
+ weekStart: user.weekStart,
+ }}
+ />
</PageSectionContent>
</PageSection>
@@ -73,29 +82,6 @@ export default async function Page() {
<ThemePreference />
</PageSectionContent>
</PageSection>
-
- <PageSection variant="card">
- <PageSectionHeader>
- <PageSectionTitle>
- <Trans i18nKey="dateAndTime" defaults="Date & Time" />
- </PageSectionTitle>
- <PageSectionDescription>
- <Trans
- i18nKey="dateAndTimeDescription"
- defaults="Change your preferred date and time settings"
- />
- </PageSectionDescription>
- </PageSectionHeader>
- <PageSectionContent>
- <DateTimePreferences
- initialValues={{
- timeFormat: user.timeFormat,
- timeZone: user.timeZone,
- weekStart: user.weekStart,
- }}
- />
- </PageSectionContent>
- </PageSection>
</PageSectionGroup>
</SettingsPageContent>
</SettingsPage>
diff --git a/apps/web/src/components/language-selector.tsx b/apps/web/src/components/language-selector.tsx
index cb6db7cbb..8de154af7 100644
--- a/apps/web/src/components/language-selector.tsx
+++ b/apps/web/src/components/language-selector.tsx
@@ -13,7 +13,9 @@ export const LanguageSelect: React.FunctionComponent<{
className?: string;
value?: string;
onChange?: (language: string) => void;
-}> = ({ className, value, onChange }) => {
+ "aria-labelledby"?: string;
+ "aria-describedby"?: string;
+}> = ({ className, value, onChange, ...ariaProps }) => {
return (
<Select
items={languages}
@@ -24,7 +26,7 @@ export const LanguageSelect: React.FunctionComponent<{
}
}}
>
- <SelectTrigger className={className}>
+ <SelectTrigger className={className} {...ariaProps}>
<Icon>
<LanguagesIcon />
</Icon>
diff --git a/apps/web/src/components/time-zone-picker/time-zone-select.tsx b/apps/web/src/components/time-zone-picker/time-zone-select.tsx
index 95e70162b..ee049d711 100644
--- a/apps/web/src/components/time-zone-picker/time-zone-select.tsx
+++ b/apps/web/src/components/time-zone-picker/time-zone-select.tsx
@@ -35,11 +35,14 @@ export function TimeZoneSelect({
onValueChange,
className,
disabled,
+ ...ariaProps
}: {
value?: string;
onValueChange?: (value: string) => void;
className?: string;
disabled?: boolean;
+ "aria-labelledby"?: string;
+ "aria-describedby"?: string;
}) {
const { t } = useTranslation();
@@ -75,6 +78,7 @@ export function TimeZoneSelect({
placeholder={t("timezoneInputPlaceholder", {
defaultValue: "Search timezone…",
})}
+ {...ariaProps}
>
<InputGroupAddon>
<GlobeIcon />
diff --git a/apps/web/src/features/user/actions.ts b/apps/web/src/features/user/actions.ts
index 4a16b30b8..0afdd0251 100644
--- a/apps/web/src/features/user/actions.ts
+++ b/apps/web/src/features/user/actions.ts
@@ -54,7 +54,7 @@ export const updateLocalizationAction = authActionClient
}),
)
.action(async ({ parsedInput }) => {
- // The locale cookie is written client-side (see language-preference.tsx).
+ // The locale cookie is written client-side (see localization-preferences.tsx).
// Writing it here via next/headers would collide with updateUser's session
// cookie and drop it.
await authLib.api.updateUser({