mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-23 14:06:00 +03:00
[UBER-387] Hide tags category if category is single (#3365)
This commit is contained in:
parent
fd353b4ec4
commit
d798d872aa
@ -137,19 +137,21 @@
|
||||
</div>
|
||||
</div>
|
||||
<svelte:fragment slot="pool">
|
||||
<div class="ml-12">
|
||||
<DropdownLabels
|
||||
icon={IconFolder}
|
||||
label={tags.string.CategoryLabel}
|
||||
kind={'secondary'}
|
||||
size={'large'}
|
||||
bind:selected={category}
|
||||
items={categoryItems}
|
||||
on:selected={() => {
|
||||
categoryWasSet = true
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
{#if categories.length > 1}
|
||||
<div class="ml-12">
|
||||
<DropdownLabels
|
||||
icon={IconFolder}
|
||||
label={tags.string.CategoryLabel}
|
||||
kind={'secondary'}
|
||||
size={'large'}
|
||||
bind:selected={category}
|
||||
items={categoryItems}
|
||||
on:selected={() => {
|
||||
categoryWasSet = true
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
</svelte:fragment>
|
||||
</Card>
|
||||
|
||||
|
@ -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
|
||||
/>
|
||||
<Button
|
||||
kind={'transparent'}
|
||||
size={'large'}
|
||||
icon={show ? IconView : IconViewHide}
|
||||
on:click={() => {
|
||||
show = !show
|
||||
}}
|
||||
/>
|
||||
{#if !isSingleCategory}
|
||||
<Button
|
||||
kind={'transparent'}
|
||||
size={'large'}
|
||||
icon={show ? IconView : IconViewHide}
|
||||
on:click={() => {
|
||||
show = !show
|
||||
}}
|
||||
/>
|
||||
{/if}
|
||||
{#if !hideAdd}<Button kind={'transparent'} size={'large'} icon={IconAdd} on:click={createTagElement} />{/if}
|
||||
</div>
|
||||
<div class="scroll">
|
||||
@ -132,7 +136,8 @@
|
||||
<div class="sticky-wrapper">
|
||||
<button
|
||||
class="menu-group__header"
|
||||
class:show={categories.length === 1 || search !== '' || show}
|
||||
class:show={isSingleCategory || search !== '' || show}
|
||||
class:hidden={isSingleCategory}
|
||||
on:click={toggleGroup}
|
||||
>
|
||||
<div class="flex-row-center">
|
||||
@ -211,4 +216,7 @@
|
||||
font-size: 0.75rem;
|
||||
color: var(--theme-dark-color);
|
||||
}
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
|
Loading…
Reference in New Issue
Block a user