@@ -2,7 +2,7 @@ import { type Interpolation, type Theme } from "@emotion/react";
2
2
import Button from "@mui/material/Button" ;
3
3
import AlertTitle from "@mui/material/AlertTitle" ;
4
4
import { type FC , useEffect , useState } from "react" ;
5
- import { useNavigate } from "react-router-dom" ;
5
+ import { useNavigate , useSearchParams } from "react-router-dom" ;
6
6
import dayjs from "dayjs" ;
7
7
import type * as TypesGen from "api/typesGenerated" ;
8
8
import { Alert , AlertDetail } from "components/Alert/Alert" ;
@@ -21,6 +21,9 @@ import { WorkspaceTopbar } from "./WorkspaceTopbar";
21
21
import { HistorySidebar } from "./HistorySidebar" ;
22
22
import { dashboardContentBottomPadding , navHeight } from "theme/constants" ;
23
23
import { bannerHeight } from "components/Dashboard/DeploymentBanner/DeploymentBannerView" ;
24
+ import HistoryOutlined from "@mui/icons-material/HistoryOutlined" ;
25
+ import { useTheme } from "@mui/material/styles" ;
26
+ import { SidebarIconButton } from "components/FullPageLayout/Sidebar" ;
24
27
25
28
export type WorkspaceError =
26
29
| "getBuildsError"
@@ -94,6 +97,9 @@ export const Workspace: FC<React.PropsWithChildren<WorkspaceProps>> = ({
94
97
} ) => {
95
98
const navigate = useNavigate ( ) ;
96
99
const { saveLocal, getLocal } = useLocalStorage ( ) ;
100
+ const theme = useTheme ( ) ;
101
+
102
+ const [ searchParams , setSearchParams ] = useSearchParams ( ) ;
97
103
98
104
const [ showAlertPendingInQueue , setShowAlertPendingInQueue ] = useState ( false ) ;
99
105
@@ -148,8 +154,8 @@ export const Workspace: FC<React.PropsWithChildren<WorkspaceProps>> = ({
148
154
flex : 1 ,
149
155
display : "grid" ,
150
156
gridTemplate : `
151
- "topbar topbar" auto
152
- "sidebar content" 1fr / auto 1fr
157
+ "topbar topbar topbar " auto
158
+ "leftbar sidebar content" 1fr / auto auto 1fr
153
159
` ,
154
160
maxHeight : `calc(100vh - ${ navHeight + bannerHeight } px)` ,
155
161
marginBottom : `-${ dashboardContentBottomPadding } px` ,
@@ -175,6 +181,34 @@ export const Workspace: FC<React.PropsWithChildren<WorkspaceProps>> = ({
175
181
canUpdateWorkspace = { canUpdateWorkspace }
176
182
/>
177
183
184
+ < div
185
+ css = { {
186
+ gridArea : "leftbar" ,
187
+ height : "100%" ,
188
+ overflowY : "auto" ,
189
+ borderRight : `1px solid ${ theme . palette . divider } ` ,
190
+ } }
191
+ >
192
+ < SidebarIconButton
193
+ isActive = { searchParams . get ( "sidebar" ) === "history" }
194
+ onClick = { ( ) => {
195
+ const sidebarOption = searchParams . get ( "sidebar" ) ;
196
+ if ( sidebarOption === "history" ) {
197
+ searchParams . delete ( "sidebar" ) ;
198
+ } else {
199
+ searchParams . set ( "sidebar" , "history" ) ;
200
+ }
201
+ setSearchParams ( searchParams ) ;
202
+ } }
203
+ >
204
+ < HistoryOutlined />
205
+ </ SidebarIconButton >
206
+ </ div >
207
+
208
+ { searchParams . get ( "sidebar" ) === "history" && (
209
+ < HistorySidebar workspace = { workspace } />
210
+ ) }
211
+
178
212
< div css = { styles . content } >
179
213
< div css = { styles . dotBackground } >
180
214
< Stack direction = "column" css = { styles . firstColumnSpacer } spacing = { 4 } >
@@ -331,8 +365,6 @@ export const Workspace: FC<React.PropsWithChildren<WorkspaceProps>> = ({
331
365
</ Stack >
332
366
</ div >
333
367
</ div >
334
-
335
- < HistorySidebar workspace = { workspace } />
336
368
</ div >
337
369
) ;
338
370
} ;
0 commit comments