Create settings page and image cache #27
4 changed files with 88 additions and 31 deletions
|
@ -1,18 +1,36 @@
|
||||||
<template>
|
<template>
|
||||||
<nav>
|
<nav>
|
||||||
<router-link
|
<section class="pages">
|
||||||
:class="routeClass(route)"
|
<router-link
|
||||||
v-for="route in routes"
|
:class="routeClass(route)"
|
||||||
:key="route"
|
v-for="route in mainRoutes"
|
||||||
:to="{ name: route }"
|
:key="route"
|
||||||
>{{ prettyTitle(route) }}</router-link
|
:to="{ name: route }"
|
||||||
>
|
>{{ prettyTitle(route) }}</router-link
|
||||||
|
>
|
||||||
|
</section>
|
||||||
|
<section class="icons">
|
||||||
|
<router-link
|
||||||
|
:class="routeClass(route)"
|
||||||
|
v-for="route in iconRoutes"
|
||||||
|
:key="route"
|
||||||
|
:to="{ name: route }"
|
||||||
|
><b-icon
|
||||||
|
:icon="prettyTitle(route)"
|
||||||
|
class="route-icon"
|
||||||
|
custom-size="mdi-36px"
|
||||||
|
/></router-link>
|
||||||
|
</section>
|
||||||
</nav>
|
</nav>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@import "@/assets/scss/_variables.scss";
|
@import "@/assets/scss/_variables.scss";
|
||||||
|
|
||||||
|
.route-icon {
|
||||||
|
width: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
nav {
|
nav {
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -22,13 +40,23 @@ nav {
|
||||||
rgba(100, 180, 255, 0.1)
|
rgba(100, 180, 255, 0.1)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
.pages {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icons {
|
||||||
|
flex-grow: 0;
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
.entry {
|
.entry {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
height: 50px;
|
height: 50px;
|
||||||
max-width: 300px;
|
max-width: 250px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: $grey-lighter;
|
color: $grey-lighter;
|
||||||
|
|
||||||
|
@ -61,17 +89,20 @@ nav {
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Component, Vue } from "vue-property-decorator";
|
import { Component, Vue } from "vue-property-decorator";
|
||||||
|
|
||||||
const routes = ["lobby", "deck-editor"];
|
const mainRoutes = ["lobby", "deck-editor"];
|
||||||
|
const iconRoutes = ["settings"];
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
components: {}
|
components: {}
|
||||||
})
|
})
|
||||||
export default class TopNav extends Vue {
|
export default class TopNav extends Vue {
|
||||||
private routes!: string[];
|
private mainRoutes!: string[];
|
||||||
|
private iconRoutes!: string[];
|
||||||
|
|
||||||
private data() {
|
private data() {
|
||||||
return {
|
return {
|
||||||
routes
|
mainRoutes,
|
||||||
|
iconRoutes
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ import GameView from "@/views/Game.vue";
|
||||||
import DraftView from "@/views/Draft.vue";
|
import DraftView from "@/views/Draft.vue";
|
||||||
import Lobby from "@/views/Lobby.vue";
|
import Lobby from "@/views/Lobby.vue";
|
||||||
import RoomView from "@/views/Room.vue";
|
import RoomView from "@/views/Room.vue";
|
||||||
|
import SettingsView from "@/views/Settings.vue";
|
||||||
|
|
||||||
Vue.use(Router);
|
Vue.use(Router);
|
||||||
|
|
||||||
|
@ -48,6 +49,14 @@ export default new Router({
|
||||||
path: "/room",
|
path: "/room",
|
||||||
name: "room",
|
name: "room",
|
||||||
component: RoomView
|
component: RoomView
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/settings",
|
||||||
|
name: "settings",
|
||||||
|
component: SettingsView,
|
||||||
|
meta: {
|
||||||
|
topnav: "settings"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
|
@ -16,30 +16,11 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Component, Vue } from "vue-property-decorator";
|
import { Component, Vue } from "vue-property-decorator";
|
||||||
import TopNav from "@/components/Navigation/TopNav.vue";
|
import TopNav from "@/components/Navigation/TopNav.vue";
|
||||||
import { TaskRunner } from "@/workers";
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
components: {
|
components: {
|
||||||
TopNav
|
TopNav
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
export default class Lobby extends Vue {
|
export default class Lobby extends Vue {}
|
||||||
private mounted() {
|
|
||||||
const worker = new TaskRunner("downloadCardImages");
|
|
||||||
worker.on("dl-progress", progress => {
|
|
||||||
console.log(
|
|
||||||
`Download progress: ${progress.progress}/${
|
|
||||||
progress.total
|
|
||||||
}b (${Math.round((progress.progress * 100) / progress.total)}%)`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
worker.on("ex-progress", progress => {
|
|
||||||
console.log(
|
|
||||||
`Extraction progress: ${progress.progress}/${
|
|
||||||
progress.total
|
|
||||||
}b (${Math.round((progress.progress * 100) / progress.total)}%)`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
36
src/views/Settings.vue
Normal file
36
src/views/Settings.vue
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
<template>
|
||||||
|
<section class="settings">
|
||||||
|
<TopNav />
|
||||||
|
</section>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped></style>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import { Component, Vue } from "vue-property-decorator";
|
||||||
|
import TopNav from "@/components/Navigation/TopNav.vue";
|
||||||
|
import { TaskRunner } from "@/workers";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
components: { TopNav }
|
||||||
|
})
|
||||||
|
export default class SettingsView extends Vue {
|
||||||
|
private downloadSets() {
|
||||||
|
const worker = new TaskRunner("downloadCardImages");
|
||||||
|
worker.on("dl-progress", progress => {
|
||||||
|
console.log(
|
||||||
|
`Download progress: ${progress.progress}/${
|
||||||
|
progress.total
|
||||||
|
}b (${Math.round((progress.progress * 100) / progress.total)}%)`
|
||||||
|
);
|
||||||
|
});
|
||||||
|
worker.on("ex-progress", progress => {
|
||||||
|
console.log(
|
||||||
|
`Extraction progress: ${progress.progress}/${
|
||||||
|
progress.total
|
||||||
|
}b (${Math.round((progress.progress * 100) / progress.total)}%)`
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
Loading…
Reference in a new issue