mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-18 10:36:22 +08:00
feat:add isOwner
This commit is contained in:
@@ -1,47 +0,0 @@
|
||||
import { WorkspaceModal } from '@/components/workspace-modal';
|
||||
import { getWorkspaces } from '@/hooks/mock-data/mock';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { styled } from '@/styles';
|
||||
import Button from '@/ui/button/Button';
|
||||
|
||||
const Page = () => {
|
||||
const [open, setOpen] = useState<boolean>(false);
|
||||
|
||||
useEffect(() => {
|
||||
const data = getWorkspaces();
|
||||
if (!data.length) {
|
||||
setOpen(true);
|
||||
}
|
||||
}, []);
|
||||
return (
|
||||
<Workspace>
|
||||
<h1>workspace</h1>
|
||||
<div>
|
||||
<Button
|
||||
onClick={() => {
|
||||
setOpen(true);
|
||||
}}
|
||||
>
|
||||
View Workspace List
|
||||
</Button>
|
||||
</div>
|
||||
<WorkspaceModal
|
||||
open={open}
|
||||
onClose={() => {
|
||||
setOpen(false);
|
||||
}}
|
||||
></WorkspaceModal>
|
||||
</Workspace>
|
||||
);
|
||||
};
|
||||
export default Page;
|
||||
|
||||
const Workspace = styled.div(({ theme }) => {
|
||||
return {
|
||||
height: '100vh',
|
||||
background: theme.colors.pageBackground,
|
||||
color: '#FFFFFF',
|
||||
fontSize: '18px',
|
||||
fontWeight: 500,
|
||||
};
|
||||
});
|
||||
@@ -60,7 +60,7 @@ const tabMap: {
|
||||
];
|
||||
|
||||
const WorkspaceSetting = () => {
|
||||
const { currentWorkspace } = useAppState();
|
||||
const { currentWorkspace, isOwner } = useAppState();
|
||||
|
||||
const [activeTab, setActiveTab] = useState<TabNames>(tabMap[0].name);
|
||||
const handleTabChange = (tab: TabNames) => {
|
||||
@@ -70,7 +70,20 @@ const WorkspaceSetting = () => {
|
||||
const activeTabPanelRender = tabMap.find(
|
||||
tab => tab.name === activeTab
|
||||
)?.panelRender;
|
||||
|
||||
let tableArr: {
|
||||
name: TabNames;
|
||||
icon: ReactNode;
|
||||
panelRender: (workspace: WorkspaceUnit) => ReactNode;
|
||||
}[] = tabMap;
|
||||
if (!isOwner) {
|
||||
tableArr = [
|
||||
{
|
||||
name: 'general',
|
||||
icon: <EditIcon />,
|
||||
panelRender: workspace => <GeneralPage workspace={workspace} />,
|
||||
},
|
||||
];
|
||||
}
|
||||
return (
|
||||
<StyledSettingContainer>
|
||||
<StyledSettingSidebar>
|
||||
@@ -78,7 +91,7 @@ const WorkspaceSetting = () => {
|
||||
Workspace Settings
|
||||
</StyledSettingSidebarHeader>
|
||||
<StyledSettingTabContainer>
|
||||
{tabMap.map(({ icon, name }) => {
|
||||
{tableArr.map(({ icon, name }) => {
|
||||
return (
|
||||
<WorkspaceSettingTagItem
|
||||
key={name}
|
||||
|
||||
Reference in New Issue
Block a user