-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings.ts
More file actions
31 lines (25 loc) · 780 Bytes
/
Copy pathsettings.ts
File metadata and controls
31 lines (25 loc) · 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"use client";
import { useEffect } from "react";
import { BasicStorage } from "./utils/UseLocalStorage";
// Define settings interface
export interface Settings {
lightClients: boolean;
customWWS?: boolean | null;
}
// Instantiate BasicStorage for settings
export const settings = new BasicStorage<string, Settings>();
// Component to initialize settings in localStorage
export function GlobeSettings() {
useEffect(() => {
// Check if settings already exist in localStorage
const existingSettings = settings.get("settings");
// Only set defaults if no settings are present
if (!existingSettings) {
settings.set("settings", {
lightClients: true,
customWWS: false,
});
}
}, []);
return null; // No UI elements needed
}