From 30679763abce60535a2114a24938d82186506aaf Mon Sep 17 00:00:00 2001 From: DiamondThree <857159145@qq.com> Date: Tue, 10 Jan 2023 21:59:09 +0800 Subject: [PATCH] feat: change workspaceInfo type --- .../app/src/components/quick-search/Input.tsx | 2 +- .../app/src/components/quick-search/index.tsx | 2 +- .../src/components/workspace-modal/index.tsx | 2 +- .../workspace-setting/ExportPage.tsx | 4 +- .../workspace-setting/MembersPage.tsx | 4 +- .../workspace-setting/PublishPage.tsx | 8 +- .../components/workspace-setting/SyncPage.tsx | 4 +- .../workspace-setting/general/General.tsx | 4 +- .../general/delete/Delete.tsx | 4 +- .../pages/workspace/[workspaceId]/setting.tsx | 4 +- .../providers/app-state-provider/Provider.tsx | 19 +-- .../providers/app-state-provider/interface.ts | 6 +- packages/data-center/src/index.ts | 1 + .../src/workspace-meta-collection.ts | 127 ------------------ .../src/workspace-unit-collection.ts | 2 +- 15 files changed, 35 insertions(+), 158 deletions(-) delete mode 100644 packages/data-center/src/workspace-meta-collection.ts diff --git a/packages/app/src/components/quick-search/Input.tsx b/packages/app/src/components/quick-search/Input.tsx index 69d47a16a1..e12dc655b2 100644 --- a/packages/app/src/components/quick-search/Input.tsx +++ b/packages/app/src/components/quick-search/Input.tsx @@ -20,7 +20,7 @@ export const Input = (props: { const { currentWorkspaceId, workspaceList, currentWorkspace } = useAppState(); const isPublish = workspaceList.find( meta => String(meta.id) === String(currentWorkspaceId) - )?.isPublish; + )?.published; useEffect(() => { inputRef.current?.addEventListener( 'blur', diff --git a/packages/app/src/components/quick-search/index.tsx b/packages/app/src/components/quick-search/index.tsx index 8199493a47..1450531f5a 100644 --- a/packages/app/src/components/quick-search/index.tsx +++ b/packages/app/src/components/quick-search/index.tsx @@ -29,7 +29,7 @@ export const QuickSearch = ({ open, onClose }: TransitionsModalProps) => { const [showCreatePage, setShowCreatePage] = useState(true); const { triggerQuickSearchModal } = useModal(); - const isPublish = currentMetaWorkSpace?.isPublish; + const isPublish = currentMetaWorkSpace?.published; // Add ‘⌘+K’ shortcut keys as switches useEffect(() => { diff --git a/packages/app/src/components/workspace-modal/index.tsx b/packages/app/src/components/workspace-modal/index.tsx index 5380f71fc0..dbe5146c52 100644 --- a/packages/app/src/components/workspace-modal/index.tsx +++ b/packages/app/src/components/workspace-modal/index.tsx @@ -98,7 +98,7 @@ export const WorkspaceModal = ({ open, onClose }: WorkspaceModalProps) => { {item.provider === 'affine' && ( )} - {item.isPublish && } + {item.published && } {/* {item.isLocal ? 'isLocal' : ''}/ */} diff --git a/packages/app/src/components/workspace-setting/ExportPage.tsx b/packages/app/src/components/workspace-setting/ExportPage.tsx index 3742b71a3c..e3bde461f9 100644 --- a/packages/app/src/components/workspace-setting/ExportPage.tsx +++ b/packages/app/src/components/workspace-setting/ExportPage.tsx @@ -1,5 +1,5 @@ import { styled } from '@/styles'; -import { WorkspaceInfo } from '@affine/datacenter'; +import { WorkspaceUnit } from '@affine/datacenter'; export const ExportPageTitleContainer = styled('div')(() => { return { @@ -9,7 +9,7 @@ export const ExportPageTitleContainer = styled('div')(() => { flex: 1, }; }); -export const ExportPage = ({ workspace }: { workspace: WorkspaceInfo }) => { +export const ExportPage = ({ workspace }: { workspace: WorkspaceUnit }) => { return ( Export Workspace{' '} diff --git a/packages/app/src/components/workspace-setting/MembersPage.tsx b/packages/app/src/components/workspace-setting/MembersPage.tsx index 32639f874f..3859bcbd26 100644 --- a/packages/app/src/components/workspace-setting/MembersPage.tsx +++ b/packages/app/src/components/workspace-setting/MembersPage.tsx @@ -24,13 +24,13 @@ import { Empty } from '@/ui/empty'; // User, // Workspace, // } from '@/hooks/mock-data/mock'; -import { WorkspaceInfo } from '@affine/datacenter'; +import { WorkspaceUnit } from '@affine/datacenter'; import { useTemporaryHelper } from '@/providers/temporary-helper-provider'; import { StyledMemberWarp } from './general/style'; import { useConfirm } from '@/providers/ConfirmProvider'; // import { useAppState } from '@/providers/app-state-provider'; -export const MembersPage = ({ workspace }: { workspace: WorkspaceInfo }) => { +export const MembersPage = ({ workspace }: { workspace: WorkspaceUnit }) => { const [isInviteModalShow, setIsInviteModalShow] = useState(false); const [members, setMembers] = useState<[{ name: string; email: string }]>([ { name: 'affine', email: 'tttt' }, diff --git a/packages/app/src/components/workspace-setting/PublishPage.tsx b/packages/app/src/components/workspace-setting/PublishPage.tsx index e931041fac..dce254dc21 100644 --- a/packages/app/src/components/workspace-setting/PublishPage.tsx +++ b/packages/app/src/components/workspace-setting/PublishPage.tsx @@ -12,9 +12,9 @@ import { toast } from '@/ui/toast'; import { useConfirm } from '@/providers/ConfirmProvider'; // import { useAppState } from '@/providers/app-state-provider3'; import { useWorkspaceHelper } from '@/hooks/use-workspace-helper'; -import { WorkspaceInfo } from '@affine/datacenter'; +import { WorkspaceUnit } from '@affine/datacenter'; -export const PublishPage = ({ workspace }: { workspace: WorkspaceInfo }) => { +export const PublishPage = ({ workspace }: { workspace: WorkspaceUnit }) => { const shareUrl = window.location.host + '/workspace/' + workspace.id + '?share=true'; const { publishWorkspace } = useWorkspaceHelper(); @@ -53,7 +53,7 @@ export const PublishPage = ({ workspace }: { workspace: WorkspaceInfo }) => { {workspace.provider === 'cloud' ? (
- {workspace?.isPublish ? ( + {workspace?.published ? ( <> Publishing to web requires AFFiNE Cloud service . @@ -75,7 +75,7 @@ export const PublishPage = ({ workspace }: { workspace: WorkspaceInfo }) => { )} - {workspace.isPublish ? ( + {workspace.published ? (