@@ -17,7 +17,8 @@ import { ClassNames } from '@renderer/utils'
1717import { ModuleTitle } from '@renderer/components/ModuleTitle'
1818import { ReactNode } from 'react'
1919import { IconProp } from '@fortawesome/fontawesome-svg-core'
20- import { CustomThemedTooltip } from '@renderer/components/Nethesis/CurstomThemedTooltip'
20+ import { Tooltip } from 'react-tooltip'
21+
2122interface SearchNumberBoxProps {
2223 contactDetail ?: {
2324 contact : SearchData ,
@@ -54,25 +55,14 @@ export function SearchNumberDetail({ contactDetail, onBack }: SearchNumberBoxPro
5455 < div className = 'pl-6 pt-6 w-full h-full' >
5556 < Scrollable >
5657 < div className = 'flex flex-col gap-6 w-full pr-1' >
57- < ContactVisibility isPublic = { true } />
58- < ContactDetail icon = { PhoneIcon } label = { t ( 'Phonebook.Primary phone' ) } >
59- < LinkedValue type = 'phone' > { primaryNumber || '' } </ LinkedValue >
60- </ ContactDetail >
61- < ContactDetail icon = { PhoneIcon } label = { t ( 'Phonebook.Home phone' ) } >
62- < LinkedValue type = 'phone' > { contact . homephone } </ LinkedValue >
63- </ ContactDetail >
64- < ContactDetail icon = { MobilePhoneIcon } label = { t ( 'Phonebook.Mobile phone' ) } >
65- < LinkedValue type = 'phone' > { contact . cellphone } </ LinkedValue >
66- </ ContactDetail >
67- < ContactDetail icon = { PhoneIcon } label = { t ( 'Phonebook.Work phone' ) } >
68- < LinkedValue type = 'phone' > { contact . workphone } </ LinkedValue >
69- </ ContactDetail >
70- < ContactDetail icon = { MailIcon } label = { t ( 'Phonebook.Email' ) } >
71- < LinkedValue type = 'mail' > { contact . homeemail } </ LinkedValue >
72- </ ContactDetail >
73- < ContactDetail icon = { WorkIcon } label = { t ( 'Phonebook.Company' ) } >
74- { contact . company }
75- </ ContactDetail >
58+ < ContactVisibility isPublic = { ! ( contact ?. type === 'private' && contact ?. source === 'cti' ) } />
59+ { /* <ContactDetail icon={PhoneIcon} label={t('Phonebook.Primary phone')} copy>{primaryNumber || ''}</ContactDetail> */ }
60+ < ContactDetail icon = { PhoneIcon } label = { t ( 'Phonebook.Home phone' ) } copy > { contact . homephone } </ ContactDetail >
61+ < ContactDetail icon = { MobilePhoneIcon } label = { t ( 'Phonebook.Mobile phone' ) } copy > { contact . cellphone } </ ContactDetail >
62+ < ContactDetail icon = { PhoneIcon } label = { t ( 'Phonebook.Work phone' ) } copy > { contact . workphone } </ ContactDetail >
63+ < ContactDetail icon = { MailIcon } label = { t ( 'Phonebook.Email' ) } copy > { contact . homeemail } </ ContactDetail >
64+ < ContactDetail icon = { MailIcon } label = { t ( 'Phonebook.Work' ) } copy > { contact . workemail } </ ContactDetail >
65+ < ContactDetail icon = { WorkIcon } label = { t ( 'Phonebook.Company' ) } > { contact . company } </ ContactDetail >
7666 </ div >
7767 </ Scrollable >
7868 </ div >
@@ -104,7 +94,7 @@ const ContactVisibility = ({ isPublic }: { isPublic: boolean }) => {
10494 </ div >
10595}
10696
107- const ContactDetail = ( { children, label, icon } : { label : string | DefaultTFuncReturn , icon : IconProp , children : ReactNode } ) => {
97+ const ContactDetail = ( { children, label, icon, copy } : { label : string | DefaultTFuncReturn , icon : IconProp , children : string , copy ?: boolean } ) => {
10898 return < div className = 'flex flex-row w-full justify-start' >
10999 < div className = 'flex flex-row gap-2 items-center min-w-[170px] ' >
110100 < FontAwesomeIcon
@@ -114,43 +104,44 @@ const ContactDetail = ({ children, label, icon }: { label: string | DefaultTFunc
114104 { label }
115105 </ div >
116106 < div className = 'relative truncate max-w-[calc(100%-170px)]'
117- {
118- ...( typeof children === 'string' ? {
119- 'data-tooltip-id' : `tooltip-${ label } ` ,
120- 'data-tooltip-content' : children
121- } : { } )
122- }
107+ data-tooltip-id = { `tooltip-${ label } ` }
108+ data-tooltip-content = { children }
109+ data-tooltip-place = { 'bottom' }
110+
123111 >
124- { children }
125- { typeof children === 'string' && < CustomThemedTooltip id = { `tooltip-${ label } ` } />
126- }
112+ { copy ? < CopyValue > { children } </ CopyValue > : ( children || '-' ) }
113+ < Tooltip
114+ id = { `tooltip-${ label } ` }
115+ place = "bottom"
116+ className = "z-10"
117+ opacity = { 1 }
118+ noArrow = { false }
119+ />
120+
127121 </ div >
128122 </ div >
129123}
130124
131- const LinkedValue = ( { children, type , className } : { className ?: string , children : string , type : 'phone' | 'mail' } ) => {
132- if ( ! children ) return < > </ >
125+ const CopyValue = ( { children, className } : { className ?: string , children : string } ) => {
126+ if ( ! children ) return < > - </ >
133127
134128 const onClick = ( ) => {
135- const url = ( type === 'phone' ? 'callto://' : 'mailto://' ) + `${ children . replace ( / / g, '' ) } `
136- window . api . openExternalPage ( url ) ;
129+ window . api . copyToClipboard ( children )
137130 }
138131
139132 return < div
140- className = { ClassNames ( className , 'truncate cursor-pointer w-full flex flex-row items-center text-textBlueLight dark:text-textBlueDark font-normal gap-2 dark:focus:outline-none dark:focus:ring-2 focus:outline-none focus:ring-2 dark:ring-offset-1 ring-offset-1 dark:ring-offset-slate-900 ring-offset-slate-50 focus:ring-primaryRing dark:focus:ring-primaryRingDark rounded-md hover:underline' ) }
133+ className = { ClassNames ( className , 'relative cursor-pointer w-full flex flex-row items-center text-textBlueLight dark:text-textBlueDark font-normal gap-2 dark:focus:outline-none dark:focus:ring-2 focus:outline-none focus:ring-2 dark:ring-offset-1 ring-offset-1 dark:ring-offset-slate-900 ring-offset-slate-50 focus:ring-primaryRing dark:focus:ring-primaryRingDark rounded-md hover:underline' ) }
141134 onClick = { onClick }
142135 >
143136 < span className = 'truncate'
144- data-tooltip-id = { `tooltip-${ children } ` }
145- data-tooltip-content = { children }
146137 >
147138 { children }
148139 </ span >
149140 < FontAwesomeIcon
150141 className = "text-base"
151142 icon = { CopyIcon }
152143 />
153- < CustomThemedTooltip id = { `tooltip- ${ children } ` } />
144+
154145 </ div >
155146
156- }
147+ }
0 commit comments