Skip to content

Commit

Permalink
Bugs/517 ftue qa (#532)
Browse files Browse the repository at this point in the history
* Don't overwrite app theme, just remove the dark class from html.

* * Require one weekday to be selected
* Adjust styling of notice bar
* Dynamically show warnings on notice bar
* Add missing chip
  • Loading branch information
MelissaAutumn authored Jul 10, 2024
1 parent f687f70 commit 1882e2d
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 8 deletions.
2 changes: 1 addition & 1 deletion backend/src/appointment/database/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class ScheduleBase(BaseModel):
end_time: time | None = None
earliest_booking: int | None = None
farthest_booking: int | None = None
weekdays: list[int] | None = [1, 2, 3, 4, 5]
weekdays: list[int] | None = Field(min_length=1, default=[1, 2, 3, 4, 5])
slot_duration: int | None = None
meeting_link_provider: MeetingLinkProviderType | None = MeetingLinkProviderType.none

Expand Down
1 change: 1 addition & 0 deletions frontend/src/assets/styles/colours.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ html {
--tbpro-primary-hover: #066769;
--tbpro-primary-pressed: #0A5757;

--tbpro-appointment-seconday: #81D4B5;
--tbpro-secondary: var(--surface-subtle);
--tbpro-secondary-border: var(--surface-border);
--tbpro-secondary-pressed: var(--neutral-500);
Expand Down
12 changes: 10 additions & 2 deletions frontend/src/components/FTUE/ConnectCalendars.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<script setup>
import { useI18n } from 'vue-i18n';
import {
onMounted, inject, ref, computed,
onMounted, inject, ref, computed, watch,
} from 'vue';
import SecondaryButton from '@/tbpro/elements/SecondaryButton.vue';
import { useFTUEStore } from '@/stores/ftue-store';
Expand All @@ -52,7 +52,7 @@ const isLoading = ref(false);
const ftueStore = useFTUEStore();
const {
hasNextStep, hasPreviousStep, infoMessage,
hasNextStep, hasPreviousStep, infoMessage, warningMessage,
} = storeToRefs(ftueStore);
const { previousStep, nextStep } = ftueStore;
Expand All @@ -62,6 +62,14 @@ const calendars = ref([]);
const selected = computed(() => calendars.value.filter((item) => item.checked).length);
const continueTitle = computed(() => (selected.value ? t('label.continue') : t('ftue.oneCalendarRequired')));
watch(selected, (val) => {
if (val === 0) {
warningMessage.value = t('ftue.oneCalendarRequired');
} else {
warningMessage.value = null;
}
});
onMounted(async () => {
isLoading.value = true;
Expand Down
16 changes: 16 additions & 0 deletions frontend/src/components/FTUE/ConnectVideo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<div class="content">
<div class="cards">
<div class="card zoom" @click="connectZoom">
<div class="chip">Recommended</div>
<img class="zoom-logo" src="@/assets/svg/zoom-logo.svg" :alt="t('heading.zoom')"/>
<p class="zoom-description">
{{ t('text.connectZoom') }}
Expand Down Expand Up @@ -144,6 +145,21 @@ const connectZoom = async () => {
}
}
.chip {
display: flex;
justify-content: center;
align-self: flex-end;
align-items: center;
width: 6.0625rem;
min-height: 1.0625rem;
font-size: 0.5625rem;
font-weight: 700;
color: var(--tbpro-text);
background-color: var(--tbpro-appointment-seconday);
border-radius: 0.1875rem;
text-transform: uppercase;
}
.zoom-logo {
margin: auto;
width: 8.25rem;
Expand Down
1 change: 0 additions & 1 deletion frontend/src/components/FTUE/SetupSchedule.vue
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ const isLoading = ref(false);
const onSubmit = async () => {
isLoading.value = true;
errorMessage.value = null;
if (!formRef.value.checkValidity()) {
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"unknownAppointmentError": "There was an issue creating your booking. Please try again.",
"unknownScheduleError": "There was an issue creating your schedule. Please try again.",
"usernameIsNotAvailable": "Username not available. Please choose another.",
"externalAccountHasNoCalendars": "Your {external} account contains no calendars. Please connect a different account."
"externalAccountHasNoCalendars": "Your {external} account contains no calendars. Please connect a different account.",
"selectOneDay": "You need to select at least one day to continue."
},
"fields": {
"slot_duration": "Slot Duration",
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/stores/ftue-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const useFTUEStore = defineStore('FTUE', () => {
const data = useLocalStorage('tba/ftue', structuredClone(initialObject));
const infoMessage = ref(null);
const errorMessage = ref(null);
const warningMessage = ref(null);

/**
* State information for navigating the First Time User Experience
Expand Down Expand Up @@ -74,6 +75,7 @@ export const useFTUEStore = defineStore('FTUE', () => {
const clearMessages = () => {
infoMessage.value = null;
errorMessage.value = null;
warningMessage.value = null;
};

const nextStep = async () => {
Expand All @@ -97,6 +99,6 @@ export const useFTUEStore = defineStore('FTUE', () => {
};

return {
data, ftueView, nextStep, previousStep, currentStep, hasNextStep, hasPreviousStep, stepTitle, $reset, infoMessage, errorMessage,
data, ftueView, nextStep, previousStep, currentStep, hasNextStep, hasPreviousStep, stepTitle, $reset, infoMessage, errorMessage, warningMessage,
};
});
2 changes: 2 additions & 0 deletions frontend/src/stores/schedule-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ export const useScheduleStore = defineStore('schedules', () => {
field: fieldLocalized,
value: valueLocalized,
});
} else if (err.type === 'too_short' && field === 'weekdays') {
message = i18n.t('error.selectOneDay');
}

return message;
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/tbpro/elements/NoticeBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ const isError = props.type === 'error';
}
.body {
margin: auto;
font-size: 0.8125rem;
font-weight: 700;
line-height: 1;
}
.notice {
position: relative;
Expand Down
7 changes: 5 additions & 2 deletions frontend/src/views/FirstTimeUserExperienceView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
<notice-bar type="error" v-if="errorMessage">
{{ errorMessage }}
</notice-bar>
<notice-bar type="warning" v-else-if="warningMessage">
{{ warningMessage }}
</notice-bar>
<notice-bar v-else-if="infoMessage">
{{ infoMessage }}
</notice-bar>
Expand Down Expand Up @@ -60,7 +63,7 @@ const router = useRouter();
const user = useUserStore();
const ftueStore = useFTUEStore();
const {
stepTitle, currentStep, infoMessage, errorMessage,
stepTitle, currentStep, infoMessage, errorMessage, warningMessage,
} = storeToRefs(ftueStore);
const { t } = useI18n();
Expand All @@ -73,7 +76,7 @@ onMounted(() => {
}
// Force light-mode
localStorage?.setItem('theme', 'light');
document.documentElement.classList.remove('dark');
});
</script>
Expand Down

0 comments on commit 1882e2d

Please sign in to comment.