import { GetServerSidePropsContext } from "next"; import { Trans } from "next-i18next"; import { Controller, useForm } from "react-hook-form"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import prisma from "@calcom/prisma"; import { trpc } from "@calcom/trpc/react"; import Badge from "@calcom/ui/v2/core/Badge"; import { Button } from "@calcom/ui/v2/core/Button"; import Meta from "@calcom/ui/v2/core/Meta"; import Switch from "@calcom/ui/v2/core/Switch"; import ColorPicker from "@calcom/ui/v2/core/colorpicker"; import Select from "@calcom/ui/v2/core/form/Select"; import { Form } from "@calcom/ui/v2/core/form/fields"; import { getLayout } from "@calcom/ui/v2/core/layouts/AdminLayout"; import showToast from "@calcom/ui/v2/core/notifications"; import { getSession } from "@lib/auth"; import { inferSSRProps } from "@lib/types/inferSSRProps"; const AppearanceView = (props: inferSSRProps) => { const { t } = useLocale(); const { user } = props; const mutation = trpc.useMutation("viewer.updateProfile", { onSuccess: () => { showToast(t("settings_updated_successfully"), "success"); }, onError: () => { showToast(t("error_updating_settings"), "error"); }, }); const themeOptions = [ { value: "light", label: t("light") }, { value: "dark", label: t("dark") }, ]; const formMethods = useForm(); return (
{ mutation.mutate({ ...values, theme: values.theme.value, }); }}> ( <>

{t("follow_system_preferences")}

Automatically adjust theme based on invitee system preferences. Note: This only applies to the booking pages.

formMethods.setValue("theme", checked ? null : themeOptions[0])} checked={!value} />