mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-12 15:46:29 +08:00
feat: split readonly properties
This commit is contained in:
+28
-6
@@ -279,29 +279,51 @@ const CustomPropertyRowsList = ({
|
||||
|
||||
return <CustomPropertyRows properties={filtered} statistics={statistics} />;
|
||||
} 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 ? (
|
||||
<>
|
||||
<div className={styles.subListHeader}>
|
||||
{t[
|
||||
'com.affine.settings.workspace.properties.required-properties'
|
||||
]()}
|
||||
</div>
|
||||
<CustomPropertyRows properties={required} statistics={statistics} />
|
||||
<CustomPropertyRows
|
||||
properties={partition.required}
|
||||
statistics={statistics}
|
||||
/>
|
||||
</>
|
||||
) : null}
|
||||
|
||||
{optional.length > 0 ? (
|
||||
{partition.optional && partition.optional.length > 0 ? (
|
||||
<>
|
||||
<div className={styles.subListHeader}>
|
||||
{t[
|
||||
'com.affine.settings.workspace.properties.general-properties'
|
||||
]()}
|
||||
</div>
|
||||
<CustomPropertyRows properties={optional} statistics={statistics} />
|
||||
<CustomPropertyRows
|
||||
properties={partition.optional}
|
||||
statistics={statistics}
|
||||
/>
|
||||
</>
|
||||
) : null}
|
||||
|
||||
{partition.readonly && partition.readonly.length > 0 ? (
|
||||
<>
|
||||
<div className={styles.subListHeader}>
|
||||
{t[
|
||||
'com.affine.settings.workspace.properties.readonly-properties'
|
||||
]()}
|
||||
</div>
|
||||
<CustomPropertyRows
|
||||
properties={partition.readonly}
|
||||
statistics={statistics}
|
||||
/>
|
||||
</>
|
||||
) : null}
|
||||
</>
|
||||
|
||||
@@ -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 =
|
||||
|
||||
@@ -1358,6 +1358,7 @@
|
||||
"com.affine.settings.workspace.properties.doc_others": "<0>{{count}}</0> 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}}</1> properties",
|
||||
"com.affine.settings.workspace.properties.header.title": "Properties",
|
||||
"com.affine.settings.workspace.properties.in-use": "In use",
|
||||
|
||||
Reference in New Issue
Block a user