2019-09-02 07:29:49 +00:00
|
|
|
<template>
|
2019-09-03 13:19:48 +00:00
|
|
|
<main v-if="loaded">
|
2019-09-02 16:02:40 +00:00
|
|
|
<TopBar v-if="!isFullscreen" />
|
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>
|
|
|
|
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";
|
|
|
|
import TopBar from "@/components/Navigation/TopBar.vue";
|
|
|
|
import { loadSets } from "@/mlpccg/set";
|
|
|
|
import { AppState } from "./store/types";
|
2019-09-02 16:02:40 +00:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
components: {
|
|
|
|
TopBar
|
|
|
|
}
|
|
|
|
})
|
|
|
|
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();
|
|
|
|
this.hideLoading();
|
|
|
|
this.setLoaded(true);
|
|
|
|
}
|
2019-09-02 07:29:49 +00:00
|
|
|
}
|
2019-09-02 16:02:40 +00:00
|
|
|
</script>
|