From 6d2ee60b4758ec75aeb83f77f1944e4565dedb50 Mon Sep 17 00:00:00 2001 From: Ahmed Awan Date: Tue, 13 Feb 2024 16:52:08 -0600 Subject: [PATCH] add separate `Histories` side panel (from multiview panel) --- .../components/ActivityBar/ActivityBar.vue | 6 +- .../components/History/HistoryScrollList.vue | 51 ++++++----- .../src/components/Panels/ActivityPanel.vue | 5 +- .../src/components/Panels/HistoriesPanel.vue | 89 +++++++++++++++++++ .../src/components/Panels/MultiviewPanel.vue | 59 ++++++------ .../components/Panels/NotificationsPanel.vue | 2 +- client/src/stores/activitySetup.ts | 2 +- 7 files changed, 158 insertions(+), 56 deletions(-) create mode 100644 client/src/components/Panels/HistoriesPanel.vue diff --git a/client/src/components/ActivityBar/ActivityBar.vue b/client/src/components/ActivityBar/ActivityBar.vue index 8785a550b972..17e00eb84e09 100644 --- a/client/src/components/ActivityBar/ActivityBar.vue +++ b/client/src/components/ActivityBar/ActivityBar.vue @@ -17,6 +17,7 @@ import NotificationItem from "./Items/NotificationItem.vue"; import UploadItem from "./Items/UploadItem.vue"; import ContextMenu from "@/components/Common/ContextMenu.vue"; import FlexPanel from "@/components/Panels/FlexPanel.vue"; +import HistoriesPanel from "@/components/Panels/HistoriesPanel.vue"; import MultiviewPanel from "@/components/Panels/MultiviewPanel.vue"; import NotificationsPanel from "@/components/Panels/NotificationsPanel.vue"; import ToolPanel from "@/components/Panels/ToolPanel.vue"; @@ -181,7 +182,7 @@ function toggleContextMenu(evt: MouseEvent) { :to="activity.to" @click="onToggleSidebar()" /> + + + diff --git a/client/src/components/History/HistoryScrollList.vue b/client/src/components/History/HistoryScrollList.vue index c8a6b5a82d5b..7e73c924556d 100644 --- a/client/src/components/History/HistoryScrollList.vue +++ b/client/src/components/History/HistoryScrollList.vue @@ -33,6 +33,7 @@ const props = defineProps({ additionalOptions: { type: Array as PropType, default: () => [] }, showModal: { type: Boolean, default: false }, inModal: { type: Boolean, default: false }, + inPanel: { type: Boolean, default: false }, filter: { type: String, default: "" }, loading: { type: Boolean, default: false }, }); @@ -124,9 +125,9 @@ const filtered: Ref = computed(() => { }); } return filteredHistories.sort((a, b) => { - if (!isMultiviewPanel.value && a.id == currentHistoryId.value) { + if (!props.inPanel && a.id == currentHistoryId.value) { return -1; - } else if (!isMultiviewPanel.value && b.id == currentHistoryId.value) { + } else if (!props.inPanel && b.id == currentHistoryId.value) { return 1; } else if (a.update_time < b.update_time) { return 1; @@ -137,11 +138,13 @@ const filtered: Ref = computed(() => { }); /** is this the selector list for Multiview that shows up in the left panel */ -const isMultiviewPanel = computed(() => !props.inModal && props.multiple); +const isMultiviewPanel = computed(() => props.inPanel && props.multiple); function isActiveItem(history: HistorySummary) { if (isMultiviewPanel.value) { return pinnedHistories.value.some((item: PinnedHistory) => item.id == history.id); + } else if (props.inPanel) { + return currentHistoryId.value === history.id; } else { return props.selectedHistories.some((item: PinnedHistory) => item.id == history.id); } @@ -155,6 +158,8 @@ function historyClicked(history: HistorySummary) { } else { openInMulti(history); } + } else if (props.inPanel) { + setCurrentHistory(history); } } @@ -182,6 +187,9 @@ function openInMulti(history: HistorySummary) { router.push("/histories/view_multiple"); historyStore.pinHistory(history.id); emit("update:show-modal", false); + if (props.inPanel && !isMultiviewPanel.value) { + useUserStore().toggleSideBar("multiview"); + } } /** Loads (paginates) for more histories @@ -198,7 +206,7 @@ async function loadMore(noScroll = false) {