mirror of
https://code.lenaisten.de/Lenaisten/advent22.git
synced 2024-11-23 00:03:07 +00:00
ConfigView luxon date formatting
This commit is contained in:
parent
f7dc74d508
commit
77cb0c1da2
1 changed files with 24 additions and 16 deletions
|
@ -21,16 +21,16 @@
|
||||||
<dd v-else><CountDown :millis="next_door" /></dd>
|
<dd v-else><CountDown :millis="next_door" /></dd>
|
||||||
|
|
||||||
<dt>Erstes Türchen</dt>
|
<dt>Erstes Türchen</dt>
|
||||||
<dd>{{ config_model.puzzle.first }}</dd>
|
<dd>{{ fmt_puzzle_date("first") }}</dd>
|
||||||
|
|
||||||
<dt>Nächstes Türchen</dt>
|
<dt>Nächstes Türchen</dt>
|
||||||
<dd>{{ config_model.puzzle.next }}</dd>
|
<dd>{{ fmt_puzzle_date("next") }}</dd>
|
||||||
|
|
||||||
<dt>Letztes Türchen</dt>
|
<dt>Letztes Türchen</dt>
|
||||||
<dd>{{ config_model.puzzle.last }}</dd>
|
<dd>{{ fmt_puzzle_date("last") }}</dd>
|
||||||
|
|
||||||
<dt>Rätsel schließt nach</dt>
|
<dt>Rätsel schließt nach</dt>
|
||||||
<dd>{{ config_model.puzzle.end }}</dd>
|
<dd>{{ fmt_puzzle_date("end") }}</dd>
|
||||||
|
|
||||||
<dt>Zufalls-Seed</dt>
|
<dt>Zufalls-Seed</dt>
|
||||||
<dd class="is-family-monospace">
|
<dd class="is-family-monospace">
|
||||||
|
@ -125,6 +125,7 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { ConfigModel, DayStrModel, DoorsSaved } from "@/lib/api";
|
import { ConfigModel, DayStrModel, DoorsSaved } from "@/lib/api";
|
||||||
|
import { DateTime } from "luxon";
|
||||||
import { Options, Vue } from "vue-class-component";
|
import { Options, Vue } from "vue-class-component";
|
||||||
|
|
||||||
import BulmaDrawer from "../bulma/Drawer.vue";
|
import BulmaDrawer from "../bulma/Drawer.vue";
|
||||||
|
@ -146,26 +147,26 @@ interface Credentials {
|
||||||
export default class extends Vue {
|
export default class extends Vue {
|
||||||
public config_model: ConfigModel = {
|
public config_model: ConfigModel = {
|
||||||
puzzle: {
|
puzzle: {
|
||||||
solution: "ABCDEFGHIJKLMNOPQRSTUVWX",
|
solution: "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
||||||
first: "01.12.2023",
|
first: "2023-12-01",
|
||||||
next: "01.12.2023",
|
next: "2023-12-01",
|
||||||
last: "24.12.2023",
|
last: "2023-12-24",
|
||||||
end: "01.04.2024",
|
end: "2024-04-01",
|
||||||
seed: "",
|
seed: "",
|
||||||
},
|
},
|
||||||
calendar: {
|
calendar: {
|
||||||
config_file: "default.toml",
|
config_file: "lorem ipsum",
|
||||||
background: "adventskalender.jpg",
|
background: "dolor sit amet",
|
||||||
},
|
},
|
||||||
image: {
|
image: {
|
||||||
size: 500,
|
size: 500,
|
||||||
border: 30,
|
border: 0,
|
||||||
fonts: [{ file: "files/Lena.ttf", size: 50 }],
|
fonts: [{ file: "consetetur", size: 0 }],
|
||||||
},
|
},
|
||||||
webdav: {
|
webdav: {
|
||||||
url: "https://example.com/remote.php/webdav/advent22",
|
url: "sadipscing elitr",
|
||||||
cache_ttl: 30,
|
cache_ttl: 0,
|
||||||
config_file: "config.toml",
|
config_file: "sed diam nonumy",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
public day_parts: DayStrModel[] = [];
|
public day_parts: DayStrModel[] = [];
|
||||||
|
@ -174,6 +175,13 @@ export default class extends Vue {
|
||||||
public dav_credentials: Credentials = { username: "", password: "" };
|
public dav_credentials: Credentials = { username: "", password: "" };
|
||||||
public ui_credentials: Credentials = { username: "", password: "" };
|
public ui_credentials: Credentials = { username: "", password: "" };
|
||||||
|
|
||||||
|
public fmt_puzzle_date(name: keyof ConfigModel["puzzle"]): string {
|
||||||
|
const iso_date = this.config_model.puzzle[name];
|
||||||
|
if (iso_date === null) return "-";
|
||||||
|
|
||||||
|
return DateTime.fromISO(iso_date).toLocaleString(DateTime.DATE_SHORT);
|
||||||
|
}
|
||||||
|
|
||||||
public on_open(ready: () => void, fail: () => void): void {
|
public on_open(ready: () => void, fail: () => void): void {
|
||||||
Promise.all([
|
Promise.all([
|
||||||
this.$advent22.api_get<ConfigModel>("admin/config_model"),
|
this.$advent22.api_get<ConfigModel>("admin/config_model"),
|
||||||
|
|
Loading…
Reference in a new issue