summaryrefslogtreecommitdiffstats
path: root/apps/projects-web/src/app/pages/views/settings-labels-tile.svelte
diff options
context:
space:
mode:
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.svelte112
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>