fix: some typo and i18n (#3155)

(cherry picked from commit 6ad2d106bc)
This commit is contained in:
3720
2023-07-11 19:04:45 +08:00
committed by Alex Yang
parent b0bb925ef6
commit 2c9c4c2cd3
7 changed files with 61 additions and 16 deletions

View File

@@ -7,6 +7,7 @@ import {
} from '@affine/component/page-list';
import type { Collection } from '@affine/env/filter';
import type { GetPageInfoById } from '@affine/env/page-info';
import { useAFFiNEI18N } from '@affine/i18n/hooks';
import {
DeleteIcon,
FilterIcon,
@@ -51,6 +52,7 @@ const CollectionOperations = ({
showUpdateCollection: () => void;
setting: ReturnType<typeof useCollectionManager>;
}) => {
const t = useAFFiNEI18N();
const actions = useMemo<
Array<
| {
@@ -68,12 +70,12 @@ const CollectionOperations = ({
() => [
{
icon: <FilterIcon />,
name: 'Edit Filter',
name: t['Edit Filter'](),
click: showUpdateCollection,
},
{
icon: <UnpinIcon />,
name: 'Unpin',
name: t['Unpin'](),
click: () => {
return setting.updateCollection({
...view,
@@ -86,14 +88,14 @@ const CollectionOperations = ({
},
{
icon: <DeleteIcon style={{ color: 'var(--affine-warning-color)' }} />,
name: 'Delete',
name: t['Delete'](),
click: () => {
return setting.deleteCollection(view.id);
},
className: styles.deleteFolder,
},
],
[setting, showUpdateCollection, view]
[setting, showUpdateCollection, t, view]
);
return (
<div style={{ minWidth: 150 }}>

View File

@@ -39,6 +39,7 @@ export const PageOperations = ({
addToExcludeList: (id: string) => void;
}) => {
const { removeToTrash } = useBlockSuiteMetaHelper(workspace);
const t = useAFFiNEI18N();
const actions = useMemo<
Array<
| {
@@ -58,7 +59,7 @@ export const PageOperations = ({
? [
{
icon: <FilterMinusIcon />,
name: 'Remove special filter',
name: t['Remove special filter'](),
click: () => removeFromAllowList(page.id),
},
]
@@ -67,7 +68,7 @@ export const PageOperations = ({
? [
{
icon: <FilterUndoIcon />,
name: 'Exclude from filter',
name: t['Exclude from filter'](),
click: () => addToExcludeList(page.id),
},
]
@@ -77,7 +78,7 @@ export const PageOperations = ({
},
{
icon: <DeleteIcon style={{ color: 'var(--affine-warning-color)' }} />,
name: 'Delete',
name: t['Delete'](),
click: () => {
removeToTrash(page.id);
},
@@ -86,9 +87,10 @@ export const PageOperations = ({
],
[
inAllowList,
t,
inExcludeList,
page.id,
removeFromAllowList,
page.id,
addToExcludeList,
removeToTrash,
]

View File

@@ -1,4 +1,5 @@
import { MenuLinkItem } from '@affine/component/app-sidebar';
import { useAFFiNEI18N } from '@affine/i18n/hooks';
import { EdgelessIcon, PageIcon } from '@blocksuite/icons';
import type { PageMeta, Workspace } from '@blocksuite/store';
import * as Collapsible from '@radix-ui/react-collapsible';
@@ -40,6 +41,7 @@ export const ReferencePage = ({
const collapsible = referencesToShow.length > 0;
const nestedItem = parentIds.size > 0;
const untitled = !metaMapping[pageId]?.title;
const t = useAFFiNEI18N();
return (
<Collapsible.Root
className={styles.favItemWrapper}
@@ -56,7 +58,7 @@ export const ReferencePage = ({
onCollapsedChange={setCollapsed}
>
<span className={styles.label} data-untitled={untitled}>
{metaMapping[pageId]?.title || 'Untitled'}
{metaMapping[pageId]?.title || t['Untitled']()}
</span>
</MenuLinkItem>
{collapsible && (