feat: add open info button to doc center peek (#8388)

fix AF-1229

![image](https://github.com/user-attachments/assets/3e7b43ad-43c6-4dfb-b737-5dffb1396b6b)
This commit is contained in:
pengx17
2024-09-25 09:11:24 +00:00
parent 0416e51c83
commit 76ff56a716
2 changed files with 22 additions and 1 deletions

View File

@@ -4,6 +4,7 @@ import type { DocMode } from '@blocksuite/affine/blocks';
import {
CloseIcon,
ExpandFullIcon,
InformationIcon,
OpenInNewIcon,
SplitViewIcon,
} from '@blocksuite/icons/rc';
@@ -17,6 +18,7 @@ import {
useMemo,
} from 'react';
import { DocInfoService } from '../../doc-info';
import { WorkbenchService } from '../../workbench';
import { PeekViewService } from '../services/peek-view';
import * as styles from './peek-view-controls.css';
@@ -100,6 +102,7 @@ export const DocPeekViewControls = ({
const peekView = useService(PeekViewService).peekView;
const workbench = useService(WorkbenchService).workbench;
const t = useI18n();
const docInfoService = useService(DocInfoService);
const controls = useMemo(() => {
return [
{
@@ -138,8 +141,25 @@ export const DocPeekViewControls = ({
peekView.close('none');
},
},
{
icon: <InformationIcon />,
nameKey: 'info',
name: t['com.affine.peek-view-controls.open-info'](),
onClick: () => {
docInfoService.modal.open(docId);
},
},
].filter((opt): opt is ControlButtonProps => Boolean(opt));
}, [docId, mode, blockIds, elementIds, peekView, t, workbench]);
}, [
t,
peekView,
workbench,
docId,
mode,
blockIds,
elementIds,
docInfoService.modal,
]);
return (
<div {...rest} className={clsx(styles.root, className)}>
{controls.map(option => (