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