Skip to content

Commit

Permalink
hide annotation and tags if no pinned histories in multiview
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedhamidawan committed May 30, 2024
1 parent 7a73c83 commit e4bf56d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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>(), {
Expand Down
15 changes: 12 additions & 3 deletions client/src/components/History/Layout/DetailsLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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>(), {
Expand Down Expand Up @@ -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"
Expand All @@ -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" />
Expand Down Expand Up @@ -206,5 +212,8 @@ function selectText() {
.annotation {
min-height: 2rem;
}
.hidden {
display: none;
}
}
</style>
4 changes: 4 additions & 0 deletions client/src/stores/historyStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,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) {
Expand Down

0 comments on commit e4bf56d

Please sign in to comment.