Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

chore: remove offset top

ascarbekad0a6d01d25f
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/layout/NavigationPanel/FolderItem.hooks.ts b/frontend/appflowy_tauri/src/appflowy_app/components/layout/NavigationPanel/FolderItem.hooks.ts
index 510d9a526b..642e75f4e4 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/layout/NavigationPanel/FolderItem.hooks.ts
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/layout/NavigationPanel/FolderItem.hooks.ts
@@ -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,
};
};
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/layout/NavigationPanel/FolderItem.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/layout/NavigationPanel/FolderItem.tsx
index 414104daeb..c1d87f2a5b 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/layout/NavigationPanel/FolderItem.tsx
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/layout/NavigationPanel/FolderItem.tsx
@@ -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();
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/layout/NavigationPanel/PageItem.hooks.ts b/frontend/appflowy_tauri/src/appflowy_app/components/layout/NavigationPanel/PageItem.hooks.ts
index f01752f5f1..9e608071e1 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/layout/NavigationPanel/PageItem.hooks.ts
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/layout/NavigationPanel/PageItem.hooks.ts
@@ -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,
};
};
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/layout/NavigationPanel/PageItem.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/layout/NavigationPanel/PageItem.tsx
index 7e07d06316..6085fb2a8c 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/layout/NavigationPanel/PageItem.tsx
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/layout/NavigationPanel/PageItem.tsx
@@ -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(() => {
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/layout/Screen.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/layout/Screen.tsx
index 265eefedcc..c4e6316ab4 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/layout/Screen.tsx
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/layout/Screen.tsx
@@ -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';
diff --git a/frontend/appflowy_tauri/src/appflowy_app/stores/reducers/folders/slice.ts b/frontend/appflowy_tauri/src/appflowy_app/stores/reducers/folders/slice.ts
index 609988f347..31cc72b05a 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/stores/reducers/folders/slice.ts
+++ b/frontend/appflowy_tauri/src/appflowy_app/stores/reducers/folders/slice.ts
@@ -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));
},
diff --git a/frontend/appflowy_tauri/src/appflowy_app/stores/reducers/pages/slice.ts b/frontend/appflowy_tauri/src/appflowy_app/stores/reducers/pages/slice.ts
index b0459d98ce..9c7700d11b 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/stores/reducers/pages/slice.ts
+++ b/frontend/appflowy_tauri/src/appflowy_app/stores/reducers/pages/slice.ts
@@ -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));
- },
},
});