hide annotation and tags if no pinned histories in multiview

This commit is contained in:
Ahmed Awan
2024-07-25 11:06:57 -05:00
parent c336828bb5
commit 7aadb71991
3 changed files with 17 additions and 4 deletions
@@ -11,7 +11,7 @@ import UtcDate from "@/components/UtcDate.vue";
interface Props {
history: HistorySummary;
writeable: boolean;
summarized?: "both" | "annotation" | "tags" | "none";
summarized?: "both" | "annotation" | "tags" | "none" | "hidden";
}
const props = withDefaults(defineProps<Props>(), {
@@ -20,7 +20,7 @@ interface Props {
writeable?: boolean;
annotation?: string;
showAnnotation?: boolean;
summarized?: "both" | "annotation" | "tags" | "none";
summarized?: "both" | "annotation" | "tags" | "none" | "hidden";
}
const props = withDefaults(defineProps<Props>(), {
@@ -125,7 +125,9 @@ function selectText() {
v-short="annotation"
class="mt-2"
data-description="annotation value" />
<div v-else-if="summarized" :class="{ annotation: ['both', 'annotation'].includes(summarized) }">
<div
v-else-if="summarized"
:class="{ annotation: ['both', 'annotation'].includes(summarized), hidden: summarized === 'hidden' }">
<TextSummary
v-if="annotation"
:description="annotation"
@@ -135,7 +137,11 @@ function selectText() {
</div>
<StatelessTags
v-if="tags"
:class="{ 'mt-2': !summarized, tags: ['both', 'tags'].includes(summarized) }"
:class="{
'mt-2': !summarized,
tags: ['both', 'tags'].includes(summarized),
hidden: summarized === 'hidden',
}"
:value="tags"
disabled
:max-visible-tags="summarized ? 1 : 5" />
@@ -206,5 +212,8 @@ function selectText() {
.annotation {
min-height: 2rem;
}
.hidden {
display: none;
}
}
</style>
+4
View File
@@ -102,6 +102,10 @@ export const useHistoryStore = defineStore("historyStore", () => {
let tags = false;
let loaded = true;
if (pinnedHistories.value.length === 0) {
return "hidden";
}
for (const h of pinnedHistories.value) {
const history = storedHistories.value[h.id];
if (!history) {