|
@@ -7,6 +7,8 @@ import { AppBackendService } from '../../../stores/effects/folder/app/app_bd_svc
|
|
|
import { WorkspaceBackendService } from '../../../stores/effects/folder/workspace/workspace_bd_svc';
|
|
|
import { useError } from '../../error/Error.hooks';
|
|
|
import { AppObserver } from '../../../stores/effects/folder/app/app_observer';
|
|
|
+import { activePageIdActions } from '../../../stores/reducers/activePageId/slice';
|
|
|
+import { useNavigate } from 'react-router-dom';
|
|
|
|
|
|
const initialFolderHeight = 40;
|
|
|
const initialPageHeight = 40;
|
|
@@ -16,6 +18,8 @@ export const useFolderEvents = (folder: IFolder, pages: IPage[]) => {
|
|
|
const appDispatch = useAppDispatch();
|
|
|
const workspace = useAppSelector((state) => state.workspace);
|
|
|
|
|
|
+ const navigate = useNavigate();
|
|
|
+
|
|
|
// Actions
|
|
|
const [showPages, setShowPages] = useState(false);
|
|
|
const [showFolderOptions, setShowFolderOptions] = useState(false);
|
|
@@ -140,6 +144,10 @@ export const useFolderEvents = (folder: IFolder, pages: IPage[]) => {
|
|
|
id: newView.id,
|
|
|
})
|
|
|
);
|
|
|
+
|
|
|
+ appDispatch(activePageIdActions.setActivePageId(newView.id));
|
|
|
+
|
|
|
+ navigate(`/page/document/${newView.id}`);
|
|
|
} catch (e: any) {
|
|
|
error.showError(e?.message);
|
|
|
}
|
|
@@ -161,6 +169,10 @@ export const useFolderEvents = (folder: IFolder, pages: IPage[]) => {
|
|
|
id: newView.id,
|
|
|
})
|
|
|
);
|
|
|
+
|
|
|
+ appDispatch(activePageIdActions.setActivePageId(newView.id));
|
|
|
+
|
|
|
+ navigate(`/page/board/${newView.id}`);
|
|
|
} catch (e: any) {
|
|
|
error.showError(e?.message);
|
|
|
}
|
|
@@ -182,11 +194,19 @@ export const useFolderEvents = (folder: IFolder, pages: IPage[]) => {
|
|
|
id: newView.id,
|
|
|
})
|
|
|
);
|
|
|
+
|
|
|
+ appDispatch(activePageIdActions.setActivePageId(newView.id));
|
|
|
+
|
|
|
+ navigate(`/page/grid/${newView.id}`);
|
|
|
} catch (e: any) {
|
|
|
error.showError(e?.message);
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ const setOffsetTop = (v: number) => {
|
|
|
+ foldersActions.setOffsetTop({ id: folder.id, offset: v });
|
|
|
+ };
|
|
|
+
|
|
|
return {
|
|
|
showPages,
|
|
|
onFolderNameClick,
|
|
@@ -209,5 +229,6 @@ export const useFolderEvents = (folder: IFolder, pages: IPage[]) => {
|
|
|
closePopup,
|
|
|
folderHeight,
|
|
|
animationDuration,
|
|
|
+ setOffsetTop,
|
|
|
};
|
|
|
};
|