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

@@ -53,7 +53,11 @@ describe('Output size, never enlarged', () => {
})
it('crops a square box out of the sample', () => {
const size = outputSize(SAMPLE, { width: 1000, height: 1000, fit: 'cover' })
const size = outputSize(SAMPLE, {
width: 1000,
height: 1000,
fit: 'cover',
})
expect(size).toEqual({ width: 1000, height: 1000 })
})
@@ -19,7 +19,13 @@ const RANGE_ERROR = 'Enter a value from 1 to 8000.'
const QUALITY_ERROR = 'Enter a value from 1 to 100.'
function values(overrides: Partial<VariantFormValues>): VariantFormValues {
return { ...blankValues(), name: 'hero', width: '1200', height: '630', ...overrides }
return {
...blankValues(),
name: 'hero',
width: '1200',
height: '630',
...overrides,
}
}
describe('Field errors', () => {
@@ -65,7 +71,12 @@ describe('Field errors', () => {
describe('Request body', () => {
it('builds the create body from the form', () => {
const body = toNewVariant(
values({ format: 'webp', quality: '82', generateOnUpload: true, enabled: true }),
values({
format: 'webp',
quality: '82',
generateOnUpload: true,
enabled: true,
}),
)
expect(body).toEqual({
@@ -126,7 +126,11 @@ describe('Footer sums are computed from the list', () => {
})
it('uses the singular for one variant with one file', () => {
const thumb = variant({ name: 'thumb', generated_files: 1, cache_size: 18 * 1024 })
const thumb = variant({
name: 'thumb',
generated_files: 1,
cache_size: 18 * 1024,
})
expect(variantsSummary([thumb])).toBe('1 variant · 1 generated file · 18 KB')
})
@@ -64,7 +64,12 @@ describe('Option labels', () => {
it('offers only Original for a vector image', () => {
const options = buildOptions(
{ ...NORTH_WALL, width: null, height: null, content_type: 'image/svg+xml' },
{
...NORTH_WALL,
width: null,
height: null,
content_type: 'image/svg+xml',
},
[variant({})],
)
+5 -1
View File
@@ -10,7 +10,11 @@ function splitSrc(src: string) {
if (queryAt === -1) {
return { base: withoutHash, query: '', hash }
}
return { base: withoutHash.slice(0, queryAt), query: withoutHash.slice(queryAt + 1), hash }
return {
base: withoutHash.slice(0, queryAt),
query: withoutHash.slice(queryAt + 1),
hash,
}
}
export function variantOfSrc(src: string | undefined | null) {
+3 -1
View File
@@ -30,7 +30,9 @@ export interface VariantFormValues {
enabled: boolean
}
export type FieldErrors = Partial<Record<FieldName, string>> & { dimension?: string }
export type FieldErrors = Partial<Record<FieldName, string>> & {
dimension?: string
}
export const FIELD_ORDER: FieldName[] = ['name', 'width', 'height', 'quality']
+4 -1
View File
@@ -12,7 +12,10 @@ export interface OutputRequest {
}
function scaled(size: PixelSize, factor: number): PixelSize {
return { width: Math.round(size.width * factor), height: Math.round(size.height * factor) }
return {
width: Math.round(size.width * factor),
height: Math.round(size.height * factor),
}
}
function singleDimension(source: PixelSize, width: number | null, height: number | null) {