From 152093e7d87cacd0f5580e3fd4a28b67d44aae58 Mon Sep 17 00:00:00 2001
From: DiamondThree <857159145@qq.com>
Date: Mon, 30 Jan 2023 12:37:28 +0800
Subject: [PATCH] fix: publish status error and delete export tab
---
.../src/components/workspace-modal/index.tsx | 10 ++++++++--
.../workspace-setting/PublishPage.tsx | 4 +---
.../components/workspace-setting/SyncPage.tsx | 19 ++++++++++++++-----
.../src/components/workspace-setting/style.ts | 1 +
.../pages/workspace/[workspaceId]/setting.tsx | 10 +++++-----
5 files changed, 29 insertions(+), 15 deletions(-)
diff --git a/packages/app/src/components/workspace-modal/index.tsx b/packages/app/src/components/workspace-modal/index.tsx
index c0dd2a8bd..2ce3e5099 100644
--- a/packages/app/src/components/workspace-modal/index.tsx
+++ b/packages/app/src/components/workspace-modal/index.tsx
@@ -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 && (
- Published to Web
+ Published to Web
)}
diff --git a/packages/app/src/components/workspace-setting/PublishPage.tsx b/packages/app/src/components/workspace-setting/PublishPage.tsx
index a30b72bdf..a03749fe9 100644
--- a/packages/app/src/components/workspace-setting/PublishPage.tsx
+++ b/packages/app/src/components/workspace-setting/PublishPage.tsx
@@ -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"
diff --git a/packages/app/src/components/workspace-setting/SyncPage.tsx b/packages/app/src/components/workspace-setting/SyncPage.tsx
index 6969461a3..69a3df8a6 100644
--- a/packages/app/src/components/workspace-setting/SyncPage.tsx
+++ b/packages/app/src/components/workspace-setting/SyncPage.tsx
@@ -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 (
@@ -40,12 +42,19 @@ export const SyncPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
) : (
<>
-
- {{ workspaceName: workspace.name ?? 'Affine' }}
- is Cloud Workspace. All data will be synchronised and saved to
- the AFFiNE
-
+
+ {workspace.name} is
+ Cloud Workspace.
+
+ All data will be synchronized and saved to the AFFiNE account{' '}
+ {user?.email}
+