diff --git a/packages/app/src/components/workspace-modal/LanguageMenu.tsx b/packages/app/src/components/workspace-modal/SelectLanguageMenu.tsx
similarity index 100%
rename from packages/app/src/components/workspace-modal/LanguageMenu.tsx
rename to packages/app/src/components/workspace-modal/SelectLanguageMenu.tsx
diff --git a/packages/app/src/components/workspace-modal/index.tsx b/packages/app/src/components/workspace-modal/index.tsx
index 4ebce59edf..af14025d47 100644
--- a/packages/app/src/components/workspace-modal/index.tsx
+++ b/packages/app/src/components/workspace-modal/index.tsx
@@ -2,15 +2,15 @@ import { Modal, ModalWrapper, ModalCloseButton } from '@/ui/modal';
import { Wrapper } from '@/ui/layout';
import { useState } from 'react';
import { CreateWorkspaceModal } from '../create-workspace';
+
import { Tooltip } from '@/ui/tooltip';
-import { toast } from '@/ui/toast';
import { AddIcon, HelpCenterIcon } from '@blocksuite/icons';
import { useAppState } from '@/providers/app-state-provider';
import { useRouter } from 'next/router';
import { useTranslation } from '@affine/i18n';
-import { LanguageMenu } from './LanguageMenu';
+import { LanguageMenu } from './SelectLanguageMenu';
import { LoginModal } from '../login-modal';
import { LogoutModal } from '../logout-modal';
@@ -29,7 +29,6 @@ import {
} from './styles';
import { WorkspaceCard } from './WorkspaceCard';
import { Footer } from './Footer';
-import { useConfirm } from '@/providers/ConfirmProvider';
interface WorkspaceModalProps {
open: boolean;
onClose: () => void;
@@ -42,7 +41,6 @@ export const WorkspaceModal = ({ open, onClose }: WorkspaceModalProps) => {
const { t } = useTranslation();
const [loginOpen, setLoginOpen] = useState(false);
const [logoutOpen, setLogoutOpen] = useState(false);
- const { confirm } = useConfirm();
return (
<>
@@ -117,19 +115,7 @@ export const WorkspaceModal = ({ open, onClose }: WorkspaceModalProps) => {
setLoginOpen(true);
}}
onLogout={() => {
- setLoginOpen(true);
- confirm({
- title: 'Sign out?',
- content: `All data has been stored in the cloud. `,
- confirmText: 'Sign out',
- cancelText: 'Cancel',
- }).then(async confirm => {
- if (confirm) {
- await logout();
- await router.replace(`/workspace`);
- toast('Enabled success');
- }
- });
+ setLogoutOpen(true);
}}
/>
diff --git a/packages/app/src/components/workspace-modal/languageMenu.tsx b/packages/app/src/components/workspace-modal/languageMenu.tsx
deleted file mode 100644
index ad579e145b..0000000000
--- a/packages/app/src/components/workspace-modal/languageMenu.tsx
+++ /dev/null
@@ -1,61 +0,0 @@
-import { LOCALES } from '@affine/i18n';
-import { styled } from '@/styles';
-import { useTranslation } from '@affine/i18n';
-import { ArrowDownIcon } from '@blocksuite/icons';
-import { Button } from '@/ui/button';
-import { Menu, MenuItem } from '@/ui/menu';
-
-const LanguageMenuContent = () => {
- const { i18n } = useTranslation();
- const changeLanguage = (event: string) => {
- i18n.changeLanguage(event);
- };
- return (
- <>
- {LOCALES.map(option => {
- return (
- {
- changeLanguage(option.tag);
- }}
- >
- {option.originalName}
-
- );
- })}
- >
- );
-};
-export const LanguageMenu = () => {
- const { i18n } = useTranslation();
-
- const currentLanguage = LOCALES.find(item => item.tag === i18n.language);
-
- return (
-
}
- placement="bottom"
- trigger="click"
- disablePortal={true}
- >
- }
- iconPosition="end"
- noBorder={true}
- style={{ textTransform: 'capitalize' }}
- >
- {currentLanguage?.originalName}
-
-
- );
-};
-
-const ListItem = styled(MenuItem)(({ theme }) => ({
- height: '38px',
- color: theme.colors.popoverColor,
- fontSize: theme.font.sm,
- textTransform: 'capitalize',
- padding: '0 24px',
-}));
diff --git a/packages/app/src/components/workspace-setting/PublishPage.tsx b/packages/app/src/components/workspace-setting/PublishPage.tsx
index 677b8a4909..a21c5b7d85 100644
--- a/packages/app/src/components/workspace-setting/PublishPage.tsx
+++ b/packages/app/src/components/workspace-setting/PublishPage.tsx
@@ -10,7 +10,6 @@ import { useState } from 'react';
import { Button } from '@/ui/button';
import Input from '@/ui/input';
import { toast } from '@/ui/toast';
-// import { useAppState } from '@/providers/app-state-provider3';
import { WorkspaceUnit } from '@affine/datacenter';
import { useWorkspaceHelper } from '@/hooks/use-workspace-helper';
import { useTranslation } from '@affine/i18n';
@@ -23,6 +22,7 @@ export const PublishPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
const togglePublic = async (flag: boolean) => {
try {
await publishWorkspace(workspace.id.toString(), flag);
+ setLoaded(false);
} catch (e) {
toast(t('Failed to publish workspace'));
}
@@ -66,7 +66,6 @@ export const PublishPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
onClick={async () => {
setLoaded(true);
await togglePublic(true);
- setLoaded(false);
}}
loading={loaded}
type="primary"
@@ -85,7 +84,6 @@ export const PublishPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
onClick={async () => {
setLoaded(true);
await togglePublic(false);
- setLoaded(true);
}}
loading={false}
type="danger"
diff --git a/packages/app/src/components/workspace-setting/SyncPage.tsx b/packages/app/src/components/workspace-setting/SyncPage.tsx
index 0632b304c0..ddca482143 100644
--- a/packages/app/src/components/workspace-setting/SyncPage.tsx
+++ b/packages/app/src/components/workspace-setting/SyncPage.tsx
@@ -9,11 +9,13 @@ import { DownloadIcon } from '@blocksuite/icons';
import { Button } from '@/ui/button';
import { Menu, MenuItem } from '@/ui/menu';
import { WorkspaceUnit } from '@affine/datacenter';
-import { Trans, 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 (
@@ -51,7 +53,7 @@ export const SyncPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
All data will be synchronised and saved to the AFFiNE account
{{
- email: '{' + workspace.owner?.email + '}.',
+ email: '{' + user?.email + '}.',
}}
diff --git a/packages/app/src/components/workspace-setting/style.ts b/packages/app/src/components/workspace-setting/style.ts
index eafcd415d2..3e29c53d9e 100644
--- a/packages/app/src/components/workspace-setting/style.ts
+++ b/packages/app/src/components/workspace-setting/style.ts
@@ -148,5 +148,6 @@ export const StyledPublishContent = styled('div')(({ theme }) => {
flexDirection: 'column',
fontSize: theme.font.base,
lineHeight: theme.font.lineHeightBase,
+ flex: 1,
};
});
diff --git a/packages/app/src/components/workspace-slider-bar/index.tsx b/packages/app/src/components/workspace-slider-bar/index.tsx
index b0f24c7ada..4a56307d1f 100644
--- a/packages/app/src/components/workspace-slider-bar/index.tsx
+++ b/packages/app/src/components/workspace-slider-bar/index.tsx
@@ -16,7 +16,6 @@ import {
SearchIcon,
AllPagesIcon,
FavouritesIcon,
- ImportIcon,
TrashIcon,
AddIcon,
SettingsIcon,
@@ -65,7 +64,7 @@ const FavoriteList = ({ showList }: { showList: boolean }) => {
);
};
export const WorkSpaceSliderBar = () => {
- const { triggerQuickSearchModal, triggerImportModal } = useModal();
+ const { triggerQuickSearchModal } = useModal();
const [showSubFavorite, setShowSubFavorite] = useState(true);
const { currentWorkspace } = useAppState();
const { openPage, createPage } = usePageHelper();
@@ -161,14 +160,14 @@ export const WorkSpaceSliderBar = () => {
setShowWorkspaceSetting(false);
}}
/> */}
-
- {
triggerImportModal();
}}
>
{t('Import')}
-
+ */}
diff --git a/packages/app/src/hooks/use-workspace-helper.ts b/packages/app/src/hooks/use-workspace-helper.ts
index 44124ae615..ec990feb30 100644
--- a/packages/app/src/hooks/use-workspace-helper.ts
+++ b/packages/app/src/hooks/use-workspace-helper.ts
@@ -33,8 +33,8 @@ export const useWorkspaceHelper = () => {
await dataCenter.updateWorkspaceMeta({ name }, workspace);
}
if (avatarBlob) {
- // const blobId = await dataCenter.setBlob(workspace, avatarBlob);
- // await dataCenter.updateWorkspaceMeta({ avatar: blobId }, workspace);
+ const blobId = await dataCenter.setBlob(workspace, avatarBlob);
+ await dataCenter.updateWorkspaceMeta({ avatar: blobId }, workspace);
}
};
diff --git a/packages/app/src/pages/workspace/[workspaceId]/setting.tsx b/packages/app/src/pages/workspace/[workspaceId]/setting.tsx
index bd80a4ecfe..ffab84524c 100644
--- a/packages/app/src/pages/workspace/[workspaceId]/setting.tsx
+++ b/packages/app/src/pages/workspace/[workspaceId]/setting.tsx
@@ -10,7 +10,6 @@ import {
GeneralPage,
MembersPage,
PublishPage,
- ExportPage,
SyncPage,
} from '@/components/workspace-setting';
import { SettingsIcon } from '@blocksuite/icons';
@@ -43,11 +42,11 @@ const useTabMap = () => {
name: t('Publish'),
panelRender: workspace => ,
},
-
- {
- name: t('Export'),
- panelRender: workspace => ,
- },
+ // TODO: next version will finish this feature
+ // {
+ // name: t('Export'),
+ // panelRender: workspace => ,
+ // },
];
const [activeTab, setActiveTab] = useState(tabMap[0].name);
const handleTabChange = (tab: string) => {
diff --git a/packages/data-center/src/provider/affine/apis/token.ts b/packages/data-center/src/provider/affine/apis/token.ts
index 88c1997772..f002fedb9e 100644
--- a/packages/data-center/src/provider/affine/apis/token.ts
+++ b/packages/data-center/src/provider/affine/apis/token.ts
@@ -100,17 +100,13 @@ class Token {
static parse(token: string): AccessTokenMessage | null {
try {
return JSON.parse(
- String.fromCharCode.apply(
- null,
- Array.from(
- Uint8Array.from(
- window.atob(
- // split jwt
- token.split('.')[1]
- ),
- c => c.charCodeAt(0)
- )
- )
+ decodeURIComponent(
+ atob(token.split('.')[1])
+ .split('')
+ .map(function (c) {
+ return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
+ })
+ .join('')
)
);
} catch (error) {