Tweak workspace settings and a bunch of small things

This commit is contained in:
Gregory Schier
2025-07-18 08:47:14 -07:00
parent 4c375ed3e9
commit bcde4de4a7
28 changed files with 450 additions and 271 deletions

View File

@@ -1,12 +0,0 @@
import { copyToClipboard } from '../lib/copy';
import { getThemes } from '../lib/theme/themes';
import { getThemeCSS } from '../lib/theme/window';
import { useListenToTauriEvent } from './useListenToTauriEvent';
export function useGenerateThemeCss() {
useListenToTauriEvent('generate_theme_css', async () => {
const themes = await getThemes();
const themesCss = themes.themes.map(getThemeCSS).join('\n\n');
copyToClipboard(themesCss);
});
}

View File

@@ -1,48 +0,0 @@
import { openUrl } from '@tauri-apps/plugin-opener';
import { Button } from '../components/core/Button';
import { invokeCmd } from '../lib/tauri';
import { useListenToTauriEvent } from './useListenToTauriEvent';
import { showToast } from '../lib/toast';
export function useNotificationToast() {
const markRead = (id: string) => {
invokeCmd('cmd_dismiss_notification', { notificationId: id }).catch(console.error);
};
useListenToTauriEvent<{
id: string;
timestamp: string;
message: string;
timeout?: number | null;
action?: null | {
url: string;
label: string;
};
}>('notification', ({ payload }) => {
console.log('Got notification event', payload);
const actionUrl = payload.action?.url;
const actionLabel = payload.action?.label;
showToast({
id: payload.id,
timeout: payload.timeout ?? undefined,
message: payload.message,
onClose: () => {
markRead(payload.id)
},
action: ({ hide }) =>
actionLabel && actionUrl ? (
<Button
size="xs"
color="secondary"
className="mr-auto min-w-[5rem]"
onClick={() => {
hide();
return openUrl(actionUrl);
}}
>
{actionLabel}
</Button>
) : null,
});
});
}

View File

@@ -1,26 +0,0 @@
import React from 'react';
import { InlineCode } from '../components/core/InlineCode';
import { showConfirmDelete } from '../lib/confirm';
import { invokeCmd } from '../lib/tauri';
import { useFastMutation } from './useFastMutation';
export function useUninstallPlugin() {
return useFastMutation({
mutationKey: ['uninstall_plugin'],
mutationFn: async ({ pluginId, name }: { pluginId: string; name: string }) => {
const confirmed = await showConfirmDelete({
id: 'uninstall-plugin-' + name,
title: 'Uninstall Plugin',
confirmText: 'Uninstall',
description: (
<>
Permanently uninstall <InlineCode>{name}</InlineCode>?
</>
),
});
if (confirmed) {
await invokeCmd('cmd_uninstall_plugin', { pluginId });
}
},
});
}