77 </v-card-title >
88
99 <v-card-text >
10- <v-alert type = " info " class = " mb-4 " >
11- <v-icon start >mdi-information </v-icon >
12- Settings panel is coming soon! This will allow you to customize your learning experience .
13- </v-alert >
10+ <div v-if = " loading " >
11+ <v-progress-circular indeterminate color = " primary " > </v-progress-circular >
12+ Loading settings.. .
13+ </div >
1414
15- <v-row >
16- <v-col cols =" 12" md =" 6" >
17- <v-card variant =" outlined" >
18- <v-card-title class =" text-h6" >Study Preferences</v-card-title >
19- <v-card-text >
20- <p class =" text-body-2" >Configure session length, difficulty settings, and review scheduling.</p >
21- </v-card-text >
22- </v-card >
23- </v-col >
24-
25- <v-col cols =" 12" md =" 6" >
26- <v-card variant =" outlined" >
27- <v-card-title class =" text-h6" >Interface Options</v-card-title >
28- <v-card-text >
29- <p class =" text-body-2" >Customize theme, keyboard shortcuts, and display preferences.</p >
30- </v-card-text >
31- </v-card >
32- </v-col >
33-
34- <v-col cols =" 12" >
35- <v-card variant =" outlined" >
36- <v-card-title class =" text-h6" >Account Management</v-card-title >
37- <v-card-text >
38- <p class =" text-body-2" >Manage your profile information and data privacy settings.</p >
39- </v-card-text >
40- </v-card >
41- </v-col >
42- </v-row >
15+ <div v-else >
16+ <!-- Study Preferences -->
17+ <v-card variant =" outlined" class =" mb-4" >
18+ <v-card-title class =" text-h6" >
19+ <v-icon start >mdi-clock-outline</v-icon >
20+ Study Preferences
21+ </v-card-title >
22+ <v-card-text >
23+ <v-row >
24+ <v-col cols =" 12" md =" 6" >
25+ <v-slider
26+ v-model =" sessionTimeLimit"
27+ label =" Session Time Limit (minutes)"
28+ :min =" 1"
29+ :max =" 30"
30+ :step =" 1"
31+ thumb-label =" always"
32+ @update:model-value =" updateSessionTimeLimit"
33+ >
34+ <template #append >
35+ <v-text-field
36+ v-model =" sessionTimeLimit"
37+ type =" number"
38+ style =" width : 80px "
39+ density =" compact"
40+ hide-details
41+ variant =" outlined"
42+ :min =" 1"
43+ :max =" 30"
44+ @update:model-value =" updateSessionTimeLimit"
45+ />
46+ </template >
47+ </v-slider >
48+ </v-col >
49+ </v-row >
50+ </v-card-text >
51+ </v-card >
52+
53+ <!-- Interface Options -->
54+ <v-card variant =" outlined" class =" mb-4" >
55+ <v-card-title class =" text-h6" >
56+ <v-icon start >mdi-palette-outline</v-icon >
57+ Interface Options
58+ </v-card-title >
59+ <v-card-text >
60+ <v-row >
61+ <v-col cols =" 12" md =" 6" >
62+ <v-switch
63+ v-model =" darkMode"
64+ label =" Dark Mode"
65+ color =" primary"
66+ @update:model-value =" updateDarkMode"
67+ />
68+ </v-col >
69+ <v-col cols =" 12" md =" 6" >
70+ <v-switch
71+ v-model =" likesConfetti"
72+ label =" Enable Confetti"
73+ color =" primary"
74+ @update:model-value =" updateConfetti"
75+ />
76+ </v-col >
77+ </v-row >
78+ </v-card-text >
79+ </v-card >
80+
81+ <!-- Account Actions -->
82+ <v-card variant =" outlined" >
83+ <v-card-title class =" text-h6" >
84+ <v-icon start >mdi-account-outline</v-icon >
85+ Account Management
86+ </v-card-title >
87+ <v-card-text >
88+ <v-row >
89+ <v-col cols =" 12" >
90+ <v-btn
91+ variant =" outlined"
92+ color =" warning"
93+ @click =" resetToDefaults"
94+ >
95+ <v-icon start >mdi-restore</v-icon >
96+ Reset to Defaults
97+ </v-btn >
98+ </v-col >
99+ </v-row >
100+ </v-card-text >
101+ </v-card >
102+ </div >
43103 </v-card-text >
44104
45105 <v-card-actions >
46106 <v-btn variant =" outlined" @click =" $router.back()" >
47107 <v-icon start >mdi-arrow-left</v-icon >
48108 Back
49109 </v-btn >
110+ <v-spacer />
111+ <v-btn variant =" text" color =" success" v-if =" !loading" >
112+ <v-icon start >mdi-check</v-icon >
113+ Settings Saved
114+ </v-btn >
50115 </v-card-actions >
51116 </v-card >
52117 </v-container >
53118</template >
54119
55120<script setup lang="ts">
56- // Placeholder for user settings view
121+ import { ref , onMounted } from ' vue' ;
122+ import { useConfigStore } from ' @vue-skuilder/common-ui' ;
123+
124+ const loading = ref (true );
125+ const configStore = useConfigStore ();
126+
127+ // Reactive references to config values
128+ const sessionTimeLimit = ref (5 );
129+ const darkMode = ref (false );
130+ const likesConfetti = ref (false );
131+
132+ // Update methods
133+ const updateSessionTimeLimit = async (value : number ) => {
134+ sessionTimeLimit .value = value ;
135+ await configStore .updateSessionTimeLimit (value );
136+ };
137+
138+ const updateDarkMode = async (value : boolean ) => {
139+ darkMode .value = value ;
140+ await configStore .updateDarkMode (value );
141+ };
142+
143+ const updateConfetti = async (value : boolean ) => {
144+ likesConfetti .value = value ;
145+ await configStore .updateLikesConfetti (value );
146+ };
147+
148+ const resetToDefaults = async () => {
149+ configStore .resetDefaults ();
150+ await configStore .updateSessionTimeLimit (5 );
151+ await configStore .updateDarkMode (false );
152+ await configStore .updateLikesConfetti (false );
153+
154+ // Update local refs
155+ sessionTimeLimit .value = 5 ;
156+ darkMode .value = false ;
157+ likesConfetti .value = false ;
158+ };
159+
160+ // Load current settings on mount
161+ onMounted (async () => {
162+ try {
163+ await configStore .hydrate ();
164+
165+ // Update local refs with current config
166+ sessionTimeLimit .value = configStore .config .sessionTimeLimit ;
167+ darkMode .value = configStore .config .darkMode ;
168+ likesConfetti .value = configStore .config .likesConfetti ;
169+ } catch (error ) {
170+ console .error (' Error loading user settings:' , error );
171+ } finally {
172+ loading .value = false ;
173+ }
174+ });
57175 </script >
0 commit comments