fix(core): correct card view properties display (#12401)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Refactor** - Improved the layout of property display in the card view by consolidating all properties into a single container and streamlining the rendering structure. - Updated filtering to exclude properties of type "tags" from stack properties. - **Style** - Simplified the visual structure for properties, removing unnecessary nested containers for a cleaner appearance. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -36,14 +36,16 @@ const useProperties = (view: 'list' | 'card') => {
|
|||||||
|
|
||||||
const stackProperties = useMemo(
|
const stackProperties = useMemo(
|
||||||
() =>
|
() =>
|
||||||
explorerPropertyList.filter(
|
explorerPropertyList
|
||||||
property =>
|
.filter(
|
||||||
(property.systemProperty &&
|
property =>
|
||||||
property.systemProperty.showInDocList === 'stack') ||
|
(property.systemProperty &&
|
||||||
(property.workspaceProperty &&
|
property.systemProperty.showInDocList === 'stack') ||
|
||||||
WorkspacePropertyTypes[property.workspaceProperty.type]
|
(property.workspaceProperty &&
|
||||||
.showInDocList === 'stack')
|
WorkspacePropertyTypes[property.workspaceProperty.type]
|
||||||
),
|
.showInDocList === 'stack')
|
||||||
|
)
|
||||||
|
.filter(p => p.systemProperty?.type !== 'tags'),
|
||||||
[explorerPropertyList]
|
[explorerPropertyList]
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -191,50 +193,7 @@ export const CardViewProperties = ({ docId }: { docId: string }) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<div className={styles.cardProperties}>
|
||||||
{/* stack properties */}
|
|
||||||
<div className={styles.stackContainer}>
|
|
||||||
<div className={styles.stackProperties}>
|
|
||||||
{stackProperties.map(({ systemProperty, workspaceProperty }) => {
|
|
||||||
const displayKeys = [
|
|
||||||
systemProperty ? `system:${systemProperty.type}` : null,
|
|
||||||
workspaceProperty ? `property:${workspaceProperty.id}` : null,
|
|
||||||
];
|
|
||||||
if (
|
|
||||||
!displayKeys.some(key => key && displayProperties?.includes(key))
|
|
||||||
) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (systemProperty) {
|
|
||||||
return (
|
|
||||||
<SystemPropertyRenderer
|
|
||||||
doc={doc}
|
|
||||||
config={SystemPropertyTypes[systemProperty.type]}
|
|
||||||
key={systemProperty.type}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
} else if (workspaceProperty) {
|
|
||||||
return (
|
|
||||||
<WorkspacePropertyRenderer
|
|
||||||
key={workspaceProperty.id}
|
|
||||||
doc={doc}
|
|
||||||
property={workspaceProperty}
|
|
||||||
config={WorkspacePropertyTypes[workspaceProperty.type]}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
})}
|
|
||||||
</div>
|
|
||||||
{displayProperties?.includes('system:tags') ? (
|
|
||||||
<div className={styles.stackProperties}>
|
|
||||||
<SystemPropertyRenderer
|
|
||||||
doc={doc}
|
|
||||||
config={SystemPropertyTypes.tags}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
</div>
|
|
||||||
{/* inline properties */}
|
{/* inline properties */}
|
||||||
{inlineProperties.map(({ systemProperty, workspaceProperty }) => {
|
{inlineProperties.map(({ systemProperty, workspaceProperty }) => {
|
||||||
const displayKeys = [
|
const displayKeys = [
|
||||||
@@ -265,7 +224,39 @@ export const CardViewProperties = ({ docId }: { docId: string }) => {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
})}
|
})}
|
||||||
</>
|
{/* stack properties */}
|
||||||
|
{stackProperties.map(({ systemProperty, workspaceProperty }) => {
|
||||||
|
const displayKeys = [
|
||||||
|
systemProperty ? `system:${systemProperty.type}` : null,
|
||||||
|
workspaceProperty ? `property:${workspaceProperty.id}` : null,
|
||||||
|
];
|
||||||
|
if (!displayKeys.some(key => key && displayProperties?.includes(key))) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (systemProperty) {
|
||||||
|
return (
|
||||||
|
<SystemPropertyRenderer
|
||||||
|
doc={doc}
|
||||||
|
config={SystemPropertyTypes[systemProperty.type]}
|
||||||
|
key={systemProperty.type}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
} else if (workspaceProperty) {
|
||||||
|
return (
|
||||||
|
<WorkspacePropertyRenderer
|
||||||
|
key={workspaceProperty.id}
|
||||||
|
doc={doc}
|
||||||
|
property={workspaceProperty}
|
||||||
|
config={WorkspacePropertyTypes[workspaceProperty.type]}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
})}
|
||||||
|
{displayProperties?.includes('system:tags') ? (
|
||||||
|
<SystemPropertyRenderer doc={doc} config={SystemPropertyTypes.tags} />
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user