mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-27 02:42:25 +08:00
feat(core): add tooltips to the doc properties in the sidebar (#8684)
close AF-1597
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Divider, IconButton } from '@affine/component';
|
||||
import { Divider, IconButton, Tooltip } from '@affine/component';
|
||||
import { generateUniqueNameInSequence } from '@affine/core/utils/unique-name';
|
||||
import { useI18n } from '@affine/i18n';
|
||||
import { PlusIcon } from '@blocksuite/icons/rc';
|
||||
@@ -77,27 +77,32 @@ export const DocPropertySidebar = () => {
|
||||
meta => meta.id === value.uniqueId
|
||||
);
|
||||
return (
|
||||
<div
|
||||
className={styles.itemContainer}
|
||||
<Tooltip
|
||||
key={key}
|
||||
onClick={() => {
|
||||
onAddProperty({
|
||||
type: key,
|
||||
name,
|
||||
});
|
||||
}}
|
||||
data-disabled={isUniqueExist}
|
||||
content={t.t(value.description || value.name)}
|
||||
side="left"
|
||||
>
|
||||
<Icon className={styles.itemIcon} />
|
||||
<span className={styles.itemName}>{t.t(value.name)}</span>
|
||||
{isUniqueExist ? (
|
||||
<span className={styles.itemAdded}>Added</span>
|
||||
) : (
|
||||
<IconButton size={20} iconClassName={styles.itemAdd}>
|
||||
<PlusIcon />
|
||||
</IconButton>
|
||||
)}
|
||||
</div>
|
||||
<div
|
||||
className={styles.itemContainer}
|
||||
onClick={() => {
|
||||
onAddProperty({
|
||||
type: key,
|
||||
name,
|
||||
});
|
||||
}}
|
||||
data-disabled={isUniqueExist}
|
||||
>
|
||||
<Icon className={styles.itemIcon} />
|
||||
<span className={styles.itemName}>{t.t(value.name)}</span>
|
||||
{isUniqueExist ? (
|
||||
<span className={styles.itemAdded}>Added</span>
|
||||
) : (
|
||||
<IconButton size={20} iconClassName={styles.itemAdd}>
|
||||
<PlusIcon />
|
||||
</IconButton>
|
||||
)}
|
||||
</div>
|
||||
</Tooltip>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
||||
@@ -72,12 +72,14 @@ export const DocPropertyTypes = {
|
||||
icon: DateTimeIcon,
|
||||
value: UpdatedDateValue,
|
||||
name: 'com.affine.page-properties.property.updatedAt',
|
||||
description: 'com.affine.page-properties.property.updatedAt.tooltips',
|
||||
renameable: false,
|
||||
},
|
||||
createdAt: {
|
||||
icon: HistoryIcon,
|
||||
value: CreateDateValue,
|
||||
name: 'com.affine.page-properties.property.createdAt',
|
||||
description: 'com.affine.page-properties.property.createdAt.tooltips',
|
||||
renameable: false,
|
||||
},
|
||||
docPrimaryMode: {
|
||||
|
||||
Reference in New Issue
Block a user