mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-06 03:49:56 +08:00
@@ -7,6 +7,7 @@ import {
|
|||||||
} from '@affine/component/page-list';
|
} from '@affine/component/page-list';
|
||||||
import type { Collection } from '@affine/env/filter';
|
import type { Collection } from '@affine/env/filter';
|
||||||
import type { GetPageInfoById } from '@affine/env/page-info';
|
import type { GetPageInfoById } from '@affine/env/page-info';
|
||||||
|
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
import {
|
import {
|
||||||
DeleteIcon,
|
DeleteIcon,
|
||||||
FilterIcon,
|
FilterIcon,
|
||||||
@@ -51,6 +52,7 @@ const CollectionOperations = ({
|
|||||||
showUpdateCollection: () => void;
|
showUpdateCollection: () => void;
|
||||||
setting: ReturnType<typeof useCollectionManager>;
|
setting: ReturnType<typeof useCollectionManager>;
|
||||||
}) => {
|
}) => {
|
||||||
|
const t = useAFFiNEI18N();
|
||||||
const actions = useMemo<
|
const actions = useMemo<
|
||||||
Array<
|
Array<
|
||||||
| {
|
| {
|
||||||
@@ -68,12 +70,12 @@ const CollectionOperations = ({
|
|||||||
() => [
|
() => [
|
||||||
{
|
{
|
||||||
icon: <FilterIcon />,
|
icon: <FilterIcon />,
|
||||||
name: 'Edit Filter',
|
name: t['Edit Filter'](),
|
||||||
click: showUpdateCollection,
|
click: showUpdateCollection,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: <UnpinIcon />,
|
icon: <UnpinIcon />,
|
||||||
name: 'Unpin',
|
name: t['Unpin'](),
|
||||||
click: () => {
|
click: () => {
|
||||||
return setting.updateCollection({
|
return setting.updateCollection({
|
||||||
...view,
|
...view,
|
||||||
@@ -86,14 +88,14 @@ const CollectionOperations = ({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: <DeleteIcon style={{ color: 'var(--affine-warning-color)' }} />,
|
icon: <DeleteIcon style={{ color: 'var(--affine-warning-color)' }} />,
|
||||||
name: 'Delete',
|
name: t['Delete'](),
|
||||||
click: () => {
|
click: () => {
|
||||||
return setting.deleteCollection(view.id);
|
return setting.deleteCollection(view.id);
|
||||||
},
|
},
|
||||||
className: styles.deleteFolder,
|
className: styles.deleteFolder,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[setting, showUpdateCollection, view]
|
[setting, showUpdateCollection, t, view]
|
||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
<div style={{ minWidth: 150 }}>
|
<div style={{ minWidth: 150 }}>
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ export const PageOperations = ({
|
|||||||
addToExcludeList: (id: string) => void;
|
addToExcludeList: (id: string) => void;
|
||||||
}) => {
|
}) => {
|
||||||
const { removeToTrash } = useBlockSuiteMetaHelper(workspace);
|
const { removeToTrash } = useBlockSuiteMetaHelper(workspace);
|
||||||
|
const t = useAFFiNEI18N();
|
||||||
const actions = useMemo<
|
const actions = useMemo<
|
||||||
Array<
|
Array<
|
||||||
| {
|
| {
|
||||||
@@ -58,7 +59,7 @@ export const PageOperations = ({
|
|||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
icon: <FilterMinusIcon />,
|
icon: <FilterMinusIcon />,
|
||||||
name: 'Remove special filter',
|
name: t['Remove special filter'](),
|
||||||
click: () => removeFromAllowList(page.id),
|
click: () => removeFromAllowList(page.id),
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
@@ -67,7 +68,7 @@ export const PageOperations = ({
|
|||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
icon: <FilterUndoIcon />,
|
icon: <FilterUndoIcon />,
|
||||||
name: 'Exclude from filter',
|
name: t['Exclude from filter'](),
|
||||||
click: () => addToExcludeList(page.id),
|
click: () => addToExcludeList(page.id),
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
@@ -77,7 +78,7 @@ export const PageOperations = ({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: <DeleteIcon style={{ color: 'var(--affine-warning-color)' }} />,
|
icon: <DeleteIcon style={{ color: 'var(--affine-warning-color)' }} />,
|
||||||
name: 'Delete',
|
name: t['Delete'](),
|
||||||
click: () => {
|
click: () => {
|
||||||
removeToTrash(page.id);
|
removeToTrash(page.id);
|
||||||
},
|
},
|
||||||
@@ -86,9 +87,10 @@ export const PageOperations = ({
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
inAllowList,
|
inAllowList,
|
||||||
|
t,
|
||||||
inExcludeList,
|
inExcludeList,
|
||||||
page.id,
|
|
||||||
removeFromAllowList,
|
removeFromAllowList,
|
||||||
|
page.id,
|
||||||
addToExcludeList,
|
addToExcludeList,
|
||||||
removeToTrash,
|
removeToTrash,
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { MenuLinkItem } from '@affine/component/app-sidebar';
|
import { MenuLinkItem } from '@affine/component/app-sidebar';
|
||||||
|
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
import { EdgelessIcon, PageIcon } from '@blocksuite/icons';
|
import { EdgelessIcon, PageIcon } from '@blocksuite/icons';
|
||||||
import type { PageMeta, Workspace } from '@blocksuite/store';
|
import type { PageMeta, Workspace } from '@blocksuite/store';
|
||||||
import * as Collapsible from '@radix-ui/react-collapsible';
|
import * as Collapsible from '@radix-ui/react-collapsible';
|
||||||
@@ -40,6 +41,7 @@ export const ReferencePage = ({
|
|||||||
const collapsible = referencesToShow.length > 0;
|
const collapsible = referencesToShow.length > 0;
|
||||||
const nestedItem = parentIds.size > 0;
|
const nestedItem = parentIds.size > 0;
|
||||||
const untitled = !metaMapping[pageId]?.title;
|
const untitled = !metaMapping[pageId]?.title;
|
||||||
|
const t = useAFFiNEI18N();
|
||||||
return (
|
return (
|
||||||
<Collapsible.Root
|
<Collapsible.Root
|
||||||
className={styles.favItemWrapper}
|
className={styles.favItemWrapper}
|
||||||
@@ -56,7 +58,7 @@ export const ReferencePage = ({
|
|||||||
onCollapsedChange={setCollapsed}
|
onCollapsedChange={setCollapsed}
|
||||||
>
|
>
|
||||||
<span className={styles.label} data-untitled={untitled}>
|
<span className={styles.label} data-untitled={untitled}>
|
||||||
{metaMapping[pageId]?.title || 'Untitled'}
|
{metaMapping[pageId]?.title || t['Untitled']()}
|
||||||
</span>
|
</span>
|
||||||
</MenuLinkItem>
|
</MenuLinkItem>
|
||||||
{collapsible && (
|
{collapsible && (
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ export const FilterTag = ({ name }: FilterTagProps) => {
|
|||||||
return t['Created']();
|
return t['Created']();
|
||||||
case 'Updated':
|
case 'Updated':
|
||||||
return t['Updated']();
|
return t['Updated']();
|
||||||
|
case 'Tags':
|
||||||
|
return t['Tags']();
|
||||||
case 'Is Favourited':
|
case 'Is Favourited':
|
||||||
return t['com.affine.filter.is-favourited']();
|
return t['com.affine.filter.is-favourited']();
|
||||||
case 'after':
|
case 'after':
|
||||||
@@ -19,6 +21,18 @@ export const FilterTag = ({ name }: FilterTagProps) => {
|
|||||||
return t['com.affine.filter.before']();
|
return t['com.affine.filter.before']();
|
||||||
case 'is':
|
case 'is':
|
||||||
return t['com.affine.filter.is']();
|
return t['com.affine.filter.is']();
|
||||||
|
case 'is not empty':
|
||||||
|
return t['com.affine.filter.is not empty']();
|
||||||
|
case 'is empty':
|
||||||
|
return t['com.affine.filter.is empty']();
|
||||||
|
case 'contains all':
|
||||||
|
return t['com.affine.filter.contains all']();
|
||||||
|
case 'contains one of':
|
||||||
|
return t['com.affine.filter.contains one of']();
|
||||||
|
case 'does not contains all':
|
||||||
|
return t['com.affine.filter.does not contains all']();
|
||||||
|
case 'does not contains one of':
|
||||||
|
return t['com.affine.filter.does not contains one of']();
|
||||||
case 'true':
|
case 'true':
|
||||||
return t['com.affine.filter.true']();
|
return t['com.affine.filter.true']();
|
||||||
case 'false':
|
case 'false':
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { EditCollectionModel } from '@affine/component/page-list';
|
import { EditCollectionModel } from '@affine/component/page-list';
|
||||||
import type { PropertiesMeta } from '@affine/env/filter';
|
import type { PropertiesMeta } from '@affine/env/filter';
|
||||||
import type { GetPageInfoById } from '@affine/env/page-info';
|
import type { GetPageInfoById } from '@affine/env/page-info';
|
||||||
|
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
import {
|
import {
|
||||||
DeleteIcon,
|
DeleteIcon,
|
||||||
FilterIcon,
|
FilterIcon,
|
||||||
@@ -80,6 +81,7 @@ export const CollectionBar = ({
|
|||||||
[setting, collection]
|
[setting, collection]
|
||||||
);
|
);
|
||||||
const onClose = useCallback(() => setOpen(false), []);
|
const onClose = useCallback(() => setOpen(false), []);
|
||||||
|
const t = useAFFiNEI18N();
|
||||||
return !setting.isDefault ? (
|
return !setting.isDefault ? (
|
||||||
<tr style={{ userSelect: 'none' }}>
|
<tr style={{ userSelect: 'none' }}>
|
||||||
<td>
|
<td>
|
||||||
@@ -124,8 +126,11 @@ export const CollectionBar = ({
|
|||||||
justifyContent: 'end',
|
justifyContent: 'end',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Button style={{ border: 'none' }} onClick={() => setting.backToAll()}>
|
<Button
|
||||||
Back to all
|
style={{ border: 'none', position: 'static' }}
|
||||||
|
onClick={() => setting.backToAll()}
|
||||||
|
>
|
||||||
|
{t['Back to all']()}
|
||||||
</Button>
|
</Button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import type { Collection } from '@affine/env/filter';
|
import type { Collection } from '@affine/env/filter';
|
||||||
import type { PropertiesMeta } from '@affine/env/filter';
|
import type { PropertiesMeta } from '@affine/env/filter';
|
||||||
import type { GetPageInfoById } from '@affine/env/page-info';
|
import type { GetPageInfoById } from '@affine/env/page-info';
|
||||||
|
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
import {
|
import {
|
||||||
EdgelessIcon,
|
EdgelessIcon,
|
||||||
PageIcon,
|
PageIcon,
|
||||||
@@ -35,14 +36,17 @@ export const EditCollectionModel = ({
|
|||||||
onClose,
|
onClose,
|
||||||
getPageInfo,
|
getPageInfo,
|
||||||
propertiesMeta,
|
propertiesMeta,
|
||||||
|
title,
|
||||||
}: {
|
}: {
|
||||||
init?: Collection;
|
init?: Collection;
|
||||||
onConfirm: (view: Collection) => void;
|
onConfirm: (view: Collection) => void;
|
||||||
open: boolean;
|
open: boolean;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
|
title?: string;
|
||||||
getPageInfo: GetPageInfoById;
|
getPageInfo: GetPageInfoById;
|
||||||
propertiesMeta: PropertiesMeta;
|
propertiesMeta: PropertiesMeta;
|
||||||
}) => {
|
}) => {
|
||||||
|
const t = useAFFiNEI18N();
|
||||||
return (
|
return (
|
||||||
<Modal open={open} onClose={onClose}>
|
<Modal open={open} onClose={onClose}>
|
||||||
<ModalWrapper
|
<ModalWrapper
|
||||||
@@ -61,8 +65,8 @@ export const EditCollectionModel = ({
|
|||||||
{init ? (
|
{init ? (
|
||||||
<EditCollection
|
<EditCollection
|
||||||
propertiesMeta={propertiesMeta}
|
propertiesMeta={propertiesMeta}
|
||||||
title="Update Collection"
|
title={title}
|
||||||
onConfirmText="Save"
|
onConfirmText={t['Save']()}
|
||||||
init={init}
|
init={init}
|
||||||
getPageInfo={getPageInfo}
|
getPageInfo={getPageInfo}
|
||||||
onCancel={onClose}
|
onCancel={onClose}
|
||||||
@@ -129,6 +133,7 @@ export const EditCollection = ({
|
|||||||
}: CreateCollectionProps & {
|
}: CreateCollectionProps & {
|
||||||
onCancel: () => void;
|
onCancel: () => void;
|
||||||
}) => {
|
}) => {
|
||||||
|
const t = useAFFiNEI18N();
|
||||||
const [value, onChange] = useState<Collection>(init);
|
const [value, onChange] = useState<Collection>(init);
|
||||||
const removeFromExcludeList = useCallback(
|
const removeFromExcludeList = useCallback(
|
||||||
(id: string) => {
|
(id: string) => {
|
||||||
@@ -157,7 +162,7 @@ export const EditCollection = ({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className={styles.saveTitle}>
|
<div className={styles.saveTitle}>
|
||||||
{title ?? 'Save As New Collection'}
|
{title ?? t['Update Collection']()}
|
||||||
</div>
|
</div>
|
||||||
<ScrollableContainer
|
<ScrollableContainer
|
||||||
className={styles.scrollContainer}
|
className={styles.scrollContainer}
|
||||||
@@ -244,7 +249,7 @@ export const EditCollection = ({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Button className={styles.cancelButton} onClick={onCancel}>
|
<Button className={styles.cancelButton} onClick={onCancel}>
|
||||||
Cancel
|
{t['Cancel']()}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
style={{
|
style={{
|
||||||
@@ -259,7 +264,7 @@ export const EditCollection = ({
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{onConfirmText ?? 'Create'}
|
{onConfirmText ?? t['Create']()}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -272,6 +277,7 @@ export const SaveCollectionButton = ({
|
|||||||
propertiesMeta,
|
propertiesMeta,
|
||||||
}: CreateCollectionProps) => {
|
}: CreateCollectionProps) => {
|
||||||
const [show, changeShow] = useState(false);
|
const [show, changeShow] = useState(false);
|
||||||
|
const t = useAFFiNEI18N();
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Button
|
<Button
|
||||||
@@ -288,6 +294,7 @@ export const SaveCollectionButton = ({
|
|||||||
</div>
|
</div>
|
||||||
</Button>
|
</Button>
|
||||||
<EditCollectionModel
|
<EditCollectionModel
|
||||||
|
title={t['Save As New Collection']()}
|
||||||
propertiesMeta={propertiesMeta}
|
propertiesMeta={propertiesMeta}
|
||||||
init={init}
|
init={init}
|
||||||
onConfirm={onConfirm}
|
onConfirm={onConfirm}
|
||||||
|
|||||||
@@ -61,6 +61,12 @@
|
|||||||
"Export AFFiNE backup file": "Export AFFiNE backup file",
|
"Export AFFiNE backup file": "Export AFFiNE backup file",
|
||||||
"com.affine.filter.before": "before",
|
"com.affine.filter.before": "before",
|
||||||
"com.affine.filter.is": "is",
|
"com.affine.filter.is": "is",
|
||||||
|
"com.affine.filter.is not empty": "is not empty",
|
||||||
|
"com.affine.filter.is empty": "is empty",
|
||||||
|
"com.affine.filter.contains all": "contains all",
|
||||||
|
"com.affine.filter.contains one of": "contains one of",
|
||||||
|
"com.affine.filter.does not contains all": "does not contains all",
|
||||||
|
"com.affine.filter.does not contains one of": "does not contains one of",
|
||||||
"com.affine.filter.true": "true",
|
"com.affine.filter.true": "true",
|
||||||
"com.affine.filter.false": "false",
|
"com.affine.filter.false": "false",
|
||||||
"com.affine.filter.save-view": "Save View",
|
"com.affine.filter.save-view": "Save View",
|
||||||
@@ -364,6 +370,13 @@
|
|||||||
"Date Format": "Date Format",
|
"Date Format": "Date Format",
|
||||||
"Select All": "Select All",
|
"Select All": "Select All",
|
||||||
"Collections": "Collections",
|
"Collections": "Collections",
|
||||||
|
"Save As New Collection": "Save As New Collection",
|
||||||
|
"Update Collection": "Update Collection",
|
||||||
|
"Back to all": "Back to all",
|
||||||
|
"Edit Filter": "Edit Filter",
|
||||||
|
"Unpin": "Unpin",
|
||||||
|
"Remove special filter": "Remove special filter",
|
||||||
|
"Exclude from filter": "Exclude from filter",
|
||||||
"Customize your date style.": "Customise your date style.",
|
"Customize your date style.": "Customise your date style.",
|
||||||
"Contact with us": "Contact Us",
|
"Contact with us": "Contact Us",
|
||||||
"Terms of Use": "Terms of Use",
|
"Terms of Use": "Terms of Use",
|
||||||
|
|||||||
Reference in New Issue
Block a user