Compare commits

...

3 Commits

Author SHA1 Message Date
Tomáš Mládek 1f63d26d94 wip
ci/woodpecker/push/woodpecker Pipeline was successful Details
2024-02-02 12:57:12 +01:00
Tomáš Mládek 947fd2d98c refactor(webui): fix typo, rename ProgessBar -> ProgressBar
ci/woodpecker/manual/woodpecker Pipeline failed Details
2024-02-01 20:39:03 +01:00
Tomáš Mládek c1e2700499 fix(webui): re-add forgotten global components (Footer, AddModal, DropPasteHandler) 2024-02-01 20:39:03 +01:00
4 changed files with 28 additions and 4 deletions

View File

@ -10,7 +10,7 @@
<script lang="ts"> <script lang="ts">
import type { IJob } from '@upnd/upend/types'; import type { IJob } from '@upnd/upend/types';
import { fade } from 'svelte/transition'; import { fade } from 'svelte/transition';
import ProgessBar from '../utils/ProgessBar.svelte'; import ProgressBar from '../utils/ProgressBar.svelte';
import api from '$lib/api'; import api from '$lib/api';
import { DEBUG } from '$lib/debug'; import { DEBUG } from '$lib/debug';
@ -66,7 +66,7 @@
{#each activeJobs as job (job.id)} {#each activeJobs as job (job.id)}
<div class="job" transition:fade> <div class="job" transition:fade>
<div class="job-label">{job.title}</div> <div class="job-label">{job.title}</div>
<ProgessBar value={job.progress} /> <ProgressBar value={job.progress} />
</div> </div>
{/each} {/each}

View File

@ -5,16 +5,20 @@
import type { AttributeCreate, AttributeUpdate } from '$lib/types/base'; import type { AttributeCreate, AttributeUpdate } from '$lib/types/base';
import type { UpEntry } from '@upnd/upend'; import type { UpEntry } from '@upnd/upend';
import LabelBorder from './LabelBorder.svelte'; import LabelBorder from './LabelBorder.svelte';
import { i18n } from '$lib/i18n';
import { format } from 'date-fns';
const dispatch = createEventDispatcher(); const dispatch = createEventDispatcher();
export let address: string; export let address: string;
let lastSaved: Date | undefined;
$: ({ entity } = useEntity(address)); $: ({ entity } = useEntity(address));
let noteEntry: UpEntry | undefined; let noteEntry: UpEntry | undefined;
let notes: string | undefined = undefined; let notes: string | undefined = undefined;
$: { $: {
if ($entity?.attr['NOTE']?.length && $entity?.attr['NOTE'][0]?.value?.c) { if ($entity?.attr['NOTE']?.[0]?.value?.c) {
noteEntry = $entity?.attr['NOTE'][0]; noteEntry = $entity?.attr['NOTE'][0];
notes = String(noteEntry.value.c); notes = String(noteEntry.value.c);
} else { } else {
@ -41,14 +45,27 @@
value: { t: 'String', c: contentEl.innerText } value: { t: 'String', c: contentEl.innerText }
} as AttributeCreate); } as AttributeCreate);
} }
lastSaved = new Date();
}, 500); }, 500);
function onInput() {
lastSaved = undefined;
update();
}
</script> </script>
<LabelBorder hide={!notes?.length}> <LabelBorder hide={!notes?.length}>
<span slot="header">Notes</span> <span slot="header">Notes</span>
<div class="notes" contenteditable on:input={update} bind:this={contentEl}> <div class="notes" contenteditable on:input={onInput} bind:this={contentEl}>
{notes ? notes : ''} {notes ? notes : ''}
</div> </div>
<div class="status">
{#if lastSaved}
{$i18n.t('Last saved at {{time}}', { time: format(lastSaved, 'HH:mm') })}
{:else}
{$i18n.t('Waiting for changes...')}
{/if}
</div>
</LabelBorder> </LabelBorder>
<style lang="scss"> <style lang="scss">

View File

@ -1,9 +1,16 @@
<script lang="ts"> <script lang="ts">
import '$lib/styles/main.scss'; import '$lib/styles/main.scss';
import Header from '$lib/components/layout/Header.svelte'; import Header from '$lib/components/layout/Header.svelte';
import Footer from '$lib/components/layout/Footer.svelte';
import DropPasteHandler from '$lib/components/DropPasteHandler.svelte';
import AddModal from '$lib/components/AddModal.svelte';
</script> </script>
<Header /> <Header />
<main> <main>
<slot /> <slot />
</main> </main>
<Footer />
<AddModal />
<DropPasteHandler />>