QLFW-68: русские подписи у списков в панели

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
peppa-bot 2026-11-24 19:01:19 +00:00
parent 13d46ea607
commit 84c0358707
4 changed files with 22 additions and 2 deletions

1
.gitignore vendored
View File

@ -8,3 +8,4 @@ node_modules
next-env.d.ts
data/*.db*
*.tsbuildinfo
data/media/

View File

@ -12,8 +12,8 @@ export const Home: GlobalConfig = {
access: { read: () => true },
fields: [
{ name: 'mission', label: 'Миссия фонда', type: 'textarea', localized: true },
{ name: 'directions', label: 'Направления деятельности', type: 'array', localized: false, fields: [...item] },
{ name: 'projects', label: 'Проекты', type: 'array', fields: [...item] },
{ name: 'directions', label: 'Направления деятельности', type: 'array', labels: { singular: 'направление', plural: 'Направления' }, localized: false, fields: [...item] },
{ name: 'projects', label: 'Проекты', type: 'array', labels: { singular: 'проект', plural: 'Проекты' }, fields: [...item] },
{ name: 'collaboration', label: 'Приглашение к сотрудничеству', type: 'textarea', localized: true },
{ name: 'contactEmail', label: 'Почта для связи', type: 'email' },
],

View File

@ -12,6 +12,7 @@ export const SiteSettings: GlobalConfig = {
name: 'bookPhotos',
label: 'Фотографии книги (после четырёх основных)',
type: 'array',
labels: { singular: 'фото книги', plural: 'Фотографии книги' },
admin: { description: 'Новое фото появится в ряду фотографий книги тем же размером. Порядок — как в списке.' },
fields: [{ name: 'photo', label: 'Фото', type: 'upload', relationTo: 'media', required: true }],
},
@ -19,6 +20,7 @@ export const SiteSettings: GlobalConfig = {
name: 'socials',
label: 'Социальные сети',
type: 'array',
labels: { singular: 'соцсеть', plural: 'Социальные сети' },
fields: [
{ name: 'label', label: 'Название (например, Instagram)', type: 'text', required: true },
{ name: 'url', label: 'Ссылка', type: 'text', required: true, validate: (v: string | null | undefined) => (v && /^https?:\/\//.test(v) ? true : 'Ссылка должна начинаться с https://') },

View File

@ -26,3 +26,20 @@ describe('Понятная панель для сотрудника', () => {
expect(ru.translations.error.emailOrPasswordIncorrect).toMatch(/парол/i)
})
})
describe('повторяющиеся поля подписаны по-русски', () => {
it('у каждого списка в разделах панели есть русские подписи', async () => {
const config = await configPromise
const arrays = [...config.globals, ...config.collections].flatMap((c) =>
c.fields
// служебный список сеансов входа Payload сотрудник в панели не видит
.filter((f) => f.type === 'array' && !(c.slug === 'users' && f.name === 'sessions')).map((f) => [c.slug, f]),
)
expect(arrays.length).toBeGreaterThan(0)
for (const [, f] of arrays) {
const labels = (f as { labels?: { singular?: unknown; plural?: unknown } }).labels
expect(String(labels?.singular)).toMatch(/[а-яё]/i)
expect(String(labels?.plural)).toMatch(/[а-яё]/i)
}
})
})