@@ -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,7 +45,7 @@ import {
4145 TruncatedTextComponent ,
4246} from '@osf/shared/components' ;
4347import { ResourceType , UserPermissions } from '@osf/shared/enums' ;
44- import { IS_SMALL } from '@osf/shared/helpers' ;
48+ import { IS_MEDIUM , IS_SMALL } from '@osf/shared/helpers' ;
4549import { ToolbarResource } from '@osf/shared/models' ;
4650import { Duplicate } from '@osf/shared/models/duplicates' ;
4751import { CustomDialogService } from '@osf/shared/services' ;
@@ -82,6 +86,7 @@ export class ViewRelatedProjectsComponent implements OnInit {
8286 isLoading = select ( RelatedSelectors . getRelatedLoading ) ;
8387 totalDuplicates = select ( RelatedSelectors . getRelatedTotalCount ) ;
8488 isAuthenticated = select ( UserSelectors . isAuthenticated ) ;
89+ isMedium = toSignal ( inject ( IS_MEDIUM ) ) ;
8590
8691 title = computed ( ( ) => {
8792 switch ( this . itemType ( ) ) {
@@ -110,6 +115,15 @@ export class ViewRelatedProjectsComponent implements OnInit {
110115 }
111116 } ) ;
112117
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+
113127 readonly pageSize = 10 ;
114128 readonly UserPermissions = UserPermissions ;
115129
@@ -241,6 +255,26 @@ export class ViewRelatedProjectsComponent implements OnInit {
241255 break ;
242256 }
243257 }
258+ handleMainAction ( ) {
259+ switch ( this . itemType ( ) ) {
260+ case RelatedItemsType . Duplicates :
261+ this . handleForkResource ( ) ;
262+ return ;
263+
264+ case RelatedItemsType . Linked :
265+ this . openLinkProjectModal ( ) ;
266+ return ;
267+ }
268+ }
269+
270+ openLinkProjectModal ( ) {
271+ const dialogWidth = this . isMedium ( ) ? '850px' : '95vw' ;
272+
273+ this . customDialogService . open ( LinkResourceDialogComponent , {
274+ header : 'project.overview.dialog.linkProject.header' ,
275+ width : dialogWidth ,
276+ } ) ;
277+ }
244278
245279 handleForkResource ( ) : void {
246280 const toolbarResource = this . toolbarResource ( ) ;
0 commit comments