frontend cleanup

This commit is contained in:
Priler 2026-01-04 22:50:34 +05:00
parent 091a41ac33
commit 0c28304840
38 changed files with 2873 additions and 1180 deletions

View file

@ -1,61 +1,27 @@
import { invoke } from "@tauri-apps/api/core"
import { is_listening, isListening } from "@/stores"
import { clearInterval, clearTimeout, setInterval, setTimeout } from 'worker-timers';
// setInterval(() => {
// (async () => {
// is_listening.set(await invoke("is_listening"));
// })().catch(err => {
// console.error(err);
// });
// }, 1000);
// ### UTILITY FUNCTIONS
export function startListening() {
(async () => {
invoke('start_listening')
.then((message) => {
is_listening.set(true);
})
.catch((error) => {
is_listening.set(false);
console.error(error);
// alert("Ошибка: " + error);
})
})().catch(err => {
console.error(err);
});
export function capitalizeFirstLetter(str: string): string {
if (!str) return ""
return str.charAt(0).toUpperCase() + str.slice(1)
}
export function stopListening(callback: () => void) {
(async () => {
invoke('stop_listening')
.then((message) => {
is_listening.set(false);
if(callback) {
callback();
}
})
.catch((error) => {
console.error(error);
})
})().catch(err => {
console.error(err);
});
export function showInExplorer(path: string): void {
invoke("show_in_folder", { path })
.catch(err => console.error("failed to open explorer:", err))
}
export function capitalizeFirstLetter(string: string) {
return string.charAt(0).toUpperCase() + string.slice(1);
// ### LISTENER FUNCTIONS
// removed since gui now doesn't handle listening
export function startListening(): void {
// disabled in GUI - listening is handled by the tray app
console.log("[gui] listening not available in settings app")
}
export function showInExplorer(path: any) {
(async () => {
invoke('show_in_folder', {path: path})
.then((message) => {})
.catch((error) => {
console.error(error);
// alert("Ошибка: " + error);
})
})().catch(err => {
console.error(err);
});
}
export function stopListening(callback?: () => void): void {
// disabled in GUI - just call the callback if provided
console.log("[gui] listening not available in settings app")
if (callback) callback()
}