import { patchModel, settingsAtom } from '@yaakapp-internal/models'; import { useAtomValue } from 'jotai'; import { lazy, Suspense } from 'react'; import { activeWorkspaceAtom } from '../../hooks/useActiveWorkspace'; import { useResolvedAppearance } from '../../hooks/useResolvedAppearance'; import { useResolvedTheme } from '../../hooks/useResolvedTheme'; import type { ButtonProps } from '../core/Button'; import { Heading } from '../core/Heading'; import type { IconProps } from '../core/Icon'; import { Icon } from '../core/Icon'; import { IconButton } from '../core/IconButton'; import { Link } from '../core/Link'; import type { SelectProps } from '../core/Select'; import { Select } from '../core/Select'; import { HStack, VStack } from '../core/Stacks'; const Editor = lazy(() => import('../core/Editor/Editor').then((m) => ({ default: m.Editor }))); const buttonColors: ButtonProps['color'][] = [ 'primary', 'info', 'success', 'notice', 'warning', 'danger', 'secondary', 'default', ]; const icons: IconProps['icon'][] = [ 'info', 'box', 'update', 'alert_triangle', 'arrow_big_right_dash', 'download', 'copy', 'magic_wand', 'settings', 'trash', 'sparkles', 'pencil', 'paste', 'search', 'send_horizontal', ]; export function SettingsTheme() { const workspace = useAtomValue(activeWorkspaceAtom); const settings = useAtomValue(settingsAtom); const appearance = useResolvedAppearance(); const activeTheme = useResolvedTheme(); if (settings == null || workspace == null || activeTheme.data == null) { return null; } const lightThemes: SelectProps['options'] = activeTheme.data.themes .filter((theme) => !theme.dark) .map((theme) => ({ label: theme.label, value: theme.id, })); const darkThemes: SelectProps['options'] = activeTheme.data.themes .filter((theme) => theme.dark) .map((theme) => ({ label: theme.label, value: theme.id, })); return (
Theme

Make Yaak your own by selecting a theme, or{' '} Create Your Own

} name="lightTheme" label="Light Theme" size="sm" className="flex-1" value={activeTheme.data.light.id} options={lightThemes} onChange={(themeLight) => patchModel(settings, { themeLight })} /> )} {(settings.appearance === 'system' || settings.appearance === 'dark') && (