Update files

This commit is contained in:
Mohamed Boudra
2026-02-04 10:52:36 +07:00
parent 8f1637ee55
commit 4887592ebe
11 changed files with 775 additions and 132 deletions
+19
View File
@@ -16,6 +16,13 @@ export const MAX_CONTENT_WIDTH = 820;
export const TAURI_TRAFFIC_LIGHT_WIDTH = 78;
export const TAURI_TRAFFIC_LIGHT_HEIGHT = 56;
// Check if running in Tauri desktop app (any OS)
function isTauri(): boolean {
if (Platform.OS !== "web") return false;
if (typeof window === "undefined") return false;
return "__TAURI__" in window;
}
// Check if running in Tauri desktop app on macOS
function isTauriMac(): boolean {
if (Platform.OS !== "web") return false;
@@ -28,6 +35,7 @@ function isTauriMac(): boolean {
// Cached result - only cache true, keep checking if false (in case __TAURI__ loads later)
let _isTauriMacCached: boolean | null = null;
let _isTauriCached: boolean | null = null;
export function getIsTauriMac(): boolean {
if (_isTauriMacCached === true) {
@@ -40,6 +48,17 @@ export function getIsTauriMac(): boolean {
return result;
}
export function getIsTauri(): boolean {
if (_isTauriCached === true) {
return true;
}
const result = isTauri();
if (result) {
_isTauriCached = true;
}
return result;
}
// Get traffic light padding values (only non-zero on Tauri macOS)
export function getTrafficLightPadding(): { left: number; top: number } {
if (!getIsTauriMac()) {