Skip to content

Commit da46daf

Browse files
committed
Refactors HistoryView UI with reusable components
Replaces button elements with reusable GButton for improved consistency. Introduces BreadcrumbHeading and HistoryOptions components to enhance navigation and history management.
1 parent 1af153c commit da46daf

File tree

1 file changed

+43
-19
lines changed

1 file changed

+43
-19
lines changed

client/src/components/History/HistoryView.vue

Lines changed: 43 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,30 @@
11
<template>
22
<div v-if="currentUser && history" class="d-flex flex-column h-100">
3-
<div class="flex-row flex-grow-0 pb-3">
4-
<b-button
5-
v-if="userOwnsHistory"
6-
size="sm"
7-
:title="setAsCurrentTitle"
8-
:disabled="isSetAsCurrentDisabled"
9-
data-description="switch to history button"
10-
@click="setCurrentHistory(history.id)">
11-
Switch to this history
12-
</b-button>
3+
<BreadcrumbHeading :items="breadcrumbItems">
4+
<div class="d-flex flex-gapx-1">
5+
<GButton
6+
v-if="userOwnsHistory"
7+
color="blue"
8+
:title="setAsCurrentTitle"
9+
:disabled="isSetAsCurrentDisabled"
10+
data-description="switch to history button"
11+
@click="setCurrentHistory(history.id)">
12+
Switch to this history
13+
</GButton>
1314

14-
<b-button
15-
v-if="canImportHistory"
16-
v-b-modal:copy-history-modal
17-
size="sm"
18-
title="Import this history"
19-
data-description="import history button">
20-
Import this history
21-
</b-button>
22-
</div>
15+
<GButton
16+
v-if="canImportHistory"
17+
v-b-modal:copy-history-modal
18+
color="blue"
19+
title="Import this history"
20+
data-description="import history button">
21+
<FontAwesomeIcon :icon="faFileImport" />
22+
Import this history
23+
</GButton>
24+
25+
<HistoryOptions :history="history" minimal />
26+
</div>
27+
</BreadcrumbHeading>
2328

2429
<b-alert :show="copySuccess">
2530
History imported and is now your active history. <b-link :to="importedHistoryLink">View here</b-link>.
@@ -38,6 +43,7 @@
3843
</template>
3944

4045
<script>
46+
import FontAwesomeIcon from "@fortawesome/vue-fontawesome";
4147
import { mapActions, mapState } from "pinia";
4248
4349
import { isAnonymousUser } from "@/api";
@@ -48,11 +54,19 @@ import CollectionPanel from "./CurrentCollection/CollectionPanel";
4854
import HistoryPanel from "./CurrentHistory/HistoryPanel";
4955
import CopyModal from "./Modals/CopyModal";
5056
57+
import GButton from "@/components/BaseComponents/GButton.vue";
58+
import BreadcrumbHeading from "@/components/Common/BreadcrumbHeading.vue";
59+
import HistoryOptions from "@/components/History/HistoryOptions.vue";
60+
5161
export default {
5262
components: {
5363
HistoryPanel,
5464
CollectionPanel,
5565
CopyModal,
66+
FontAwesomeIcon,
67+
GButton,
68+
BreadcrumbHeading,
69+
HistoryOptions,
5670
},
5771
props: {
5872
id: {
@@ -69,6 +83,16 @@ export default {
6983
computed: {
7084
...mapState(useUserStore, ["currentUser"]),
7185
...mapState(useHistoryStore, ["getHistoryById", "currentHistory"]),
86+
breadcrumbItems() {
87+
return [
88+
{ title: "Histories", to: "/histories/list" },
89+
{
90+
title: this.history.name,
91+
to: `/histories/view?id=${this.history.id}`,
92+
superText: this.isCurrentHistory ? "current" : undefined,
93+
},
94+
];
95+
},
7296
history() {
7397
return this.getHistoryById(this.id);
7498
},

0 commit comments

Comments
 (0)