fix: should show sync tab for cloud workspace (#1072)

This commit is contained in:
Peng Xiao
2023-02-17 01:53:03 +08:00
committed by GitHub
parent 121ac152fa
commit c69637fe98

View File

@@ -17,6 +17,7 @@ import {
MembersPage,
PublishPage,
ExportPage,
SyncPage,
} from '@/components/workspace-setting';
import { SettingsIcon } from '@blocksuite/icons';
import WorkspaceLayout from '@/components/workspace-layout';
@@ -41,10 +42,11 @@ const useTabMap = () => {
panelRender: workspace => <GeneralPage workspace={workspace} />,
},
// TODO: add it back for desktop version
// {
// name: t('Sync'),
// panelRender: workspace => <SyncPage workspace={workspace} />,
// },
{
id: 'Sync',
name: t('Sync'),
panelRender: workspace => <SyncPage workspace={workspace} />,
},
{
id: 'Collaboration',
name: t('Collaboration'),
@@ -100,6 +102,7 @@ const WorkspaceSetting = () => {
const currentWorkspace = useGlobalState(
useCallback(store => store.currentDataCenterWorkspace, [])
);
const user = useGlobalState(store => store.user);
const { activeTabPanelRender, tabMap, handleTabChange, activeTab } =
useTabMap();
@@ -110,6 +113,10 @@ const WorkspaceSetting = () => {
width: 0,
});
const shouldHideSyncTab =
currentWorkspace?.owner?.id !== user?.id ||
currentWorkspace?.provider === 'local';
useEffect(() => {
const tabButton = document.querySelector(
`[data-setting-tab-button="${activeTab}"]`
@@ -134,6 +141,9 @@ const WorkspaceSetting = () => {
<StyledSettingContainer>
<StyledTabButtonWrapper>
{tabMap.map(({ id, name }) => {
if (shouldHideSyncTab && id === 'Sync') {
return null;
}
return (
<WorkspaceSettingTagItem
key={id}