feat: sites and authors integration into existing screens (& formated all frontend files kinda accidentally)

This commit is contained in:
Florian Sylvain committed 2026-10-15 05:25:44 +02:00
1 parent 3d81d2c717
commit 6b8990c55e
239 files changed
+9194 -1354

No files matched your search

@@ -7,16 +7,22 @@ import { useSessionStore } from '@/stores/session'
import type { Article } from '@/composables/useArticles'
import ArticleEditor from '@/components/ArticleEditor.vue'
import RootComponent from '@/App.vue'
import { articleMeta, oneSite } from './editorMetaKit'
const FIXED_NOW = '2026-09-26T11:02:00Z'
vi.mock('@/lib/fileHash', () => ({ hashFile: vi.fn(async () => 'a'.repeat(64)) }))
vi.mock('@/lib/fileHash', () => ({
hashFile: vi.fn(async () => 'a'.repeat(64)),
}))
vi.mock('@/lib/imageCrop', async (importOriginal) => {
const actual = await importOriginal<typeof import('@/lib/imageCrop')>()
return {
...actual,
readNaturalImageSize: vi.fn(async () => ({ width: 4032, height: 3024 })),
readNaturalImageSize: vi.fn(async () => ({
width: 4032,
height: 3024,
})),
renderCroppedImage: vi.fn(async () => new Blob([new Uint8Array(430080)])),
}
})
@@ -86,7 +92,10 @@ function mib(value: number) {
function fileFixture(name: string, type: string, sizeMB: number) {
const file = new File(['x'], name, { type })
Object.defineProperty(file, 'size', { value: mib(sizeMB), configurable: true })
Object.defineProperty(file, 'size', {
value: mib(sizeMB),
configurable: true,
})
return file
}
@@ -105,9 +114,13 @@ function routeFor(url: string, init?: RequestInit) {
}
function fetchRouter(handlers: Record<string, () => Response | Promise<Response>>) {
const routes = {
'GET /v1/site/': () => mockResponse(200, oneSite),
...handlers,
}
return vi.fn((url: string, init?: RequestInit) => {
const key = routeFor(url, init)
const handler = handlers[key]
const handler = routes[key]
if (!handler) {
throw new Error(`Unexpected fetch call: ${key}`)
}
@@ -121,6 +134,7 @@ function articleFixture(overrides: Partial<Article> = {}): Article {
title: 'How we price a bathroom renovation',
body: '<p>a</p>',
is_online: false,
...articleMeta,
created_at: '2026-03-12T09:14:00Z',
updated_at: FIXED_NOW,
...overrides,