From 1506867c90a2de5ce0ee1183053eb01fa8845a3e Mon Sep 17 00:00:00 2001 From: Codex Date: Thu, 23 Apr 2026 10:41:19 +0800 Subject: [PATCH] refactor: hide doc locale from admin editing UI --- src/app/(payload)/admin-theme.css | 35 ++++++++++++++++++++ src/payload/collections/Dealers.ts | 5 ++- src/payload/collections/Downloads.ts | 5 ++- src/payload/collections/FAQs.ts | 5 ++- src/payload/collections/News.ts | 6 ++-- src/payload/collections/ProductCategories.ts | 5 ++- src/payload/collections/ProductReviews.ts | 5 ++- src/payload/collections/ProductVideos.ts | 5 ++- src/payload/collections/Products.ts | 4 +-- 9 files changed, 51 insertions(+), 24 deletions(-) diff --git a/src/app/(payload)/admin-theme.css b/src/app/(payload)/admin-theme.css index 48fde45..7222ede 100644 --- a/src/app/(payload)/admin-theme.css +++ b/src/app/(payload)/admin-theme.css @@ -291,6 +291,33 @@ html[data-theme] .row .field-type { max-width: none; } +html[data-theme] .field-type.row, +html[data-theme] .field-type.tabs-field, +html[data-theme] .field-type.group, +html[data-theme] .field-type.collapsible-field, +html[data-theme] .field-type.row:has(input[type='checkbox']), +html[data-theme] .field-type.row:has(select), +html[data-theme] .field-type.row:has(input[type='date']), +html[data-theme] .field-type.row:has(input[type='datetime-local']), +html[data-theme] .field-type.row:has(input[type='number']), +html[data-theme] .field-type.row:has(input[type='email']), +html[data-theme] .field-type.row:has(input[type='text']), +html[data-theme] .field-type.group:has(.render-fields), +html[data-theme] .field-type.group:has(.array-field), +html[data-theme] .field-type.group:has(.blocks-field), +html[data-theme] .field-type.group:has(.relationship-field), +html[data-theme] .field-type.group:has(.upload-field), +html[data-theme] .field-type.collapsible-field:has(.render-fields), +html[data-theme] .field-type.tabs-field:has(input[type='checkbox']), +html[data-theme] .field-type.tabs-field:has(select), +html[data-theme] .field-type.tabs-field:has(input[type='date']), +html[data-theme] .field-type.tabs-field:has(input[type='datetime-local']), +html[data-theme] .field-type.tabs-field:has(input[type='number']), +html[data-theme] .field-type.tabs-field:has(input[type='email']), +html[data-theme] .field-type.tabs-field:has(input[type='text']) { + max-width: none; +} + html[data-theme] .tabs-field__content-wrap, html[data-theme] .tabs-field__content-wrap .render-fields, html[data-theme] .tabs-field__content-wrap .field-type, @@ -310,6 +337,14 @@ html[data-theme] .tabs-field__content-wrap .field-type:has(.upload-field) { max-width: none; } +html[data-theme] .field-type.group > .field-type__wrap, +html[data-theme] .field-type.collapsible-field > .field-type__wrap, +html[data-theme] .field-type.group .render-fields, +html[data-theme] .field-type.collapsible-field .render-fields { + max-width: none; + width: 100%; +} + html[data-theme] .row { gap: 10px; } diff --git a/src/payload/collections/Dealers.ts b/src/payload/collections/Dealers.ts index 85ebc77..2bb4914 100644 --- a/src/payload/collections/Dealers.ts +++ b/src/payload/collections/Dealers.ts @@ -10,7 +10,7 @@ export const Dealers: CollectionConfig = { }, admin: { baseFilter: independentDocListFilter('name'), - defaultColumns: ['name', 'docLocale', 'region', 'country', 'city', 'updatedAt'], + defaultColumns: ['name', 'region', 'country', 'city', 'updatedAt'], description: 'Dealer and distributor records surfaced in the dealer finder and product pages. English and Chinese dealer entries are maintained as separate documents.', group: { en: 'Sales', zh: '销售' }, @@ -39,8 +39,7 @@ export const Dealers: CollectionConfig = { { label: '简体中文', value: 'zh' }, ], admin: { - position: 'sidebar', - description: 'Independent document language for this dealer record.', + condition: () => false, }, }, { name: 'name', label: { en: 'Name', zh: '名称' }, type: 'text', required: true, localized: true }, diff --git a/src/payload/collections/Downloads.ts b/src/payload/collections/Downloads.ts index eb358bd..6efcade 100644 --- a/src/payload/collections/Downloads.ts +++ b/src/payload/collections/Downloads.ts @@ -25,7 +25,7 @@ export const Downloads: CollectionConfig = { }, admin: { baseFilter: independentDocListFilter('title'), - defaultColumns: ['title', 'docLocale', 'product', 'type', 'version', 'status', 'updatedAt'], + defaultColumns: ['title', 'product', 'type', 'version', 'status', 'updatedAt'], description: 'Firmware packages, manuals, software installers, and release notes tied to products. English and Chinese download entries are maintained as separate documents.', group: { en: 'Catalog', zh: '产品' }, @@ -54,8 +54,7 @@ export const Downloads: CollectionConfig = { { label: '简体中文', value: 'zh' }, ], admin: { - position: 'sidebar', - description: 'Independent document language for this download entry.', + condition: () => false, }, }, { name: 'title', label: { en: 'Title', zh: '标题' }, type: 'text', required: true, localized: true }, diff --git a/src/payload/collections/FAQs.ts b/src/payload/collections/FAQs.ts index c7e55fa..93d998a 100644 --- a/src/payload/collections/FAQs.ts +++ b/src/payload/collections/FAQs.ts @@ -10,7 +10,7 @@ export const FAQs: CollectionConfig = { }, admin: { baseFilter: independentDocListFilter('question'), - defaultColumns: ['question', 'docLocale', 'group', 'order', 'updatedAt'], + defaultColumns: ['question', 'group', 'order', 'updatedAt'], description: 'Support knowledge base entries powering the FAQ center and product help flows. English and Chinese FAQ entries are maintained as separate documents.', group: { en: 'Support', zh: '支持' }, @@ -39,8 +39,7 @@ export const FAQs: CollectionConfig = { { label: '简体中文', value: 'zh' }, ], admin: { - position: 'sidebar', - description: 'Independent document language for this FAQ entry.', + condition: () => false, }, }, { diff --git a/src/payload/collections/News.ts b/src/payload/collections/News.ts index 6becb71..9da456d 100644 --- a/src/payload/collections/News.ts +++ b/src/payload/collections/News.ts @@ -10,7 +10,7 @@ export const News: CollectionConfig = { }, admin: { baseFilter: independentDocListFilter('title'), - defaultColumns: ['title', 'docLocale', 'category', 'publishedAt', 'updatedAt'], + defaultColumns: ['title', 'category', 'publishedAt', 'updatedAt'], description: 'Editorial news stories used for the news hub and homepage highlights. English and Chinese are maintained as separate documents.', group: { en: 'Publishing', zh: '内容' }, @@ -45,9 +45,7 @@ export const News: CollectionConfig = { { label: '简体中文', value: 'zh' }, ], admin: { - position: 'sidebar', - description: - 'Independent document language. Create one record for EN and one record for ZH, then keep this aligned with the admin locale while editing.', + condition: () => false, }, }, { name: 'slug', label: { en: 'Slug', zh: '链接标识' }, type: 'text', required: true, localized: true }, diff --git a/src/payload/collections/ProductCategories.ts b/src/payload/collections/ProductCategories.ts index c43dbb8..30d8be4 100644 --- a/src/payload/collections/ProductCategories.ts +++ b/src/payload/collections/ProductCategories.ts @@ -10,7 +10,7 @@ export const ProductCategories: CollectionConfig = { }, admin: { baseFilter: independentDocListFilter('name'), - defaultColumns: ['slug', 'docLocale', 'name', 'order', 'updatedAt'], + defaultColumns: ['slug', 'name', 'order', 'updatedAt'], description: 'Navigation and merchandising categories for the product catalog. English and Chinese categories are maintained as separate documents.', group: { en: 'Catalog', zh: '产品' }, @@ -38,8 +38,7 @@ export const ProductCategories: CollectionConfig = { { label: '中文 Doc', value: 'zh' }, ], admin: { - position: 'sidebar', - description: 'Independent document language for this category record.', + condition: () => false, }, }, { name: 'slug', type: 'text', required: true }, diff --git a/src/payload/collections/ProductReviews.ts b/src/payload/collections/ProductReviews.ts index db75eeb..a30ea0d 100644 --- a/src/payload/collections/ProductReviews.ts +++ b/src/payload/collections/ProductReviews.ts @@ -25,7 +25,7 @@ export const ProductReviews: CollectionConfig = { }, admin: { baseFilter: independentDocListFilter('title'), - defaultColumns: ['title', 'docLocale', 'product', 'sourceName', 'sortOrder', 'status', 'updatedAt'], + defaultColumns: ['title', 'product', 'sourceName', 'sortOrder', 'status', 'updatedAt'], description: 'Editorial reviews, quotes, thumbnails, and outbound links associated with products. Homepage review quotes are also sourced from this collection, and English/Chinese entries are maintained as separate documents.', group: { en: 'Catalog', zh: '产品' }, @@ -54,8 +54,7 @@ export const ProductReviews: CollectionConfig = { { label: '简体中文', value: 'zh' }, ], admin: { - position: 'sidebar', - description: 'Independent document language for this review entry.', + condition: () => false, }, }, { name: 'title', label: { en: 'Title', zh: '标题' }, type: 'text', localized: true, required: true }, diff --git a/src/payload/collections/ProductVideos.ts b/src/payload/collections/ProductVideos.ts index 0ad59e7..8d97ab4 100644 --- a/src/payload/collections/ProductVideos.ts +++ b/src/payload/collections/ProductVideos.ts @@ -25,7 +25,7 @@ export const ProductVideos: CollectionConfig = { }, admin: { baseFilter: independentDocListFilter('title'), - defaultColumns: ['title', 'docLocale', 'product', 'provider', 'sortOrder', 'status', 'updatedAt'], + defaultColumns: ['title', 'product', 'provider', 'sortOrder', 'status', 'updatedAt'], description: 'Product-linked video entries shown on detail pages and reused in marketing blocks. English and Chinese video records are maintained as separate documents.', group: { en: 'Catalog', zh: '产品' }, @@ -54,8 +54,7 @@ export const ProductVideos: CollectionConfig = { { label: '简体中文', value: 'zh' }, ], admin: { - position: 'sidebar', - description: 'Independent document language for this video entry.', + condition: () => false, }, }, { name: 'title', label: { en: 'Title', zh: '标题' }, type: 'text', localized: true, required: true }, diff --git a/src/payload/collections/Products.ts b/src/payload/collections/Products.ts index 94e7f76..27906d7 100644 --- a/src/payload/collections/Products.ts +++ b/src/payload/collections/Products.ts @@ -34,7 +34,7 @@ export const Products: CollectionConfig = { }, admin: { baseFilter: independentDocListFilter('name'), - defaultColumns: ['model', 'docLocale', 'category', 'template', 'status', 'updatedAt'], + defaultColumns: ['model', 'category', 'template', 'status', 'updatedAt'], description: 'Product master records power templates, editor-driven pages, awards, downloads, and SEO. English and Chinese products are maintained as separate documents.', group: { en: 'Catalog', zh: '产品' }, @@ -66,7 +66,7 @@ export const Products: CollectionConfig = { { label: '简体中文', value: 'zh' }, ], admin: { - description: 'Independent document language for this product record.', + condition: () => false, }, }, { name: 'model', label: { en: 'Model', zh: '产品型号' }, type: 'text', required: true },