Skip to content

Commit

Permalink
Merge pull request #190 from Ritika-Patel08/fixed-timezone-modal
Browse files Browse the repository at this point in the history
Implemented: Spinner in timezone modal so users can see that data is being fetched
  • Loading branch information
ravilodhi authored Feb 8, 2024
2 parents 0723a14 + bfdf8b0 commit 5940c08
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"Error getting preferred product store.": "Error getting preferred product store.",
"Error getting user profile.": "Error getting user profile.",
"Facility": "Facility",
"Fetching time zones": "Fetching time zones",
"Filters": "Filters",
"Go to OMS": "Go to OMS",
"Go to Launchpad": "Go to Launchpad",
Expand Down
19 changes: 18 additions & 1 deletion src/theme/variables.css
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,23 @@ img {
object-fit: contain;
}

.empty-state {
max-width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 10px;
}

.empty-state > img {
object-fit: contain;
}

.empty-state > p {
text-align: center;
}

@media (prefers-color-scheme: dark) {
ion-chip > ion-icon {
color: var(--ion-color-dark);
Expand All @@ -260,4 +277,4 @@ img {
ion-item {
--border-color: var(--ion-color-medium)
}
}
}
17 changes: 14 additions & 3 deletions src/views/TimezoneModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,14 @@

<ion-content class="ion-padding">
<!-- Empty state -->
<div class="empty-state" v-if="filteredTimeZones.length === 0">
<p>{{ $t("No time zone found")}}</p>
<div class="empty-state" v-if="isLoading">
<ion-item lines="none">
<ion-spinner color="secondary" name="crescent" slot="start" />
{{ $t("Fetching time zones") }}
</ion-item>
</div>
<div class="empty-state" v-else-if="filteredTimeZones.length === 0">
<p>{{ $t("No time zone found") }}</p>
</div>

<!-- Timezones -->
Expand Down Expand Up @@ -54,6 +60,7 @@ import {
IonRadioGroup,
IonRadio,
IonSearchbar,
IonSpinner,
IonTitle,
IonToolbar,
modalController,
Expand Down Expand Up @@ -81,6 +88,7 @@ export default defineComponent({
IonRadioGroup,
IonRadio,
IonSearchbar,
IonSpinner,
IonTitle,
IonToolbar
},
Expand All @@ -89,7 +97,8 @@ export default defineComponent({
queryString: '',
filteredTimeZones: [],
timeZones: [],
timeZoneId: ''
timeZoneId: '',
isLoading: false
}
},
methods: {
Expand Down Expand Up @@ -126,6 +135,7 @@ export default defineComponent({
});
},
async getAvailableTimeZones() {
this.isLoading = true;
const resp = await UserService.getAvailableTimeZones()
if(resp.status === 200 && !hasError(resp)) {
// We are filtering valid the timeZones coming with response here
Expand All @@ -134,6 +144,7 @@ export default defineComponent({
});
this.findTimeZone();
}
this.isLoading = false;
},
async selectSearchBarText(event: any) {
const element = await event.target.getInputElement()
Expand Down

0 comments on commit 5940c08

Please sign in to comment.