From f968cc8780410c8c3982d851445aa4fd802c0d9b Mon Sep 17 00:00:00 2001 From: Ahmed Awan Date: Mon, 15 Apr 2024 12:46:14 -0500 Subject: [PATCH] move help mode into side panel (primarily) Still toggleable into a draggable mode if needed --- .../components/ActivityBar/ActivityBar.vue | 14 ++++ .../HelpModeDraggable.vue} | 50 +++++---------- client/src/components/Help/HelpModeText.vue | 50 +++++++++++++++ .../components/Masthead/HelpModeSwitch.vue | 9 ++- client/src/components/Masthead/Masthead.vue | 4 +- .../src/components/Panels/HelpModePanel.vue | 64 +++++++++++++++++++ .../src/entry/analysis/modules/Analysis.vue | 6 +- client/src/stores/helpmode/helpModeStore.ts | 20 +++++- client/src/stores/helpmode/helpTextConfig.yml | 3 + 9 files changed, 174 insertions(+), 46 deletions(-) rename client/src/components/{Panels/HelpModeText.vue => Help/HelpModeDraggable.vue} (67%) create mode 100644 client/src/components/Help/HelpModeText.vue create mode 100644 client/src/components/Panels/HelpModePanel.vue diff --git a/client/src/components/ActivityBar/ActivityBar.vue b/client/src/components/ActivityBar/ActivityBar.vue index 9a440d5ddd27..bf65a3420e1f 100644 --- a/client/src/components/ActivityBar/ActivityBar.vue +++ b/client/src/components/ActivityBar/ActivityBar.vue @@ -9,6 +9,7 @@ import { useHashedUserId } from "@/composables/hashedUserId"; import { convertDropData } from "@/stores/activitySetup"; import { type Activity, useActivityStore } from "@/stores/activityStore"; import { useEventStore } from "@/stores/eventStore"; +import { useHelpModeStore } from "@/stores/helpmode/helpModeStore"; import { useUserStore } from "@/stores/userStore"; import VisualizationPanel from "../Panels/VisualizationPanel.vue"; @@ -17,6 +18,7 @@ import InteractiveItem from "./Items/InteractiveItem.vue"; import NotificationItem from "./Items/NotificationItem.vue"; import UploadItem from "./Items/UploadItem.vue"; import FlexPanel from "@/components/Panels/FlexPanel.vue"; +import HelpModePanel from "@/components/Panels/HelpModePanel.vue"; import MultiviewPanel from "@/components/Panels/MultiviewPanel.vue"; import NotificationsPanel from "@/components/Panels/NotificationsPanel.vue"; import SettingsPanel from "@/components/Panels/SettingsPanel.vue"; @@ -38,6 +40,9 @@ const emit = defineEmits(["dragstart"]); // activities from store const { activities } = storeToRefs(activityStore); +// Galaxy help mode draggable status +const { draggableActive } = storeToRefs(useHelpModeStore()); + // drag references const dragTarget: Ref = ref(null); const dragItem: Ref = ref(null); @@ -197,6 +202,14 @@ watch( + + diff --git a/client/src/components/Panels/HelpModeText.vue b/client/src/components/Help/HelpModeDraggable.vue similarity index 67% rename from client/src/components/Panels/HelpModeText.vue rename to client/src/components/Help/HelpModeDraggable.vue index 1a8067a2e002..c0fd7ece3f37 100644 --- a/client/src/components/Panels/HelpModeText.vue +++ b/client/src/components/Help/HelpModeDraggable.vue @@ -3,35 +3,27 @@ import { library } from "@fortawesome/fontawesome-svg-core"; import { faTimes, faUndo } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; import { useDraggable } from "@vueuse/core"; -import { BButton, BTab, BTabs } from "bootstrap-vue"; +import { BButton } from "bootstrap-vue"; import { storeToRefs } from "pinia"; import { reactive, ref, watch } from "vue"; -import { useMarkdown } from "@/composables/markdown"; import { useAnimationFrameSize } from "@/composables/sensors/animationFrameSize"; -import { DEFAULT_HELP_TEXT, useHelpModeStore } from "@/stores/helpmode/helpModeStore"; -import localize from "@/utils/localization"; +import { useHelpModeStore } from "@/stores/helpmode/helpModeStore"; +import { useUserStore } from "@/stores/userStore"; +import HelpModeText from "./HelpModeText.vue"; import Heading from "@/components/Common/Heading.vue"; -import LoadingSpan from "@/components/LoadingSpan.vue"; library.add(faTimes, faUndo); -const { renderMarkdown } = useMarkdown({ - openLinksInNewPage: true, - html: true, - appendHrRuleToDetails: true, - replaceCodeWithIcon: true, -}); +const userStore = useUserStore(); // local refs -const { status, position, helpModeStyle, activeTab, contents, loading, currentTabs } = storeToRefs(useHelpModeStore()); +const { draggableActive, position, helpModeStyle } = storeToRefs(useHelpModeStore()); const el = ref(null); const helpModeHeader = ref(null); const helpModeSize = reactive(useAnimationFrameSize(el)); -const noHelpTextMsg = localize("No help text available for this component"); - // draggable properties const { style } = useDraggable(helpModeHeader, { initialValue: position.value }); @@ -75,6 +67,15 @@ watch( } ); +/** Close the draggable help mode and toggle the sidebar */ +function closeDraggable() { + const panelActive = userStore.toggledSideBar !== ""; + draggableActive.value = false; + if (!panelActive) { + userStore.toggleSideBar("help"); + } +} + /** Reset the position of the help mode to default */ function resetPosition() { helpModeStyle.value = { @@ -93,22 +94,11 @@ function resetPosition() { - + - {{ DEFAULT_HELP_TEXT }} - - - - -
- - - +
@@ -137,10 +127,4 @@ function resetPosition() { border-bottom: 2px solid #868686; cursor: move; } -.help-mode-container { - margin-top: 0; - padding: 10px; - overflow-y: auto; - height: 100%; -} diff --git a/client/src/components/Help/HelpModeText.vue b/client/src/components/Help/HelpModeText.vue new file mode 100644 index 000000000000..bc2e46abe54a --- /dev/null +++ b/client/src/components/Help/HelpModeText.vue @@ -0,0 +1,50 @@ + + + + + diff --git a/client/src/components/Masthead/HelpModeSwitch.vue b/client/src/components/Masthead/HelpModeSwitch.vue index a1a7b7bbf0b4..aed71d8f3211 100644 --- a/client/src/components/Masthead/HelpModeSwitch.vue +++ b/client/src/components/Masthead/HelpModeSwitch.vue @@ -11,9 +11,9 @@ import localize from "@/utils/localization"; library.add(faQuestionCircle); const tooltip = localize("Enable/Disable Help Mode"); -const { status } = storeToRefs(useHelpModeStore()); +const { draggableActive } = storeToRefs(useHelpModeStore()); function toggleEnabledStatus() { - status.value = !status.value; + draggableActive.value = !draggableActive.value; } @@ -22,14 +22,13 @@ function toggleEnabledStatus() { - - + diff --git a/client/src/components/Masthead/Masthead.vue b/client/src/components/Masthead/Masthead.vue index a122410528be..04882a5ec394 100644 --- a/client/src/components/Masthead/Masthead.vue +++ b/client/src/components/Masthead/Masthead.vue @@ -139,9 +139,9 @@ onMounted(() => { :active-tab="activeTab" @open-url="emit('open-url', $event)" /> - + diff --git a/client/src/components/Panels/HelpModePanel.vue b/client/src/components/Panels/HelpModePanel.vue new file mode 100644 index 000000000000..5941e1471657 --- /dev/null +++ b/client/src/components/Panels/HelpModePanel.vue @@ -0,0 +1,64 @@ + + + + + diff --git a/client/src/entry/analysis/modules/Analysis.vue b/client/src/entry/analysis/modules/Analysis.vue index 39b789bdebeb..28a5ad2284c6 100644 --- a/client/src/entry/analysis/modules/Analysis.vue +++ b/client/src/entry/analysis/modules/Analysis.vue @@ -8,15 +8,15 @@ import { useHelpModeStore } from "@/stores/helpmode/helpModeStore"; import CenterFrame from "./CenterFrame.vue"; import ActivityBar from "@/components/ActivityBar/ActivityBar.vue"; +import HelpModeDraggable from "@/components/Help/HelpModeDraggable.vue"; import HistoryIndex from "@/components/History/Index.vue"; import FlexPanel from "@/components/Panels/FlexPanel.vue"; -import HelpModeText from "@/components/Panels/HelpModeText.vue"; import DragAndDropModal from "@/components/Upload/DragAndDropModal.vue"; const router = useRouter(); const showCenter = ref(false); const { showPanels } = usePanels(); -const { status: helpModeStatus } = storeToRefs(useHelpModeStore()); +const { draggableActive } = storeToRefs(useHelpModeStore()); // methods function hideCenter() { @@ -50,6 +50,6 @@ onUnmounted(() => { - + diff --git a/client/src/stores/helpmode/helpModeStore.ts b/client/src/stores/helpmode/helpModeStore.ts index e098d4215b8c..fab82558299f 100644 --- a/client/src/stores/helpmode/helpModeStore.ts +++ b/client/src/stores/helpmode/helpModeStore.ts @@ -3,11 +3,12 @@ */ import type { IconDefinition } from "@fortawesome/fontawesome-svg-core"; -import { defineStore } from "pinia"; -import { ref, watch } from "vue"; +import { defineStore, storeToRefs } from "pinia"; +import { computed, ref, watch } from "vue"; import { rethrowSimple } from "@/utils/simple-error"; +import { useUserStore } from "../userStore"; import config from "./helpTextConfig.yml"; interface HelpContent { @@ -28,7 +29,9 @@ export const useHelpModeStore = defineStore("helpModeStore", () => { // TODO: Maybe `status` should be tracked in local storage? // const status: Ref = useUserLocalStorage("help-mode-status", false); - const status = ref(false); + const { toggledSideBar } = storeToRefs(useUserStore()); + + const draggableActive = ref(false); const position = ref({ x: 0, y: 0 }); const helpModeStyle = ref({ width: "25%", @@ -43,6 +46,15 @@ export const useHelpModeStore = defineStore("helpModeStore", () => { /** The ids of the components for which help text was requested while help mode was disabled */ const idsToStore = ref([]); + const status = computed(() => toggledSideBar.value === "help" || draggableActive.value); + + // if side bar is toggled to help mode, if draggable is active, set it to false + watch(toggledSideBar, (newVal) => { + if (newVal === "help" && draggableActive.value) { + draggableActive.value = false; + } + }); + // when help mode is enabled, store help for the ids requested while help mode was disabled watch(status, async (newStatus) => { if (newStatus) { @@ -129,6 +141,8 @@ export const useHelpModeStore = defineStore("helpModeStore", () => { position, /** Whether help mode is active or not */ status, + /** Whether the draggble help mode is active or not */ + draggableActive, /** Removes the tab from the stack for the given component `id` */ clearHelpModeText, /** Adds help mode text for the given Galaxy component `id` if help mode is enabled */ diff --git a/client/src/stores/helpmode/helpTextConfig.yml b/client/src/stores/helpmode/helpTextConfig.yml index 32997b44f978..8b44bb141b4b 100644 --- a/client/src/stores/helpmode/helpTextConfig.yml +++ b/client/src/stores/helpmode/helpTextConfig.yml @@ -7,3 +7,6 @@ collection_builder: selector_modal_switch: title: History Selector file_path: histories/selector_modal_switch.md +selector_modal_multiview: + title: History Selector + file_path: histories/selector_modal_multiview.md