Skip to content

Commit abfc5ca

Browse files
use confirmDialog and GButton in SettingsPanel
1 parent 684aa49 commit abfc5ca

File tree

1 file changed

+23
-15
lines changed

1 file changed

+23
-15
lines changed
Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<script setup lang="ts">
22
import { faUndo } from "@fortawesome/free-solid-svg-icons";
33
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
4-
import { BButton, BModal } from "bootstrap-vue";
54
import { ref } from "vue";
65
6+
import { useConfirmDialog } from "@/composables/confirmDialog";
77
import { useActivityStore } from "@/stores/activityStore";
88
import localize from "@/utils/localization";
99
10+
import GButton from "../BaseComponents/GButton.vue";
1011
import ActivitySettings from "@/components/ActivityBar/ActivitySettings.vue";
1112
import DelayedInput from "@/components/Common/DelayedInput.vue";
1213
import ActivityPanel from "@/components/Panels/ActivityPanel.vue";
@@ -21,11 +22,25 @@ const emit = defineEmits<{
2122
(e: "activityClicked", activityId: string): void;
2223
}>();
2324
25+
const { confirm } = useConfirmDialog();
26+
2427
const activityStore = useActivityStore(props.activityBarId);
2528
26-
const confirmRestore = ref(false);
2729
const query = ref("");
2830
31+
async function confirmRestore() {
32+
const confirmed = await confirm(
33+
localize("Are you sure you want to reset the activity bar to its default settings?"),
34+
{
35+
title: localize("Restore Activity Bar Defaults"),
36+
},
37+
);
38+
39+
if (confirmed) {
40+
activityStore.restore();
41+
}
42+
}
43+
2944
function onQuery(newQuery: string) {
3045
query.value = newQuery;
3146
}
@@ -37,27 +52,20 @@ function onQuery(newQuery: string) {
3752
<DelayedInput :delay="100" :placeholder="props.searchPlaceholder" @change="onQuery" />
3853
</template>
3954
<template v-slot:header-buttons>
40-
<BButton
41-
v-b-tooltip.bottom.hover
55+
<GButton
4256
data-description="restore factory settings"
43-
size="sm"
44-
variant="link"
57+
size="small"
58+
transparent
59+
color="blue"
4560
:title="localize('Restore default')"
46-
@click="confirmRestore = true">
61+
@click="confirmRestore">
4762
<span v-localize>Reset</span>
4863
<FontAwesomeIcon :icon="faUndo" fixed-width />
49-
</BButton>
64+
</GButton>
5065
</template>
5166
<ActivitySettings
5267
:query="query"
5368
:activity-bar-id="props.activityBarId"
5469
@activityClicked="(...args) => emit('activityClicked', ...args)" />
55-
<BModal
56-
v-model="confirmRestore"
57-
:title="localize('Restore Activity Bar Defaults')"
58-
title-tag="h2"
59-
@ok="activityStore.restore()">
60-
<p v-localize>Are you sure you want to reset the activity bar to its default settings?</p>
61-
</BModal>
6270
</ActivityPanel>
6371
</template>

0 commit comments

Comments
 (0)