diff options
| author | ivarlovlie <git@ivarlovlie.no> | 2022-06-01 22:20:31 +0200 |
|---|---|---|
| committer | ivarlovlie <git@ivarlovlie.no> | 2022-06-01 22:20:31 +0200 |
| commit | 9db0f70f75886ab1f97e231a3f9c16fcbbbe04bd (patch) | |
| tree | ee4386cdffe27eaf0325b4617c7fafefbb9f7d51 /apps/projects-web/src/app/pages/views/settings-labels-tile.svelte | |
| parent | 7058f55fe099d6b6dea50558f30a4dc8ee52dde8 (diff) | |
| download | greatoffice-9db0f70f75886ab1f97e231a3f9c16fcbbbe04bd.tar.xz greatoffice-9db0f70f75886ab1f97e231a3f9c16fcbbbe04bd.zip | |
refactor: Move projects-web to projects
Diffstat (limited to 'apps/projects-web/src/app/pages/views/settings-labels-tile.svelte')
| -rw-r--r-- | apps/projects-web/src/app/pages/views/settings-labels-tile.svelte | 112 |
1 files changed, 0 insertions, 112 deletions
diff --git a/apps/projects-web/src/app/pages/views/settings-labels-tile.svelte b/apps/projects-web/src/app/pages/views/settings-labels-tile.svelte deleted file mode 100644 index f59e233..0000000 --- a/apps/projects-web/src/app/pages/views/settings-labels-tile.svelte +++ /dev/null @@ -1,112 +0,0 @@ -<script> - import {IconNames} from "$shared/lib/configuration"; - import {onMount} from "svelte"; - import labels, {reload_labels, delete_label_async} from "$app/lib/stores/labels"; - import Button from "$shared/components/button.svelte"; - import Tile from "$shared/components/tile.svelte"; - import {Table, THead, TBody, TCell, TRow} from "$shared/components/table"; - - let is_loading = true; - - $: active_labels = $labels.filter(c => !c.archived); - $: archived_labels = $labels.filter(c => c.archived); - - async function load_labels() { - is_loading = true; - await reload_labels(); - is_loading = false; - } - - async function handle_edit_label_click(event) { - } - - async function handle_delete_label_click(event) { - const row = event.target.closest("tr"); - if ( - row && - row.dataset.id && - confirm( - "Are you sure you want to delete this label?\nIt will be removed from all related entries!" - ) - ) { - await delete_label_async({id: row.dataset.id}); - row.classList.add("d-none"); - } - } - - onMount(() => { - load_labels(); - }); -</script> - -<Tile class="col-6@md col-12 {is_loading ? 'c-disabled loading' : ''}"> - <h2 class="margin-bottom-xxs">Labels</h2> - {#if active_labels.length > 0 && archived_labels.length > 0} - <nav class="s-tabs text-sm"> - <ul class="s-tabs__list"> - <li><a class="s-tabs__link s-tabs__link--current" - href="#0">Active ({active_labels.length})</a></li> - <li><a class="s-tabs__link" - href="#0">Archived ({archived_labels.length})</a></li> - </ul> - </nav> - {/if} - <div class="max-width-100% overflow-auto"> - <Table class="text-sm width-100%"> - <THead class="text-left"> - <TCell type="th" - thScope="row"> - Name - </TCell> - <TCell type="th" - thScope="row"> - Color - </TCell> - <TCell type="th" - thScope="row" - style="width: 50px;"> - </TCell> - </THead> - <TBody class="text-left"> - {#if $labels.length > 0} - {#each $labels as label} - <TRow class="text-nowrap" - dataId={label.id}> - <TCell> - {label.name} - </TCell> - <TCell> - <span style="border-left: 3px solid {label.color}; background-color:{label.color}25;"> - {label.color} - </span> - </TCell> - <TCell> - <Button icon="{IconNames.pencilSquare}" - variant="reset" - icon_width="1.2rem" - class="hide" - icon_height="1.2rem" - on:click={handle_edit_label_click} - title="Edit entry"/> - <Button icon="{IconNames.trash}" - variant="reset" - icon_width="1.2rem" - icon_height="1.2rem" - on:click={handle_delete_label_click} - title="Delete entry"/> - </TCell> - </TRow> - {/each} - {:else} - <TRow> - <TCell type="th" - thScope="row" - colspan="3"> - No labels - </TCell> - </TRow> - {/if} - </TBody> - </Table> - </div> -</Tile> |
