import { type } from '@tauri-apps/plugin-os'; import { useFonts } from '@yaakapp-internal/fonts'; import { useLicense } from '@yaakapp-internal/license'; import type { EditorKeymap, Settings } from '@yaakapp-internal/models'; import { patchModel, settingsAtom } from '@yaakapp-internal/models'; import { useAtomValue } from 'jotai'; import React from 'react'; import { activeWorkspaceAtom } from '../../hooks/useActiveWorkspace'; import { clamp } from '../../lib/clamp'; import { showConfirm } from '../../lib/confirm'; import { CargoFeature } from '../CargoFeature'; import { Checkbox } from '../core/Checkbox'; import { Icon } from '../core/Icon'; import { Link } from '../core/Link'; import { Select } from '../core/Select'; import { HStack, VStack } from '../core/Stacks'; const NULL_FONT_VALUE = '__NULL_FONT__'; const fontSizeOptions = [ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, ].map((n) => ({ label: `${n}`, value: `${n}` })); const keymaps: { value: EditorKeymap; label: string }[] = [ { value: 'default', label: 'Default' }, { value: 'vim', label: 'Vim' }, { value: 'vscode', label: 'VSCode' }, { value: 'emacs', label: 'Emacs' }, ]; export function SettingsInterface() { const workspace = useAtomValue(activeWorkspaceAtom); const settings = useAtomValue(settingsAtom); const fonts = useFonts(); if (settings == null || workspace == null) { return null; } return ( {fonts.data && ( patchModel(settings, { interfaceFontSize: parseInt(v) })} /> {fonts.data && ( patchModel(settings, { editorFontSize: clamp(parseInt(v) || 14, 8, 30) }) } />