feat: add about and help panels, donate button, and live setting update #48

Merged
naomi merged 6 commits from feat/infos into main 2026-01-20 20:04:04 -08:00
3 changed files with 22 additions and 16 deletions
Showing only changes of commit 32fd2ddf45 - Show all commits
+1 -1
View File
@@ -2,7 +2,7 @@ import { NOTIFICATION_SOUNDS, type NotificationType } from "./types";
class SoundPlayer {
private audioCache: Map<NotificationType, HTMLAudioElement> = new Map();
private enabled: boolean = true;
private enabled: boolean = false; // Start disabled until config loads
private globalVolume: number = 1.0;
constructor() {
+16 -15
View File
@@ -1,22 +1,23 @@
import { derived } from "svelte/store";
import { configStore } from "./config";
import { soundPlayer } from "$lib/notifications";
// Sync notification settings with config
export const notificationSettings = derived(configStore.config, ($config) => {
soundPlayer.setEnabled($config.notifications_enabled);
soundPlayer.setGlobalVolume($config.notification_volume);
let unsubscribe: (() => void) | null = null;
return {
enabled: $config.notifications_enabled,
volume: $config.notification_volume,
};
});
// Initialize notification settings sync - call this once on app startup
export function initNotificationSync() {
// Prevent duplicate subscriptions
if (unsubscribe) return;
// Helper to update notification settings
export async function updateNotificationSettings(enabled: boolean, volume: number) {
await configStore.updateConfig({
notifications_enabled: enabled,
notification_volume: volume,
unsubscribe = configStore.config.subscribe(($config) => {
soundPlayer.setEnabled($config.notifications_enabled);
soundPlayer.setGlobalVolume($config.notification_volume);
});
}
// Cleanup function if needed
export function cleanupNotificationSync() {
if (unsubscribe) {
unsubscribe();
unsubscribe = null;
}
}
+5
View File
@@ -2,6 +2,7 @@
import { onMount, onDestroy } from "svelte";
import { initializeTauriListeners, cleanupTauriListeners } from "$lib/tauri";
import { configStore, applyTheme } from "$lib/stores/config";
import { initNotificationSync, cleanupNotificationSync } from "$lib/stores/notifications";
import { conversationsStore } from "$lib/stores/conversations";
import "$lib/notifications/testNotifications";
import Terminal from "$lib/components/Terminal.svelte";
@@ -29,12 +30,16 @@
// Apply saved theme on startup
const config = configStore.getConfig();
applyTheme(config.theme);
// Initialize notification settings sync
initNotificationSync();
}
});
onDestroy(() => {
if (initialized) {
cleanupTauriListeners();
cleanupNotificationSync();
initialized = false;
}
});