mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: remove offset top
This commit is contained in:
parent
f556e50be4
commit
ad0a6d01d2
@ -202,10 +202,6 @@ export const useFolderEvents = (folder: IFolder, pages: IPage[]) => {
|
||||
}
|
||||
};
|
||||
|
||||
const setOffsetTop = (v: number) => {
|
||||
foldersActions.setOffsetTop({ id: folder.id, offset: v });
|
||||
};
|
||||
|
||||
return {
|
||||
showPages,
|
||||
onFolderNameClick,
|
||||
@ -227,6 +223,5 @@ export const useFolderEvents = (folder: IFolder, pages: IPage[]) => {
|
||||
|
||||
closePopup,
|
||||
folderHeight,
|
||||
setOffsetTop,
|
||||
};
|
||||
};
|
||||
|
@ -42,17 +42,12 @@ export const FolderItem = ({
|
||||
|
||||
closePopup,
|
||||
folderHeight,
|
||||
setOffsetTop,
|
||||
} = useFolderEvents(folder, pages);
|
||||
|
||||
const [popupY, setPopupY] = useState(0);
|
||||
|
||||
const el = useRef<HTMLDivElement>(null);
|
||||
|
||||
useEffect(() => {
|
||||
setOffsetTop(el.current?.offsetTop || 0);
|
||||
}, [el, showPages]);
|
||||
|
||||
useEffect(() => {
|
||||
if (el.current) {
|
||||
const { top } = el.current.getBoundingClientRect();
|
||||
|
@ -60,10 +60,6 @@ export const usePageEvents = (page: IPage) => {
|
||||
setShowRenamePopup(false);
|
||||
};
|
||||
|
||||
const setOffsetTop = (v: number) => {
|
||||
pagesActions.setOffsetTop({ id: page.id, offset: v });
|
||||
};
|
||||
|
||||
return {
|
||||
showPageOptions,
|
||||
onPageOptionsClick,
|
||||
@ -75,6 +71,5 @@ export const usePageEvents = (page: IPage) => {
|
||||
closePopup,
|
||||
closeRenamePopup,
|
||||
activePageId,
|
||||
setOffsetTop,
|
||||
};
|
||||
};
|
||||
|
@ -23,15 +23,10 @@ export const PageItem = ({ page, onPageClick }: { page: IPage; onPageClick: () =
|
||||
closePopup,
|
||||
closeRenamePopup,
|
||||
activePageId,
|
||||
setOffsetTop,
|
||||
} = usePageEvents(page);
|
||||
|
||||
const el = useRef<HTMLDivElement>(null);
|
||||
|
||||
useEffect(() => {
|
||||
setOffsetTop(el.current?.offsetTop || 0);
|
||||
}, [el.current]);
|
||||
|
||||
const [popupY, setPopupY] = useState(0);
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -2,7 +2,6 @@ import React, { ReactNode, useEffect } from 'react';
|
||||
import { NavigationPanel } from './NavigationPanel/NavigationPanel';
|
||||
import { MainPanel } from './MainPanel';
|
||||
import { useNavigationPanelHooks } from './NavigationPanel/NavigationPanel.hooks';
|
||||
import { NavigationFloatingPanel } from './NavigationPanel/NavigationFloatingPanel';
|
||||
import { useWorkspace } from './Workspace.hooks';
|
||||
import { useAppSelector } from '../../stores/store';
|
||||
|
||||
|
@ -3,7 +3,6 @@ import { createSlice, PayloadAction } from '@reduxjs/toolkit';
|
||||
export interface IFolder {
|
||||
id: string;
|
||||
title: string;
|
||||
offsetTop?: number;
|
||||
showPages?: boolean;
|
||||
}
|
||||
|
||||
@ -25,9 +24,6 @@ export const foldersSlice = createSlice({
|
||||
clearFolders() {
|
||||
return [];
|
||||
},
|
||||
setOffsetTop(state, action: PayloadAction<{ id: string; offset: number }>) {
|
||||
return state.map((f) => (f.id === action.payload.id ? { ...f, offsetTop: action.payload.offset } : f));
|
||||
},
|
||||
toggleShowPages(state, action: PayloadAction<{ id: string }>) {
|
||||
return state.map((f) => (f.id === action.payload.id ? { ...f, showPages: !f.showPages } : f));
|
||||
},
|
||||
|
@ -6,7 +6,6 @@ export interface IPage {
|
||||
title: string;
|
||||
pageType: ViewLayoutTypePB;
|
||||
folderId: string;
|
||||
offsetTop?: number;
|
||||
}
|
||||
|
||||
const initialState: IPage[] = [];
|
||||
@ -32,9 +31,6 @@ export const pagesSlice = createSlice({
|
||||
clearPages() {
|
||||
return [];
|
||||
},
|
||||
setOffsetTop(state, action: PayloadAction<{ id: string; offset: number }>) {
|
||||
return state.map((page) => (page.id === action.payload.id ? { ...page, offsetTop: action.payload.offset } : page));
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user