mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-16 17:46:18 +08:00
feat: add workspace to setting
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user