🚸 Show infocard on loading failure
This commit is contained in:
@ -1,10 +1,10 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { history } from "../store";
|
import { history, loadingFailed } from "../store";
|
||||||
import { getSubstitutionText } from "../util";
|
import { getSubstitutionText } from "../util";
|
||||||
import { computed } from "vue";
|
import { computed } from "vue";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import InfoCard from "./info-card.vue";
|
import InfoCard from "./info-card.vue";
|
||||||
import { ClockIcon, AlarmClockOffIcon } from "lucide-vue-next";
|
import { ClockIcon, AlarmClockOffIcon, CloudOffIcon } from "lucide-vue-next";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
date: {
|
date: {
|
||||||
@ -26,16 +26,25 @@ const chars = {
|
|||||||
<template>
|
<template>
|
||||||
<InfoCard
|
<InfoCard
|
||||||
v-show="typeof historyOfDate == 'undefined'"
|
v-show="typeof historyOfDate == 'undefined'"
|
||||||
|
v-if="!loadingFailed"
|
||||||
:icon="ClockIcon"
|
:icon="ClockIcon"
|
||||||
:title="$t('infoCard.titles.loading')"
|
:title="$t('infoCard.titles.loading')"
|
||||||
:text="$t('infoCard.texts.loading')"
|
:text="$t('infoCard.texts.loading')"
|
||||||
/>
|
/>
|
||||||
<InfoCard
|
<InfoCard
|
||||||
v-show="typeof historyOfDate == 'object' && historyOfDate.length == 0"
|
v-show="typeof historyOfDate == 'object' && historyOfDate.length == 0"
|
||||||
|
v-if="!loadingFailed || historyOfDate"
|
||||||
:icon="AlarmClockOffIcon"
|
:icon="AlarmClockOffIcon"
|
||||||
:title="$t('infoCard.titles.noHistory')"
|
:title="$t('infoCard.titles.noHistory')"
|
||||||
:text="$t('infoCard.texts.noHistory')"
|
:text="$t('infoCard.texts.noHistory')"
|
||||||
/>
|
/>
|
||||||
|
<InfoCard
|
||||||
|
class="card"
|
||||||
|
v-if="loadingFailed && !historyOfDate"
|
||||||
|
:icon="CloudOffIcon"
|
||||||
|
:title="$t('infoCard.titles.loadingFailed')"
|
||||||
|
:text="$t('infoCard.texts.loadingFailed')"
|
||||||
|
/>
|
||||||
<template v-for="event in historyOfDate" :key="event">
|
<template v-for="event in historyOfDate" :key="event">
|
||||||
<div
|
<div
|
||||||
class="change"
|
class="change"
|
||||||
|
@ -37,6 +37,7 @@ defineProps({
|
|||||||
height: 50vh;
|
height: 50vh;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
@ -45,7 +46,7 @@ defineProps({
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
gap: 3px;
|
gap: 3px;
|
||||||
max-width: 400px;
|
max-width: 350px;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
height: inherit;
|
height: inherit;
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { substitutions } from "../store";
|
import { substitutions, loadingFailed } from "../store";
|
||||||
import { getSubstitutionText, getSubstitutionColor } from "../util";
|
import { getSubstitutionText, getSubstitutionColor } from "../util";
|
||||||
import { computed } from "vue";
|
import { computed } from "vue";
|
||||||
import InfoCard from "./info-card.vue";
|
import InfoCard from "./info-card.vue";
|
||||||
import { BellOffIcon, ClockIcon } from "lucide-vue-next";
|
import { BellOffIcon, ClockIcon, CloudOffIcon } from "lucide-vue-next";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
date: {
|
date: {
|
||||||
@ -19,6 +19,7 @@ const substitutionsForDate = computed(() => {
|
|||||||
<template>
|
<template>
|
||||||
<InfoCard
|
<InfoCard
|
||||||
v-show="typeof substitutionsForDate == 'undefined'"
|
v-show="typeof substitutionsForDate == 'undefined'"
|
||||||
|
v-if="!loadingFailed"
|
||||||
:icon="ClockIcon"
|
:icon="ClockIcon"
|
||||||
:title="$t('infoCard.titles.loading')"
|
:title="$t('infoCard.titles.loading')"
|
||||||
:text="$t('infoCard.texts.loading')"
|
:text="$t('infoCard.texts.loading')"
|
||||||
@ -28,10 +29,18 @@ const substitutionsForDate = computed(() => {
|
|||||||
typeof substitutionsForDate == 'object' &&
|
typeof substitutionsForDate == 'object' &&
|
||||||
substitutionsForDate.length == 0
|
substitutionsForDate.length == 0
|
||||||
"
|
"
|
||||||
|
v-if="!loadingFailed || substitutionsForDate"
|
||||||
:icon="BellOffIcon"
|
:icon="BellOffIcon"
|
||||||
:title="$t('infoCard.titles.noEntries')"
|
:title="$t('infoCard.titles.noEntries')"
|
||||||
:text="$t('infoCard.texts.noEntries')"
|
:text="$t('infoCard.texts.noEntries')"
|
||||||
/>
|
/>
|
||||||
|
<InfoCard
|
||||||
|
class="card"
|
||||||
|
v-if="loadingFailed && !substitutionsForDate"
|
||||||
|
:icon="CloudOffIcon"
|
||||||
|
:title="$t('infoCard.titles.loadingFailed')"
|
||||||
|
:text="$t('infoCard.texts.loadingFailed')"
|
||||||
|
/>
|
||||||
<template v-for="substitution in substitutionsForDate" :key="substitution">
|
<template v-for="substitution in substitutionsForDate" :key="substitution">
|
||||||
<div class="substitution" :style="getSubstitutionColor(substitution)">
|
<div class="substitution" :style="getSubstitutionColor(substitution)">
|
||||||
<span class="hour">{{ substitution.lesson }}</span>
|
<span class="hour">{{ substitution.lesson }}</span>
|
||||||
|
@ -80,12 +80,15 @@ export const strings = {
|
|||||||
infoCard: {
|
infoCard: {
|
||||||
titles: {
|
titles: {
|
||||||
loading: "Loading data",
|
loading: "Loading data",
|
||||||
|
loadingFailed: "Loading failed",
|
||||||
noEntries: "No Substitutions",
|
noEntries: "No Substitutions",
|
||||||
noHistory: "No History",
|
noHistory: "No History",
|
||||||
},
|
},
|
||||||
texts: {
|
texts: {
|
||||||
loading: "The data for this day is still being loaded",
|
loading: "The data for this day is still being loaded",
|
||||||
loadingTimetable: "The timetable is still being loaded",
|
loadingTimetable: "The timetable is still being loaded",
|
||||||
|
loadingFailed:
|
||||||
|
"The data could not be loaded. Plase check your internet connection!",
|
||||||
noEntries: "There are no substitutions for this day yet",
|
noEntries: "There are no substitutions for this day yet",
|
||||||
noHistory: "No substitutions for this day have changed yet",
|
noHistory: "No substitutions for this day have changed yet",
|
||||||
},
|
},
|
||||||
@ -175,12 +178,15 @@ export const strings = {
|
|||||||
infoCard: {
|
infoCard: {
|
||||||
titles: {
|
titles: {
|
||||||
loading: "Läd noch",
|
loading: "Läd noch",
|
||||||
|
loadingFailed: "Fehler",
|
||||||
noEntries: "Keine Vertretungen",
|
noEntries: "Keine Vertretungen",
|
||||||
noHistory: "Noch keine Änderungen",
|
noHistory: "Noch keine Änderungen",
|
||||||
},
|
},
|
||||||
texts: {
|
texts: {
|
||||||
loading: "Die Daten für diesen Tag laden noch",
|
loading: "Die Daten für diesen Tag laden noch",
|
||||||
loadingTimetable: "Der Stundenplan wird noch geladen",
|
loadingTimetable: "Der Stundenplan wird noch geladen",
|
||||||
|
loadingFailed:
|
||||||
|
"Die Daten konnten nicht geladen werden. Bitte überprüfe deine Internetverbindung!",
|
||||||
noEntries: "Es gibt noch keine Vertretungen für diesen Tag",
|
noEntries: "Es gibt noch keine Vertretungen für diesen Tag",
|
||||||
noHistory:
|
noHistory:
|
||||||
"An den Vertretungen für diesen Tag wurde noch nichts geändert",
|
"An den Vertretungen für diesen Tag wurde noch nichts geändert",
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import TimetableSetup from "../components/timetable-setup.vue";
|
import TimetableSetup from "../components/timetable-setup.vue";
|
||||||
import { classList, classFilter, timetable } from "../store";
|
import { classList, classFilter, timetable, loadingFailed } from "../store";
|
||||||
import DayCarousel from "../components/day-carousel.vue";
|
import DayCarousel from "../components/day-carousel.vue";
|
||||||
import TimetableList from "../components/timetable-list.vue";
|
import TimetableList from "../components/timetable-list.vue";
|
||||||
import InfoCard from "../components/info-card.vue";
|
import InfoCard from "../components/info-card.vue";
|
||||||
import { ClockIcon } from "lucide-vue-next";
|
import { ClockIcon } from "lucide-vue-next";
|
||||||
|
import { CloudOffIcon } from "lucide-vue-next";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -19,10 +20,18 @@ import { ClockIcon } from "lucide-vue-next";
|
|||||||
>
|
>
|
||||||
<InfoCard
|
<InfoCard
|
||||||
class="card"
|
class="card"
|
||||||
|
v-if="!loadingFailed"
|
||||||
:icon="ClockIcon"
|
:icon="ClockIcon"
|
||||||
:title="$t('infoCard.titles.loading')"
|
:title="$t('infoCard.titles.loading')"
|
||||||
:text="$t('infoCard.texts.loadingTimetable')"
|
:text="$t('infoCard.texts.loadingTimetable')"
|
||||||
/>
|
/>
|
||||||
|
<InfoCard
|
||||||
|
class="card"
|
||||||
|
v-else
|
||||||
|
:icon="CloudOffIcon"
|
||||||
|
:title="$t('infoCard.titles.loadingFailed')"
|
||||||
|
:text="$t('infoCard.texts.loadingFailed')"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<DayCarousel v-show="classFilter != 'none'" :element="TimetableList" />
|
<DayCarousel v-show="classFilter != 'none'" :element="TimetableList" />
|
||||||
</template>
|
</template>
|
||||||
|
Reference in New Issue
Block a user