fix: publish status error and delete export tab

This commit is contained in:
DiamondThree
2023-01-30 12:37:28 +08:00
parent 23b9ff1ce6
commit 152093e7d8
5 changed files with 29 additions and 15 deletions

View File

@@ -20,7 +20,13 @@ import { useRouter } from 'next/router';
import { useTranslation } from '@affine/i18n'; import { useTranslation } from '@affine/i18n';
import { LanguageMenu } from './languageMenu'; import { LanguageMenu } from './languageMenu';
import { CloudIcon, LineIcon, LocalIcon, OfflineIcon } from './icons'; import {
CloudIcon,
LineIcon,
LocalIcon,
OfflineIcon,
PublishedIcon,
} from './icons';
import { LoginModal } from '../login-modal'; import { LoginModal } from '../login-modal';
import { LogoutModal } from '../logout-modal'; import { LogoutModal } from '../logout-modal';
interface WorkspaceModalProps { interface WorkspaceModalProps {
@@ -120,7 +126,7 @@ export const WorkspaceModal = ({ open, onClose }: WorkspaceModalProps) => {
)} )}
{item.published && ( {item.published && (
<p> <p>
<PublishIcon fontSize={16} /> Published to Web <PublishedIcon /> Published to Web
</p> </p>
)} )}
</StyleWorkspaceInfo> </StyleWorkspaceInfo>

View File

@@ -10,7 +10,6 @@ import { useState } from 'react';
import { Button } from '@/ui/button'; import { Button } from '@/ui/button';
import Input from '@/ui/input'; import Input from '@/ui/input';
import { toast } from '@/ui/toast'; import { toast } from '@/ui/toast';
// import { useAppState } from '@/providers/app-state-provider3';
import { WorkspaceUnit } from '@affine/datacenter'; import { WorkspaceUnit } from '@affine/datacenter';
import { useWorkspaceHelper } from '@/hooks/use-workspace-helper'; import { useWorkspaceHelper } from '@/hooks/use-workspace-helper';
import { useTranslation } from '@affine/i18n'; import { useTranslation } from '@affine/i18n';
@@ -23,6 +22,7 @@ export const PublishPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
const togglePublic = async (flag: boolean) => { const togglePublic = async (flag: boolean) => {
try { try {
await publishWorkspace(workspace.id.toString(), flag); await publishWorkspace(workspace.id.toString(), flag);
setLoaded(false);
} catch (e) { } catch (e) {
toast('Failed to publish workspace'); toast('Failed to publish workspace');
} }
@@ -67,7 +67,6 @@ export const PublishPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
onClick={async () => { onClick={async () => {
setLoaded(true); setLoaded(true);
await togglePublic(true); await togglePublic(true);
setLoaded(false);
}} }}
loading={loaded} loading={loaded}
type="primary" type="primary"
@@ -86,7 +85,6 @@ export const PublishPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
onClick={async () => { onClick={async () => {
setLoaded(true); setLoaded(true);
await togglePublic(false); await togglePublic(false);
setLoaded(true);
}} }}
loading={false} loading={false}
type="danger" type="danger"

View File

@@ -12,8 +12,10 @@ import { WorkspaceUnit } from '@affine/datacenter';
import { Trans, useTranslation } from '@affine/i18n'; import { Trans, useTranslation } from '@affine/i18n';
import { WorkspaceUnitAvatar } from '@/components/workspace-avatar'; import { WorkspaceUnitAvatar } from '@/components/workspace-avatar';
import { EnableWorkspaceButton } from '../enable-workspace'; import { EnableWorkspaceButton } from '../enable-workspace';
import { useAppState } from '@/providers/app-state-provider';
export const SyncPage = ({ workspace }: { workspace: WorkspaceUnit }) => { export const SyncPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
const { t } = useTranslation(); const { t } = useTranslation();
const { user } = useAppState();
return ( return (
<div> <div>
<StyledPublishContent> <StyledPublishContent>
@@ -40,12 +42,19 @@ export const SyncPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
) : ( ) : (
<> <>
<StyledPublishExplanation> <StyledPublishExplanation>
<Trans i18nKey="Sync Description2"> <WorkspaceUnitAvatar
<code>{{ workspaceName: workspace.name ?? 'Affine' }}</code> size={32}
is Cloud Workspace. All data will be synchronised and saved to name={workspace.name}
the AFFiNE workspaceUnit={workspace}
</Trans> style={{ marginRight: '12px' }}
/>
<StyledWorkspaceName>{workspace.name} </StyledWorkspaceName>is
Cloud Workspace.
</StyledPublishExplanation> </StyledPublishExplanation>
<StyledWorkspaceType>
All data will be synchronized and saved to the AFFiNE account{' '}
{user?.email}
</StyledWorkspaceType>
<StyleAsync> <StyleAsync>
<Menu <Menu
content={ content={

View File

@@ -146,6 +146,7 @@ export const StyledPublishContent = styled('div')(() => {
return { return {
display: 'flex', display: 'flex',
flexDirection: 'column', flexDirection: 'column',
flex: 1,
}; };
}); });

View File

@@ -42,11 +42,11 @@ const tabMap: {
name: 'Publish', name: 'Publish',
panelRender: workspace => <PublishPage workspace={workspace} />, panelRender: workspace => <PublishPage workspace={workspace} />,
}, },
// TODO: next version will finish this feature
{ // {
name: 'Export', // name: 'Export',
panelRender: workspace => <ExportPage workspace={workspace} />, // panelRender: workspace => <ExportPage workspace={workspace} />,
}, // },
]; ];
const WorkspaceSetting = () => { const WorkspaceSetting = () => {