File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import React , { useState , useEffect } from 'react'
1+ import React , { useState , useEffect , useRef } from 'react'
22import {
33 Settings ,
44 CloudDownload ,
@@ -36,6 +36,15 @@ import LogViewer from './components/views/LogViewer'
3636
3737function App ( ) {
3838 const [ view , setView ] = useState ( 'dashboard' )
39+ const mainRef = useRef ( null )
40+
41+ useEffect ( ( ) => {
42+ if ( mainRef . current ) {
43+ mainRef . current . scrollTop = 0
44+ }
45+ window . scrollTo ( 0 , 0 )
46+ } , [ view ] )
47+
3948 const [ sidebarExpanded , setSidebarExpanded ] = useState ( ( ) => {
4049 const saved = localStorage . getItem ( 'sidebarExpanded' )
4150 return saved !== null ? JSON . parse ( saved ) : true
@@ -457,7 +466,7 @@ function App() {
457466 "flex flex-col relative" ,
458467 isPS5 ? "h-screen flex-1 min-h-0" : "md:h-screen md:flex-1 md:min-h-0"
459468 ) } >
460- < main className = { cn (
469+ < main ref = { mainRef } className = { cn (
461470 "custom-scrollbar max-w-[1800px] mx-auto w-full flex flex-col" ,
462471 isPS5 ? "pt-16 px-16 pb-12 flex-1 overflow-y-auto" : "pt-6 px-6 pb-36 md:pt-16 md:px-16 md:pb-12 md:flex-1 md:overflow-y-auto"
463472 ) } >
You can’t perform that action at this time.
0 commit comments