Skip to content

Commit 98991d8

Browse files
Add an easy to access/obvious button to hide history panel
1 parent f23a469 commit 98991d8

4 files changed

Lines changed: 29 additions & 5 deletions

File tree

client/src/components/History/CurrentHistory/HistoryNavigation.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import { faExchangeAlt, faPlus, faSpinner } from "@fortawesome/free-solid-svg-icons";
2+
import { faChevronRight, faExchangeAlt, faPlus, faSpinner } from "@fortawesome/free-solid-svg-icons";
33
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
44
import { BButton, BButtonGroup } from "bootstrap-vue";
55
import { storeToRefs } from "pinia";
@@ -10,6 +10,7 @@ import { useHistoryStore } from "@/stores/historyStore";
1010
import { useUserStore } from "@/stores/userStore";
1111
import localize from "@/utils/localization";
1212
13+
import GButton from "@/components/BaseComponents/GButton.vue";
1314
import HistoryOptions from "@/components/History/HistoryOptions.vue";
1415
import SelectorModal from "@/components/History/Modals/SelectorModal.vue";
1516
@@ -22,6 +23,10 @@ const props = withDefaults(defineProps<Props>(), {
2223
minimal: false,
2324
});
2425
26+
const emit = defineEmits<{
27+
(e: "show", showPanel: boolean): void;
28+
}>();
29+
2530
const historyStore = useHistoryStore();
2631
const { histories, changingCurrentHistory } = storeToRefs(historyStore);
2732
@@ -45,7 +50,10 @@ function userTitle(title: string) {
4550
<nav
4651
:class="{ 'd-flex justify-content-between mx-3 my-2': !props.minimal }"
4752
aria-label="current history management">
48-
<h2 v-if="!props.minimal" class="m-1 h-sm">History</h2>
53+
<GButton v-if="!props.minimal" size="small" transparent @click="emit('show', false)">
54+
<FontAwesomeIcon fixed-width :icon="faChevronRight" />
55+
<span>History</span>
56+
</GButton>
4957

5058
<BButtonGroup>
5159
<BButton

client/src/components/History/Index.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ import CurrentCollection from "@/components/History/CurrentCollection/Collection
1010
import HistoryNavigation from "@/components/History/CurrentHistory/HistoryNavigation.vue";
1111
import HistoryPanel from "@/components/History/CurrentHistory/HistoryPanel.vue";
1212
13+
const emit = defineEmits<{
14+
(e: "show", showPanel: boolean): void;
15+
}>();
16+
1317
const userStore = useUserStore();
1418
const historyStore = useHistoryStore();
1519
@@ -37,7 +41,7 @@ function onViewCollection(collection: CollectionEntry, currentOffset?: number) {
3741
:filterable="true"
3842
@view-collection="onViewCollection">
3943
<template v-slot:navigation>
40-
<HistoryNavigation :history="currentHistory" />
44+
<HistoryNavigation :history="currentHistory" @show="(val) => emit('show', val)" />
4145
</template>
4246
</HistoryPanel>
4347

client/src/components/Panels/FlexPanel.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ const sideClasses = computed(() => ({
8383
left: props.side === "left",
8484
right: props.side === "right",
8585
}));
86+
87+
defineExpose({
88+
show,
89+
});
8690
</script>
8791

8892
<template>

client/src/entry/analysis/modules/Analysis.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,21 @@ const router = useRouter();
1616
const showCenter = ref(false);
1717
const { showPanels } = usePanels();
1818
19+
const historyPanel = ref(null);
20+
1921
const { historyPanelWidth } = storeToRefs(useUserStore());
2022
2123
// methods
2224
function hideCenter() {
2325
showCenter.value = false;
2426
}
2527
28+
function onShow(showPanel) {
29+
if (historyPanel.value) {
30+
historyPanel.value.show = showPanel;
31+
}
32+
}
33+
2634
function onLoad() {
2735
showCenter.value = true;
2836
}
@@ -48,8 +56,8 @@ onUnmounted(() => {
4856
<router-view :key="$route.fullPath" class="h-100" />
4957
</div>
5058
</div>
51-
<FlexPanel v-if="showPanels" side="right" :reactive-width.sync="historyPanelWidth">
52-
<HistoryIndex />
59+
<FlexPanel v-if="showPanels" ref="historyPanel" side="right" :reactive-width.sync="historyPanelWidth">
60+
<HistoryIndex @show="onShow" />
5361
</FlexPanel>
5462
<DragAndDropModal />
5563
</div>

0 commit comments

Comments
 (0)