forked from craws/OpenAtlas-Discovery
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: remove radix ui collapsible from entity sidebar and make filtere…
…dRelations reactive
- Loading branch information
1 parent
fe2e43c
commit d6b312a
Showing
2 changed files
with
50 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,18 @@ | ||
<script lang="ts" setup> | ||
import { ChevronDown, ChevronUp } from "lucide-vue-next"; | ||
defineProps<{ title: string; relations: Array<NonNullable<EntityFeature["relations"]>[0]> }>(); | ||
const isOpen = ref(false); | ||
</script> | ||
|
||
<template v-if="relations?.length"> | ||
<Collapsible v-model:open="isOpen" class="space-y-2"> | ||
<div class="space-x-4 px-4"></div> | ||
<div class="flex items-center justify-between"> | ||
<h4 class="text-sm font-semibold"> | ||
{{ title }} {{ relations.length > 1 ? `(${relations.length})` : "" }} | ||
</h4> | ||
<CollapsibleTrigger v-if="relations.length > 1" as-child> | ||
<Button variant="ghost" size="sm" class="w-9 p-0"> | ||
<ChevronUp v-if="isOpen" class="size-4" /> | ||
<ChevronDown v-else class="size-4" /> | ||
<span class="sr-only">Toggle</span> | ||
</Button> | ||
</CollapsibleTrigger> | ||
</div> | ||
<div class="space-x-4 px-4"></div> | ||
<div class="flex items-center justify-between"> | ||
<h4 class="text-sm font-semibold"> | ||
{{ title }} {{ relations.length > 1 ? `(${relations.length})` : "" }} | ||
</h4> | ||
</div> | ||
|
||
<RelationListEntry v-if="relations[0]" :relation="relations[0]" /> | ||
|
||
<RelationListEntry v-if="relations[0]" :relation="relations[0]" /> | ||
<CollapsibleContent v-if="relations.length > 1" class="space-y-3"> | ||
<template v-for="relation in relations.slice(1)" :key="getUnprefixedId(relation.relationTo)"> | ||
<RelationListEntry :relation="relation" /> | ||
</template> | ||
</CollapsibleContent> | ||
</Collapsible> | ||
<template v-for="relation in relations.slice(1)" :key="getUnprefixedId(relation.relationTo)"> | ||
<RelationListEntry :relation="relation" /> | ||
</template> | ||
</template> |