@@ -17,9 +17,20 @@ export class CommunityLinkDialogComponent {
1717 selectedLink : { db , title , selector ? } ;
1818 links : { db , title , selector ? } [ ] = [
1919 { db : 'teams' , title : $localize `Teams` , selector : { type : 'team' } } ,
20- { db : 'teams' , title : $localize `Enterprises` , selector : { type : 'enterprise' } }
20+ { db : 'teams' , title : $localize `Enterprises` , selector : { type : 'enterprise' } } ,
21+ { db : 'social' , title : $localize `Web & Social` }
2122 ] ;
2223 linkForm : UntypedFormGroup ;
24+ socialPlatforms = [
25+ { value : 'instagram' , label : 'Instagram' } ,
26+ { value : 'facebook' , label : 'Facebook' } ,
27+ { value : 'whatsapp' , label : 'WhatsApp' } ,
28+ { value : 'discord' , label : 'Discord' } ,
29+ { value : 'x' , label : 'X (Twitter)' } ,
30+ { value : 'youtube' , label : 'YouTube' } ,
31+ { value : 'tiktok' , label : 'TikTok' } ,
32+ { value : 'website' , label : 'Website' }
33+ ] ;
2334
2435 constructor (
2536 private dialogRef : MatDialogRef < CommunityLinkDialogComponent > ,
@@ -33,14 +44,17 @@ export class CommunityLinkDialogComponent {
3344 title : [ '' , CustomValidators . required , ac => this . validatorService . isUnique$ ( 'teams' , 'title' , ac , { } ) ] ,
3445 route : [ '' , CustomValidators . required ] ,
3546 linkId : '' ,
36- teamType : ''
47+ teamType : '' ,
48+ icon : '' ,
49+ platform : ''
3750 } ) ;
3851 }
3952
4053 teamSelect ( { mode, teamId, teamType } ) {
4154 this . linkForm . controls . route . setValue ( this . teamsService . teamLinkRoute ( mode , teamId ) ) ;
4255 this . linkForm . controls . linkId . setValue ( teamId ) ;
4356 this . linkForm . controls . teamType . setValue ( teamType ) ;
57+ this . linkForm . controls . icon . setValue ( mode === 'team' ? 'groups' : 'work' ) ;
4458 this . linkStepper . selected . completed = true ;
4559 this . linkStepper . next ( ) ;
4660 }
@@ -69,4 +83,18 @@ export class CommunityLinkDialogComponent {
6983 cancelForm ( ) {
7084 this . dialogRef . close ( ) ;
7185 }
86+
87+ onPlatformSelect ( platform : string ) {
88+ this . linkForm . controls . icon . setValue ( this . socialPlatforms . find ( p => p . value === platform ) ?. value || '' ) ;
89+ this . linkForm . controls . teamType . setValue ( 'social' ) ;
90+
91+ // Apply URL validator for generic Website entries
92+ const routeCtrl = this . linkForm . controls . route ;
93+ routeCtrl . setAsyncValidators ( platform === 'website' ? [ CustomValidators . validLink ] : [ ] ) ;
94+ routeCtrl . updateValueAndValidity ( ) ;
95+ }
96+
97+ getPlatformLabel ( platform : string ) : string {
98+ return this . socialPlatforms . find ( p => p . value === platform ) ?. label || '' ;
99+ }
72100}
0 commit comments