2019-09-02 07:29:49 +00:00
|
|
|
<template>
|
2019-09-03 13:19:48 +00:00
|
|
|
<main v-if="loaded">
|
2019-09-02 07:29:49 +00:00
|
|
|
<router-view />
|
2019-09-02 16:02:40 +00:00
|
|
|
</main>
|
2019-09-03 13:19:48 +00:00
|
|
|
<main class="loading-box" v-else>
|
|
|
|
<h1 class="loading-message" v-if="loading">{{ loading }}</h1>
|
|
|
|
</main>
|
2019-09-02 07:29:49 +00:00
|
|
|
</template>
|
|
|
|
|
2019-09-03 13:19:48 +00:00
|
|
|
<style lang="scss" scoped>
|
2019-09-12 09:11:32 +00:00
|
|
|
main {
|
|
|
|
user-select: none;
|
|
|
|
}
|
|
|
|
|
2019-09-03 13:19:48 +00:00
|
|
|
main.loading-box {
|
|
|
|
height: 100vh;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
h1.loading-message {
|
|
|
|
flex: 1;
|
|
|
|
text-align: center;
|
|
|
|
}
|
2019-09-02 16:02:40 +00:00
|
|
|
</style>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { Component, Vue } from "vue-property-decorator";
|
2019-09-03 13:19:48 +00:00
|
|
|
import { Action, Getter } from "vuex-class";
|
2019-09-20 10:49:15 +00:00
|
|
|
import { AppState } from "@/store/types";
|
|
|
|
import { refreshCardSource, loadSets, getCards } from "@/mlpccg";
|
2019-09-02 16:02:40 +00:00
|
|
|
|
|
|
|
@Component({
|
2019-09-16 21:05:19 +00:00
|
|
|
components: {}
|
2019-09-02 16:02:40 +00:00
|
|
|
})
|
|
|
|
export default class App extends Vue {
|
2019-09-03 13:19:48 +00:00
|
|
|
@Action showLoading!: (msg: string) => void;
|
|
|
|
@Action hideLoading!: () => void;
|
|
|
|
@Action setLoaded!: (loaded: boolean) => void;
|
|
|
|
@Getter loaded!: boolean;
|
|
|
|
@Getter loading!: string | null;
|
|
|
|
|
2019-09-02 16:02:40 +00:00
|
|
|
private get isFullscreen(): boolean {
|
|
|
|
return this.$route.meta && this.$route.meta.fullscreen;
|
2019-09-02 07:29:49 +00:00
|
|
|
}
|
2019-09-03 13:19:48 +00:00
|
|
|
|
|
|
|
private mounted() {
|
|
|
|
// Load all sets
|
|
|
|
this.loadCards();
|
|
|
|
}
|
|
|
|
|
|
|
|
private async loadCards() {
|
|
|
|
this.showLoading("Downloading data for all sets");
|
|
|
|
await loadSets();
|
2019-09-20 10:49:15 +00:00
|
|
|
await refreshCardSource();
|
2019-09-03 13:19:48 +00:00
|
|
|
this.hideLoading();
|
|
|
|
this.setLoaded(true);
|
|
|
|
}
|
2019-09-02 07:29:49 +00:00
|
|
|
}
|
2019-09-02 16:02:40 +00:00
|
|
|
</script>
|