@@ -39,8 +39,9 @@ import {
3939} from '../../../../../redux/actions' ;
4040import { routePaths } from '../../../../../routes/routePaths' ;
4141import { ProjectPopup } from './ProjectPopup' ;
42- import CookieConsent from 'react-cookie-consent' ;
43- import cookieImage from '../../../../assets/cookie.svg'
42+ import ReactTooltip from 'react-tooltip' ;
43+ import { CookiePopup } from './CookiePopup'
44+
4445// import { endpoints } from '../../../../../api/endpoints';
4546
4647export const AuthenticatedHeader : React . FC < {
@@ -53,8 +54,8 @@ export const AuthenticatedHeader: React.FC<{
5354 const history = useHistory ( ) ;
5455 const [ popupOpen , setPopupOpen ] = useState < boolean > ( false ) ;
5556 const [ createPopupOpen , setCreatePopupOpen ] = useState < boolean > ( false ) ;
56- const [ showProjects , setShowProjects ] = useState < boolean > ( false ) ;
57-
57+ const [ showCookiePopup , setShowCookiePopup ] = useState < any > ( localStorage . getItem ( 'showCookie' ) ) ;
58+
5859 const dispatch = useDispatch ( ) ;
5960 const { push } = usePushRoute ( ) ;
6061 const locationPath = useLocationPath ( ) ;
@@ -155,6 +156,11 @@ export const AuthenticatedHeader: React.FC<{
155156 await dispatch ( projectsActions . getMy ( { selectDefault : false , selectedProject } ) )
156157 } ;
157158
159+
160+ const selected = projects . some ( ( project ) => project [ 'name' ] === locationPath . split ( '/' ) [ 2 ] )
161+ ? locationPath . split ( '/' ) [ 2 ] . substring ( 0 , 10 )
162+ : DEFAULT_PROJECT_NAME . substring ( 0 , 10 )
163+
158164 return (
159165 < >
160166 { createPopupOpen && < ProjectPopup setPopupOpen = { setCreatePopupOpen } /> }
@@ -215,32 +221,26 @@ export const AuthenticatedHeader: React.FC<{
215221
216222 < Box marginHorizontal = 'md' > < Separator . LightNew /> </ Box >
217223 < Box marginTop = 'sm' marginHorizontal = "md" > < Paragraph color = 'grey' style = { { fontSize : '14px' } } > Your workspaces</ Paragraph > </ Box >
218- < Box marginVertical = 'sm' marginHorizontal = 'md' className = "d-none d-md-block" >
219- < LinkBox onClick = { ( ) => setShowProjects ( ! showProjects ) } >
220- < FlexBox alignItems = "center" >
221- < FlexBox style = { { width : '100%' } } alignItems = "center" justifyContent = 'space-between' className = "d-none d-md-flex" >
222- < Box paddingRight = "md" >
223- < Paragraph > { projects . some ( ( project ) => project [ 'name' ] === locationPath . split ( '/' ) [ 2 ] )
224- ? locationPath . split ( '/' ) [ 2 ] . substring ( 0 , 10 )
225- : DEFAULT_PROJECT_NAME . substring ( 0 , 10 ) } </ Paragraph >
226- </ Box >
227- < Box >
228- { showProjects ? < icons . chevronUpLight size = { iconSizes . xs } color = { iconColors . black } /> : < icons . chevronDownLight size = { iconSizes . xs } color = { iconColors . black } /> }
229- </ Box >
230- </ FlexBox >
231- </ FlexBox >
232- </ LinkBox >
233-
234- { showProjects &&
235- < Box marginTop = 'md' >
236- < Paragraph color = 'grey' > Select Project</ Paragraph >
237- { projects . slice ( 0 , 10 ) . map ( ( option , index ) => (
224+
225+ < Box marginVertical = 'sm' marginLeft = 'md' className = "d-none d-md-block" >
226+ < Box marginTop = 'sm' style = { { maxHeight : '290px' , overflow : projects ?. length > 10 ? 'auto' :'hidden' } } >
227+ { projects . map ( ( option , index ) => (
238228 < Box marginTop = 'sm' onClick = { ( ) => onChange ( option ) } key = { index } >
239- < Paragraph style = { { fontSize : '16px' , color : '#424240' , cursor : 'pointer' } } > { option . name . substring ( 0 , 10 ) } </ Paragraph >
229+ < div data-tip data-for = { option . name } >
230+ < Paragraph style = { { fontSize : '16px' , color : '#443E99' , cursor : 'pointer' , fontWeight : selected === option . name ? 'bold' : 'normal' } } >
231+ { option . name . substring ( 0 , 10 ) } { selected === option . name && < > •</ > }
232+ </ Paragraph >
233+ </ div >
234+
235+ < ReactTooltip id = { option . name } place = "top" effect = "solid" >
236+ < Paragraph color = "white" > { option . name } </ Paragraph >
237+ </ ReactTooltip >
238+
240239 </ Box >
241240 ) ) }
242- </ Box > }
241+ </ Box >
243242 </ Box >
243+
244244 < Box marginHorizontal = 'md' > < Separator . LightNew /> </ Box >
245245
246246 { process . env . REACT_APP_DEMO_SETUP === 'true' ? null : (
@@ -272,107 +272,7 @@ export const AuthenticatedHeader: React.FC<{
272272 </ If >
273273 </ FlexBox >
274274
275- < CookieConsent
276- buttonText = "Accept"
277- cookieName = "My Cookie"
278- style = { {
279- background : '#fff' ,
280- borderRadius : '15px' ,
281- border : '1px solid #8045FF' ,
282- color : '#424240' ,
283- fontFamily : 'Rubik' ,
284- fontSize : '1.6rem' ,
285- fontWeight : 'bold' ,
286- maxWidth : `300px` ,
287- maxHeight : '300px' ,
288-
289- display : 'flex' ,
290- justifyContent : 'center' ,
291- position : 'absolute' ,
292- margin : '0 auto 0 auto' ,
293- top : '30%' ,
294- left : '42%'
295- } }
296- buttonStyle = { {
297- backgroundColor : '#fff' ,
298- color : '#8045FF' ,
299- fontFamily : 'Rubik' ,
300- fontSize : '1.6rem' ,
301- fontWeight : 'bold' ,
302- borderRadius : '4px' ,
303- padding : '0 3.2rem'
304- } }
305- expires = { 120 }
306- >
307- < FlexBox
308- alignItems = "center"
309- justifyContent = "space-between"
310- flexDirection = 'column'
311- >
312- < Box style = { { height : '130px' , width : '130px' } } >
313- < img src = { cookieImage } alt = 'cookie' />
314- </ Box >
315- < Box marginTop = 'sm' style = { { maxWidth : '180px' } } >
316- < Paragraph size = "small" >
317- This website uses cookies
318- to ensure you get the best
319- experience on our website.
320- </ Paragraph >
321- </ Box >
322- </ FlexBox >
323- </ CookieConsent >
275+ { showCookiePopup !== 'false' && < CookiePopup setShowCookie = { setShowCookiePopup } /> }
324276 </ >
325277 ) ;
326- } ;
327-
328-
329- // {!window.location.href?.includes('settings') && (
330- // <Box marginLeft="md" className="d-none d-md-block">
331- // <select
332- // onClick={() =>
333- // dispatch(
334- // projectsActions.getMy({
335- // selectDefault: false,
336- // selectedProject,
337- // }),
338- // )
339- // }
340- // onChange={(e: any) => onChange(e)}
341- // defaultValue={
342- // projects.some(
343- // (project) =>
344- // project['name'] === locationPath.split('/')[2],
345- // )
346- // ? locationPath.split('/')[2]
347- // : DEFAULT_PROJECT_NAME
348- // }
349- // value={
350- // projects.some(
351- // (project) =>
352- // project['name'] === locationPath.split('/')[2],
353- // )
354- // ? locationPath.split('/')[2]
355- // : DEFAULT_PROJECT_NAME
356- // }
357- // placeholder={'Projects'}
358- // className={cn(css.input)}
359- // style={{
360- // border: 'none',
361- // outline: 'none',
362- // width: '146px',
363- // fontSize: '16px',
364- // fontWeight: 'bold',
365- // color: '#424240',
366- // }}
367- // >
368- // <option selected disabled value="">
369- // {'Select Project'}
370- // </option>
371- // {projects.map((option, index) => (
372- // <option key={index} value={option.name}>
373- // {option.name}
374- // </option>
375- // ))}
376- // </select>
377- // </Box>
378- // )}
278+ } ;
0 commit comments