feat: add open info button to doc center peek (#8388)
fix AF-1229 
This commit is contained in:
@@ -4,6 +4,7 @@ import type { DocMode } from '@blocksuite/affine/blocks';
|
|||||||
import {
|
import {
|
||||||
CloseIcon,
|
CloseIcon,
|
||||||
ExpandFullIcon,
|
ExpandFullIcon,
|
||||||
|
InformationIcon,
|
||||||
OpenInNewIcon,
|
OpenInNewIcon,
|
||||||
SplitViewIcon,
|
SplitViewIcon,
|
||||||
} from '@blocksuite/icons/rc';
|
} from '@blocksuite/icons/rc';
|
||||||
@@ -17,6 +18,7 @@ import {
|
|||||||
useMemo,
|
useMemo,
|
||||||
} from 'react';
|
} from 'react';
|
||||||
|
|
||||||
|
import { DocInfoService } from '../../doc-info';
|
||||||
import { WorkbenchService } from '../../workbench';
|
import { WorkbenchService } from '../../workbench';
|
||||||
import { PeekViewService } from '../services/peek-view';
|
import { PeekViewService } from '../services/peek-view';
|
||||||
import * as styles from './peek-view-controls.css';
|
import * as styles from './peek-view-controls.css';
|
||||||
@@ -100,6 +102,7 @@ export const DocPeekViewControls = ({
|
|||||||
const peekView = useService(PeekViewService).peekView;
|
const peekView = useService(PeekViewService).peekView;
|
||||||
const workbench = useService(WorkbenchService).workbench;
|
const workbench = useService(WorkbenchService).workbench;
|
||||||
const t = useI18n();
|
const t = useI18n();
|
||||||
|
const docInfoService = useService(DocInfoService);
|
||||||
const controls = useMemo(() => {
|
const controls = useMemo(() => {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
@@ -138,8 +141,25 @@ export const DocPeekViewControls = ({
|
|||||||
peekView.close('none');
|
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));
|
].filter((opt): opt is ControlButtonProps => Boolean(opt));
|
||||||
}, [docId, mode, blockIds, elementIds, peekView, t, workbench]);
|
}, [
|
||||||
|
t,
|
||||||
|
peekView,
|
||||||
|
workbench,
|
||||||
|
docId,
|
||||||
|
mode,
|
||||||
|
blockIds,
|
||||||
|
elementIds,
|
||||||
|
docInfoService.modal,
|
||||||
|
]);
|
||||||
return (
|
return (
|
||||||
<div {...rest} className={clsx(styles.root, className)}>
|
<div {...rest} className={clsx(styles.root, className)}>
|
||||||
{controls.map(option => (
|
{controls.map(option => (
|
||||||
|
|||||||
@@ -882,6 +882,7 @@
|
|||||||
"com.affine.peek-view-controls.open-doc": "Open this doc",
|
"com.affine.peek-view-controls.open-doc": "Open this doc",
|
||||||
"com.affine.peek-view-controls.open-doc-in-new-tab": "Open in new tab",
|
"com.affine.peek-view-controls.open-doc-in-new-tab": "Open in new tab",
|
||||||
"com.affine.peek-view-controls.open-doc-in-split-view": "Open in split view",
|
"com.affine.peek-view-controls.open-doc-in-split-view": "Open in split view",
|
||||||
|
"com.affine.peek-view-controls.open-info": "Open doc info",
|
||||||
"com.affine.quicksearch.group.creation": "New",
|
"com.affine.quicksearch.group.creation": "New",
|
||||||
"com.affine.quicksearch.group.searchfor": "Search for \"{{query}}\"",
|
"com.affine.quicksearch.group.searchfor": "Search for \"{{query}}\"",
|
||||||
"com.affine.resetSyncStatus.button": "Reset sync",
|
"com.affine.resetSyncStatus.button": "Reset sync",
|
||||||
|
|||||||
Reference in New Issue
Block a user