File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ export const AllPagesPanel: React.FC<AllPagesPanelProps> = (props) => {
5151 onMenuGroupsChanged,
5252 } = useAsideHeaderInnerContext ( ) ;
5353 const items = useGroupedMenuItems ( menuItems , menuGroups , true ) ;
54-
54+ console . log ( items ) ;
5555 const menuItemsRef = useRef ( items ) ;
5656 menuItemsRef . current = items ;
5757
@@ -161,8 +161,8 @@ export const AllPagesPanel: React.FC<AllPagesPanelProps> = (props) => {
161161
162162 const currentFlatList = menuItemsRef . current || [ ] ;
163163
164+ console . log ( [ ...currentFlatList ] ) ;
164165 const updatedItems = sortMenuItems ( oldIndex , newIndex , currentFlatList ) ;
165-
166166 if ( updatedItems ) {
167167 onMenuItemsChanged ?.( updatedItems ) ;
168168 }
@@ -282,6 +282,10 @@ export const AllPagesPanel: React.FC<AllPagesPanelProps> = (props) => {
282282 ] ,
283283 ) ;
284284
285+ const data = items . filter (
286+ ( item ) => item . id !== ALL_PAGES_ID && item . type !== 'divider' && item . type !== 'action' ,
287+ ) ;
288+
285289 return (
286290 < Flex className = { b ( null , className ) } gap = "5" direction = "column" >
287291 < Flex gap = "4" alignItems = "center" justifyContent = "space-between" >
@@ -304,7 +308,7 @@ export const AllPagesPanel: React.FC<AllPagesPanelProps> = (props) => {
304308 sortable = { isEditMode && editMenuProps ?. enableSorting }
305309 virtualized = { false }
306310 filterable = { false }
307- items = { items }
311+ items = { data }
308312 renderItem = { renderFirstLevelItem }
309313 />
310314 </ Flex >
Original file line number Diff line number Diff line change @@ -16,13 +16,23 @@ export const useGroupedMenuItems = (
1616 return false ;
1717 }
1818
19- if ( isEditMode && ( item . id === ALL_PAGES_ID || item . type === 'action' ) ) {
19+ if ( isEditMode && item . id === ALL_PAGES_ID ) {
2020 return false ;
2121 }
2222
2323 return true ;
2424 } ) ;
2525
26+ visibleItems . sort ( ( { type : typeA } , { type : typeB } ) => {
27+ if ( typeA === 'action' ) {
28+ return 1 ;
29+ }
30+ if ( typeB === 'action' ) {
31+ return - 1 ;
32+ }
33+ return 0 ;
34+ } ) ;
35+
2636 const groupsMap = new Map < string , MenuGroup > ( ) ;
2737
2838 menuGroups ?. forEach ( ( group ) => {
You can’t perform that action at this time.
0 commit comments