support set interval

This commit is contained in:
Julian Freeman
2026-03-22 16:46:37 -04:00
parent 858cf85281
commit b94a976e5f
3 changed files with 48 additions and 16 deletions

View File

@@ -29,6 +29,7 @@ const isFullscreen = ref(false);
const isSettingsOpen = ref(false);
const mergeScreens = ref(false);
const retainDays = ref(30);
const captureInterval = ref(30);
const hoveredTime = ref<string | null>(null);
const timelineRef = ref<HTMLElement | null>(null);
@@ -45,6 +46,11 @@ onMounted(async () => {
isSetupComplete.value = true;
mergeScreens.value = (await store.get("mergeScreens")) as boolean || false;
retainDays.value = (await store.get("retainDays")) as number || 30;
captureInterval.value = (await store.get("captureInterval")) as number || 30;
// Sync initial interval to Rust
await invoke("update_interval", { seconds: captureInterval.value });
isPaused.value = await invoke("get_pause_state");
await loadTimeline();
}
@@ -77,7 +83,11 @@ const selectFolder = async () => {
const updateSettings = async () => {
await store.set("mergeScreens", mergeScreens.value);
await store.set("retainDays", retainDays.value);
await store.set("captureInterval", captureInterval.value);
await store.save();
// Sync interval to Rust
await invoke("update_interval", { seconds: captureInterval.value });
};
const togglePauseState = async () => {
@@ -325,6 +335,15 @@ const handleTimelineClick = (e: MouseEvent) => {
</button>
</div>
<div class="space-y-4">
<div class="flex justify-between items-end">
<label class="text-sm font-bold text-[#86868B] uppercase tracking-widest ml-1">Capture Interval</label>
<span class="text-lg font-black text-[#007AFF]">{{ captureInterval }} Seconds</span>
</div>
<input type="range" v-model.number="captureInterval" min="10" max="600" step="10" @change="updateSettings" class="w-full h-2 bg-[#E5E5E7] rounded-full appearance-none cursor-pointer accent-[#007AFF]" />
<p class="text-[11px] text-[#86868B] font-medium leading-normal text-center">Frequency of snapshots (10s to 10m).</p>
</div>
<div class="space-y-4">
<div class="flex justify-between items-end">
<label class="text-sm font-bold text-[#86868B] uppercase tracking-widest ml-1">Retention Policy</label>