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

View File

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

View File

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

View File

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

View File

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