diff --git a/src/components/Settings/ProjectSettings/Authentication.tsx b/src/components/Settings/ProjectSettings/Authentication.tsx index b55ad737..aceccee5 100644 --- a/src/components/Settings/ProjectSettings/Authentication.tsx +++ b/src/components/Settings/ProjectSettings/Authentication.tsx @@ -12,7 +12,9 @@ export default function Authentication({ publicSettings, updatePublicSettings, }: IProjectSettingsChildProps) { - const [signInOptions, setSignInOptions] = useState( + const [signInOptions, setSignInOptions] = useState< + NonNullable + >( Array.isArray(publicSettings?.signInOptions) ? publicSettings.signInOptions : ["google"] @@ -23,10 +25,12 @@ export default function Authentication({ ({ - value: option, - label: startCase(option).replace("Github", "GitHub"), - }))} + options={ + Object.keys(authOptions).map((option) => ({ + value: option, + label: startCase(option).replace("Github", "GitHub"), + })) as any + } onChange={setSignInOptions} onClose={() => updatePublicSettings({ signInOptions })} multiple diff --git a/src/components/Settings/ProjectSettings/Customization.tsx b/src/components/Settings/ProjectSettings/Customization.tsx index c6d61919..320586a8 100644 --- a/src/components/Settings/ProjectSettings/Customization.tsx +++ b/src/components/Settings/ProjectSettings/Customization.tsx @@ -13,8 +13,8 @@ export default function Customization({ updatePublicSettings, }: IProjectSettingsChildProps) { const [customizedThemeColor, setCustomizedThemeColor] = useState( - publicSettings.theme?.light?.palette?.primary?.main || - publicSettings.theme?.dark?.palette?.primary?.main + (publicSettings.theme?.light?.palette?.primary as any)?.main || + (publicSettings.theme?.dark?.palette?.primary as any)?.main ); const handleSave = ({ light, dark }: { light: string; dark: string }) => { @@ -50,8 +50,12 @@ export default function Customization({ }> diff --git a/src/components/Settings/UserSettings/Account.tsx b/src/components/Settings/UserSettings/Account.tsx index f5c5c744..57f49b73 100644 --- a/src/components/Settings/UserSettings/Account.tsx +++ b/src/components/Settings/UserSettings/Account.tsx @@ -9,19 +9,19 @@ export default function Account({ settings }: IUserSettingsChildProps) { return ( - + - {settings.user.displayName} + {settings.user?.displayName} - {settings.user.email} + {settings.user?.email} diff --git a/src/components/Settings/UserSettings/Personalization.tsx b/src/components/Settings/UserSettings/Personalization.tsx index 65542669..f2687b49 100644 --- a/src/components/Settings/UserSettings/Personalization.tsx +++ b/src/components/Settings/UserSettings/Personalization.tsx @@ -14,8 +14,8 @@ export default function Personalization({ }: IUserSettingsChildProps) { const [customizedThemeColor, setCustomizedThemeColor] = useState( Boolean( - settings.theme?.light?.palette?.primary?.main || - settings.theme?.dark?.palette?.primary?.main + (settings.theme?.light?.palette?.primary as any)?.main || + (settings.theme?.dark?.palette?.primary as any)?.main ) ); @@ -52,8 +52,10 @@ export default function Personalization({ }> diff --git a/src/components/Settings/UserSettings/Theme.tsx b/src/components/Settings/UserSettings/Theme.tsx index 6f6f1c83..e7f491b4 100644 --- a/src/components/Settings/UserSettings/Theme.tsx +++ b/src/components/Settings/UserSettings/Theme.tsx @@ -62,7 +62,9 @@ export default function Theme({ { updateSettings({ theme: merge(settings.theme, { diff --git a/src/pages/Settings/DebugSettingsPage.tsx b/src/pages/Settings/DebugSettingsPage.tsx index 45c2c77f..c5ad9025 100644 --- a/src/pages/Settings/DebugSettingsPage.tsx +++ b/src/pages/Settings/DebugSettingsPage.tsx @@ -23,13 +23,6 @@ import { USERS } from "@src/config/dbPaths"; import { getTableSchemaPath } from "@src/utils/table"; import { useScrollToHash } from "@src/hooks/useScrollToHash"; -export interface IProjectSettingsChildProps { - settings: Record; - updateSettings: (data: Record) => void; - publicSettings: Record; - updatePublicSettings: (data: Record) => void; -} - export default function DebugSettingsPage() { const [firebaseDb] = useAtom(firebaseDbAtom, projectScope); const [projectSettings] = useAtom(projectSettingsAtom, projectScope); diff --git a/src/pages/Settings/ProjectSettingsPage.tsx b/src/pages/Settings/ProjectSettingsPage.tsx index 96f0e93c..f468497e 100644 --- a/src/pages/Settings/ProjectSettingsPage.tsx +++ b/src/pages/Settings/ProjectSettingsPage.tsx @@ -19,12 +19,13 @@ import { updatePublicSettingsAtom, } from "@src/atoms/projectScope"; import { useScrollToHash } from "@src/hooks/useScrollToHash"; +import { ProjectSettings, PublicSettings } from "@src/types/settings"; export interface IProjectSettingsChildProps { - settings: Record; - updateSettings: (data: Record) => void; - publicSettings: Record; - updatePublicSettings: (data: Record) => void; + settings: ProjectSettings; + updateSettings: (data: Partial) => void; + publicSettings: PublicSettings; + updatePublicSettings: (data: Partial) => void; } export default function ProjectSettingsPage() { diff --git a/src/pages/Settings/UserSettingsPage.tsx b/src/pages/Settings/UserSettingsPage.tsx index be4d43ec..1981157f 100644 --- a/src/pages/Settings/UserSettingsPage.tsx +++ b/src/pages/Settings/UserSettingsPage.tsx @@ -18,10 +18,11 @@ import { updateUserSettingsAtom, } from "@src/atoms/projectScope"; import { useScrollToHash } from "@src/hooks/useScrollToHash"; +import { UserSettings } from "@src/types/settings"; export interface IUserSettingsChildProps { - settings: Record; - updateSettings: (data: Record) => void; + settings: UserSettings; + updateSettings: (data: Partial) => void; } export default function UserSettingsPage() {