(pwa) add shortcut

This commit is contained in:
2020-07-18 10:49:03 +02:00
parent 6cbde07c70
commit 2a3d39d3de
5 changed files with 28 additions and 7 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

@@ -1,14 +1,15 @@
import Vue from 'vue'
import VueRouter, { RouteConfig } from 'vue-router'
import Home from '../views/Home.vue'
import Home from '@/views/Home.vue'
Vue.use(VueRouter)
const routes: Array<RouteConfig> = [
const routes: RouteConfig[] = [
{
path: '/',
name: 'Home',
component: Home
component: Home,
props: (route) => ({ play: route.query.play })
}
]

View File

@@ -47,7 +47,7 @@
@play="start"
@pause="pause"
/>
<footer>
<footer v-if="false">
Made by
<a
href="https://github.com/jcalixte"
@@ -66,7 +66,7 @@
</template>
<script lang="ts">
import { defineComponent } from '@vue/composition-api'
import { defineComponent, onMounted } from '@vue/composition-api'
import { useTimer } from '@/hooks/useTimer'
import DevSession from '@/components/DevSession.vue'
import ZoneMusic from '@/components/ZoneMusic.vue'
@@ -79,7 +79,10 @@ export default defineComponent({
ZoneMusic,
IntervalInput
},
setup() {
props: {
play: { type: Boolean, default: false }
},
setup(props) {
const {
interval,
start,
@@ -95,6 +98,12 @@ export default defineComponent({
timeState.value === 'stopped' ? start() : pause()
}
onMounted(() => {
if (props.play) {
start()
}
})
return {
interval,
toggle,

View File

@@ -11,7 +11,18 @@ module.exports = {
},
manifestOptions: {
background_color: mainColor,
theme_color: mainColor,
shortcuts: [
{
name: 'Start a session',
short_name: 'Start session',
description: 'Start a pair programming session',
url: '/?play=true',
icons: [
{ src: '/img/shortcuts/play-192x192.png', sizes: '192x192' },
{ src: '/img/shortcuts/play-144x144.png', sizes: '144x144' }
]
}
],
icons: [
{
src: './img/icons/android-chrome-192x192.png',