Skip to content

Commit 77a0a91

Browse files
pengx17pull[bot]
authored andcommitted
fix: should show sync tab for cloud workspace (#1072)
1 parent f76bb33 commit 77a0a91

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

apps/web/src/pages/workspace/[workspaceId]/setting.tsx

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
MembersPage,
1818
PublishPage,
1919
ExportPage,
20+
SyncPage,
2021
} from '@/components/workspace-setting';
2122
import { SettingsIcon } from '@blocksuite/icons';
2223
import WorkspaceLayout from '@/components/workspace-layout';
@@ -41,10 +42,11 @@ const useTabMap = () => {
4142
panelRender: workspace => <GeneralPage workspace={workspace} />,
4243
},
4344
// TODO: add it back for desktop version
44-
// {
45-
// name: t('Sync'),
46-
// panelRender: workspace => <SyncPage workspace={workspace} />,
47-
// },
45+
{
46+
id: 'Sync',
47+
name: t('Sync'),
48+
panelRender: workspace => <SyncPage workspace={workspace} />,
49+
},
4850
{
4951
id: 'Collaboration',
5052
name: t('Collaboration'),
@@ -100,6 +102,7 @@ const WorkspaceSetting = () => {
100102
const currentWorkspace = useGlobalState(
101103
useCallback(store => store.currentDataCenterWorkspace, [])
102104
);
105+
const user = useGlobalState(store => store.user);
103106
const { activeTabPanelRender, tabMap, handleTabChange, activeTab } =
104107
useTabMap();
105108

@@ -110,6 +113,10 @@ const WorkspaceSetting = () => {
110113
width: 0,
111114
});
112115

116+
const shouldHideSyncTab =
117+
currentWorkspace?.owner?.id !== user?.id ||
118+
currentWorkspace?.provider === 'local';
119+
113120
useEffect(() => {
114121
const tabButton = document.querySelector(
115122
`[data-setting-tab-button="${activeTab}"]`
@@ -134,6 +141,9 @@ const WorkspaceSetting = () => {
134141
<StyledSettingContainer>
135142
<StyledTabButtonWrapper>
136143
{tabMap.map(({ id, name }) => {
144+
if (shouldHideSyncTab && id === 'Sync') {
145+
return null;
146+
}
137147
return (
138148
<WorkspaceSettingTagItem
139149
key={id}

0 commit comments

Comments
 (0)