import { GetServerSidePropsContext } from "next"; import { Trans } from "next-i18next"; import { useRouter } from "next/router"; import { title } from "process"; import { useMemo, useState } from "react"; import { useForm, Controller } from "react-hook-form"; import { WEBAPP_URL } from "@calcom/lib/constants"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import prisma from "@calcom/prisma"; import { trpc } from "@calcom/trpc/react"; import { Icon } from "@calcom/ui"; import Avatar from "@calcom/ui/v2/core/Avatar"; import Badge from "@calcom/ui/v2/core/Badge"; import { Button } from "@calcom/ui/v2/core/Button"; import Loader from "@calcom/ui/v2/core/Loader"; import Switch from "@calcom/ui/v2/core/Switch"; import TimezoneSelect from "@calcom/ui/v2/core/TimezoneSelect"; import ColorPicker from "@calcom/ui/v2/core/colorpicker"; import Select from "@calcom/ui/v2/core/form/Select"; import { TextField, Form, Label } 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} />