mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-23 22:12:44 +03:00
Fixes tag category bar to show available skills (#1636)
This commit is contained in:
parent
cc57821962
commit
88ccff9ed6
@ -41,15 +41,43 @@
|
||||
let categoryKeys: Ref<TagCategory>[] = []
|
||||
|
||||
const elementsQuery = createQuery()
|
||||
$: elementsQuery.query(
|
||||
tags.class.TagElement,
|
||||
{ targetClass },
|
||||
$: if ((tagElements?.size ?? 0) > 0) {
|
||||
elementsQuery.query(
|
||||
tags.class.TagElement,
|
||||
{ targetClass },
|
||||
(res) => {
|
||||
elements = res
|
||||
},
|
||||
{
|
||||
sort: {
|
||||
title: SortingOrder.Ascending
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
type TagElementInfo = { count: number; modifiedOn: number }
|
||||
let tagElements: Map<Ref<TagElement>, TagElementInfo> | undefined = undefined
|
||||
const refQuery = createQuery()
|
||||
$: refQuery.query(
|
||||
tags.class.TagReference,
|
||||
{},
|
||||
(res) => {
|
||||
elements = res
|
||||
const result = new Map<Ref<TagElement>, TagElementInfo>()
|
||||
|
||||
for (const d of res) {
|
||||
const v = result.get(d.tag) ?? { count: 0, modifiedOn: 0 }
|
||||
v.count++
|
||||
v.modifiedOn = Math.max(v.modifiedOn, d.modifiedOn)
|
||||
result.set(d.tag, v)
|
||||
}
|
||||
|
||||
tagElements = result
|
||||
},
|
||||
{
|
||||
sort: {
|
||||
title: SortingOrder.Ascending
|
||||
projection: {
|
||||
_id: 1,
|
||||
tag: 1
|
||||
}
|
||||
}
|
||||
)
|
||||
|
@ -128,7 +128,7 @@
|
||||
{#if elements.length > 0}
|
||||
<div class="sticky-wrapper">
|
||||
<div class="menu-group" style:overflow="visible">
|
||||
{#each elements as element}
|
||||
{#each elements.filter((it) => tagElements?.has(it._id)) as element}
|
||||
<button
|
||||
class="menu-item"
|
||||
on:click={() => {
|
||||
@ -183,13 +183,6 @@
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
// .counter {
|
||||
// padding-right: 0.125rem;
|
||||
// min-width: 1.5rem;
|
||||
// text-align: right;
|
||||
// font-size: 0.8125rem;
|
||||
// color: var(--caption-color);
|
||||
// }
|
||||
.empty {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
Loading…
Reference in New Issue
Block a user