feat(core): add context menu to card view (#13258)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added a context menu to document cards, allowing additional actions when enabled. * **Improvements** * The context menu is now conditionally enabled based on live data, ensuring it only appears when relevant. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -371,12 +371,18 @@ export const CardViewDoc = ({ docId }: DocListItemProps) => {
|
||||
const selectMode = useLiveData(contextValue.selectMode$);
|
||||
const docsService = useService(DocsService);
|
||||
const doc = useLiveData(docsService.list.doc$(docId));
|
||||
const showMoreOperation = useLiveData(contextValue.showMoreOperation$);
|
||||
|
||||
if (!doc) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<ContextMenu
|
||||
asChild
|
||||
disabled={!showMoreOperation}
|
||||
items={<MoreMenuContent docId={docId} />}
|
||||
>
|
||||
<li className={styles.cardViewRoot}>
|
||||
<DragHandle id={docId} className={styles.cardDragHandle} />
|
||||
<header className={styles.cardViewHeader}>
|
||||
@@ -406,5 +412,6 @@ export const CardViewDoc = ({ docId }: DocListItemProps) => {
|
||||
<DocPreview id={docId} className={styles.cardPreviewContainer} />
|
||||
<CardViewProperties docId={docId} />
|
||||
</li>
|
||||
</ContextMenu>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user