Start implementing settings

This commit is contained in:
ZXY101
2023-09-05 14:36:39 +02:00
parent b34e5e50ec
commit 3c8ab90b06
4 changed files with 43 additions and 18 deletions

View File

@@ -9,7 +9,6 @@ body {
} }
button { button {
border: none;
font-family: $font-family; font-family: $font-family;
background-color: transparent; background-color: transparent;
color: white; color: white;

View File

@@ -1,7 +0,0 @@
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Transformed by: SVG Repo Mixer Tools -->
<svg width="64px" height="64px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="SVGRepo_bgCarrier" stroke-width="0"/>
<g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"/>

Before

Width:  |  Height:  |  Size: 2.7 KiB

View File

@@ -23,6 +23,7 @@
import { afterNavigate } from '$app/navigation'; import { afterNavigate } from '$app/navigation';
import { page } from '$app/stores'; import { page } from '$app/stores';
import { sineIn } from 'svelte/easing'; import { sineIn } from 'svelte/easing';
import { settingsStore, updateSetting } from '$lib/settings';
let transitionParams = { let transitionParams = {
x: 320, x: 320,
@@ -32,7 +33,7 @@
let promise: Promise<void>; let promise: Promise<void>;
let modal = false; let modal = false;
let drawer = true; let drawer = false;
let isReader = true; let isReader = true;
async function onUpload(files: FileList) { async function onUpload(files: FileList) {
@@ -52,6 +53,14 @@
{ value: 'ca', name: 'Canada' }, { value: 'ca', name: 'Canada' },
{ value: 'fr', name: 'France' } { value: 'fr', name: 'France' }
]; ];
$: toggles = [
{ key: 'rightToLeft', text: 'Right to left', value: $settingsStore.rightToLeft },
{ key: 'singlePageView', text: 'Single page view', value: $settingsStore.singlePageView },
{ key: 'textEditable', text: 'Editable text', value: $settingsStore.textEditable },
{ key: 'textBoxBorders', text: 'Text box borders', value: $settingsStore.textBoxBorders },
{ key: 'displayOCR', text: 'OCR enabled', value: $settingsStore.displayOCR }
];
</script> </script>
<div class="relative z-10"> <div class="relative z-10">
@@ -87,13 +96,11 @@
<CloseButton on:click={() => (drawer = true)} class="mb-4 dark:text-white" /> <CloseButton on:click={() => (drawer = true)} class="mb-4 dark:text-white" />
</div> </div>
<div class="flex flex-col gap-5"> <div class="flex flex-col gap-5">
<Toggle size="small">Right to left</Toggle> {#each toggles as { key, text, value }}
<Toggle size="small">Display two pages</Toggle> <Toggle size="small" checked={value} on:change={() => updateSetting(key, !value)}
<Toggle size="small">First page is cover</Toggle> >{text}</Toggle
<Toggle size="small">OCR enabled</Toggle> >
<Toggle size="small">Display box outlines</Toggle> {/each}
<Toggle size="small">Editable text</Toggle>
<Toggle size="small">Toggle boxes on click</Toggle>
<div> <div>
<Label>Fontsize:</Label> <Label>Fontsize:</Label>
<Select items={countries} bind:value={selected} /> <Select items={countries} bind:value={selected} />

View File

@@ -3,17 +3,32 @@
import { goto } from '$app/navigation'; import { goto } from '$app/navigation';
import { onMount } from 'svelte'; import { onMount } from 'svelte';
import VolumeItem from '$lib/components/VolumeItem.svelte'; import VolumeItem from '$lib/components/VolumeItem.svelte';
import { Button, Modal } from 'flowbite-svelte';
import { ExclamationCircleOutline } from 'flowbite-svelte-icons';
import { db } from '$lib/catalog/db';
const manga = $currentManga; const manga = $currentManga;
let popupModal = false;
onMount(() => { onMount(() => {
if (!manga) { if (!manga) {
goto('/'); goto('/');
} }
}); });
function onDelete() {
popupModal = true;
}
async function confirmDelete() {
const title = manga?.[0].mokuroData.title_uuid;
await db.catalog.delete(title);
goto('/');
}
</script> </script>
<div> <div class="float-right"><Button outline color="red" on:click={onDelete}>Delete manga</Button></div>
<div class="volumes">
{#if manga} {#if manga}
{#each manga as volume} {#each manga as volume}
<VolumeItem {volume} /> <VolumeItem {volume} />
@@ -21,8 +36,19 @@
{/if} {/if}
</div> </div>
<Modal bind:open={popupModal} size="xs" autoclose>
<div class="text-center">
<ExclamationCircleOutline class="mx-auto mb-4 text-gray-400 w-12 h-12 dark:text-gray-200" />
<h3 class="mb-5 text-lg font-normal text-gray-500 dark:text-gray-400">
Are you sure you want to delete this manga?
</h3>
<Button color="red" class="mr-2" on:click={confirmDelete}>Yes</Button>
<Button color="alternative">No</Button>
</div>
</Modal>
<style> <style>
div { .volumes {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
gap: 20px; gap: 20px;