@@ -40,14 +40,65 @@ interface AppAuthenticatedProps {
4040 userRole : Role ;
4141}
4242
43- const AppAuthenticated : React . FC < AppAuthenticatedProps > = ( { userId, userRole } ) => {
44- const { isLoading, isError, error, data : userSettingsData } = useSingleUserSettings ( userId ) ;
45-
43+ const SidebarLayout : React . FC < { children : React . ReactNode } > = ( { children } ) => {
4644 const theme = useTheme ( ) ;
4745 const [ drawerOpen , setDrawerOpen ] = useState ( false ) ;
4846 const [ moveContent , setMoveContent ] = useState ( false ) ;
4947 const { onGuestHomePage } = useHomePageContext ( ) ;
5048
49+ return (
50+ < >
51+ < Box
52+ onMouseEnter = { ( ) => {
53+ setDrawerOpen ( true ) ;
54+ } }
55+ sx = { {
56+ height : '100vh' ,
57+ position : 'fixed' ,
58+ width : 15 ,
59+ borderRight : 2 ,
60+ borderRightColor : theme . palette . background . paper
61+ } }
62+ />
63+ < IconButton
64+ onClick = { ( ) => {
65+ setDrawerOpen ( true ) ;
66+ setMoveContent ( true ) ;
67+ } }
68+ sx = { { position : 'fixed' , left : - 8 , top : '3%' } }
69+ id = "sidebar-button"
70+ >
71+ < ArrowCircleRightTwoToneIcon
72+ sx = { {
73+ fontSize : '30px' ,
74+ zIndex : 1 ,
75+ '& path:first-of-type' : { color : '#000000' } ,
76+ '& path:last-of-type' : { color : '#ef4345' }
77+ } }
78+ />
79+ </ IconButton >
80+ < Sidebar
81+ drawerOpen = { drawerOpen }
82+ setDrawerOpen = { setDrawerOpen }
83+ moveContent = { moveContent }
84+ setMoveContent = { setMoveContent }
85+ />
86+ < Box display = { 'flex' } >
87+ < HiddenContentMargin open = { moveContent } variant = "permanent" />
88+ < Container
89+ maxWidth = { false }
90+ sx = { { width : onGuestHomePage && moveContent ? 'calc(100vw - 220px)' : `calc(100vw - 30px)` } }
91+ >
92+ { children }
93+ </ Container >
94+ </ Box >
95+ </ >
96+ ) ;
97+ } ;
98+
99+ const AppAuthenticated : React . FC < AppAuthenticatedProps > = ( { userId, userRole } ) => {
100+ const { isLoading, isError, error, data : userSettingsData } = useSingleUserSettings ( userId ) ;
101+
51102 const {
52103 data : organization ,
53104 isLoading : organizationIsLoading ,
@@ -70,71 +121,26 @@ const AppAuthenticated: React.FC<AppAuthenticatedProps> = ({ userId, userRole })
70121
71122 return userSettingsData . slackId || isGuest ( userRole ) ? (
72123 < AppContextUser >
73- {
74- < >
75- < Box
76- onMouseEnter = { ( ) => {
77- setDrawerOpen ( true ) ;
78- } }
79- sx = { {
80- height : '100vh' ,
81- position : 'fixed' ,
82- width : 15 ,
83- borderRight : 2 ,
84- borderRightColor : theme . palette . background . paper
85- } }
86- />
87- < IconButton
88- onClick = { ( ) => {
89- setDrawerOpen ( true ) ;
90- setMoveContent ( true ) ;
91- } }
92- sx = { { position : 'fixed' , left : - 8 , top : '3%' } }
93- id = "sidebar-button"
94- >
95- < ArrowCircleRightTwoToneIcon
96- sx = { {
97- fontSize : '30px' ,
98- zIndex : 1 ,
99- '& path:first-of-type' : { color : '#000000' } ,
100- '& path:last-of-type' : { color : '#ef4345' }
101- } }
102- />
103- </ IconButton >
104- < Sidebar
105- drawerOpen = { drawerOpen }
106- setDrawerOpen = { setDrawerOpen }
107- moveContent = { moveContent }
108- setMoveContent = { setMoveContent }
109- />
110- </ >
111- }
112- < Box display = { 'flex' } >
113- < HiddenContentMargin open = { moveContent } variant = "permanent" />
114- < Container
115- maxWidth = { false }
116- sx = { { width : onGuestHomePage && moveContent ? 'calc(100vw - 220px)' : `calc(100vw - 30px)` } }
117- >
118- < Switch >
119- < Route path = { routes . PROJECTS } component = { Projects } />
120- < Redirect from = { routes . CR_BY_ID } to = { routes . CHANGE_REQUESTS_BY_ID } />
121- < Route path = { routes . CHANGE_REQUESTS } component = { ChangeRequests } />
122- < Route path = { routes . GANTT } component = { GanttChartPage } />
123- < Route path = { routes . TEAMS } component = { Teams } />
124- < Route path = { routes . SETTINGS } component = { Settings } />
125- < Route path = { routes . ADMIN_TOOLS } component = { AdminTools } />
126- < Route path = { routes . INFO } component = { InfoPage } />
127- < Route path = { routes . CREDITS } component = { Credits } />
128- < Route path = { routes . FINANCE } component = { Finance } />
129- < Route path = { routes . CALENDAR } component = { Calendar } />
130- < Route path = { routes . STATISTICS } component = { Statistics } />
131- < Route path = { routes . HOME } component = { Home } />
132- < Route path = { routes . RETROSPECTIVE } component = { RetrospectiveGanttChartPage } />
133- < Redirect from = { routes . BASE } to = { routes . HOME } />
134- < Route path = "*" component = { PageNotFound } />
135- </ Switch >
136- </ Container >
137- </ Box >
124+ < SidebarLayout >
125+ < Switch >
126+ < Route path = { routes . PROJECTS } component = { Projects } />
127+ < Redirect from = { routes . CR_BY_ID } to = { routes . CHANGE_REQUESTS_BY_ID } />
128+ < Route path = { routes . CHANGE_REQUESTS } component = { ChangeRequests } />
129+ < Route path = { routes . GANTT } component = { GanttChartPage } />
130+ < Route path = { routes . TEAMS } component = { Teams } />
131+ < Route path = { routes . SETTINGS } component = { Settings } />
132+ < Route path = { routes . ADMIN_TOOLS } component = { AdminTools } />
133+ < Route path = { routes . INFO } component = { InfoPage } />
134+ < Route path = { routes . CREDITS } component = { Credits } />
135+ < Route path = { routes . FINANCE } component = { Finance } />
136+ < Route path = { routes . CALENDAR } component = { Calendar } />
137+ < Route path = { routes . STATISTICS } component = { Statistics } />
138+ < Route path = { routes . HOME } component = { Home } />
139+ < Route path = { routes . RETROSPECTIVE } component = { RetrospectiveGanttChartPage } />
140+ < Redirect from = { routes . BASE } to = { routes . HOME } />
141+ < Route path = "*" component = { PageNotFound } />
142+ </ Switch >
143+ </ SidebarLayout >
138144 </ AppContextUser >
139145 ) : (
140146 < SetUserPreferences userSettings = { userSettingsData } />
0 commit comments