Skip to content

Commit

Permalink
[24.0] History Multiview panel shows pinned histories on top
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedhamidawan committed May 3, 2024
1 parent dcf8207 commit bb24c23
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions client/src/components/History/HistoryScrollList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ const filtered = computed<HistorySummary[]>(() => {
return -1;
} else if (!isMultiviewPanel.value && b.id == currentHistoryId.value) {
return 1;
} else if (isMultiviewPanel.value && isPinned(a.id) && !isPinned(b.id)) {
return -1;
} else if (isMultiviewPanel.value && !isPinned(a.id) && isPinned(b.id)) {
return 1;
} else if (a.update_time < b.update_time) {
return 1;
} else {
Expand All @@ -161,16 +165,20 @@ const isMultiviewPanel = computed(() => !props.inModal && props.multiple);
function isActiveItem(history: HistorySummary) {
if (isMultiviewPanel.value) {
return pinnedHistories.value.some((item: PinnedHistory) => item.id == history.id);
return isPinned(history.id);
} else {
return props.selectedHistories.some((item: PinnedHistory) => item.id == history.id);
}
}
function isPinned(historyId: string) {
return pinnedHistories.value.some((item: PinnedHistory) => item.id == historyId);
}
function historyClicked(history: HistorySummary) {
emit("selectHistory", history);
if (isMultiviewPanel.value) {
if (pinnedHistories.value.some((item: PinnedHistory) => item.id == history.id)) {
if (isPinned(history.id)) {
historyStore.unpinHistories([history.id]);
} else {
openInMulti(history);
Expand Down Expand Up @@ -263,7 +271,7 @@ async function loadMore(noScroll = false) {
<i v-if="history.id === currentHistoryId">(Current)</i>
</Heading>
<i
v-if="props.multiple && pinnedHistories.some((h) => h.id === history.id)"
v-if="props.multiple && isPinned(history.id)"
v-b-tooltip.noninteractive.hover
title="This history is currently pinned in the multi-history view">
(currently pinned)
Expand Down

0 comments on commit bb24c23

Please sign in to comment.