From d798d872aa63926046e8fc0379f661166e1143f6 Mon Sep 17 00:00:00 2001 From: Sergei Ogorelkov Date: Tue, 6 Jun 2023 19:41:18 +0400 Subject: [PATCH] [UBER-387] Hide tags category if category is single (#3365) --- .../src/components/CreateTagElement.svelte | 28 ++++++++++--------- .../src/components/TagsPopup.svelte | 26 +++++++++++------ 2 files changed, 32 insertions(+), 22 deletions(-) diff --git a/plugins/tags-resources/src/components/CreateTagElement.svelte b/plugins/tags-resources/src/components/CreateTagElement.svelte index ed6a4ea3eb..ad178635fb 100644 --- a/plugins/tags-resources/src/components/CreateTagElement.svelte +++ b/plugins/tags-resources/src/components/CreateTagElement.svelte @@ -137,19 +137,21 @@ -
- { - categoryWasSet = true - }} - /> -
+ {#if categories.length > 1} +
+ { + categoryWasSet = true + }} + /> +
+ {/if}
diff --git a/plugins/tags-resources/src/components/TagsPopup.svelte b/plugins/tags-resources/src/components/TagsPopup.svelte index 0e266bce96..91c69cc762 100644 --- a/plugins/tags-resources/src/components/TagsPopup.svelte +++ b/plugins/tags-resources/src/components/TagsPopup.svelte @@ -51,6 +51,7 @@ let show: boolean = false let objects: TagElement[] = [] let categories: TagCategory[] = [] + let isSingleCategory = true const dispatch = createEventDispatcher() const query = createQuery() @@ -58,6 +59,7 @@ const client = getClient() client.findAll(tags.class.TagCategory, { targetClass }).then((res) => { categories = res + isSingleCategory = categories.length <= 1 }) // TODO: Add $not: {$in: []} query @@ -113,14 +115,16 @@ {placeholderParam} on:change /> -