diff --git a/app/javascript/src/components/Navigation/components/ActivityElement.jsx b/app/javascript/src/components/Navigation/components/ActivityElement.jsx index 8465fcf15..08b7ab10b 100644 --- a/app/javascript/src/components/Navigation/components/ActivityElement.jsx +++ b/app/javascript/src/components/Navigation/components/ActivityElement.jsx @@ -38,6 +38,39 @@ const TextSpan = styled.span` padding: 3px 10px; text-align: justify; ` +function truncatedTooltip(id, text) { + return ( + + {text} + + )} placement="bottom"> + + {text.substring(0, NAME_TRUNCATION_LENGTH)}... + + + ); +} + +function taskPath(activity) { + return ( +   + [ :  + {activity.project.length > NAME_TRUNCATION_LENGTH ? ( + truncatedTooltip('activity_modal.long_project_tooltip', activity.project) + ):( + {activity.project} + )},  + :  + {activity.task.length > NAME_TRUNCATION_LENGTH ? ( + truncatedTooltip('activity_modal.long_task_tooltip', activity.task) + ):( + {activity.task} + )} ] + + ); +} + const ActivityElement = ({ activity }) => @@ -48,38 +81,7 @@ const ActivityElement = ({ activity }) => - {activity.task && -   - [ :  - {activity.project.length > NAME_TRUNCATION_LENGTH ? ( - - {activity.project} - - )} placement="bottom"> - - {activity.project.substring(0, NAME_TRUNCATION_LENGTH)}... - - - ):( - {activity.project} - )},  - :  - {activity.task.length > NAME_TRUNCATION_LENGTH ? ( - - {activity.task} - - )} placement="bottom"> - - {activity.task.substring(0, NAME_TRUNCATION_LENGTH)}... - - - ):( - {activity.task} - )} ] - - } + {activity.task && taskPath(activity)} ;