import { open } from '@tauri-apps/plugin-dialog'; import React, { useState } from 'react'; import { useLocalStorage } from 'react-use'; import { capitalize } from '../../lib/capitalize'; import { invokeCmd } from '../../lib/tauri'; import { getThemes } from '../../lib/theme/themes'; import { yaakDark } from '../../lib/theme/themes/yaak'; import { getThemeCSS } from '../../lib/theme/window'; import { Banner } from '../core/Banner'; import { Button } from '../core/Button'; import {Editor} from "../core/Editor/Editor"; import type { IconProps } from '../core/Icon'; import { Icon } from '../core/Icon'; import { IconButton } from '../core/IconButton'; import { InlineCode } from '../core/InlineCode'; import { Input } from '../core/Input'; import { Separator } from '../core/Separator'; import { HStack, VStack } from '../core/Stacks'; const buttonColors = [ 'primary', 'secondary', 'info', 'success', 'warning', 'danger', 'default', ] as const; 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', ]; const themes = getThemes(); export function SettingsDesign() { const [exportDir, setExportDir] = useLocalStorage('theme_export_dir', null); const [loadingExport, setLoadingExport] = useState(false); const saveThemes = () => { setLoadingExport(true); setTimeout(async () => { const allThemesCSS = themes.themes.map(getThemeCSS).join('\n\n'); const coreThemeCSS = [yaakDark].map(getThemeCSS).join('\n\n'); try { await invokeCmd('cmd_write_file_dev', { pathname: exportDir + '/themes-all.css', contents: allThemesCSS, }); await invokeCmd('cmd_write_file_dev', { pathname: exportDir + '/themes-slim.css', contents: coreThemeCSS, }); } catch (err) { console.log('FAILED', err); } setLoadingExport(false); }, 500); }; return (
{exportDir} } stateKey={null} />
{buttonColors.map((c, i) => ( ))}
{buttonColors.map((c, i) => ( ))}
{icons.map((v, i) => ( ))}
Primary banner Secondary banner Danger banner Warning banner Success banner
); }