@@ -30,11 +30,37 @@ interface DirectoryInfo {
30
30
// Retrieve the SDK instance to interact with the backend
31
31
const sdk = useSDK ();
32
32
33
- // Reactive state
34
- const thresholdMB = ref (10 );
35
- const enableWarnings = ref (true );
36
- const warningAt75Percent = ref (true );
37
- const warningAt90Percent = ref (true );
33
+ // Load settings from localStorage with defaults
34
+ const loadSettings = () => {
35
+ const saved = localStorage .getItem (' bytecap-settings' );
36
+ if (saved ) {
37
+ try {
38
+ return JSON .parse (saved );
39
+ } catch {
40
+ return {};
41
+ }
42
+ }
43
+ return {};
44
+ };
45
+
46
+ // Save settings to localStorage
47
+ const saveSettings = () => {
48
+ const settings = {
49
+ thresholdMB: thresholdMB .value ,
50
+ enableWarnings: enableWarnings .value ,
51
+ warningAt75Percent: warningAt75Percent .value ,
52
+ warningAt90Percent: warningAt90Percent .value ,
53
+ };
54
+ localStorage .setItem (' bytecap-settings' , JSON .stringify (settings ));
55
+ };
56
+
57
+ const savedSettings = loadSettings ();
58
+
59
+ // Reactive state with persisted values
60
+ const thresholdMB = ref (savedSettings .thresholdMB ?? 10 );
61
+ const enableWarnings = ref (savedSettings .enableWarnings ?? true );
62
+ const warningAt75Percent = ref (savedSettings .warningAt75Percent ?? true );
63
+ const warningAt90Percent = ref (savedSettings .warningAt90Percent ?? true );
38
64
const workspaceFiles = ref <DirectoryInfo >({
39
65
files: [],
40
66
totalSize: 0 ,
@@ -127,6 +153,9 @@ const onRefreshClick = async () => {
127
153
128
154
// Apply settings and check thresholds manually
129
155
const applySettings = async () => {
156
+ // Save settings to localStorage
157
+ saveSettings ();
158
+
130
159
// Clear any existing notifications first
131
160
clearAllNotifications ();
132
161
0 commit comments