Skip to content

Commit 5e5abf8

Browse files
authored
Fix Availability Page and Settings Page NoticeBar styles (#1402)
* Fix Availability NoticeBar styles * Fix Settings NoticeBar styles
1 parent 29cd5e1 commit 5e5abf8

File tree

2 files changed

+88
-35
lines changed

2 files changed

+88
-35
lines changed

frontend/src/views/AvailabilityView/index.vue

Lines changed: 47 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ import { inject, ref, useTemplateRef } from 'vue';
33
import { useI18n } from 'vue-i18n';
44
import { storeToRefs } from 'pinia';
55
import { callKey, dayjsKey } from '@/keys';
6-
import { LinkButton, NoticeBar, NoticeBarTypes, PrimaryButton } from '@thunderbirdops/services-ui';
6+
import { IconButton, LinkButton, NoticeBar, NoticeBarTypes, PrimaryButton } from '@thunderbirdops/services-ui';
7+
import { PhX } from '@phosphor-icons/vue';
78
import { createAvailabilityStore } from '@/stores/availability-store';
89
import { createScheduleStore } from '@/stores/schedule-store';
910
import { useUserStore } from '@/stores/user-store';
1011
import { deepClone } from '@/utils';
1112
import { Alert, Availability } from '@/models';
12-
import { DateFormatStrings, AlertSchemes } from '@/definitions';
13-
import AlertBox from '@/elements/AlertBox.vue';
13+
import { DateFormatStrings } from '@/definitions';
1414
1515
import AvailabilitySettings from './components/AvailabilitySettings/index.vue';
1616
import BookingPageDetails from './components/BookingPageDetails/index.vue';
@@ -110,7 +110,13 @@ async function onSaveChanges() {
110110
})
111111
}
112112
113+
function clearNotices() {
114+
validationError.value = null;
115+
saveSuccess.value = null;
116+
}
117+
113118
function onRevertChanges() {
119+
clearNotices();
114120
availabilityStore.revertChanges();
115121
}
116122
</script>
@@ -154,20 +160,41 @@ export default {
154160
</template>
155161
</notice-bar>
156162

157-
<alert-box
158-
class="alert-box"
159-
v-if="validationError"
160-
:alert="validationError"
161-
@close="validationError = null"
162-
/>
163+
<notice-bar
164+
v-else-if="validationError"
165+
:type="NoticeBarTypes.Critical"
166+
class="notice-bar"
167+
>
168+
{{ validationError.title }}
169+
170+
<template #cta>
171+
<icon-button
172+
@click="clearNotices"
173+
:title="t('label.close')"
174+
class="btn-close"
175+
>
176+
<ph-x />
177+
</icon-button>
178+
</template>
179+
</notice-bar>
163180

164-
<alert-box
165-
class="alert-box"
181+
<notice-bar
166182
v-else-if="saveSuccess"
167-
:alert="saveSuccess"
168-
:scheme="AlertSchemes.Success"
169-
@close="saveSuccess = null"
170-
/>
183+
:type="NoticeBarTypes.Success"
184+
class="notice-bar"
185+
>
186+
{{ saveSuccess.title }}
187+
188+
<template #cta>
189+
<icon-button
190+
@click="clearNotices"
191+
:title="t('label.close')"
192+
class="btn-close"
193+
>
194+
<ph-x />
195+
</icon-button>
196+
</template>
197+
</notice-bar>
171198

172199
<form ref="availability-form" @submit.prevent>
173200
<div class="page-content">
@@ -223,6 +250,11 @@ export default {
223250
position: sticky;
224251
top: 5rem;
225252
z-index: 50;
253+
254+
.btn-close {
255+
height: 2.375rem;
256+
width: 2.375rem;
257+
}
226258
}
227259
228260
.page-content {
@@ -232,10 +264,6 @@ export default {
232264
margin-block-end: 2rem;
233265
}
234266
235-
.alert-box {
236-
margin-block-end: 2rem;
237-
}
238-
239267
.page-content-right {
240268
display: grid;
241269
gap: 2rem;

frontend/src/views/SettingsView/index.vue

Lines changed: 41 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,16 @@ import {
55
import { useRoute, useRouter } from 'vue-router';
66
import { useI18n } from 'vue-i18n';
77
import { storeToRefs } from 'pinia';
8-
import { PrimaryButton, LinkButton } from '@thunderbirdops/services-ui';
8+
import { PrimaryButton, LinkButton, NoticeBar, NoticeBarTypes, IconButton } from '@thunderbirdops/services-ui';
99
import { enumToObject } from '@/utils';
1010
import { callKey } from '@/keys';
11-
import { SettingsSections, AlertSchemes, ColourSchemes } from '@/definitions';
11+
import { SettingsSections, ColourSchemes } from '@/definitions';
1212
import { Alert, SubscriberResponse } from '@/models';
13-
import AlertBox from '@/elements/AlertBox.vue';
1413
import { useUserStore } from '@/stores/user-store';
1514
import { useCalendarStore } from '@/stores/calendar-store';
1615
import { useScheduleStore } from '@/stores/schedule-store';
1716
import { createSettingsStore } from '@/stores/settings-store';
18-
import { PhCaretRight } from '@phosphor-icons/vue';
17+
import { PhCaretRight, PhX } from '@phosphor-icons/vue';
1918
2019
// Page sections
2120
import AccountSettings from './components/AccountSettings.vue';
@@ -196,7 +195,14 @@ async function onSaveChanges() {
196195
}
197196
}
198197
198+
function clearNotices() {
199+
validationError.value = null;
200+
saveSuccess.value = null;
201+
}
202+
199203
function onRevertChanges() {
204+
clearNotices();
205+
200206
settingsStore.revertChanges();
201207
}
202208
@@ -227,20 +233,39 @@ export default {
227233
<h2>{{ t('label.settings') }}</h2>
228234
</header>
229235

230-
<alert-box
231-
class="alert-box"
236+
<notice-bar
237+
class="notice-bar"
232238
v-if="validationError"
233-
:alert="validationError"
234-
@close="validationError = null"
235-
/>
239+
:type="NoticeBarTypes.Critical"
240+
>
241+
{{ validationError.title }}
242+
243+
<template #cta>
244+
<icon-button
245+
@click="clearNotices"
246+
:title="t('label.close')"
247+
>
248+
<ph-x />
249+
</icon-button>
250+
</template>
251+
</notice-bar>
236252

237-
<alert-box
238-
class="alert-box"
253+
<notice-bar
254+
class="notice-bar"
239255
v-else-if="saveSuccess"
240-
:alert="saveSuccess"
241-
:scheme="AlertSchemes.Success"
242-
@close="saveSuccess = null"
243-
/>
256+
:type="NoticeBarTypes.Success"
257+
>
258+
{{ saveSuccess.title }}
259+
260+
<template #cta>
261+
<icon-button
262+
@click="clearNotices"
263+
:title="t('label.close')"
264+
>
265+
<ph-x />
266+
</icon-button>
267+
</template>
268+
</notice-bar>
244269

245270
<div class="main-container">
246271
<!-- sidebar navigation -->
@@ -310,7 +335,7 @@ section {
310335
margin-block-end: 2rem;
311336
}
312337
313-
.alert-box {
338+
.notice-bar {
314339
margin-block-end: 2rem;
315340
}
316341

0 commit comments

Comments
 (0)