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,95 +1,75 @@
|
||||
<template>
|
||||
<div class="user-new box columns">
|
||||
<div class="column is-5" v-if="user">
|
||||
<div class="field is-horizontal">
|
||||
<div class="field-label is-normal">
|
||||
<label class="label" v-t="'user.pseudo'"></label>
|
||||
</div>
|
||||
<div class="field-body">
|
||||
<div class="field">
|
||||
<p class="control">
|
||||
<input :readonly="isMainUser" class="input" type="text" v-model="userId" />
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column is-6" v-if="newUser">
|
||||
<div class="field is-horizontal">
|
||||
<div class="field-label is-normal">
|
||||
<label class="label" v-t="'user.alias'"></label>
|
||||
</div>
|
||||
<div class="field-body">
|
||||
<div class="field">
|
||||
<p class="control">
|
||||
<input
|
||||
required
|
||||
class="input"
|
||||
type="text"
|
||||
maxlength="20"
|
||||
v-model="newUser.alias"
|
||||
:placeholder="newUser.userId"
|
||||
/>
|
||||
</p>
|
||||
<p class="help is-primary">Nom utilisé sur ce compte</p>
|
||||
<p
|
||||
class="help is-primary"
|
||||
>{{ $tc('validation.max_char', maxChar(newUser), { max: maxChar(newUser) }) }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column is-1" v-if="!isMainUser">
|
||||
<button class="button is-danger" @click="$emit('remove')">
|
||||
<vaquant-icon icon="trash" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, watch } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import type IUser from '@/models/IUser'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Model, Vue, Watch } from 'vue-property-decorator'
|
||||
import { Getter } from 'vuex-class'
|
||||
import IUser from '@/models/IUser'
|
||||
import { slug } from '@/utils'
|
||||
const newUser = defineModel<IUser>({ required: true })
|
||||
defineEmits<{ remove: [] }>()
|
||||
const { t } = useI18n()
|
||||
|
||||
@Component
|
||||
export default class UserNew extends Vue {
|
||||
@Getter
|
||||
public user!: IUser | null
|
||||
@Model('input', { type: Object, required: true })
|
||||
public newUser!: IUser
|
||||
private localeUserId = (this.newUser.userId || '').toLowerCase()
|
||||
const userStore = useUserStore()
|
||||
const { user } = storeToRefs(userStore)
|
||||
|
||||
public maxChar(user: IUser): number {
|
||||
return 20 - (user.alias ? user.alias.length : 0)
|
||||
const localeUserId = ref<string>((newUser.value.userId || '').toLowerCase())
|
||||
|
||||
const userId = computed({
|
||||
get: () => localeUserId.value,
|
||||
set: (val: string) => {
|
||||
localeUserId.value = (val || '').toLowerCase()
|
||||
}
|
||||
})
|
||||
|
||||
public get isMainUser(): boolean {
|
||||
if (!this.newUser) {
|
||||
return false
|
||||
watch(
|
||||
localeUserId,
|
||||
(value) => {
|
||||
if (newUser.value.userId !== value) {
|
||||
newUser.value.userId = value
|
||||
}
|
||||
return !!this.user && this.user.userId === this.newUser.userId
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
public set userId(newUserId: string) {
|
||||
this.localeUserId = (newUserId || '').toLowerCase()
|
||||
}
|
||||
public get userId(): string {
|
||||
return this.localeUserId
|
||||
}
|
||||
const isMainUser = computed(
|
||||
() => !!user.value && !!newUser.value && user.value.userId === newUser.value.userId
|
||||
)
|
||||
|
||||
@Watch('localeUserId', { immediate: true })
|
||||
public onLocaleUserIdChange(userId: string) {
|
||||
if (this.newUser.userId !== userId) {
|
||||
this.newUser.userId = userId
|
||||
}
|
||||
}
|
||||
}
|
||||
const maxChar = (u: IUser): number => 20 - (u.alias ? u.alias.length : 0)
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.user-new {
|
||||
margin: 5px 0;
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<div class="user-new card bg-base-100 shadow p-4 my-2 flex flex-col md:flex-row gap-3 items-end">
|
||||
<div v-if="user" class="flex flex-col gap-1 flex-1">
|
||||
<label class="label">{{ t('user.pseudo') }}</label>
|
||||
<input
|
||||
v-model="userId"
|
||||
:readonly="isMainUser"
|
||||
type="text"
|
||||
class="input input-bordered w-full"
|
||||
/>
|
||||
</div>
|
||||
<div v-if="newUser" class="flex flex-col gap-1 flex-1">
|
||||
<label class="label">{{ t('user.alias') }}</label>
|
||||
<input
|
||||
v-model="newUser.alias"
|
||||
required
|
||||
type="text"
|
||||
maxlength="20"
|
||||
:placeholder="newUser.userId"
|
||||
class="input input-bordered w-full"
|
||||
/>
|
||||
<p class="text-xs text-primary">Nom utilisé sur ce compte</p>
|
||||
<p class="text-xs text-primary">
|
||||
{{ t('validation.max_char', { max: maxChar(newUser) }, maxChar(newUser)) }}
|
||||
</p>
|
||||
</div>
|
||||
<button
|
||||
v-if="!isMainUser"
|
||||
class="btn btn-error btn-square"
|
||||
@click="$emit('remove')"
|
||||
>
|
||||
<vaquant-icon icon="trash" />
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user