app/src/App.vue

70 lines
1.3 KiB
Vue
Raw Normal View History

2021-04-19 15:28:52 +02:00
<template>
<div id="app">
2021-04-30 13:14:23 +02:00
<p class="error" v-if="wakeLockAvailable == false">Wake lock not available</p>
2021-05-01 10:29:28 +02:00
<Settings v-if="time == 0" v-on:set-time="setTime" v-on:set-playsound="setPlaySound"/>
<Timer v-if="time != 0" v-bind:time="time" v-bind:playsound="playsound"/>
2021-04-19 15:28:52 +02:00
</div>
</template>
<script>
2021-04-20 13:30:23 +02:00
import Settings from './components/Settings.vue'
2021-04-19 18:13:54 +02:00
import Timer from './components/Timer.vue'
2021-04-19 15:28:52 +02:00
export default {
name: 'App',
components: {
2021-04-20 13:30:23 +02:00
Timer,
Settings
},
data: function() {
return {
2021-04-30 13:14:23 +02:00
time: 0,
2021-05-01 10:29:28 +02:00
playsound: false,
2021-04-30 13:14:23 +02:00
wakeLockAvailable: this.hasWakeLock()
2021-04-20 13:30:23 +02:00
}
},
methods: {
setTime(number) {
this.time = number;
2021-04-30 13:14:23 +02:00
},
2021-05-01 10:29:28 +02:00
setPlaySound(state) {
this.playsound = state;
},
2021-04-30 13:14:23 +02:00
hasWakeLock() {
if ('wakeLock' in navigator) {
return true;
} else {
return false;
}
2021-04-20 13:30:23 +02:00
}
2021-04-19 15:28:52 +02:00
}
2021-04-20 13:30:23 +02:00
2021-04-19 15:28:52 +02:00
}
</script>
2021-04-30 13:14:23 +02:00
<style lang="scss">
2021-04-19 22:46:31 +02:00
html, body {
2021-05-01 10:29:28 +02:00
background-image: url("~@/img/background.png");
background-size: cover;
2021-04-19 22:46:31 +02:00
height: 100%;
2021-04-22 14:04:30 +02:00
margin: 0;
2021-04-19 22:46:31 +02:00
}
2021-04-19 15:28:52 +02:00
#app {
2021-04-19 22:46:31 +02:00
font-family: "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif;
2021-04-19 15:28:52 +02:00
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
2021-05-01 10:29:28 +02:00
color: $white;
2021-04-19 22:46:31 +02:00
height: 100%;
2021-04-19 15:28:52 +02:00
}
2021-04-30 13:14:23 +02:00
.error {
background: $light-red;
border: 1px solid $dark-red;
padding: 5px;
color: $dark-red;
margin: 5px;
}
2021-04-19 15:28:52 +02:00
</style>