+ 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">
-
+
+
+
+ Build {{ buildDate }}
+
@@ -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
diff --git a/src/main.ts b/src/main.ts
index a0918fc..a3a9830 100644
--- a/src/main.ts
+++ b/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Ă©
pour fonctionner hors-ligne.', 2000)
+ },
+})
+
const app = createApp(App)
app.use(router)
diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue
index 459e334..ab0d2af 100644
--- a/src/views/HomeView.vue
+++ b/src/views/HomeView.vue
@@ -12,9 +12,7 @@
class="text-2xl btn">
{{ t('dailyGame') }}
-
-
-
+
diff --git a/vite.config.ts b/vite.config.ts
index 9e8c0dc..358285a 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -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: {