fix: fix filename and tabname

This commit is contained in:
DiamondThree
2023-01-06 16:45:34 +08:00
parent 726c8c54ab
commit 78facb2fe6
6 changed files with 59 additions and 30 deletions

View File

@@ -31,7 +31,6 @@ export const WorkspaceModal = ({ open, onClose }: LoginModalProps) => {
updateWorkspaceMeta, updateWorkspaceMeta,
} = useTemporaryHelper(); } = useTemporaryHelper();
console.log('workspaceMetaList: ', workspaceMetaList);
return ( return (
<div> <div>
<Modal open={open} onClose={onClose}> <Modal open={open} onClose={onClose}>
@@ -164,16 +163,15 @@ export const WorkspaceModal = ({ open, onClose }: LoginModalProps) => {
confirmText: user ? 'Enable' : 'Sign in and Enable', confirmText: user ? 'Enable' : 'Sign in and Enable',
cancelText: 'Skip', cancelText: 'Skip',
}).then(confirm => { }).then(confirm => {
if (user) { if (confirm) {
console.log('enable cloud'); if (user) {
workspaceId && workspaceId &&
setTimeout(() => { updateWorkspaceMeta(workspaceId, { isPublish: true });
updateWorkspaceMeta(workspaceId as string, { } else {
type: 'cloud', login();
}); workspaceId &&
}, 1000); updateWorkspaceMeta(workspaceId, { isPublish: true });
} else { }
confirm && login();
} }
}); });
}} }}

View File

@@ -24,12 +24,15 @@ import {
Workspace, Workspace,
} from '@/hooks/mock-data/mock'; } from '@/hooks/mock-data/mock';
import { useTemporaryHelper } from '@/providers/temporary-helper-provider'; import { useTemporaryHelper } from '@/providers/temporary-helper-provider';
import { StyledMemberWarp } from './general/style';
import { useConfirm } from '@/providers/confirm-provider';
// import { useAppState } from '@/providers/app-state-provider'; // import { useAppState } from '@/providers/app-state-provider';
export const MembersPage = ({ workspace }: { workspace: Workspace }) => { export const MembersPage = ({ workspace }: { workspace: Workspace }) => {
const [isInviteModalShow, setIsInviteModalShow] = useState(false); const [isInviteModalShow, setIsInviteModalShow] = useState(false);
const [members, setMembers] = useState<User[]>([]); const [members, setMembers] = useState<User[]>([]);
const { user, login } = useTemporaryHelper(); const { user, login, updateWorkspaceMeta } = useTemporaryHelper();
const { confirm } = useConfirm();
// const refreshMembers = useCallback(() => { // const refreshMembers = useCallback(() => {
// getDataCenter() // getDataCenter()
// .then(dc => // .then(dc =>
@@ -57,7 +60,7 @@ export const MembersPage = ({ workspace }: { workspace: Workspace }) => {
return ( return (
<div> <div>
{user ? ( {workspace.type === 'cloud' ? (
<> <>
<StyledMemberTitleContainer> <StyledMemberTitleContainer>
<StyledMemberNameContainer> <StyledMemberNameContainer>
@@ -169,20 +172,36 @@ export const MembersPage = ({ workspace }: { workspace: Workspace }) => {
</StyledMemberButtonContainer> </StyledMemberButtonContainer>
</> </>
) : ( ) : (
<> <StyledMemberWarp>
<div> <div style={{ flex: 1 }}>
Collaborating with other members requires AFFiNE Cloud service. Collaborating with other members requires AFFiNE Cloud service.
</div> </div>
<div> <div style={{ height: '40px' }}>
<Button <Button
type="primary"
shape="circle"
onClick={() => { onClick={() => {
login(); confirm({
title: 'Enable AFFiNE Cloud?',
content: `If enabled, the data in this workspace will be backed up and synchronized via AFFiNE Cloud.`,
confirmText: user ? 'Enable' : 'Sign in and Enable',
cancelText: 'Skip',
}).then(confirm => {
if (confirm) {
if (user) {
updateWorkspaceMeta(workspace.id, { isPublish: true });
} else {
login();
updateWorkspaceMeta(workspace.id, { isPublish: true });
}
}
});
}} }}
> >
Enable AFFiNE Cloud Enable AFFiNE Cloud
</Button> </Button>
</div> </div>
</> </StyledMemberWarp>
)} )}
</div> </div>
); );

View File

@@ -14,15 +14,15 @@ import { useTemporaryHelper } from '@/providers/temporary-helper-provider';
import { useConfirm } from '@/providers/confirm-provider'; import { useConfirm } from '@/providers/confirm-provider';
export const PublishPage = ({ workspace }: { workspace: Workspace }) => { export const PublishPage = ({ workspace }: { workspace: Workspace }) => {
console.log('workspace: ', workspace);
const shareUrl = const shareUrl =
window.location.host + '/workspace/' + workspace.id + '?share=true'; window.location.host + '/workspace/' + workspace.id + '?share=true';
const { login, updateWorkspaceMeta, user, currentWorkspace } = const { login, updateWorkspaceMeta, user } = useTemporaryHelper();
useTemporaryHelper();
const { confirm } = useConfirm(); const { confirm } = useConfirm();
const togglePublic = (flag: boolean) => { const togglePublic = (flag: boolean) => {
updateWorkspaceMeta(currentWorkspace.id, { isPublish: flag }); updateWorkspaceMeta(workspace.id, { isPublish: flag });
}; };
const copyUrl = () => { const copyUrl = () => {
@@ -37,20 +37,22 @@ export const PublishPage = ({ workspace }: { workspace: Workspace }) => {
confirmText: user ? 'Enable' : 'Sign in and Enable', confirmText: user ? 'Enable' : 'Sign in and Enable',
cancelText: 'Skip', cancelText: 'Skip',
}).then(confirm => { }).then(confirm => {
if (user) { if (confirm) {
updateWorkspaceMeta(currentWorkspace.id, { isPublish: true }); if (user) {
} else { updateWorkspaceMeta(workspace.id, { isPublish: true });
confirm && login(); } else {
updateWorkspaceMeta(currentWorkspace.id, { isPublish: true }); login();
updateWorkspaceMeta(workspace.id, { isPublish: true });
}
} }
}); });
}; };
return ( return (
<> <>
{currentWorkspace.type === 'cloud' ? ( {workspace.type === 'cloud' ? (
<div> <div>
<StyledPublishContent> <StyledPublishContent>
{currentWorkspace?.isPublish ? ( {workspace?.isPublish ? (
<> <>
<StyledPublishExplanation> <StyledPublishExplanation>
Publishing to web requires AFFiNE Cloud service . Publishing to web requires AFFiNE Cloud service .
@@ -74,7 +76,7 @@ export const PublishPage = ({ workspace }: { workspace: Workspace }) => {
</StyledPublishExplanation> </StyledPublishExplanation>
)} )}
</StyledPublishContent> </StyledPublishContent>
{!currentWorkspace?.isPublish ? ( {!workspace.isPublish ? (
<Button <Button
onClick={() => { onClick={() => {
togglePublic(true); togglePublic(true);

View File

@@ -26,3 +26,12 @@ export const StyledSettingAvatarContent = styled('div')(() => {
export const StyledSettingAvatar = styled(MuiAvatar)(() => { export const StyledSettingAvatar = styled(MuiAvatar)(() => {
return { height: '72px', width: '72px', marginRight: '24px' }; return { height: '72px', width: '72px', marginRight: '24px' };
}); });
export const StyledMemberWarp = styled('div')(() => {
return {
display: 'flex',
height: '500px',
flexDirection: 'column',
padding: '60px 0',
};
});

View File

@@ -117,6 +117,7 @@ export const StyledMemberTitleContainer = styled('div')(() => {
display: 'flex', display: 'flex',
marginTop: '60px', marginTop: '60px',
fontWeight: '500', fontWeight: '500',
flex: 1,
}; };
}); });

View File

@@ -75,7 +75,7 @@ const WorkspaceSettingTab = ({ activeTab, onTabChange }: SettingTabProps) => {
<StyledSettingTagIconContainer> <StyledSettingTagIconContainer>
<UsersIcon /> <UsersIcon />
</StyledSettingTagIconContainer> </StyledSettingTagIconContainer>
Members Collaboration
</WorkspaceSettingTagItem> </WorkspaceSettingTagItem>
<WorkspaceSettingTagItem <WorkspaceSettingTagItem
isActive={activeTab === ActiveTab.publish} isActive={activeTab === ActiveTab.publish}