@@ -28,12 +28,16 @@ import { newImage } from '@gitroom/frontend/components/launches/helpers/new.imag
28
28
import { postSelector } from '@gitroom/frontend/components/post-url-selector/post.url.selector' ;
29
29
import { UpDownArrow } from '@gitroom/frontend/components/launches/up.down.arrow' ;
30
30
import { arrayMoveImmutable } from 'array-move' ;
31
- import { linkedinCompany } from '@gitroom/frontend/components/launches/helpers/linkedin.component' ;
31
+ import {
32
+ LinkedinCompany ,
33
+ linkedinCompany ,
34
+ } from '@gitroom/frontend/components/launches/helpers/linkedin.component' ;
32
35
import { Editor } from '@gitroom/frontend/components/launches/editor' ;
33
36
import { useCopilotAction , useCopilotReadable } from '@copilotkit/react-core' ;
34
37
import { AddPostButton } from '@gitroom/frontend/components/launches/add.post.button' ;
35
38
import { GeneralPreviewComponent } from '@gitroom/frontend/components/launches/general.preview.component' ;
36
39
import { capitalize } from 'lodash' ;
40
+ import { useModals } from '@mantine/modals' ;
37
41
38
42
// Simple component to change back to settings on after changing tab
39
43
export const SetTab : FC < { changeTab : ( ) => void } > = ( props ) => {
@@ -69,8 +73,8 @@ export const EditorWrapper: FC<{ children: ReactNode }> = ({ children }) => {
69
73
} ;
70
74
71
75
export const withProvider = function < T extends object > (
72
- SettingsComponent : FC < { values ?: any } > | null ,
73
- CustomPreviewComponent ?: FC < { maximumCharacters ?: number } > ,
76
+ SettingsComponent : FC < { values ?: any } > | null ,
77
+ CustomPreviewComponent ?: FC < { maximumCharacters ?: number } > ,
74
78
dto ?: any ,
75
79
checkValidity ?: (
76
80
value : Array < Array < { path : string } > > ,
@@ -91,6 +95,8 @@ export const withProvider = function <T extends object>(
91
95
} ) => {
92
96
const existingData = useExistingData ( ) ;
93
97
const { integration, date } = useIntegration ( ) ;
98
+ const [ showLinkedinPopUp , setShowLinkedinPopUp ] = useState < any > ( false ) ;
99
+
94
100
useCopilotReadable ( {
95
101
description :
96
102
integration ?. type === 'social'
@@ -255,6 +261,21 @@ export const withProvider = function <T extends object>(
255
261
} ,
256
262
} ) ;
257
263
264
+ const tagPersonOrCompany = useCallback (
265
+ ( integration : string , editor : ( value : string ) => void ) => ( ) => {
266
+ setShowLinkedinPopUp (
267
+ < LinkedinCompany
268
+ onSelect = { ( tag ) => {
269
+ editor ( tag ) ;
270
+ } }
271
+ id = { integration }
272
+ onClose = { ( ) => setShowLinkedinPopUp ( false ) }
273
+ />
274
+ ) ;
275
+ } ,
276
+ [ ]
277
+ ) ;
278
+
258
279
// this is a trick to prevent the data from being deleted, yet we don't render the elements
259
280
if ( ! props . show ) {
260
281
return null ;
@@ -263,6 +284,7 @@ export const withProvider = function <T extends object>(
263
284
return (
264
285
< FormProvider { ...form } >
265
286
< SetTab changeTab = { ( ) => setShowTab ( 0 ) } />
287
+ { showLinkedinPopUp ? showLinkedinPopUp : null }
266
288
< div className = "mt-[15px] w-full flex flex-col flex-1" >
267
289
{ ! props . hideMenu && (
268
290
< div className = "flex gap-[4px]" >
@@ -319,6 +341,20 @@ export const withProvider = function <T extends object>(
319
341
< div >
320
342
< div className = "flex gap-[4px]" >
321
343
< div className = "flex-1 text-textColor editor" >
344
+ { integration ?. identifier === 'linkedin' && (
345
+ < Button
346
+ className = "mb-[5px]"
347
+ onClick = { tagPersonOrCompany (
348
+ integration . id ,
349
+ ( newValue : string ) =>
350
+ changeValue ( index ) (
351
+ val . content + newValue
352
+ )
353
+ ) }
354
+ >
355
+ Tag a company
356
+ </ Button >
357
+ ) }
322
358
< Editor
323
359
order = { index }
324
360
height = { InPlaceValue . length > 1 ? 200 : 250 }
0 commit comments