@@ -7,7 +7,7 @@ import { Button } from 'primeng/button';
7
7
import { DialogService , DynamicDialogRef } from 'primeng/dynamicdialog' ;
8
8
import { TablePageEvent } from 'primeng/table' ;
9
9
10
- import { debounceTime , distinctUntilChanged } from 'rxjs' ;
10
+ import { debounceTime , distinctUntilChanged , filter , tap } from 'rxjs' ;
11
11
12
12
import { Component , computed , DestroyRef , effect , inject , OnInit , signal } from '@angular/core' ;
13
13
import { takeUntilDestroyed , toSignal } from '@angular/core/rxjs-interop' ;
@@ -20,6 +20,7 @@ import { MY_PROJECTS_TABLE_PARAMS } from '@osf/shared/constants';
20
20
import { SortOrder } from '@osf/shared/enums' ;
21
21
import { IS_MEDIUM } from '@osf/shared/helpers' ;
22
22
import { MyResourcesItem , MyResourcesSearchFilters , TableParameters } from '@osf/shared/models' ;
23
+ import { ProjectRedirectDialogService } from '@osf/shared/services' ;
23
24
import { ClearMyResources , GetMyProjects , MyResourcesSelectors } from '@osf/shared/stores' ;
24
25
25
26
@Component ( {
@@ -35,6 +36,7 @@ export class DashboardComponent implements OnInit {
35
36
private readonly route = inject ( ActivatedRoute ) ;
36
37
private readonly translateService = inject ( TranslateService ) ;
37
38
private readonly dialogService = inject ( DialogService ) ;
39
+ private readonly projectRedirectDialogService = inject ( ProjectRedirectDialogService ) ;
38
40
39
41
readonly isMedium = toSignal ( inject ( IS_MEDIUM ) ) ;
40
42
@@ -175,13 +177,20 @@ export class DashboardComponent implements OnInit {
175
177
createProject ( ) : void {
176
178
const dialogWidth = this . isMedium ( ) ? '850px' : '95vw' ;
177
179
178
- this . dialogService . open ( CreateProjectDialogComponent , {
179
- width : dialogWidth ,
180
- focusOnShow : false ,
181
- header : this . translateService . instant ( 'myProjects.header.createProject' ) ,
182
- closeOnEscape : true ,
183
- modal : true ,
184
- closable : true ,
185
- } ) ;
180
+ this . dialogService
181
+ . open ( CreateProjectDialogComponent , {
182
+ width : dialogWidth ,
183
+ focusOnShow : false ,
184
+ header : this . translateService . instant ( 'myProjects.header.createProject' ) ,
185
+ closeOnEscape : true ,
186
+ modal : true ,
187
+ closable : true ,
188
+ } )
189
+ . onClose . pipe (
190
+ filter ( ( result ) => result . project . id ) ,
191
+ tap ( ( result ) => this . projectRedirectDialogService . showProjectRedirectDialog ( result . project . id ) ) ,
192
+ takeUntilDestroyed ( this . destroyRef )
193
+ )
194
+ . subscribe ( ) ;
186
195
}
187
196
}
0 commit comments