feat!: rewrite frontend in Vue 3 with Pinia, DaisyUI, vite-plugin-pwa
Migrates every component from class-based vue-property-decorator to
<script setup> + Composition API. Replaces Vuex 3 + vuex-class with a
single Pinia store (persisted via pinia-plugin-persistedstate). Swaps
Bulma + bulma-{checkradio,switch,pricingtable} for DaisyUI 5 utilities
on Tailwind 4. Replaces register-service-worker with vite-plugin-pwa
(workbox, skipWaiting/clientsClaim preserved).
Plugins replaced:
- vue-class-component / vue-property-decorator -> <script setup>
- vuex / vuex-class / vuex-persist -> pinia + persistedstate
- vue-i18n 8 -> vue-i18n 11 (composition mode, legacy: false)
- vue-click-outside -> @vueuse/core onClickOutside
- @xkeshi/vue-qrcode -> qrcode.vue
- vue-currency-input 1 -> vue-currency-input 3 (composable wrapper)
- bus-event (Vue instance) -> mitt
- Vue filters -> plain functions imported per component
BREAKING: drops Stripe / pricing entirely (Payment, PricingTable,
/pricing route, vue-stripe-checkout, bulma-pricingtable).
Clears unused Cypress and Jest test scaffolding; leaves a Vitest
harness behind for future tests.
This commit is contained in:
@@ -1,7 +1,14 @@
|
||||
import Vue from 'vue'
|
||||
import mitt from 'mitt'
|
||||
|
||||
export default new Vue()
|
||||
export const ONLINE = 'ONLINE'
|
||||
export const OFFLINE = 'OFFLINE'
|
||||
export const SYNC = 'SYNC'
|
||||
|
||||
export const ONLINE: string = 'ONLINE'
|
||||
export const OFFLINE: string = 'OFFLINE'
|
||||
export const SYNC: string = 'SYNC'
|
||||
type Events = {
|
||||
[ONLINE]: undefined
|
||||
[OFFLINE]: undefined
|
||||
[SYNC]: string[] | undefined
|
||||
}
|
||||
|
||||
export const bus = mitt<Events>()
|
||||
export default bus
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
import ICurrency from '@/models/ICurrency'
|
||||
import type ICurrency from '@/models/ICurrency'
|
||||
|
||||
export const money = (
|
||||
value: number,
|
||||
currency: ICurrency | null | undefined,
|
||||
country: string = 'fr-FR'
|
||||
country = 'fr-FR'
|
||||
): string => {
|
||||
if (!currency) {
|
||||
return value.toString()
|
||||
}
|
||||
|
||||
return new Intl.NumberFormat(country, {
|
||||
style: 'currency',
|
||||
currency: currency.code,
|
||||
@@ -19,36 +18,24 @@ export const money = (
|
||||
export const moneypad = (
|
||||
value: number,
|
||||
currency?: ICurrency | null,
|
||||
withPadEnd: boolean = true
|
||||
withPadEnd = true
|
||||
): string => {
|
||||
const m = money(value, currency)
|
||||
const s: string[] = m.split('\xa0')
|
||||
let cur: string | undefined = s.pop()
|
||||
|
||||
if (withPadEnd) {
|
||||
cur = (cur || '').padEnd(3, '\xa0')
|
||||
}
|
||||
|
||||
const result = `${s.join('\xa0')}\xa0${cur || ''}`
|
||||
return result
|
||||
return `${s.join('\xa0')}\xa0${cur || ''}`
|
||||
}
|
||||
|
||||
export const date = (value: string, country: string = 'fr-FR') => {
|
||||
return new Intl.DateTimeFormat(country).format(new Date(value))
|
||||
}
|
||||
export const date = (value: string, country = 'fr-FR') =>
|
||||
new Intl.DateTimeFormat(country).format(new Date(value))
|
||||
|
||||
export const fulldate = (value: string, country: string = 'fr-FR') => {
|
||||
return new Intl.DateTimeFormat(country, {
|
||||
export const fulldate = (value: string, country = 'fr-FR') =>
|
||||
new Intl.DateTimeFormat(country, {
|
||||
weekday: 'long',
|
||||
year: 'numeric',
|
||||
month: 'long',
|
||||
day: 'numeric'
|
||||
}).format(new Date(value))
|
||||
}
|
||||
|
||||
export default {
|
||||
money,
|
||||
moneypad,
|
||||
date,
|
||||
fulldate
|
||||
} as { [key: string]: (...args: any[]) => any }
|
||||
@@ -1,3 +0,0 @@
|
||||
import { Component } from 'vue-property-decorator'
|
||||
|
||||
Component.registerHooks(['beforeRouteEnter', 'beforeRouteUpdate'])
|
||||
@@ -1,15 +1,6 @@
|
||||
import Vue from 'vue'
|
||||
import '@tabler/icons-webfont/dist/tabler-icons.min.css'
|
||||
import type { App } from 'vue'
|
||||
import VaquantIcon from '@/components/VaquantIcon.vue'
|
||||
|
||||
Vue.component('vaquant-icon', {
|
||||
functional: true,
|
||||
props: {
|
||||
icon: { type: String, required: true }
|
||||
},
|
||||
render(h, { props, data }) {
|
||||
return h('i', {
|
||||
...data,
|
||||
class: [`ti ti-${props.icon}`, data.class, data.staticClass]
|
||||
})
|
||||
}
|
||||
})
|
||||
export const registerIcons = (app: App): void => {
|
||||
app.component('VaquantIcon', VaquantIcon)
|
||||
}
|
||||
|
||||
@@ -1,20 +1,26 @@
|
||||
declare var navigator: any
|
||||
interface NetworkConnection {
|
||||
effectiveType?: string
|
||||
metered?: boolean
|
||||
bandwidth?: number
|
||||
}
|
||||
|
||||
interface NavigatorWithConnection {
|
||||
connection?: NetworkConnection
|
||||
mozConnection?: NetworkConnection
|
||||
webkitConnection?: NetworkConnection
|
||||
}
|
||||
|
||||
export const hasGoodNetwork = (): boolean => {
|
||||
const nav = navigator as Navigator & NavigatorWithConnection
|
||||
const connection =
|
||||
navigator.connection ||
|
||||
navigator.mozConnection ||
|
||||
navigator.webkitConnection
|
||||
nav.connection || nav.mozConnection || nav.webkitConnection
|
||||
|
||||
if (connection) {
|
||||
if (connection.effectiveType) {
|
||||
const goodNetworks: string[] = ['3g', '4g']
|
||||
const goodNetworks = ['3g', '4g']
|
||||
return goodNetworks.includes(connection.effectiveType)
|
||||
} else {
|
||||
const highBandwidth: boolean =
|
||||
connection.metered && (connection.bandwidth || 0) > 2
|
||||
return highBandwidth
|
||||
}
|
||||
return !!(connection.metered && (connection.bandwidth || 0) > 2)
|
||||
}
|
||||
|
||||
return true
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const ROOT: string =
|
||||
process.env.NODE_ENV === 'production'
|
||||
import.meta.env.MODE === 'production'
|
||||
? 'https://vaquant.azurewebsites.net/api'
|
||||
: 'http://localhost:7071/api'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user