@@ -25,7 +25,11 @@ import { ActivatedRoute, Router, RouterLink } from '@angular/router';
2525
2626import { UserSelectors } from '@core/store/user' ;
2727import { RelatedItemsType } from '@osf/features/analytics/enums/related-items-type' ;
28- import { DeleteComponentDialogComponent , ForkDialogComponent } from '@osf/features/project/overview/components' ;
28+ import {
29+ DeleteComponentDialogComponent ,
30+ ForkDialogComponent ,
31+ LinkResourceDialogComponent ,
32+ } from '@osf/features/project/overview/components' ;
2933import { ClearProjectOverview , GetProjectById , ProjectOverviewSelectors } from '@osf/features/project/overview/store' ;
3034import {
3135 ClearRegistryOverview ,
@@ -41,6 +45,7 @@ import {
4145 TruncatedTextComponent ,
4246} from '@osf/shared/components' ;
4347import { ResourceType , UserPermissions } from '@osf/shared/enums' ;
48+ import { IS_MEDIUM } from '@osf/shared/helpers' ;
4449import { ToolbarResource } from '@osf/shared/models' ;
4550import { Duplicate } from '@osf/shared/models/duplicates' ;
4651import { CustomDialogService } from '@osf/shared/services' ;
@@ -81,6 +86,7 @@ export class ViewRelatedProjectsComponent implements OnInit {
8186 isLoading = select ( RelatedSelectors . getRelatedLoading ) ;
8287 totalDuplicates = select ( RelatedSelectors . getRelatedTotalCount ) ;
8388 isAuthenticated = select ( UserSelectors . isAuthenticated ) ;
89+ isMedium = toSignal ( inject ( IS_MEDIUM ) ) ;
8490
8591 title = computed ( ( ) => {
8692 switch ( this . itemType ( ) ) {
@@ -109,6 +115,15 @@ export class ViewRelatedProjectsComponent implements OnInit {
109115 }
110116 } ) ;
111117
118+ mainActionMessage = computed ( ( ) => {
119+ switch ( this . itemType ( ) ) {
120+ case RelatedItemsType . Duplicates :
121+ return this . translateService . instant ( 'project.overview.actions.forkProjectLabel' ) ;
122+ case RelatedItemsType . Linked :
123+ return this . translateService . instant ( 'project.overview.components.linkProjectsButton' ) ;
124+ }
125+ } ) ;
126+
112127 readonly pageSize = 10 ;
113128 readonly UserPermissions = UserPermissions ;
114129
@@ -239,6 +254,26 @@ export class ViewRelatedProjectsComponent implements OnInit {
239254 break ;
240255 }
241256 }
257+ handleMainAction ( ) {
258+ switch ( this . itemType ( ) ) {
259+ case RelatedItemsType . Duplicates :
260+ this . handleForkResource ( ) ;
261+ return ;
262+
263+ case RelatedItemsType . Linked :
264+ this . openLinkProjectModal ( ) ;
265+ return ;
266+ }
267+ }
268+
269+ openLinkProjectModal ( ) {
270+ const dialogWidth = this . isMedium ( ) ? '850px' : '95vw' ;
271+
272+ this . customDialogService . open ( LinkResourceDialogComponent , {
273+ header : 'project.overview.dialog.linkProject.header' ,
274+ width : dialogWidth ,
275+ } ) ;
276+ }
242277
243278 handleForkResource ( ) : void {
244279 const toolbarResource = this . toolbarResource ( ) ;
0 commit comments