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

View File

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

View File

@@ -11,7 +11,18 @@ module.exports = {
}, },
manifestOptions: { manifestOptions: {
background_color: mainColor, 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: [ icons: [
{ {
src: './img/icons/android-chrome-192x192.png', src: './img/icons/android-chrome-192x192.png',