feat: add workspace to setting

This commit is contained in:
MingLiang Wang
2022-12-20 19:37:52 +08:00
parent 2ede288724
commit 50e4da10d1
2 changed files with 18 additions and 4 deletions
@@ -38,6 +38,7 @@ import {
import { useEffect, useState } from 'react';
import { Button } from '@/ui/button';
import Input from '@/ui/input';
import { Workspace, WorkspaceType } from '@pathfinder/data-services';
enum ActiveTab {
'general' = 'general',
@@ -53,6 +54,7 @@ type SettingTabProps = {
type WorkspaceSettingProps = {
isShow: boolean;
onClose?: () => void;
workspace?: Workspace;
};
const WorkspaceSettingTab = ({ activeTab, onTabChange }: SettingTabProps) => {
@@ -98,6 +100,7 @@ const WorkspaceSettingTab = ({ activeTab, onTabChange }: SettingTabProps) => {
export const WorkspaceSetting = ({
isShow,
onClose,
workspace,
}: WorkspaceSettingProps) => {
const [activeTab, setActiveTab] = useState<ActiveTab>(ActiveTab.general);
const handleTabChange = (tab: ActiveTab) => {
@@ -106,6 +109,7 @@ export const WorkspaceSetting = ({
const handleClickClose = () => {
onClose && onClose();
};
const isPrivate = workspace?.type === WorkspaceType.Private;
useEffect(() => {
// reset tab when modal is closed
if (!isShow) {
@@ -126,7 +130,9 @@ export const WorkspaceSetting = ({
/>
</StyledSettingSidebar>
<StyledSettingContent>
{activeTab === ActiveTab.general && <GeneralPage />}
{activeTab === ActiveTab.general && (
<GeneralPage workspace={workspace} />
)}
{activeTab === ActiveTab.members && <MembersPage />}
{activeTab === ActiveTab.publish && <PublishPage />}
</StyledSettingContent>
@@ -135,14 +141,14 @@ export const WorkspaceSetting = ({
);
};
const GeneralPage = () => {
const GeneralPage = ({ workspace }: { workspace?: Workspace }) => {
return (
<div>
<StyledSettingH2 marginTop={56}>Workspace Avatar</StyledSettingH2>
<StyledSettingAvatarContent>
<StyledSettingAvatar alt="workspace avatar">W</StyledSettingAvatar>
<StyledAvatarUploadBtn shape="round">upload</StyledAvatarUploadBtn>
<Button shape="round">remove</Button>
{/* <StyledAvatarUploadBtn shape="round">upload</StyledAvatarUploadBtn>
<Button shape="round">remove</Button> */}
</StyledSettingAvatarContent>
<StyledSettingH2 marginTop={36}>Workspace Name</StyledSettingH2>
<StyledSettingInputContainer>