-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(refactor): move settings modal to own composables
Signed-off-by: Martichou <m@rtin.fyi>
- Loading branch information
Showing
2 changed files
with
79 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<script setup lang="ts"> | ||
import { dialog } from '@tauri-apps/api'; | ||
import { utils } from '../vue_lib'; | ||
import { PropType } from 'vue'; | ||
import { TauriVM } from '../vue_lib/helper/ParamsHelper'; | ||
const props = defineProps({ | ||
vm: { | ||
type: Object as PropType<TauriVM>, | ||
required: true | ||
} | ||
}); | ||
const emit = defineEmits(['close']); | ||
function openDownloadPicker() { | ||
dialog.open({ | ||
title: "Select the destination for files", | ||
directory: true, | ||
multiple: false, | ||
}).then(async (el) => { | ||
if (el === null) { | ||
return; | ||
} | ||
await utils.setDownloadPath(props.vm, el as string); | ||
}) | ||
} | ||
</script> | ||
|
||
<template> | ||
<div v-if="vm.settingsOpen" class="absolute z-10 w-full h-full flex justify-center items-center bg-black bg-opacity-25"> | ||
<div class="bg-white rounded-xl shadow-xl p-4 w-[24rem]"> | ||
<div class="flex flex-row justify-between items-center"> | ||
<h3 class="font-medium text-xl"> | ||
Settings | ||
</h3> | ||
<div class="btn px-3 rounded-xl active:scale-95 transition duration-150 ease-in-out" @click="emit('close')"> | ||
Close | ||
</div> | ||
</div> | ||
<div class="py-4 flex flex-col"> | ||
<div class="form-control hover:bg-gray-500 hover:bg-opacity-10 rounded-xl p-3"> | ||
<label class="cursor-pointer flex flex-row justify-between items-center" @click="utils.setAutoStart(vm, !vm.autostart)"> | ||
<span class="label-text">Start on boot</span> | ||
<input type="checkbox" :checked="vm.autostart" class="checkbox focus:outline-none"> | ||
</label> | ||
</div> | ||
<div class="form-control hover:bg-gray-500 hover:bg-opacity-10 rounded-xl p-3"> | ||
<label class="cursor-pointer flex flex-row justify-between items-center" @click="utils.setRealClose(vm, !vm.realclose)"> | ||
<span class="label-text">Keep running on close</span> | ||
<input type="checkbox" :checked="!vm.realclose" class="checkbox focus:outline-none"> | ||
</label> | ||
</div> | ||
<div class="form-control hover:bg-gray-500 hover:bg-opacity-10 rounded-xl p-3"> | ||
<label class="cursor-pointer flex flex-row justify-between items-center" @click="utils.setStartMinimized(vm, !vm.startminimized)"> | ||
<span class="label-text">Start minimized</span> | ||
<input type="checkbox" :checked="vm.startminimized" class="checkbox focus:outline-none"> | ||
</label> | ||
</div> | ||
<div class="form-control hover:bg-gray-500 hover:bg-opacity-10 rounded-xl p-3"> | ||
<label class="cursor-pointer flex flex-col items-start" @click="openDownloadPicker()"> | ||
<span class="">Change download folder</span> | ||
<span class="overflow-hidden whitespace-nowrap text-ellipsis text-xs max-w-80"> | ||
> {{ vm.downloadPath ?? 'OS User\'s download folder' }} | ||
</span> | ||
</label> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</template> |