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/datacenter' into feat/datacenter-i18n

JimmFly720aa6e6b097
diff --cc packages/app/src/components/workspace-setting/PublishPage.tsx
index 677b8a4909,a03749fe98..a21c5b7d85
--- a/packages/app/src/components/workspace-setting/PublishPage.tsx
+++ b/packages/app/src/components/workspace-setting/PublishPage.tsx
@@@ -23,8 -22,9 +22,9 @@@ export const PublishPage = ({ workspac
const togglePublic = async (flag: boolean) => {
try {
await publishWorkspace(workspace.id.toString(), flag);
+ setLoaded(false);
} catch (e) {
- toast('Failed to publish workspace');
+ toast(t('Failed to publish workspace'));
}
};
diff --cc packages/app/src/components/workspace-setting/SyncPage.tsx
index 0632b304c0,7e17d83cf8..ddca482143
--- a/packages/app/src/components/workspace-setting/SyncPage.tsx
+++ b/packages/app/src/components/workspace-setting/SyncPage.tsx
@@@ -9,11 -9,13 +9,13 @@@ import { DownloadIcon } from '@blocksui
import { Button } from '@/ui/button';
import { Menu, MenuItem } from '@/ui/menu';
import { WorkspaceUnit } from '@affine/datacenter';
- import { Trans, useTranslation } from '@affine/i18n';
-import { useTranslation } from '@affine/i18n';
++import { useTranslation, Trans } from '@affine/i18n';
import { WorkspaceUnitAvatar } from '@/components/workspace-avatar';
import { EnableWorkspaceButton } from '../enable-workspace';
+ import { useAppState } from '@/providers/app-state-provider';
export const SyncPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
const { t } = useTranslation();
+ const { user } = useAppState();
return (
<div>
<StyledPublishContent>
@@@ -43,21 -48,14 +45,21 @@@
workspaceUnit={workspace}
style={{ marginRight: '12px' }}
/>
- <StyledWorkspaceName>{workspace.name} </StyledWorkspaceName>is
- Cloud Workspace.
+ <StyledWorkspaceName>{workspace.name}&nbsp;</StyledWorkspaceName>
+ <span>{t('is a Cloud Workspace')}</span>
</StyledPublishExplanation>
- <StyledWorkspaceType>
- All data will be synchronized and saved to the AFFiNE account{' '}
- {user?.email}
- </StyledWorkspaceType>
- <StyleAsync>
+ <div>
+ <Trans i18nKey="Cloud Workspace Description">
+ All data will be synchronised and saved to the AFFiNE account
+ <StyledEmail>
+ {{
- email: '{' + workspace.owner?.email + '}.',
++ email: '{' + user?.email + '}.',
+ }}
+ </StyledEmail>
+ </Trans>
+ </div>
+
+ <StyledButtonContainer>
<Menu
content={
<>
diff --cc packages/app/src/components/workspace-setting/style.ts
index eafcd415d2,31a19289cc..3e29c53d9e
--- a/packages/app/src/components/workspace-setting/style.ts
+++ b/packages/app/src/components/workspace-setting/style.ts
@@@ -141,12 -150,8 +141,13 @@@ export const StyledEmail = styled('span
};
});
-export const StyleAsync = styled('div')(() => {
+export const StyledPublishContent = styled('div')(({ theme }) => {
return {
- marginTop: '64px',
+ display: 'flex',
+ fontWeight: '500',
+ flexDirection: 'column',
+ fontSize: theme.font.base,
+ lineHeight: theme.font.lineHeightBase,
++ flex: 1,
};
});
diff --cc packages/app/src/pages/workspace/[workspaceId]/setting.tsx
index bd80a4ecfe,975e3d6ff1..ffab84524c
--- a/packages/app/src/pages/workspace/[workspaceId]/setting.tsx
+++ b/packages/app/src/pages/workspace/[workspaceId]/setting.tsx
@@@ -20,37 -19,41 +19,37 @@@ import { WorkspaceUnit } from '@affine/
import { useTranslation } from '@affine/i18n';
import { PageListHeader } from '@/components/header';
-type TabNames = 'General' | 'Sync' | 'Collaboration' | 'Publish' | 'Export';
-
-const tabMap: {
- name: TabNames;
- panelRender: (workspace: WorkspaceUnit) => ReactNode;
-}[] = [
- {
- name: 'General',
- panelRender: workspace => <GeneralPage workspace={workspace} />,
- },
- {
- name: 'Sync',
- panelRender: workspace => <SyncPage workspace={workspace} />,
- },
- {
- name: 'Collaboration',
- panelRender: workspace => <MembersPage workspace={workspace} />,
- },
- {
- name: 'Publish',
- panelRender: workspace => <PublishPage workspace={workspace} />,
- },
- // TODO: next version will finish this feature
- // {
- // name: 'Export',
- // panelRender: workspace => <ExportPage workspace={workspace} />,
- // },
-];
-
-const WorkspaceSetting = () => {
+const useTabMap = () => {
const { t } = useTranslation();
- const { currentWorkspace, isOwner } = useAppState();
-
- const [activeTab, setActiveTab] = useState<TabNames>(tabMap[0].name);
- const handleTabChange = (tab: TabNames) => {
+ const { isOwner } = useAppState();
+ const tabMap: {
+ name: string;
+ panelRender: (workspace: WorkspaceUnit) => ReactNode;
+ }[] = [
+ {
+ name: t('General'),
+ panelRender: workspace => <GeneralPage workspace={workspace} />,
+ },
+ {
+ name: t('Sync'),
+ panelRender: workspace => <SyncPage workspace={workspace} />,
+ },
+ {
+ name: t('Collaboration'),
+ panelRender: workspace => <MembersPage workspace={workspace} />,
+ },
+ {
+ name: t('Publish'),
+ panelRender: workspace => <PublishPage workspace={workspace} />,
+ },
-
- {
- name: t('Export'),
- panelRender: workspace => <ExportPage workspace={workspace} />,
- },
++ // TODO: next version will finish this feature
++ // {
++ // name: t('Export'),
++ // panelRender: workspace => <ExportPage workspace={workspace} />,
++ // },
+ ];
+ const [activeTab, setActiveTab] = useState<string>(tabMap[0].name);
+ const handleTabChange = (tab: string) => {
setActiveTab(tab);
};