diff --git a/packages/frontend/core/src/components/affine/setting-modal/workspace-setting/properties/index.tsx b/packages/frontend/core/src/components/affine/setting-modal/workspace-setting/properties/index.tsx index 30bc06e094..5017d7d50a 100644 --- a/packages/frontend/core/src/components/affine/setting-modal/workspace-setting/properties/index.tsx +++ b/packages/frontend/core/src/components/affine/setting-modal/workspace-setting/properties/index.tsx @@ -279,29 +279,51 @@ const CustomPropertyRowsList = ({ return ; } else { - const required = properties.filter(property => property.required); - const optional = properties.filter(property => !property.required); + const partition = Object.groupBy(properties, p => + p.required ? 'required' : p.readonly ? 'readonly' : 'optional' + ); + return ( <> - {required.length > 0 ? ( + {partition.required && partition.required.length > 0 ? ( <>
{t[ 'com.affine.settings.workspace.properties.required-properties' ]()}
- + ) : null} - {optional.length > 0 ? ( + {partition.optional && partition.optional.length > 0 ? ( <>
{t[ 'com.affine.settings.workspace.properties.general-properties' ]()}
- + + + ) : null} + + {partition.readonly && partition.readonly.length > 0 ? ( + <> +
+ {t[ + 'com.affine.settings.workspace.properties.readonly-properties' + ]()} +
+ ) : null} diff --git a/packages/frontend/core/src/modules/properties/services/schema.ts b/packages/frontend/core/src/modules/properties/services/schema.ts index a7995c7b20..dd7c670882 100644 --- a/packages/frontend/core/src/modules/properties/services/schema.ts +++ b/packages/frontend/core/src/modules/properties/services/schema.ts @@ -32,6 +32,7 @@ export const PagePropertyMetaBaseSchema = z.object({ type: z.nativeEnum(PagePropertyType), icon: z.string(), required: z.boolean().optional(), + readonly: z.boolean().optional(), }); export const PageSystemPropertyMetaBaseSchema = diff --git a/packages/frontend/i18n/src/resources/en.json b/packages/frontend/i18n/src/resources/en.json index 3f23705956..f5327788b7 100644 --- a/packages/frontend/i18n/src/resources/en.json +++ b/packages/frontend/i18n/src/resources/en.json @@ -1358,6 +1358,7 @@ "com.affine.settings.workspace.properties.doc_others": "<0>{{count}} docs", "com.affine.settings.workspace.properties.edit-property": "Edit property", "com.affine.settings.workspace.properties.general-properties": "General properties", + "com.affine.settings.workspace.properties.readonly-properties": "Readonly properties", "com.affine.settings.workspace.properties.header.subtitle": "Manage workspace <1>{{name}} properties", "com.affine.settings.workspace.properties.header.title": "Properties", "com.affine.settings.workspace.properties.in-use": "In use",