PWA
This commit is contained in:
parent
0cd8eaf580
commit
cc86729dbc
BIN
favicon.pdn
BIN
favicon.pdn
Binary file not shown.
BIN
favicon.png
BIN
favicon.png
Binary file not shown.
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 24 KiB |
13
index.html
13
index.html
|
@ -2,13 +2,18 @@
|
|||
<html lang="en" translate="no" class="dark h-full bg-stone-900">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||
<link rel="icon" href="/icons/favicon.ico" />
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>N0mbers</title>
|
||||
<meta name="description" content="Reach the result in five operations or less">
|
||||
<link rel="icon" href="/icons/favicon.ico">
|
||||
<link rel="alternate icon" href="/favicon.ico" type="image/png" sizes="16x16">
|
||||
<link rel="apple-touch-icon" href="/icons/apple-touch-icon.png" sizes="180x180">
|
||||
<link rel="mask-icon" href="/icons/favicon.svg" color="#1C1917">
|
||||
<meta name="theme-color" content="#1C1917">
|
||||
</head>
|
||||
|
||||
<body class="bg-stone-300 text-stone-900 dark:bg-stone-900 dark:text-stone-200 h-full relative transition-colors">
|
||||
<body class="bg-stone-300 text-stone-900 dark:bg-stone-900 dark:text-stone-200 h-full relative">
|
||||
<div id="app" class="h-full"></div>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
</body>
|
||||
|
|
|
@ -45,7 +45,9 @@
|
|||
"typescript": "~4.5.5",
|
||||
"unplugin-icons": "^0.13.2",
|
||||
"vite": "^2.8.4",
|
||||
"vite-plugin-pwa": "^0.11.13",
|
||||
"vitest": "^0.1.27",
|
||||
"vue-tsc": "^0.29.8"
|
||||
"vue-tsc": "^0.29.8",
|
||||
"workbox-window": "^6.4.2"
|
||||
}
|
||||
}
|
1826
pnpm-lock.yaml
1826
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div
|
||||
class="container flex overflow-hidden relative flex-col mx-auto max-w-md h-full border border-cyan-500">
|
||||
class="container flex overflow-hidden relative flex-col mx-auto max-w-md h-full">
|
||||
<div class="px-2 w-full h-full">
|
||||
<AppHeader class="" />
|
||||
<!-- keep relative for transition -->
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
@click="click(item)"
|
||||
class="h-11 border"
|
||||
:class="{
|
||||
'text-stone-600 border-stone-600': !item.free,
|
||||
'dark:text-stone-600 dark:border-stone-600 text-stone-500 border-stone-400': !item.free,
|
||||
'hover:border-cyan-500': item.free,
|
||||
}"
|
||||
:style="{ transitionDelay: `${initDelay * i}ms` }"
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
<Transition name="menu">
|
||||
<div
|
||||
v-if="isSideMenuVisible"
|
||||
class="flex absolute top-[1px] right-0 z-10 flex-col w-[50%] h-full bg-stone-300 dark:bg-stone-900 border-l border-l-cyan-500">
|
||||
class="flex absolute top-[1px] right-0 z-10 flex-col p-2 w-[50%] h-full bg-stone-300 dark:bg-stone-900 border-l border-l-cyan-500">
|
||||
<div class="h-12">
|
||||
<button @click="isSideMenuVisible = false">
|
||||
<IconClose
|
||||
class="absolute top-0 right-1 h-12 text-xl hover:text-cyan-500" />
|
||||
</button>
|
||||
</div>
|
||||
<div class="flex-1 ">
|
||||
<div class="flex-1">
|
||||
<div class="h-12" />
|
||||
<InputSwitch
|
||||
id="toggleNight"
|
||||
|
@ -17,6 +17,10 @@
|
|||
lbl-right="Night"
|
||||
v-model="darkMode" />
|
||||
</div>
|
||||
|
||||
<div class="text-xs text-stone-500 dark:text-stone-600">
|
||||
Build {{ buildDate }}
|
||||
</div>
|
||||
</div>
|
||||
</Transition>
|
||||
</template>
|
||||
|
@ -41,4 +45,6 @@ import { isSideMenuVisible } from '@/composables/side-menu'
|
|||
import IconClose from '~icons/ph/x'
|
||||
|
||||
import InputSwitch from './common/InputSwitch.vue'
|
||||
|
||||
const buildDate = import.meta.env.VITE_BUILD_DATE
|
||||
</script>
|
||||
|
|
11
src/main.ts
11
src/main.ts
|
@ -1,11 +1,12 @@
|
|||
import './index.css'
|
||||
|
||||
import messages from '@intlify/vite-plugin-vue-i18n/messages'
|
||||
import { registerSW } from 'virtual:pwa-register'
|
||||
import { createApp } from 'vue'
|
||||
import { createI18n } from 'vue-i18n'
|
||||
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
import App from '@/App.vue'
|
||||
import router from '@/router'
|
||||
|
||||
const i18n = createI18n({
|
||||
legacy: false,
|
||||
|
@ -14,6 +15,12 @@ const i18n = createI18n({
|
|||
messages,
|
||||
})
|
||||
|
||||
registerSW({
|
||||
onOfflineReady() {
|
||||
// showToast('Ce jeu peut être installé<br>pour fonctionner hors-ligne.', 2000)
|
||||
},
|
||||
})
|
||||
|
||||
const app = createApp(App)
|
||||
|
||||
app.use(router)
|
||||
|
|
|
@ -12,9 +12,7 @@
|
|||
class="text-2xl btn">
|
||||
{{ t('dailyGame') }}
|
||||
</RouterLink>
|
||||
<span v-html="t('dailyDescription')">
|
||||
|
||||
</span>
|
||||
<span v-html="t('dailyDescription')" />
|
||||
</div>
|
||||
|
||||
<!-- Random -->
|
||||
|
|
|
@ -4,6 +4,9 @@ import path from 'path'
|
|||
import Icons from 'unplugin-icons/vite'
|
||||
import { fileURLToPath, URL } from 'url'
|
||||
import { defineConfig } from 'vite'
|
||||
import { VitePWA } from 'vite-plugin-pwa'
|
||||
|
||||
process.env.VITE_BUILD_DATE = new Date().toISOString()
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
|
@ -16,6 +19,38 @@ export default defineConfig({
|
|||
vueI18n({
|
||||
include: path.resolve(__dirname, 'src/locales/**'),
|
||||
}),
|
||||
VitePWA({
|
||||
registerType: 'autoUpdate',
|
||||
includeAssets: [
|
||||
'icons/favicon.ico',
|
||||
'robots.txt',
|
||||
'icons/apple-touch-icon.png',
|
||||
],
|
||||
manifest: {
|
||||
name: 'N0mbers',
|
||||
short_name: 'N0mbers',
|
||||
description: 'Reach the result in five operations or less',
|
||||
theme_color: '#198A42',
|
||||
icons: [
|
||||
{
|
||||
src: 'icons/android-chrome-192x192.png',
|
||||
sizes: '192x192',
|
||||
type: 'image/png',
|
||||
},
|
||||
{
|
||||
src: 'icons/android-chrome-512x512.png',
|
||||
sizes: '512x512',
|
||||
type: 'image/png',
|
||||
},
|
||||
{
|
||||
src: 'icons/android-chrome-512x512.png',
|
||||
sizes: '512x512',
|
||||
type: 'image/png',
|
||||
purpose: 'any maskable',
|
||||
},
|
||||
],
|
||||
},
|
||||
}),
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
|
|
Loading…
Reference in New Issue
Block a user