4273b0ef90
Squashed commit of the following: commit 085cd9481dee748ee84c1a8f9dcd8ef0b01105ab Author: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com> Date: Mon Dec 30 16:29:41 2024 +1030 Update lib.rs for the DB sync of autostart commit 86f2fb19bde3933ec6b5cd82701de0d306121659 Author: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com> Date: Mon Dec 30 16:29:13 2024 +1030 Update db.rs to accomidate the settings sync commit ece11e7581c9aef55588b2e829379b1224021a45 Author: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com> Date: Mon Dec 30 16:27:48 2024 +1030 Update autostart.rs to include DB commit 7ea8a24fdc2ff98379694ce8e347a40fcfd5fea3 Author: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com> Date: Mon Dec 30 15:17:38 2024 +1030 Add files via upload commit af2f232d94fa449d9e20df737ce81ebded87fd50 Author: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com> Date: Mon Dec 30 15:17:09 2024 +1030 Delete src-tauri/Cargo.toml commit 5d27b65612457de6eb30835d5423b9d96fd5a596 Author: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com> Date: Mon Dec 30 15:15:42 2024 +1030 Add files via upload commit 2eea7b97a876e23cc0d6daec37f1b75af9bf3ae2 Author: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com> Date: Mon Dec 30 15:15:31 2024 +1030 Delete src-tauri/src/lib.rs commit 9a635a10d1340f86c74812113284b115b34b9bbe Author: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com> Date: Mon Dec 30 15:14:49 2024 +1030 Add files via upload commit 2fb049531a082fbdd217aba694819b7a3f954a55 Author: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com> Date: Mon Dec 30 15:13:37 2024 +1030 Add files via upload commit ea1be4d7505a9ab16bda338491c0ec313d0bc586 Author: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com> Date: Mon Dec 30 15:13:20 2024 +1030 Delete pages/settings/index.vue
60 lines
2.3 KiB
Vue
60 lines
2.3 KiB
Vue
<template>
|
|
<div class="divide-y divide-zinc-700">
|
|
<div class="py-6">
|
|
<h2 class="text-base font-semibold font-display leading-7 text-zinc-100">General</h2>
|
|
<p class="mt-1 text-sm leading-6 text-zinc-400">
|
|
Configure basic application settings
|
|
</p>
|
|
|
|
<div class="mt-10 space-y-8">
|
|
<div class="flex flex-row items-center justify-between">
|
|
<div>
|
|
<h3 class="text-sm font-medium leading-6 text-zinc-100">Start with system</h3>
|
|
<p class="mt-1 text-sm leading-6 text-zinc-400">
|
|
Drop will automatically start when you log into your computer
|
|
</p>
|
|
</div>
|
|
<Switch
|
|
v-model="autostartEnabled"
|
|
:class="[
|
|
autostartEnabled ? 'bg-blue-600' : 'bg-zinc-700',
|
|
'relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out'
|
|
]"
|
|
>
|
|
<span
|
|
:class="[
|
|
autostartEnabled ? 'translate-x-5' : 'translate-x-0',
|
|
'pointer-events-none relative inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out'
|
|
]"
|
|
/>
|
|
</Switch>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { Switch } from '@headlessui/vue'
|
|
import { invoke } from "@tauri-apps/api/core";
|
|
|
|
defineProps<{}>()
|
|
|
|
const autostartEnabled = ref<boolean>(false)
|
|
|
|
// Load initial state
|
|
invoke('get_autostart_enabled').then((enabled) => {
|
|
autostartEnabled.value = enabled as boolean
|
|
})
|
|
|
|
// Watch for changes and update autostart
|
|
watch(autostartEnabled, async (newValue: boolean) => {
|
|
try {
|
|
await invoke('toggle_autostart', { enabled: newValue })
|
|
} catch (error) {
|
|
console.error('Failed to toggle autostart:', error)
|
|
// Revert the toggle if it failed
|
|
autostartEnabled.value = !newValue
|
|
}
|
|
})
|
|
</script> |