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
@@ -55,27 +55,29 @@ export const PublishPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
</StyledPublishExplanation>
)}
</StyledPublishContent>
{workspace.published ? (
<Button
onClick={() => {
togglePublic(false);
}}
type="primary"
shape="circle"
>
{t('Stop publishing')}
</Button>
) : (
<Button
onClick={() => {
togglePublic(true);
}}
type="primary"
shape="circle"
>
{t('Publish to web')}
</Button>
)}
<StyledPublishCopyContainer>
{workspace.published ? (
<Button
onClick={() => {
togglePublic(false);
}}
type="primary"
shape="circle"
>
{t('Stop publishing')}
</Button>
) : (
<Button
onClick={() => {
togglePublic(true);
}}
type="primary"
shape="circle"
>
{t('Publish to web')}
</Button>
)}
</StyledPublishCopyContainer>
</div>
) : (
<StyledPublishContent>
@@ -69,7 +69,7 @@ export const SyncPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
placement="bottom-end"
disablePortal={true}
>
<Button>
<Button type="primary">
{t('Download data to device', { CoreOrAll: 'all' })}
</Button>
</Menu>
@@ -12,7 +12,7 @@ import Input from '@/ui/input';
import { useAppState } from '@/providers/app-state-provider';
import { WorkspaceDelete } from './delete';
import { WorkspaceLeave } from './leave';
import { Upload } from '@/components/file-upload';
// import { Upload } from '@/components/file-upload';
import { WorkspaceUnitAvatar } from '@/components/workspace-avatar';
import { WorkspaceUnit } from '@affine/datacenter';
import { useWorkspaceHelper } from '@/hooks/use-workspace-helper';
@@ -20,7 +20,7 @@ import { useTranslation } from '@affine/i18n';
export const GeneralPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
const [showDelete, setShowDelete] = 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 { currentWorkspace, isOwner } = useAppState();
const { updateWorkspace } = useWorkspaceHelper();
@@ -34,13 +34,13 @@ export const GeneralPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
updateWorkspace({ name: workspaceName }, currentWorkspace);
};
const fileChange = async (file: File) => {
setUploading(true);
const blob = new Blob([file], { type: file.type });
currentWorkspace &&
(await updateWorkspace({ avatarBlob: blob }, currentWorkspace));
setUploading(false);
};
// const fileChange = async (file: File) => {
// setUploading(true);
// const blob = new Blob([file], { type: file.type });
// currentWorkspace &&
// (await updateWorkspace({ avatarBlob: blob }, currentWorkspace));
// setUploading(false);
// };
return workspace ? (
<div>
@@ -58,12 +58,13 @@ export const GeneralPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
workspaceUnit={workspace}
/>
</div>
<Upload
{/* TODO: Wait for image sync to complete */}
{/* <Upload
accept="image/gif,image/jpeg,image/jpg,image/png,image/svg"
fileChange={fileChange}
>
<Button loading={uploading}>{t('Upload')}</Button>
</Upload>
</Upload> */}
{/* TODO: add upload logic */}
</StyledSettingAvatarContent>
<StyledSettingH2 marginTop={20}>{t('Workspace Name')}</StyledSettingH2>