From f9e475ed4b0040afdff632fe7cb4d585e6132ea7 Mon Sep 17 00:00:00 2001 From: Ahmed Awan Date: Wed, 29 May 2024 12:24:18 -0500 Subject: [PATCH] align multiview `HistoryPanel` details header based on content Adds a `pinnedHistoriesSummarizedStatus` computed ref to `historyStore` that Returns a string that indicates whether all the pinned histories have annotations, tags, both, or none of them. This is used to then adjust the `DetailsLayout` header height accordingly. --- .../History/CurrentHistory/HistoryDetails.vue | 4 +- .../History/CurrentHistory/HistoryPanel.vue | 8 +++- .../History/Layout/DetailsLayout.vue | 35 +++++++++++++----- client/src/stores/historyStore.ts | 37 +++++++++++++++++++ 4 files changed, 70 insertions(+), 14 deletions(-) diff --git a/client/src/components/History/CurrentHistory/HistoryDetails.vue b/client/src/components/History/CurrentHistory/HistoryDetails.vue index 52619647dd25..705fe6d960e5 100644 --- a/client/src/components/History/CurrentHistory/HistoryDetails.vue +++ b/client/src/components/History/CurrentHistory/HistoryDetails.vue @@ -11,12 +11,12 @@ import UtcDate from "@/components/UtcDate.vue"; interface Props { history: HistorySummary; writeable: boolean; - summarized: boolean; + summarized?: "both" | "annotation" | "tags" | "none"; } const props = withDefaults(defineProps(), { writeable: true, - summarized: false, + summarized: undefined, }); const historyStore = useHistoryStore(); diff --git a/client/src/components/History/CurrentHistory/HistoryPanel.vue b/client/src/components/History/CurrentHistory/HistoryPanel.vue index a8f5c02472d7..a28801ea2539 100644 --- a/client/src/components/History/CurrentHistory/HistoryPanel.vue +++ b/client/src/components/History/CurrentHistory/HistoryPanel.vue @@ -85,7 +85,7 @@ const contentItemRefs = computed(() => { const currItemFocused = useActiveElement(); const lastItemId = ref(null); -const { currentFilterText, currentHistoryId } = storeToRefs(useHistoryStore()); +const { currentFilterText, currentHistoryId, pinnedHistoriesSummarizedStatus } = storeToRefs(useHistoryStore()); const { lastCheckedTime, totalMatchesCount, isWatching } = storeToRefs(useHistoryItemsStore()); const historyStore = useHistoryStore(); @@ -136,6 +136,10 @@ const formattedSearchError = computed(() => { }; }); +const detailsSummarized = computed(() => { + return props.isMultiViewItem ? pinnedHistoriesSummarizedStatus.value : undefined; +}); + const storeFilterText = computed(() => { if (props.history.id !== currentHistoryId.value) { return ""; @@ -532,7 +536,7 @@ function setItemDragstart( diff --git a/client/src/components/History/Layout/DetailsLayout.vue b/client/src/components/History/Layout/DetailsLayout.vue index ef49938ca9f3..676002424bad 100644 --- a/client/src/components/History/Layout/DetailsLayout.vue +++ b/client/src/components/History/Layout/DetailsLayout.vue @@ -20,7 +20,7 @@ interface Props { writeable?: boolean; annotation?: string; showAnnotation?: boolean; - summarized?: boolean; + summarized?: "both" | "annotation" | "tags" | "none"; } const props = withDefaults(defineProps(), { @@ -29,7 +29,7 @@ const props = withDefaults(defineProps(), { writeable: true, annotation: undefined, showAnnotation: true, - summarized: false, + summarized: undefined, }); const emit = defineEmits(["save"]); @@ -47,6 +47,20 @@ const localProps = ref<{ name: string; annotation: string | null; tags: string[] tags: [], }); +const detailsClass = computed(() => { + const classes: Record = { + details: true, + "summarized-details": props.summarized && !editing.value, + "m-3": !props.summarized || editing.value, + }; + + if (props.summarized) { + classes[props.summarized] = true; + } + + return classes; +}); + const editButtonTitle = computed(() => { if (isAnonymous.value) { return l("Log in to Rename History"); @@ -90,10 +104,7 @@ function selectText() {