import { Controller, useForm } from "react-hook-form"; import { useLocale } from "@calcom/lib/hooks/useLocale"; 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 { Form } from "@calcom/ui/v2/core/form/fields"; import { getLayout } from "@calcom/ui/v2/core/layouts/SettingsLayout"; import showToast from "@calcom/ui/v2/core/notifications"; import { SkeletonContainer, SkeletonText, SkeletonButton } from "@calcom/ui/v2/core/skeleton"; const SkeletonLoader = () => { return (
); }; const AppearanceView = () => { const { t } = useLocale(); const { data: user, isLoading } = trpc.useQuery(["viewer.me"]); const mutation = trpc.useMutation("viewer.updateProfile", { onSuccess: () => { showToast(t("settings_updated_successfully"), "success"); }, onError: () => { showToast(t("error_updating_settings"), "error"); }, }); const formMethods = useForm(); if (isLoading) return ; if (user) return (
{ mutation.mutate({ ...values, // Radio values don't support null as values, therefore we convert an empty string // back to null here. theme: values.theme || null, }); }}>

{t("theme")}

{t("theme_applies_note")}


{t("custom_brand_colors")}

{t("customize_your_brand_colors")}

(

{t("light_brand_color")}

formMethods.setValue("brandColor", value)} />
)} /> (

{t("dark_brand_color")}

formMethods.setValue("darkBrandColor", value)} />
)} />
{/* TODO future PR to preview brandColors */} {/* */}
( <>

{t("disable_cal_branding")}

{" "} {t("pro")}

{t("removes_cal_branding")}

formMethods.setValue("hideBranding", checked)} checked={value} />
)} /> ); }; AppearanceView.getLayout = getLayout; export default AppearanceView; interface ThemeLabelProps { variant: "light" | "dark" | "system"; value?: "light" | "dark" | null; label: string; defaultChecked?: boolean; register: any; } const ThemeLabel = ({ variant, label, value, defaultChecked, register }: ThemeLabelProps) => { return ( ); };