@@ -25,12 +25,13 @@ interface AppState {
2525 currentView : ViewType ;
2626 selectedFile : SelectedFile | null ;
2727 selectedWorkspaceForJobs : string | null ;
28+ selectedJobId : string | null ;
2829 selectedWorkspaceForReports : string | null ;
2930}
3031
3132type AppAction =
3233 | { type : "NAVIGATE_TO_CHAT" }
33- | { type : "NAVIGATE_TO_JOBS" ; payload : string }
34+ | { type : "NAVIGATE_TO_JOBS" ; payload : { workspaceId : string ; jobId ?: string } }
3435 | { type : "NAVIGATE_TO_REPORTS" ; payload : string }
3536 | { type : "NAVIGATE_TO_FILE" ; payload : SelectedFile }
3637 | { type : "CLOSE_FILE" } ;
@@ -39,6 +40,7 @@ const initialState: AppState = {
3940 currentView : "chat" ,
4041 selectedFile : null ,
4142 selectedWorkspaceForJobs : null ,
43+ selectedJobId : null ,
4244 selectedWorkspaceForReports : null ,
4345} ;
4446
@@ -50,14 +52,16 @@ const appReducer = (state: AppState, action: AppAction): AppState => {
5052 currentView : "chat" ,
5153 selectedFile : null ,
5254 selectedWorkspaceForJobs : null ,
55+ selectedJobId : null ,
5356 selectedWorkspaceForReports : null ,
5457 } ;
5558 case "NAVIGATE_TO_JOBS" :
5659 return {
5760 ...state ,
5861 currentView : "jobs" ,
5962 selectedFile : null ,
60- selectedWorkspaceForJobs : action . payload ,
63+ selectedWorkspaceForJobs : action . payload . workspaceId ,
64+ selectedJobId : action . payload . jobId || null ,
6165 selectedWorkspaceForReports : null ,
6266 } ;
6367 case "NAVIGATE_TO_REPORTS" :
@@ -66,6 +70,7 @@ const appReducer = (state: AppState, action: AppAction): AppState => {
6670 currentView : "reports" ,
6771 selectedFile : null ,
6872 selectedWorkspaceForJobs : null ,
73+ selectedJobId : null ,
6974 selectedWorkspaceForReports : action . payload ,
7075 } ;
7176 case "NAVIGATE_TO_FILE" :
@@ -74,6 +79,7 @@ const appReducer = (state: AppState, action: AppAction): AppState => {
7479 currentView : "file" ,
7580 selectedFile : action . payload ,
7681 selectedWorkspaceForJobs : null ,
82+ selectedJobId : null ,
7783 selectedWorkspaceForReports : null ,
7884 } ;
7985 case "CLOSE_FILE" :
@@ -90,7 +96,7 @@ const appReducer = (state: AppState, action: AppAction): AppState => {
9096interface AppContextType {
9197 state : AppState ;
9298 navigateToChat : ( ) => void ;
93- navigateToJobs : ( workspaceId : string ) => void ;
99+ navigateToJobs : ( workspaceId : string , jobId ?: string ) => void ;
94100 navigateToReports : ( workspaceId : string ) => void ;
95101 navigateToFile : ( workspaceId : string , fileName : string ) => void ;
96102 closeFile : ( ) => void ;
@@ -107,8 +113,8 @@ export const AppProvider: React.FC<{ children: ReactNode }> = ({
107113 dispatch ( { type : "NAVIGATE_TO_CHAT" } ) ;
108114 } , [ ] ) ;
109115
110- const navigateToJobs = useCallback ( ( workspaceId : string ) => {
111- dispatch ( { type : "NAVIGATE_TO_JOBS" , payload : workspaceId } ) ;
116+ const navigateToJobs = useCallback ( ( workspaceId : string , jobId ?: string ) => {
117+ dispatch ( { type : "NAVIGATE_TO_JOBS" , payload : { workspaceId, jobId } } ) ;
112118 } , [ ] ) ;
113119
114120 const navigateToReports = useCallback ( ( workspaceId : string ) => {
0 commit comments