Compare commits

..

No commits in common. "489d64414e93bd2c66f67aad063cebe7e9f9449b" and "835bc6d2d016cdd00c05c1f904da07b577ac84d0" have entirely different histories.

7 changed files with 18 additions and 56 deletions

View file

@ -1,15 +1,14 @@
# MUSS # MUSS
- api: admin Login case sensitivity (username "admin" == "AdMiN") - Nach einigen Sekunden: Meldung "Türchen anzeigen?"
- api: Config-Liste von Extra-Türchen (kein Buchstabe, nur manuelles Bild) - Extra-Türchen (kein Buchstabe, nur manuelles Bild)
- api: Config-Option "Überspringe leere Türchen" (standard ja) - Option "Überspringe leere Türchen" (standard ja)
# KANN # KANN
- api/ui: Türchen mit Tag "0" einem zufälligen Tag zuweisen - `alert` bzw. `confirm` durch bulma Komponente(n) ersetzen
- api/?: Option "custom Zuordnung Buchstaben" (standard leer) - Türchen mit Tag "0" einem zufälligen Tag zuweisen
- api: `config.solution` - whitespace="IGNORE"->"REMOVE" umbenennen, +Sonderzeichen - Option "custom Zuordnung Buchstaben" (standard leer)
- ui: `confirm` durch bulma Komponente(n) ersetzen
# Erledigt # Erledigt
@ -18,5 +17,3 @@
- Türchen sichtbar machen (besser für touch, standard nein) - Türchen sichtbar machen (besser für touch, standard nein)
- Option "Nur Groß-/Kleinbuchstaben" (standard nur groß) - Option "Nur Groß-/Kleinbuchstaben" (standard nur groß)
- Option "Leerzeichen ignorieren" (standard ja) - Option "Leerzeichen ignorieren" (standard ja)
- Nach einigen Sekunden: Meldung "Türchen anzeigen?"
- `alert` durch bulma Komponente(n) ersetzen

View file

@ -29,7 +29,7 @@
<figure> <figure>
<div class="image is-unselectable"> <div class="image is-unselectable">
<img :src="store.calendar_background_image" /> <img :src="$advent22.api_url('user/background_image')" />
<ThouCanvas> <ThouCanvas>
<CalendarDoor <CalendarDoor
v-for="(door, index) in doors" v-for="(door, index) in doors"
@ -85,13 +85,11 @@ export default class extends Vue {
if (this.store.is_touch_device) return; if (this.store.is_touch_device) return;
this.store.when_initialized(() => {
this.toast_timeout = setTimeout(() => { this.toast_timeout = setTimeout(() => {
if (this.store.user_doors.length === 0) return; if (this.store.user_doors.length === 0) return;
this.toast!.show({ duration: 600000, type: "is-warning" }); this.toast!.show({ duration: 600000, type: "is-warning" });
}, 10000); }, 10000);
});
} }
public door_click(day: number) { public door_click(day: number) {
@ -107,13 +105,9 @@ export default class extends Vue {
this.multi_modal!.show_image(image_src, this.$advent22.name_door(day)); this.multi_modal!.show_image(image_src, this.$advent22.name_door(day));
}) })
.catch((error) => { .catch((error) => {
this.$advent22.alert_user_error(error); alert(error);
this.multi_modal!.hide(); this.multi_modal!.hide();
}); });
} }
public beforeUnmount(): void {
this.toast?.hide();
}
} }
</script> </script>

View file

@ -73,7 +73,6 @@ import { DoorSaved } from "@/lib/api";
import { Door } from "@/lib/door"; import { Door } from "@/lib/door";
import { Options, Vue } from "vue-class-component"; import { Options, Vue } from "vue-class-component";
import { toast } from "bulma-toast";
import Calendar from "../Calendar.vue"; import Calendar from "../Calendar.vue";
import BulmaBreadcrumbs, { Step } from "../bulma/Breadcrumbs.vue"; import BulmaBreadcrumbs, { Step } from "../bulma/Breadcrumbs.vue";
import BulmaButton from "../bulma/Button.vue"; import BulmaButton from "../bulma/Button.vue";
@ -150,7 +149,7 @@ export default class extends Vue {
this.loading_doors = true; this.loading_doors = true;
this.load_doors() this.load_doors()
.then(() => toast({ message: "Erfolgreich!", type: "is-success" })) .then(() => alert("Erfolgreich!"))
.catch(() => {}) .catch(() => {})
.finally(() => (this.loading_doors = false)); .finally(() => (this.loading_doors = false));
} }
@ -170,7 +169,7 @@ export default class extends Vue {
this.save_doors() this.save_doors()
.then(() => { .then(() => {
this.load_doors() this.load_doors()
.then(() => toast({ message: "Erfolgreich!", type: "is-success" })) .then(() => alert("Erfolgreich!"))
.catch(() => {}) .catch(() => {})
.finally(() => (this.saving_doors = false)); .finally(() => (this.saving_doors = false));
}) })

View file

@ -11,7 +11,7 @@
</ul> </ul>
</div> </div>
<figure class="image is-unselectable"> <figure class="image is-unselectable">
<img :src="store.calendar_background_image" /> <img :src="$advent22.api_url('user/background_image')" />
<ThouCanvas> <ThouCanvas>
<PreviewDoor <PreviewDoor
v-for="(door, index) in doors" v-for="(door, index) in doors"
@ -25,7 +25,6 @@
<script lang="ts"> <script lang="ts">
import { Door } from "@/lib/door"; import { Door } from "@/lib/door";
import { advent22Store } from "@/plugins/store";
import { Options, Vue } from "vue-class-component"; import { Options, Vue } from "vue-class-component";
import ThouCanvas from "../calendar/ThouCanvas.vue"; import ThouCanvas from "../calendar/ThouCanvas.vue";
@ -42,6 +41,5 @@ import PreviewDoor from "./PreviewDoor.vue";
}) })
export default class extends Vue { export default class extends Vue {
public doors!: Door[]; public doors!: Door[];
public readonly store = advent22Store();
} }
</script> </script>

View file

@ -9,7 +9,7 @@
</ul> </ul>
</div> </div>
<figure class="image is-unselectable"> <figure class="image is-unselectable">
<img :src="store.calendar_background_image" /> <img :src="$advent22.api_url('user/background_image')" />
<DoorCanvas :doors="doors" /> <DoorCanvas :doors="doors" />
</figure> </figure>
</div> </div>
@ -17,7 +17,6 @@
<script lang="ts"> <script lang="ts">
import { Door } from "@/lib/door"; import { Door } from "@/lib/door";
import { advent22Store } from "@/plugins/store";
import { Options, Vue } from "vue-class-component"; import { Options, Vue } from "vue-class-component";
import DoorCanvas from "./DoorCanvas.vue"; import DoorCanvas from "./DoorCanvas.vue";
@ -32,6 +31,5 @@ import DoorCanvas from "./DoorCanvas.vue";
}) })
export default class extends Vue { export default class extends Vue {
public doors!: Door[]; public doors!: Door[];
public readonly store = advent22Store();
} }
</script> </script>

View file

@ -1,5 +1,4 @@
import axios, { AxiosError, AxiosInstance, ResponseType } from "axios"; import axios, { AxiosError, AxiosInstance, ResponseType } from "axios";
import { toast } from "bulma-toast";
import { App, Plugin } from "vue"; import { App, Plugin } from "vue";
import { advent22Store } from "./store"; import { advent22Store } from "./store";
@ -79,10 +78,7 @@ export class Advent22 {
} }
public alert_user_error(param: [unknown, string]): void { public alert_user_error(param: [unknown, string]): void {
toast({ alert(this.format_user_error(param));
message: this.format_user_error(param),
type: "is-danger",
});
} }
public api_url(): string; public api_url(): string;

View file

@ -14,12 +14,9 @@ declare global {
type State = { type State = {
advent22: Advent22; advent22: Advent22;
api_creds: RemovableRef<Credentials>; api_creds: RemovableRef<Credentials>;
is_initialized: boolean;
on_initialized: (() => void)[];
is_touch_device: boolean; is_touch_device: boolean;
is_admin: boolean; is_admin: boolean;
site_config: SiteConfigModel; site_config: SiteConfigModel;
calendar_background_image: string | undefined;
calendar_aspect_ratio: number; calendar_aspect_ratio: number;
user_doors: Door[]; user_doors: Door[];
next_door_target: number | null; next_door_target: number | null;
@ -31,8 +28,6 @@ export const advent22Store = defineStore({
state: (): State => ({ state: (): State => ({
advent22: new Advent22(), advent22: new Advent22(),
api_creds: useLocalStorage("advent22/auth", ["", ""]), api_creds: useLocalStorage("advent22/auth", ["", ""]),
is_initialized: false,
on_initialized: [],
is_touch_device: is_touch_device:
window.matchMedia("(any-hover: none)").matches || window.matchMedia("(any-hover: none)").matches ||
"ontouchstart" in window || "ontouchstart" in window ||
@ -45,7 +40,6 @@ export const advent22Store = defineStore({
content: "", content: "",
footer: "", footer: "",
}, },
calendar_background_image: undefined,
calendar_aspect_ratio: 1, calendar_aspect_ratio: 1,
user_doors: [], user_doors: [],
next_door_target: null, next_door_target: null,
@ -79,11 +73,10 @@ export const advent22Store = defineStore({
Promise.all([ Promise.all([
this.advent22.api_get<SiteConfigModel>("user/site_config"), this.advent22.api_get<SiteConfigModel>("user/site_config"),
this.advent22.api_get_blob("user/background_image"),
this.advent22.api_get<DoorSaved[]>("user/doors"), this.advent22.api_get<DoorSaved[]>("user/doors"),
this.advent22.api_get<number | null>("user/next_door"), this.advent22.api_get<number | null>("user/next_door"),
]) ])
.then(([site_config, background_image, user_doors, next_door]) => { .then(([site_config, user_doors, next_door]) => {
document.title = site_config.title; document.title = site_config.title;
if (site_config.subtitle !== "") if (site_config.subtitle !== "")
@ -91,8 +84,6 @@ export const advent22Store = defineStore({
this.site_config = site_config; this.site_config = site_config;
this.calendar_background_image = background_image;
this.user_doors.length = 0; this.user_doors.length = 0;
for (const door_saved of user_doors) { for (const door_saved of user_doors) {
this.user_doors.push(Door.load(door_saved)); this.user_doors.push(Door.load(door_saved));
@ -100,21 +91,10 @@ export const advent22Store = defineStore({
if (next_door !== null) if (next_door !== null)
this.next_door_target = Date.now() + next_door; this.next_door_target = Date.now() + next_door;
this.is_initialized = true;
for (const callback of this.on_initialized) callback();
}) })
.catch(this.advent22.alert_user_error); .catch(this.advent22.alert_user_error);
}, },
when_initialized(callback: () => void): void {
if (this.is_initialized) {
callback();
} else {
this.on_initialized.push(callback);
}
},
update_is_admin(): Promise<boolean> { update_is_admin(): Promise<boolean> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.advent22 this.advent22