From b7e39b59fd0fc7b5610ebff29035bf622079e0d8 Mon Sep 17 00:00:00 2001
From: ivarlovlie <git@ivarlovlie.no>
Date: Wed, 5 Oct 2022 20:45:21 +0800
Subject: refactor: Change file structure

---
 .../pages/views/entry-form/sections/labels.svelte  | 66 ----------------------
 1 file changed, 66 deletions(-)
 delete mode 100644 old-apps/projects/src/app/pages/views/entry-form/sections/labels.svelte

(limited to 'old-apps/projects/src/app/pages/views/entry-form/sections/labels.svelte')

diff --git a/old-apps/projects/src/app/pages/views/entry-form/sections/labels.svelte b/old-apps/projects/src/app/pages/views/entry-form/sections/labels.svelte
deleted file mode 100644
index a6f324b..0000000
--- a/old-apps/projects/src/app/pages/views/entry-form/sections/labels.svelte
+++ /dev/null
@@ -1,66 +0,0 @@
-<script>
-	import LL from "$app/lib/i18n/i18n-svelte";
-	import {generate_random_hex_color} from "$shared/lib/colors";
-	import labels, {reload_labels, create_label_async} from "$app/lib/stores/labels";
-	import Dropdown from "$shared/components/dropdown.svelte";
-
-	let labelsError = "";
-	let loading = false;
-	let DropdownExports;
-
-	function reset() {
-		DropdownExports.reset();
-		console.log($LL.views.entryForm.labels._logReset());
-	}
-
-	function get_selected() {
-		return $labels.filter((c) => Object.hasOwn(c, "selected") && c.selected === true);
-	}
-
-	function select_label(id) {
-		DropdownExports.select(id);
-	}
-
-	function select_labels(ids) {
-		for (const id of ids) {
-			DropdownExports.select(id);
-		}
-	}
-
-	async function on_create({name}) {
-		loading = true;
-		const response = await create_label_async({
-			name: name,
-			color: generate_random_hex_color(),
-		});
-		loading = false;
-		if (response.ok) {
-			// Small pause to allow loading state to update everywhere.
-			setTimeout(() => select_label(response.data.id), 50);
-		}
-	}
-
-	export const functions = {
-		get_selected,
-		reset,
-		load_labels: reload_labels,
-		select_labels,
-		select_label,
-	};
-</script>
-
-<Dropdown
-        entries={$labels}
-        label="{$LL.views.entryForm.labels.labels()}"
-        maxlength="50"
-        createable={true}
-        placeholder="{$LL.views.entryForm.labels.placeholder()}"
-        multiple="{true}"
-        id="labels-search"
-        name="labels-search"
-        on_create_async={on_create}
-        noResultsText="{$LL.views.entryForm.labels.placeholder()}"
-        errorText="{labelsError}"
-        bind:this={DropdownExports}
-        {loading}
-/>
-- 
cgit v1.3

