Add a lightweight workspace preferences helper to store optional UI settings in localStorage and integrate it with the issues views so filters, queries, and view mode are restored per source. The integration board now remembers repository and query filters, and the Issue Center restores state filters and view mode across sessions. Also disable drag and drop for the main Tauri window to avoid accidental file drops. - Add read/write helpers for workspace preferences in localStorage - Persist and restore filters, queries, and view mode for issue views - Disable window drag-and-drop to prevent accidental file drops
13 lines
675 B
TypeScript
13 lines
675 B
TypeScript
// Optional UI preferences must never prevent the workspace from opening.
|
|
export function readWorkspacePreferences(key: string): Record<string, string> {
|
|
try {
|
|
const value: unknown = JSON.parse(localStorage.getItem(key) ?? "{}");
|
|
if (!value || typeof value !== "object" || Array.isArray(value)) return {};
|
|
return Object.fromEntries(Object.entries(value).filter((entry): entry is [string, string] => typeof entry[1] === "string"));
|
|
} catch { return {}; }
|
|
}
|
|
|
|
export function writeWorkspacePreferences(key: string, value: Record<string, string>) {
|
|
try { localStorage.setItem(key, JSON.stringify(value)); } catch { /* Storage may be unavailable or full. */ }
|
|
}
|