Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

Merge branch 'feat/poc' into feat/datacenter

JimmFlyd8a580dfae7b
diff --cc packages/app/src/components/header/QuickSearchButton.tsx
index ffe1fe7e14,0c1732adb1..a1c68ffba8
--- a/packages/app/src/components/header/QuickSearchButton.tsx
+++ b/packages/app/src/components/header/QuickSearchButton.tsx
@@@ -25,8 -11,8 +25,8 @@@ export const QuickSearchButton = (
const { triggerQuickSearchModal } = useModal();
const { t } = useTranslation();
return (
-- <Tooltip content={t('Switch to')} placement="bottom">
- <IconButton
++ <Tooltip content={t('Jump to')} placement="bottom">
+ <StyledIconButtonWithAnimate
data-testid="header-quickSearchButton"
{...props}
onClick={e => {
diff --cc packages/app/src/components/header/utils.tsx
index dd9ff50127,30f67418bd..1bf0fc88f6
--- a/packages/app/src/components/header/utils.tsx
+++ b/packages/app/src/components/header/utils.tsx
@@@ -1,4 -1,5 +1,5 @@@
import getIsMobile from '@/utils/get-is-mobile';
-import { Trans, useTranslation } from 'react-i18next';
++import { Trans, useTranslation } from '@affine/i18n';
// Inspire by https://stackoverflow.com/a/4900484/8415727
const getChromeVersion = () => {
const raw = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);
diff --cc packages/app/src/components/loading/PageLoading.tsx
index 025eba7687,0369d19b6f..ef853c4d61
--- a/packages/app/src/components/loading/PageLoading.tsx
+++ b/packages/app/src/components/loading/PageLoading.tsx
@@@ -1,5 -1,6 +1,6 @@@
import { styled } from '@/styles';
import Loading from './Loading';
-import { useTranslation } from 'react-i18next';
++import { useTranslation } from '@affine/i18n';
// Used for the full page loading
const StyledLoadingContainer = styled('div')(() => {
diff --cc packages/app/src/components/login-modal/LoginOptionButton.tsx
index c1384bc8eb,3da3010127..dd1d51cc66
--- a/packages/app/src/components/login-modal/LoginOptionButton.tsx
+++ b/packages/app/src/components/login-modal/LoginOptionButton.tsx
@@@ -3,9 -3,10 +3,10 @@@ import { styled } from '@/styles'
import { Button } from '@/ui/button';
// import { useModal } from '@/providers/GlobalModalProvider';
import { GoogleIcon, StayLogOutIcon } from './Icons';
-
-import { useTranslation } from 'react-i18next';
++import { useTranslation } from '@affine/i18n';
export const GoogleLoginButton = () => {
// const { triggerLoginModal } = useModal();
+ const { t } = useTranslation();
return (
<StyledGoogleButton
onClick={() => {
diff --cc packages/app/src/components/login-modal/index.tsx
index f398383196,1af4aab2ae..a754c76191
--- a/packages/app/src/components/login-modal/index.tsx
+++ b/packages/app/src/components/login-modal/index.tsx
@@@ -3,7 -3,7 +3,7 @@@ import { styled } from '@/styles'
import { Modal, ModalWrapper, ModalCloseButton } from '@/ui/modal';
import { TextButton } from '@/ui/button';
import { GoogleLoginButton, StayLogOutButton } from './LoginOptionButton';
-
-import { useTranslation } from 'react-i18next';
++import { useTranslation } from '@affine/i18n';
interface LoginModalProps {
open: boolean;
onClose: () => void;
diff --cc packages/app/src/components/mobile-modal/index.tsx
index ff9796359b,9142a5f170..b568c2697d
--- a/packages/app/src/components/mobile-modal/index.tsx
+++ b/packages/app/src/components/mobile-modal/index.tsx
@@@ -3,8 -3,10 +3,10 @@@ import Modal, { ModalCloseButton, Modal
import getIsMobile from '@/utils/get-is-mobile';
import { StyledButton, StyledContent, StyledTitle } from './styles';
import bg from './bg.png';
-import { useTranslation } from 'react-i18next';
++import { useTranslation } from '@affine/i18n';
export const MobileModal = () => {
const [showModal, setShowModal] = useState(getIsMobile());
+ const { t } = useTranslation();
return (
<Modal
open={showModal}
diff --cc packages/app/src/components/page-list/Empty.tsx
index ef13e1b117,f7a4e838b4..4430b8f1a9
--- a/packages/app/src/components/page-list/Empty.tsx
+++ b/packages/app/src/components/page-list/Empty.tsx
@@@ -1,6 -1,9 +1,9 @@@
import React from 'react';
import { Empty } from '@/ui/empty';
- export const PageListEmpty = () => {
-import { useTranslation } from 'react-i18next';
-export const PageListEmpty = (props: { listType: string }) => {
++import { useTranslation } from '@affine/i18n';
++export const PageListEmpty = (props: { listType?: string }) => {
+ const { listType } = props;
+ const { t } = useTranslation();
return (
<div style={{ textAlign: 'center' }}>
<Empty
diff --cc packages/app/src/components/page-list/index.tsx
index c275e8295b,1423406d58..7623eb4895
--- a/packages/app/src/components/page-list/index.tsx
+++ b/packages/app/src/components/page-list/index.tsx
@@@ -67,18 -67,18 +67,20 @@@ export const PageList = (
pageList,
showFavoriteTag = false,
isTrash = false,
+ isPublic = false,
+ listType,
}: {
pageList: PageMeta[];
showFavoriteTag?: boolean;
isTrash?: boolean;
+ isPublic?: boolean;
+ listType?: 'all' | 'trash' | 'favorite';
}) => {
const router = useRouter();
- const { currentWorkspaceId } = useAppState();
+ const { currentWorkspace } = useAppState();
const { t } = useTranslation();
if (pageList.length === 0) {
- return <Empty />;
+ return <Empty listType={listType} />;
}
return (
diff --cc packages/app/src/components/quick-search/Input.tsx
index 83ff131f71,960f764c2c..6d96d239b0
--- a/packages/app/src/components/quick-search/Input.tsx
+++ b/packages/app/src/components/quick-search/Input.tsx
@@@ -9,6 -9,7 +9,7 @@@ import { SearchIcon } from '@blocksuite
import { StyledInputContent, StyledLabel } from './style';
import { Command } from 'cmdk';
import { useAppState } from '@/providers/app-state-provider';
-import { useTranslation } from 'react-i18next';
++import { useTranslation } from '@affine/i18n';
export const Input = (props: {
query: string;
setQuery: Dispatch<SetStateAction<string>>;
@@@ -17,8 -18,11 +18,8 @@@
const [isComposition, setIsComposition] = useState(false);
const [inputValue, setInputValue] = useState('');
const inputRef = useRef<HTMLInputElement>(null);
+ const { currentWorkspace } = useAppState();
-
+ const { t } = useTranslation();
- const { currentWorkspaceId, workspaceList, currentWorkspace } = useAppState();
- const isPublish = workspaceList.find(
- meta => String(meta.id) === String(currentWorkspaceId)
- )?.isPublish;
useEffect(() => {
inputRef.current?.addEventListener(
'blur',
@@@ -77,9 -81,11 +78,11 @@@
}
}}
placeholder={
- isPublish
+ currentWorkspace?.isPublish
- ? `Search in ${currentWorkspace?.blocksuiteWorkspace?.meta.name}`
- : 'Quick Search...'
+ ? t('Quick search placeholder2', {
- workspace = currentWorkspace?.meta.name,
++ workspace: currentWorkspace?.blocksuiteWorkspace?.meta.name,
+ })
+ : t('Quick search placeholder')
}
/>
</StyledInputContent>
diff --cc packages/app/src/components/quick-search/Results.tsx
index fe9cc5d883,fc22e97136..9e23c5f7c6
--- a/packages/app/src/components/quick-search/Results.tsx
+++ b/packages/app/src/components/quick-search/Results.tsx
@@@ -79,7 -81,7 +79,7 @@@ export const Results = (props:
</StyledNotFound>
)
) : (
-- <Command.Group heading={t('Switch to')}>
++ <Command.Group heading={t('Jump to')}>
{List.map(link => {
return (
<Command.Item
diff --cc packages/app/src/components/workspace-modal/index.tsx
index 4328224d8c,40142a256d..a5f2369c4b
--- a/packages/app/src/components/workspace-modal/index.tsx
+++ b/packages/app/src/components/workspace-modal/index.tsx
@@@ -13,8 -15,8 +13,9 @@@ import { toast } from '@/ui/toast'
import { WorkspaceAvatar } from '@/components/workspace-avatar';
import { useAppState } from '@/providers/app-state-provider';
import { useRouter } from 'next/router';
-import { useUserHelper } from '@/hooks/use-user-helper';
-import { useTranslation } from 'react-i18next';
+import { useConfirm } from '@/providers/ConfirmProvider';
++import { useTranslation } from '@affine/i18n';
+
interface WorkspaceModalProps {
open: boolean;
onClose: () => void;
@@@ -22,10 -24,11 +23,11 @@@
export const WorkspaceModal = ({ open, onClose }: WorkspaceModalProps) => {
const [createWorkspaceOpen, setCreateWorkspaceOpen] = useState(false);
- // const { confirm } = useConfirm();
- const { workspaceList, currentWorkspace } = useAppState();
- const { login, user } = useUserHelper();
+ const { confirm } = useConfirm();
+ const { workspaceList, currentWorkspace, login, user, logout } =
+ useAppState();
const router = useRouter();
+ const { t } = useTranslation();
return (
<div>
<Modal open={open} onClose={onClose}>
@@@ -135,33 -134,20 +137,33 @@@
<Footer>
{!user ? (
<Button
- onClick={() => {
- login();
+ onClick={async () => {
+ await login();
- toast('Login success');
+ toast(t('login success'));
}}
>
- Sign in AFFiNE Cloud
+ {t('Sign in')}
</Button>
) : (
<Button
onClick={() => {
- SignOut();
+ confirm({
+ title: 'Sign out?',
+ content: `All data has been stored in the cloud. `,
+ confirmText: 'Sign out',
+ cancelText: 'Cancel',
+ }).then(async confirm => {
+ if (confirm) {
+ if (user) {
+ await logout();
+ router.replace(`/workspace`);
+ toast('Enabled success');
+ }
+ }
+ });
}}
>
- Sign out of AFFiNE Cloud
+ {t('Sign out')}
</Button>
)}
</Footer>
diff --cc packages/app/src/components/workspace-setting/ExportPage.tsx
index e3bde461f9,fc95c119f2..83830f1777
--- a/packages/app/src/components/workspace-setting/ExportPage.tsx
+++ b/packages/app/src/components/workspace-setting/ExportPage.tsx
@@@ -1,6 -1,6 +1,6 @@@
import { styled } from '@/styles';
-import { Workspace } from '@affine/datacenter';
-import { Trans } from 'react-i18next';
+import { WorkspaceUnit } from '@affine/datacenter';
-
++import { Trans } from '@affine/i18n';
export const ExportPageTitleContainer = styled('div')(() => {
return {
display: 'flex',
@@@ -9,11 -9,16 +9,16 @@@
flex: 1,
};
});
-export const ExportPage = ({ workspace }: { workspace: Workspace }) => {
+export const ExportPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
return (
<ExportPageTitleContainer>
- Export Workspace{' '}
- <code style={{ margin: '0 10px' }}>{workspace.name}</code> Is Comming
+ <Trans i18nKey="Export Workspace">
+ Export Workspace
+ <code style={{ margin: '0 10px' }}>
+ {{ workspace: workspace.name }}
+ </code>
+ Is Comming
+ </Trans>
</ExportPageTitleContainer>
);
};
diff --cc packages/app/src/components/workspace-setting/PublishPage.tsx
index 6cc17f68f2,26961a221e..86fbf399f9
--- a/packages/app/src/components/workspace-setting/PublishPage.tsx
+++ b/packages/app/src/components/workspace-setting/PublishPage.tsx
@@@ -9,16 -9,21 +9,16 @@@ import
import { Button } from '@/ui/button';
import Input from '@/ui/input';
import { toast } from '@/ui/toast';
-import { useConfirm } from '@/providers/ConfirmProvider';
// import { useAppState } from '@/providers/app-state-provider3';
+import { WorkspaceUnit } from '@affine/datacenter';
import { useWorkspaceHelper } from '@/hooks/use-workspace-helper';
-import { Workspace } from '@affine/datacenter';
-import { useTranslation } from 'react-i18next';
--
-export const PublishPage = ({ workspace }: { workspace: Workspace }) => {
- const shareUrl =
- window.location.host + '/workspace/' + workspace.id + '?share=true';
- const { publishWorkspace } = useWorkspaceHelper();
++import { useTranslation } from '@affine/i18n';
+export const PublishPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
+ const shareUrl = window.location.host + '/public-workspace/' + workspace.id;
+ const { publishWorkspace, enableWorkspace } = useWorkspaceHelper();
-
+ const { t } = useTranslation();
- const { confirm } = useConfirm();
-
- const togglePublic = (flag: boolean) => {
- workspace.id && publishWorkspace(workspace?.id, flag);
+ const togglePublic = async (flag: boolean) => {
+ await publishWorkspace(workspace.id.toString(), flag);
};
const copyUrl = () => {
@@@ -31,15 -51,15 +31,15 @@@
};
return (
<>
- {workspace.provider === 'cloud' ? (
+ {workspace.provider === 'affine' ? (
<div>
<StyledPublishContent>
- {workspace?.isPublish ? (
+ {workspace?.published ? (
<>
<StyledPublishExplanation>
- Publishing to web requires AFFiNE Cloud service .
+ {t('Publishing')}
</StyledPublishExplanation>
- <StyledSettingH2>Share with link</StyledSettingH2>
+ <StyledSettingH2>{t('Share with link')}</StyledSettingH2>
<StyledPublishCopyContainer>
<Input width={500} value={shareUrl} disabled={true}></Input>
<StyledCopyButtonContainer>
diff --cc packages/app/src/components/workspace-setting/SyncPage.tsx
index d6345a294b,0cb0069d2d..fe677b33a1
--- a/packages/app/src/components/workspace-setting/SyncPage.tsx
+++ b/packages/app/src/components/workspace-setting/SyncPage.tsx
@@@ -6,19 -6,21 +6,21 @@@ import
import { DownloadIcon } from '@blocksuite/icons';
import { Button } from '@/ui/button';
import { Menu, MenuItem } from '@/ui/menu';
-import { useTemporaryHelper } from '@/providers/temporary-helper-provider';
-import { Workspace } from '@affine/datacenter';
-import { Trans, useTranslation } from 'react-i18next';
-export const SyncPage = ({ workspace }: { workspace: Workspace }) => {
- console.log('workspace: ', workspace);
- const { currentWorkspace, updateWorkspaceMeta } = useTemporaryHelper();
+import { WorkspaceUnit } from '@affine/datacenter';
+import { useWorkspaceHelper } from '@/hooks/use-workspace-helper';
++import { Trans, useTranslation } from '@affine/i18n';
+export const SyncPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
+ const { enableWorkspace } = useWorkspaceHelper();
+ const { t } = useTranslation();
-
return (
<div>
<StyledPublishContent>
- {currentWorkspace?.type === 'local' ? (
+ {workspace?.provider === 'local' ? (
<>
<StyledPublishExplanation>
- {workspace.name ?? 'Affine'} is Local Workspace. All data is
- stored on the current device. You can enable AFFiNE Cloud for this
- workspace to keep data in sync with the cloud.
- {t('Sync Description', { workspaceName: currentWorkspace.name })}
++ {t('Sync Description', {
++ workspaceName: workspace.name ?? 'Affine',
++ })}
</StyledPublishExplanation>
<StyledPublishCopyContainer>
@@@ -36,8 -40,13 +38,11 @@@
) : (
<>
<StyledPublishExplanation>
- <code>{workspace.name ?? 'Affine'}</code> is Cloud Workspace. All
- data will be synchronized and saved to the AFFiNE
+ <Trans i18nKey="Sync Description2">
- <code>
- {{ workspaceName: currentWorkspace && currentWorkspace.name }}
- </code>
- is Cloud Workspace. All data will be synchronized and saved to
++ <code>{{ workspaceName: workspace.name ?? 'Affine' }}</code>
++ is Cloud Workspace. All data will be synchronised and saved to
+ the AFFiNE
+ </Trans>
</StyledPublishExplanation>
<StyledPublishCopyContainer>
<Menu
diff --cc packages/app/src/components/workspace-setting/general/General.tsx
index 65e87496d0,6dee18e82e..4ba205c8cf
--- a/packages/app/src/components/workspace-setting/general/General.tsx
+++ b/packages/app/src/components/workspace-setting/general/General.tsx
@@@ -14,16 -14,23 +14,19 @@@ import { WorkspaceDelete } from './dele
import { WorkspaceLeave } from './leave';
import { Upload } from '@/components/file-upload';
import { WorkspaceAvatar } from '@/components/workspace-avatar';
-import { useTemporaryHelper } from '@/providers/temporary-helper-provider';
-import { Workspace } from '@affine/datacenter';
-import { useTranslation } from 'react-i18next';
-export const GeneralPage = ({ workspace }: { workspace: Workspace }) => {
- // const { refreshWorkspacesMeta } = useAppState();
- const { updateWorkspaceMeta } = useTemporaryHelper();
+import { WorkspaceUnit } from '@affine/datacenter';
+import { useWorkspaceHelper } from '@/hooks/use-workspace-helper';
++import { useTranslation } from '@affine/i18n';
+export const GeneralPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
const [showDelete, setShowDelete] = useState<boolean>(false);
const [showLeave, setShowLeave] = useState<boolean>(false);
const [uploading, setUploading] = useState<boolean>(false);
- const [workspaceName, setWorkspaceName] = useState<string>('');
+ const [workspaceName, setWorkspaceName] = useState<string>(workspace.name);
+ const { currentWorkspace } = useAppState();
+ const { updateWorkspace } = useWorkspaceHelper();
+ const { t } = useTranslation();
- // const debouncedRefreshWorkspacesMeta = debounce(() => {
- // refreshWorkspacesMeta();
- // }, 100);
- const isOwner = true;
+
+ const isOwner = true;
const handleChangeWorkSpaceName = (newName: string) => {
setWorkspaceName(newName);
};
@@@ -97,7 -108,23 +100,7 @@@
✔️
</TextButton>
</StyledSettingInputContainer>
- <StyledSettingH2 marginTop={20}>Workspace Type</StyledSettingH2>
- {/* {userInfo ? (
- <div>
- <StyledSettingH2 marginTop={20}>Workspace Owner</StyledSettingH2>
- <StyledSettingInputContainer>
- <Input
- width={327}
- disabled
- value={userInfo?.name}
- placeholder="Workspace Owner"
- ></Input>
- </StyledSettingInputContainer>
- </div>
- ) : (
- ''
- )} */}
-
+ <StyledSettingH2 marginTop={20}>{t('Workspace Type')}</StyledSettingH2>
<StyledSettingInputContainer>
<code>{workspace.provider} </code>
</StyledSettingInputContainer>
diff --cc packages/app/src/components/workspace-setting/general/delete/Delete.tsx
index 9c1efb4c44,484c6f58b4..0c42548802
--- a/packages/app/src/components/workspace-setting/general/delete/Delete.tsx
+++ b/packages/app/src/components/workspace-setting/general/delete/Delete.tsx
@@@ -17,8 -17,8 +17,8 @@@ import
getWorkspaces,
// Workspace,
} from '@/hooks/mock-data/mock';
-import { Workspace } from '@affine/datacenter';
-import { Trans, useTranslation } from 'react-i18next';
+import { WorkspaceUnit } from '@affine/datacenter';
-
++import { Trans, useTranslation } from '@affine/i18n';
interface WorkspaceDeleteProps {
open: boolean;
onClose: () => void;
diff --cc packages/app/src/components/workspace-setting/general/leave/Leave.tsx
index e34b4ac257,730c1cedbf..a9689cbfda
--- a/packages/app/src/components/workspace-setting/general/leave/Leave.tsx
+++ b/packages/app/src/components/workspace-setting/general/leave/Leave.tsx
@@@ -7,6 -7,7 +7,7 @@@ import
} from './style';
import { ModalCloseButton } from '@/ui/modal';
import { Button } from '@/ui/button';
-import { useTranslation } from 'react-i18next';
++import { useTranslation } from '@affine/i18n';
// import { getDataCenter } from '@affine/datacenter';
// import { useAppState } from '@/providers/app-state-provider';
diff --cc packages/app/src/components/workspace-setting/member/InviteMemberModal.tsx
index c066908ed0,6190649a9b..c965e6c0bf
--- a/packages/app/src/components/workspace-setting/member/InviteMemberModal.tsx
+++ b/packages/app/src/components/workspace-setting/member/InviteMemberModal.tsx
@@@ -4,9 -4,10 +4,10 @@@ import { Modal, ModalWrapper, ModalClos
import { Button } from '@/ui/button';
import Input from '@/ui/input';
import { useState } from 'react';
-// import { getDataCenter } from '@affine/datacenter';
import { Avatar } from '@mui/material';
-import { setMember } from '@/hooks/mock-data/mock';
-import { useTranslation } from 'react-i18next';
+import useMembers from '@/hooks/use-members';
+import { User } from '@affine/datacenter';
++import { useTranslation } from '@affine/i18n';
interface LoginModalProps {
open: boolean;
onClose: () => void;
@@@ -51,8 -53,9 +52,9 @@@ export const InviteMemberModal = (
const [email, setEmail] = useState<string>('');
const [showMember, setShowMember] = useState<boolean>(false);
const [showTip, setShowTip] = useState<boolean>(false);
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- const [userData, setUserData] = useState<any>({});
+ const [userData, setUserData] = useState<User | null>(null);
+ const { inviteMember, getUserByEmail } = useMembers();
+ const { t } = useTranslation();
const inputChange = (value: string) => {
setShowMember(true);
if (gmailReg.test(value)) {
@@@ -96,11 -117,11 +98,11 @@@
{showMember ? (
<Members>
{showTip ? (
- <NoFind>Non-Gmail is not supported</NoFind>
- <NoFind>{t('Non-Gmail is not supported')}</NoFind>
++ <NoFind>{t('Non-Gmail')}</NoFind>
) : (
<Member>
- {userData?.avatar_url ? (
- <Avatar src={userData?.avatar_url}></Avatar>
+ {userData?.avatar ? (
+ <Avatar src={userData?.avatar}></Avatar>
) : (
<MemberIcon>
<EmailIcon></EmailIcon>
@@@ -120,12 -141,22 +122,12 @@@
<Button
shape="circle"
type="primary"
- onClick={() => {
- setMember(workspaceId, userData);
+ onClick={async () => {
+ await inviteMember(email);
onInviteSuccess();
- // getDataCenter()
- // .then(dc => dc.apis.inviteMember({ id: workspaceId, email }))
- // .then(() => {
- // onClose();
- // onInviteSuccess && onInviteSuccess();
- // })
- // .catch(err => {
- // // toast('Invite failed');
- // console.log(err);
- // });
}}
>
- Invite
+ {t('Invite')}
</Button>
</Footer>
</ModalWrapper>
diff --cc packages/app/src/components/workspace-slider-bar/index.tsx
index 32c7962ebf,18862017d5..4663afa56a
--- a/packages/app/src/components/workspace-slider-bar/index.tsx
+++ b/packages/app/src/components/workspace-slider-bar/index.tsx
@@@ -149,14 -152,15 +149,14 @@@ export const WorkSpaceSliderBar = () =
</IconButton>
</StyledListItem>
<FavoriteList showList={showSubFavorite} />
- <StyledListItem
- onClick={() => {
- setShowWorkspaceSetting(true);
- }}
- >
- <SettingsIcon /> {t('Settings')}
+ <StyledListItem active={router.asPath === paths.setting}>
+ <StyledLink href={{ pathname: paths.setting }}>
+ <SettingsIcon />
- Settings
++ {t('Settings')}
+ </StyledLink>
</StyledListItem>
- <WorkspaceSetting
+ {/* <WorkspaceSetting
isShow={showWorkspaceSetting}
onClose={() => {
setShowWorkspaceSetting(false);
diff --cc packages/app/src/pages/workspace/[workspaceId]/all.tsx
index 27718d02ef,6464a903bb..1a0ba456d7
--- a/packages/app/src/pages/workspace/[workspaceId]/all.tsx
+++ b/packages/app/src/pages/workspace/[workspaceId]/all.tsx
@@@ -12,8 -12,9 +12,9 @@@ const All = () =>
<>
<PageListHeader icon={<AllPagesIcon />}>{t('All pages')}</PageListHeader>
<PageList
- pageList={pageMetaList.filter(p => !p.trash)}
+ pageList={pageList.filter(p => !p.trash)}
showFavoriteTag={true}
+ listType="all"
/>
</>
);
diff --cc packages/app/src/pages/workspace/[workspaceId]/favorite.tsx
index 5e9e9ad752,689bd3ead4..cc3f0369a3
--- a/packages/app/src/pages/workspace/[workspaceId]/favorite.tsx
+++ b/packages/app/src/pages/workspace/[workspaceId]/favorite.tsx
@@@ -13,7 -13,10 +13,10 @@@ export const Favorite = () =>
<PageListHeader icon={<FavouritesIcon />}>
{t('Favourites')}
</PageListHeader>
- <PageList pageList={pageList.filter(p => p.favorite && !p.trash)} />
+ <PageList
- pageList={pageMetaList.filter(p => p.favorite && !p.trash)}
++ pageList={pageList.filter(p => p.favorite && !p.trash)}
+ listType="favorite"
+ />
</>
);
};
diff --cc packages/app/src/pages/workspace/[workspaceId]/trash.tsx
index bbcc742a63,e2baa990af..d0c2350373
--- a/packages/app/src/pages/workspace/[workspaceId]/trash.tsx
+++ b/packages/app/src/pages/workspace/[workspaceId]/trash.tsx
@@@ -11,7 -11,11 +11,11 @@@ export const Trash = () =>
return (
<>
<PageListHeader icon={<TrashIcon />}>{t('Trash')}</PageListHeader>
- <PageList pageList={pageList.filter(p => p.trash)} isTrash={true} />
+ <PageList
- pageList={pageMetaList.filter(p => p.trash)}
++ pageList={pageList.filter(p => p.trash)}
+ isTrash={true}
+ listType="trash"
+ />
</>
);
};
diff --cc packages/i18n/src/index.ts
index 714cc40f31,fe6d76ab41..47b5d3251e
--- a/packages/i18n/src/index.ts
+++ b/packages/i18n/src/index.ts
@@@ -15,6 -19,6 +15,7 @@@ declare module 'react-i18next'
// custom namespace type if you changed it
// defaultNS: 'ns1';
// custom resources type
++ allowObjectInHTMLChildren: true;
resources: {
en: typeof en_US;
};
diff --cc packages/i18n/src/resources/en.json
index 761f649c18,49a6bf3ab1..2831a8aafe
--- a/packages/i18n/src/resources/en.json
+++ b/packages/i18n/src/resources/en.json
@@@ -1,11 -1,11 +1,8 @@@
{
"Quick search": "Quick search",
-- "Quick search placeholder": "Quick Search...",
-- "Quick search placeholder2": "Search in {{workspace}}",
"All pages": "All pages",
"Favourites": "Favourites",
"No item": "No item",
-- "Settings": "Settings",
"Import": "Import",
"Trash": "Trash",
"New Page": "New Page",
@@@ -14,13 -14,13 +11,11 @@@
"Find results": "Find {{number}} results",
"Collapse sidebar": "Collapse sidebar",
"Expand sidebar": "Expand sidebar",
-- "Removed from Favourites": "Removed from Favourites",
-- "Remove from favourites": "Remove from favourites",
"Added to Favourites": "Added to Favourites",
"Add to favourites": "Add to favourites",
"Paper": "Paper",
"Edgeless": "Edgeless",
-- "Switch to": "Switch to",
++ "Jump to": "Jump to",
"Convert to ": "Convert to ",
"Page": "Page",
"Export": "Export",
@@@ -37,7 -37,7 +32,6 @@@
"Delete page?": "Delete page?",
"Delete permanently?": "Delete permanently?",
"will be moved to Trash": "{{title}} will be moved to Trash",
-- "Once deleted, you can't undo this action.": "Once deleted, you can't undo this action.",
"Moved to Trash": "Moved to Trash",
"Permanently deleted": "Permanently deleted",
"restored": "{{title}} restored",
@@@ -57,7 -57,7 +51,6 @@@
"Strikethrough": "Strikethrough",
"Inline code": "Inline code",
"Code block": "Code block",
- "Link": "Hyperlink (with selected text)",
- "Hyperlink(with selected text)": "Hyperlink(with selected text)",
"Body text": "Body text",
"Heading": "Heading {{number}}",
"Increase indent": "Increase indent",
@@@ -65,6 -65,6 +58,11 @@@
"Markdown Syntax": "Markdown Syntax",
"Divider": "Divider",
"404 - Page Not Found": "404 - Page Not Found",
++ "Once deleted, you can't undo this action": {
++ "": "Once deleted, you can't undo this action."
++ },
++ "Remove from favourites": "Remove from favourites",
++ "Removed from Favourites": "Removed from Favourites",
"New Workspace": "New Workspace",
"Workspace description": "Workspace is your virtual space to capture, create and plan as just one person or together as a team.",
"Create": "Create",
@@@ -79,6 -79,6 +77,10 @@@
"TrashButtonGroupTitle": "Permanently delete",
"TrashButtonGroupDescription": "Once deleted, you can't undo this action. Do you confirm?",
"Delete permanently": "Delete permanently",
++ "Link": "Hyperlink (with selected text)",
++ "Quick search placeholder": "Quick Search...",
++ "Quick search placeholder2": "Search in {{workspace}}",
++ "Settings": "Settings",
"recommendBrowser": " We recommend the <1>Chrome</1> browser for optimal experience.",
"upgradeBrowser": "Please upgrade to the latest version of Chrome for the best experience.",
"Invite Members": "Invite Members",
@@@ -104,19 -104,19 +106,15 @@@
"Create Or Import": "Create Or Import",
"Tips": "Tips: ",
"login success": "Login success",
-- "Sign in": "Sign in AFFiNE Cloud",
"Sign out": "Sign out of AFFiNE Cloud",
"Delete Workspace": "Delete Workspace",
-- "Delete Workspace Description": "Deleting (<1>{{workspace}}</1>) cannot be undone, please proceed with caution. along with all its content.",
"Delete Workspace Description2": "Deleting (<1>{{workspace}}</1>) will delete both local and cloud data, this operation cannot be undone, please proceed with caution.",
"Delete Workspace placeholder": "Please type “Delete” to confirm",
"Leave Workspace": "Leave Workspace",
-- "Leave Workspace Description": "After you leave, you will not be able to access all the contents of this workspace.",
"Leave": "Leave",
"Workspace Icon": "Workspace Icon",
"Workspace Name": "Workspace Name",
"Workspace Type": "Workspace Type",
-- "Export Workspace": "Export Workspace <1>{{workspace}}</1> Is Coming",
"Users": "Users",
"Access level": "Access level",
"Pending": "Pending",
@@@ -132,12 -132,12 +130,16 @@@
"Publishing Description": "After publishing to the web, everyone can view the content of this workspace through the link.",
"Stop publishing": "Stop publishing",
"Publish to web": "Publish to web",
-- "Sync Description": "{{workspaceName}} is Local Workspace. All data is stored on the current device. You can enable AFFiNE Cloud for this workspace to keep data in sync with the cloud.",
-- "Sync Description2": "<1>{{workspaceName}}</1> is Cloud Workspace. All data will be synchronized and saved to the AFFiNE",
"Download data to device": "Download {{CoreOrAll}} data to device",
"General": "General",
"Sync": "Sync",
"Collaboration": "Collaboration",
"Publish": "Publish",
-- "Workspace Settings": "Workspace Settings"
++ "Workspace Settings": "Workspace Settings",
++ "Export Workspace": "Export Workspace <1>{{workspace}}</1> is coming soon",
++ "Leave Workspace Description": "After you leave, you will no longer be able to access the contents of this workspace.",
++ "Sign in": "Sign in to AFFiNE Cloud",
++ "Sync Description": "{{workspaceName}} is a Local Workspace. All data is stored on the current device. You can enable AFFiNE Cloud for this workspace to keep data in sync with the cloud.",
++ "Sync Description2": "<1>{{workspaceName}}</1> is a Cloud Workspace. All data will be synchronised and saved to AFFiNE Cloud.",
++ "Delete Workspace Description": "Deleting (<1>{{workspace}}</1>) cannot be undone, please proceed with caution. All contents will be lost."
}
diff --cc packages/i18n/src/resources/index.ts
index 329fa9c679,0000000000..2081ad8aaf
mode 100644,000000..100644
--- a/packages/i18n/src/resources/index.ts
+++ b/packages/i18n/src/resources/index.ts
@@@ -1,72 -1,0 +1,17 @@@
+// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
+// Run `pnpm run download-resources` to regenerate.
- // To overwrite this, please overwrite download.ts
++// To overwrite this, please overwrite download.ts script.
+import en from './en.json';
- import zh_Hans from './zh-Hans.json';
- import zh_Hant from './zh-Hant.json';
- import sr from './sr.json';
- import fr from './fr.json';
- import bn from './bn.json';
+
+export const LOCALES = [
+ {
- id: 1000016008,
++ id: 1000040001,
+ name: 'English',
+ tag: 'en',
+ originalName: 'English',
+ flagEmoji: '🇬🇧',
+ base: true,
+ completeRate: 1,
+ res: en,
+ },
- {
- id: 1000016009,
- name: 'Simplified Chinese',
- tag: 'zh-Hans',
- originalName: '简体中文',
- flagEmoji: '🇨🇳',
- base: false,
- completeRate: 1,
- res: zh_Hans,
- },
- {
- id: 1000016012,
- name: 'Traditional Chinese',
- tag: 'zh-Hant',
- originalName: '繁體中文',
- flagEmoji: '🇭🇰',
- base: false,
- completeRate: 1,
- res: zh_Hant,
- },
- {
- id: 1000034005,
- name: 'Serbian',
- tag: 'sr',
- originalName: 'српски',
- flagEmoji: '🇷🇸',
- base: false,
- completeRate: 0.9166666666666666,
- res: sr,
- },
- {
- id: 1000034008,
- name: 'French',
- tag: 'fr',
- originalName: 'français',
- flagEmoji: '🇫🇷',
- base: false,
- completeRate: 1,
- res: fr,
- },
- {
- id: 1000034010,
- name: 'Bangla',
- tag: 'bn',
- originalName: 'বাংলা',
- flagEmoji: '🇧🇩',
- base: false,
- completeRate: 0.7083333333333334,
- res: bn,
- },
+] as const;