mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-24 18:31:16 +01:00
Faster time-to-theme (#109)
This commit is contained in:
@@ -3,10 +3,10 @@ import { useActiveWorkspace } from '../../hooks/useActiveWorkspace';
|
||||
import { useResolvedAppearance } from '../../hooks/useResolvedAppearance';
|
||||
import { useResolvedTheme } from '../../hooks/useResolvedTheme';
|
||||
import { useSettings } from '../../hooks/useSettings';
|
||||
import { useThemes } from '../../hooks/useThemes';
|
||||
import { useUpdateSettings } from '../../hooks/useUpdateSettings';
|
||||
import { trackEvent } from '../../lib/analytics';
|
||||
import { clamp } from '../../lib/clamp';
|
||||
import { getThemes } from '../../lib/theme/themes';
|
||||
import { isThemeDark } from '../../lib/theme/window';
|
||||
import type { ButtonProps } from '../core/Button';
|
||||
import { Checkbox } from '../core/Checkbox';
|
||||
@@ -52,12 +52,13 @@ const icons: IconProps['icon'][] = [
|
||||
'send_horizontal',
|
||||
];
|
||||
|
||||
const { themes } = getThemes();
|
||||
|
||||
export function SettingsAppearance() {
|
||||
const workspace = useActiveWorkspace();
|
||||
const settings = useSettings();
|
||||
const updateSettings = useUpdateSettings();
|
||||
const appearance = useResolvedAppearance();
|
||||
const { themes } = useThemes();
|
||||
const activeTheme = useResolvedTheme();
|
||||
|
||||
if (settings == null || workspace == null) {
|
||||
@@ -161,9 +162,10 @@ export function SettingsAppearance() {
|
||||
space={3}
|
||||
className="mt-3 w-full bg-surface p-3 border border-dashed border-border-subtle rounded overflow-x-auto"
|
||||
>
|
||||
<HStack className="text font-bold" space={2}>
|
||||
Theme Preview{' '}
|
||||
<HStack className="text" space={1.5}>
|
||||
<Icon icon={appearance === 'dark' ? 'moon' : 'sun'} className="text-text-subtle" />
|
||||
<strong>{activeTheme.active.name}</strong>
|
||||
<em>(preview)</em>
|
||||
</HStack>
|
||||
<HStack space={1.5} className="w-full">
|
||||
{buttonColors.map((c, i) => (
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { open } from '@tauri-apps/plugin-dialog';
|
||||
import React, { useState } from 'react';
|
||||
import { useLocalStorage } from 'react-use';
|
||||
import { useThemes } from '../../hooks/useThemes';
|
||||
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';
|
||||
@@ -45,9 +45,9 @@ const icons: IconProps['icon'][] = [
|
||||
'send_horizontal',
|
||||
];
|
||||
|
||||
export function SettingsDesign() {
|
||||
const themes = useThemes();
|
||||
const themes = getThemes();
|
||||
|
||||
export function SettingsDesign() {
|
||||
const [exportDir, setExportDir] = useLocalStorage<string | null>('theme_export_dir', null);
|
||||
const [loadingExport, setLoadingExport] = useState<boolean>(false);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user