Skip to content

Commit 63d509f

Browse files
Iurii Karpovclaude
andcommitted
Daily Routines: persist selected view in localStorage
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent fb96934 commit 63d509f

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

‎src/pages/DailyRoutine.vue‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,19 @@
234234
const fileRef = ref<HTMLInputElement | null>(null);
235235
const { width, isMobile, isTablet, bind } = useDailyRoutineViewport();
236236
237-
const view = ref<ViewId>('list');
237+
const VIEW_STORAGE_KEY = 'tmgr.dailyRoutines.view';
238+
const ALLOWED_VIEWS: ViewId[] = ['list', 'day', 'week', 'month', 'year'];
239+
function loadStoredView(): ViewId {
240+
try {
241+
const v = localStorage.getItem(VIEW_STORAGE_KEY);
242+
if (v && (ALLOWED_VIEWS as string[]).includes(v)) return v as ViewId;
243+
} catch {}
244+
return 'list';
245+
}
246+
const view = ref<ViewId>(loadStoredView());
247+
watch(view, v => {
248+
try { localStorage.setItem(VIEW_STORAGE_KEY, v); } catch {}
249+
});
238250
const cursor = ref<Date>(new Date());
239251
const editingRoutine = ref<any | null>(null);
240252

0 commit comments

Comments
 (0)