refactor(store): extract workspace out of AppState (#1037)

This commit is contained in:
Himself65
2023-02-15 21:41:43 -06:00
committed by GitHub
parent a4d0813354
commit cdc2b449a9
30 changed files with 323 additions and 245 deletions
+5 -3
View File
@@ -4,9 +4,9 @@ import { Button } from '@affine/component';
import { Content, FlexWrapper } from '@affine/component';
import Loading from '@/components/loading';
import { usePageHelper } from '@/hooks/use-page-helper';
import { useAppState } from '@/providers/app-state-provider';
import { useEffect, useState } from 'react';
import { useCallback, useEffect, useState } from 'react';
import { useTranslation } from '@affine/i18n';
import { useGlobalState } from '@/store/app';
// import { Tooltip } from '@affine/component';
type ImportModalProps = {
open: boolean;
@@ -19,7 +19,9 @@ type Template = {
export const ImportModal = ({ open, onClose }: ImportModalProps) => {
const [status, setStatus] = useState<'unImported' | 'importing'>('importing');
const { openPage, createPage } = usePageHelper();
const { currentWorkspace } = useAppState();
const currentWorkspace = useGlobalState(
useCallback(store => store.currentDataCenterWorkspace, [])
);
const { t } = useTranslation();
const _applyTemplate = function (pageId: string, template: Template) {
const page = currentWorkspace?.blocksuiteWorkspace?.getPage(pageId);