Fix/publish style (#732)

This commit is contained in:
DiamondThree
2023-01-13 17:41:13 +08:00
committed by GitHub
parent c95667eafb
commit 911cc3e217
3 changed files with 36 additions and 33 deletions

View File

@@ -55,27 +55,29 @@ export const PublishPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
</StyledPublishExplanation> </StyledPublishExplanation>
)} )}
</StyledPublishContent> </StyledPublishContent>
{workspace.published ? ( <StyledPublishCopyContainer>
<Button {workspace.published ? (
onClick={() => { <Button
togglePublic(false); onClick={() => {
}} togglePublic(false);
type="primary" }}
shape="circle" type="primary"
> shape="circle"
{t('Stop publishing')} >
</Button> {t('Stop publishing')}
) : ( </Button>
<Button ) : (
onClick={() => { <Button
togglePublic(true); onClick={() => {
}} togglePublic(true);
type="primary" }}
shape="circle" type="primary"
> shape="circle"
{t('Publish to web')} >
</Button> {t('Publish to web')}
)} </Button>
)}
</StyledPublishCopyContainer>
</div> </div>
) : ( ) : (
<StyledPublishContent> <StyledPublishContent>

View File

@@ -69,7 +69,7 @@ export const SyncPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
placement="bottom-end" placement="bottom-end"
disablePortal={true} disablePortal={true}
> >
<Button> <Button type="primary">
{t('Download data to device', { CoreOrAll: 'all' })} {t('Download data to device', { CoreOrAll: 'all' })}
</Button> </Button>
</Menu> </Menu>

View File

@@ -12,7 +12,7 @@ import Input from '@/ui/input';
import { useAppState } from '@/providers/app-state-provider'; import { useAppState } from '@/providers/app-state-provider';
import { WorkspaceDelete } from './delete'; import { WorkspaceDelete } from './delete';
import { WorkspaceLeave } from './leave'; import { WorkspaceLeave } from './leave';
import { Upload } from '@/components/file-upload'; // import { Upload } from '@/components/file-upload';
import { WorkspaceUnitAvatar } from '@/components/workspace-avatar'; import { WorkspaceUnitAvatar } from '@/components/workspace-avatar';
import { WorkspaceUnit } from '@affine/datacenter'; import { WorkspaceUnit } from '@affine/datacenter';
import { useWorkspaceHelper } from '@/hooks/use-workspace-helper'; import { useWorkspaceHelper } from '@/hooks/use-workspace-helper';
@@ -20,7 +20,7 @@ import { useTranslation } from '@affine/i18n';
export const GeneralPage = ({ workspace }: { workspace: WorkspaceUnit }) => { export const GeneralPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
const [showDelete, setShowDelete] = useState<boolean>(false); const [showDelete, setShowDelete] = useState<boolean>(false);
const [showLeave, setShowLeave] = useState<boolean>(false); const [showLeave, setShowLeave] = useState<boolean>(false);
const [uploading, setUploading] = useState<boolean>(false); // const [uploading, setUploading] = useState<boolean>(false);
const [workspaceName, setWorkspaceName] = useState<string>(workspace.name); const [workspaceName, setWorkspaceName] = useState<string>(workspace.name);
const { currentWorkspace, isOwner } = useAppState(); const { currentWorkspace, isOwner } = useAppState();
const { updateWorkspace } = useWorkspaceHelper(); const { updateWorkspace } = useWorkspaceHelper();
@@ -34,13 +34,13 @@ export const GeneralPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
updateWorkspace({ name: workspaceName }, currentWorkspace); updateWorkspace({ name: workspaceName }, currentWorkspace);
}; };
const fileChange = async (file: File) => { // const fileChange = async (file: File) => {
setUploading(true); // setUploading(true);
const blob = new Blob([file], { type: file.type }); // const blob = new Blob([file], { type: file.type });
currentWorkspace && // currentWorkspace &&
(await updateWorkspace({ avatarBlob: blob }, currentWorkspace)); // (await updateWorkspace({ avatarBlob: blob }, currentWorkspace));
setUploading(false); // setUploading(false);
}; // };
return workspace ? ( return workspace ? (
<div> <div>
@@ -58,12 +58,13 @@ export const GeneralPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
workspaceUnit={workspace} workspaceUnit={workspace}
/> />
</div> </div>
<Upload {/* TODO: Wait for image sync to complete */}
{/* <Upload
accept="image/gif,image/jpeg,image/jpg,image/png,image/svg" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg"
fileChange={fileChange} fileChange={fileChange}
> >
<Button loading={uploading}>{t('Upload')}</Button> <Button loading={uploading}>{t('Upload')}</Button>
</Upload> </Upload> */}
{/* TODO: add upload logic */} {/* TODO: add upload logic */}
</StyledSettingAvatarContent> </StyledSettingAvatarContent>
<StyledSettingH2 marginTop={20}>{t('Workspace Name')}</StyledSettingH2> <StyledSettingH2 marginTop={20}>{t('Workspace Name')}</StyledSettingH2>