Files
InvoiceShelf/resources/scripts/features/admin/views/settings/AdminFontView.vue
Darko Gjorgjijoski 71388ec6a5 Rename resources/scripts-v2 to resources/scripts and drop @v2 alias
Now that the legacy v1 frontend (commit 064bdf53) is gone, the v2 directory is the only frontend and the v2 suffix is just noise. Renames resources/scripts-v2 to resources/scripts via git mv (so git records the move as renames, preserving blame and log --follow), then bulk-rewrites the 152 files that imported via @v2/... to use @/scripts/... instead. The existing @ alias (resources/) covers the new path with no extra config needed.

Drops the now-unused @v2 alias from vite.config.js and points the laravel-vite-plugin entry at resources/scripts/main.ts. Updates the only blade reference (resources/views/app.blade.php) to match. The package.json test script (eslint ./resources/scripts) automatically targets the right place after the rename without any edit.

Verified: npm run build exits clean and the Vite warning lines now reference resources/scripts/plugins/i18n.ts, confirming every import resolved through the new path. git log --follow on any moved file walks back through its scripts-v2 history.
2026-04-07 12:50:16 +02:00

127 lines
3.4 KiB
Vue

<script setup lang="ts">
import { onMounted, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import { useNotificationStore } from '@/scripts/stores/notification.store'
import { client } from '@/scripts/api/client'
import { API } from '@/scripts/api/endpoints'
interface FontPackage {
key: string
name: string
family: string
locales: string[]
size: string
installed: boolean
bundled?: boolean
}
const { t } = useI18n()
const notificationStore = useNotificationStore()
const packages = ref<FontPackage[]>([])
const isLoading = ref(false)
const installing = ref<Set<string>>(new Set())
onMounted(async () => {
await loadStatus()
})
async function loadStatus(): Promise<void> {
isLoading.value = true
try {
const { data } = await client.get(API.FONTS_STATUS)
packages.value = data.packages
} catch {
// Silently fail
} finally {
isLoading.value = false
}
}
async function installFont(pkg: FontPackage): Promise<void> {
installing.value.add(pkg.key)
try {
await client.post(`${API.FONTS_INSTALL}/${pkg.key}/install`)
pkg.installed = true
notificationStore.showNotification({
type: 'success',
message: t('settings.fonts.download_complete', { name: pkg.name }),
})
} catch {
notificationStore.showNotification({
type: 'error',
message: t('settings.fonts.download_failed', { name: pkg.name }),
})
} finally {
installing.value.delete(pkg.key)
}
}
</script>
<template>
<BaseSettingCard
:title="$t('settings.fonts.title')"
:description="$t('settings.fonts.description')"
>
<p class="text-sm text-muted mb-6">
{{ $t('settings.fonts.bundled_info') }}
</p>
<div class="space-y-3">
<div
v-for="pkg in packages"
:key="pkg.key"
class="flex items-center justify-between p-4 border border-line-light rounded-lg"
>
<div>
<div class="font-medium text-heading">{{ pkg.name }}</div>
<div class="text-xs text-subtle mt-1">
{{ pkg.locales.join(', ') }} {{ pkg.size }}
</div>
</div>
<div class="flex items-center gap-3">
<span
v-if="pkg.bundled"
class="inline-flex items-center rounded-full bg-primary-50 px-2.5 py-1 text-xs font-medium text-primary-600"
>
{{ $t('settings.fonts.bundled') }}
</span>
<span
v-else-if="pkg.installed"
class="inline-flex items-center rounded-full bg-success px-2.5 py-1 text-xs font-medium text-status-green"
>
{{ $t('settings.fonts.installed') }}
</span>
<BaseButton
v-else
size="sm"
variant="primary-outline"
:loading="installing.has(pkg.key)"
:disabled="installing.has(pkg.key)"
@click="installFont(pkg)"
>
<template #left="slotProps">
<BaseIcon
v-if="!installing.has(pkg.key)"
name="CloudArrowDownIcon"
:class="slotProps.class"
/>
</template>
{{ installing.has(pkg.key) ? $t('settings.fonts.downloading') : $t('settings.fonts.install') }}
</BaseButton>
</div>
</div>
</div>
<div v-if="!packages.length && !isLoading" class="text-center py-8 text-muted">
{{ $t('settings.fonts.no_packages') }}
</div>
</BaseSettingCard>
</template>