@@ -2,11 +2,12 @@ import { ReactElement, useCallback, useEffect, useState } from 'react';
22import { useParams , useHistory , useRouteMatch } from 'react-router-dom' ;
33import { FormattedMessage , useIntl } from 'react-intl' ;
44import Joyride , { CallBackProps , Step , EVENTS , ACTIONS } from 'react-joyride' ;
5- import { Breadcrumb , Popup } from 'semantic-ui-react' ;
5+ import { Breadcrumb } from 'semantic-ui-react' ;
66import SideBar from './sidebar' ;
77import ProjectSiderbar from './projectSiderbar' ;
88import message from 'components/MessageBox' ;
99import Icon from 'components/Icon' ;
10+ import TextLimit from 'components/TextLimit' ;
1011import { getProjectInfo } from 'services/project' ;
1112import { getToggleInfo } from 'services/toggle' ;
1213import { saveDictionary , getFromDictionary } from 'services/dictionary' ;
@@ -16,7 +17,6 @@ import { IToggleInfo } from 'interfaces/targeting';
1617import { EnvironmentColors } from 'constants/colors' ;
1718import { commonConfig , floaterStyle , tourStyle } from 'constants/tourConfig' ;
1819import { DEMO_TIP_SHOW , USER_GUIDE_LAYOUT } from 'constants/dictionary_keys' ;
19- import { stringLimit } from 'utils/tools' ;
2020
2121import {
2222 TOGGLE_PATH ,
@@ -221,7 +221,7 @@ const ProjectLayout = (props: IProps) => {
221221 backgroundColor = { EnvironmentColors [ envIndex ] }
222222 />
223223 </ SideBar >
224- < div className = { styles . content } >
224+ < div className = { styles [ 'project- content' ] } >
225225 {
226226 tipVisible && ( localStorage . getItem ( 'isDemo' ) === 'true' ) && (
227227 < div className = { styles [ 'platform-tips' ] } >
@@ -242,35 +242,17 @@ const ProjectLayout = (props: IProps) => {
242242 match . path === TARGETING_PATH && (
243243 < >
244244 < Breadcrumb . Section link onClick = { gotoToggle } >
245- {
246- projectInfo . name . length > 24
247- ?
248- < Popup
249- inverted
250- className = { styles . popup }
251- trigger = { < span > { stringLimit ( projectInfo . name , 24 ) } </ span > }
252- content = { projectInfo . name }
253- position = 'top center'
254- wide = { true }
255- />
256- : projectInfo . name
257- }
245+ < TextLimit
246+ text = { projectInfo . name }
247+ maxWidth = { 190 }
248+ popupProps = { {
249+ offset : [ 0 , - 12 ] ,
250+ } }
251+ />
258252 </ Breadcrumb . Section >
259253 < Breadcrumb . Divider icon = { < Icon customClass = { styles [ 'breadcrumb-icon' ] } type = 'angle-right' /> } />
260254 < Breadcrumb . Section active >
261- {
262- toggleName . length > 24
263- ?
264- < Popup
265- inverted
266- className = { styles . popup }
267- trigger = { < span > { stringLimit ( toggleName , 24 ) } </ span > }
268- content = { toggleName }
269- position = 'top center'
270- wide = { true }
271- />
272- : toggleName
273- }
255+ < TextLimit text = { toggleName } maxWidth = { 190 } popupProps = { { offset : [ 0 , - 12 ] } } />
274256 </ Breadcrumb . Section >
275257 </ >
276258 )
@@ -279,35 +261,11 @@ const ProjectLayout = (props: IProps) => {
279261 match . path === GET_STARTED_PATH && (
280262 < >
281263 < Breadcrumb . Section link onClick = { gotoToggle } >
282- {
283- projectInfo . name . length > 24
284- ?
285- < Popup
286- inverted
287- className = { styles . popup }
288- trigger = { < span > { stringLimit ( projectInfo . name , 24 ) } </ span > }
289- content = { projectInfo . name }
290- position = 'top center'
291- wide = { true }
292- />
293- : projectInfo . name
294- }
264+ < TextLimit text = { projectInfo . name } maxWidth = { 190 } popupProps = { { offset : [ 0 , - 12 ] } } />
295265 </ Breadcrumb . Section >
296266 < Breadcrumb . Divider icon = { < Icon customClass = { styles [ 'breadcrumb-icon' ] } type = 'angle-right' /> } />
297267 < Breadcrumb . Section link onClick = { gotoTargeting } >
298- {
299- toggleName . length > 24
300- ?
301- < Popup
302- inverted
303- className = { styles . popup }
304- trigger = { < span > { stringLimit ( toggleName , 24 ) } </ span > }
305- content = { toggleName }
306- position = 'top center'
307- wide = { true }
308- />
309- : toggleName
310- }
268+ < TextLimit text = { toggleName } maxWidth = { 190 } popupProps = { { offset : [ 0 , - 12 ] } } />
311269 </ Breadcrumb . Section >
312270 < Breadcrumb . Divider icon = { < Icon customClass = { styles [ 'breadcrumb-icon' ] } type = 'angle-right' /> } />
313271 < Breadcrumb . Section active >
@@ -319,19 +277,7 @@ const ProjectLayout = (props: IProps) => {
319277 {
320278 match . path === TOGGLE_PATH && (
321279 < Breadcrumb . Section active >
322- {
323- projectInfo . name . length > 24
324- ?
325- < Popup
326- inverted
327- className = { styles . popup }
328- trigger = { < span > { stringLimit ( projectInfo . name , 24 ) } </ span > }
329- content = { projectInfo . name }
330- position = 'top center'
331- wide = { true }
332- />
333- : projectInfo . name
334- }
280+ < TextLimit text = { projectInfo . name } maxWidth = { 190 } popupProps = { { offset : [ 0 , - 12 ] } } />
335281 </ Breadcrumb . Section >
336282 )
337283 }
0 commit comments