mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
fix: should show sync tab for cloud workspace (#1072)
This commit is contained in:
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user