diff --git a/frontend/app/components/Session_/Subheader.js b/frontend/app/components/Session_/Subheader.js index 7a4ef9deb..7fdb149be 100644 --- a/frontend/app/components/Session_/Subheader.js +++ b/frontend/app/components/Session_/Subheader.js @@ -15,7 +15,7 @@ import { IFRAME } from 'App/constants/storageKeys'; import cn from 'classnames'; import { Switch, Button as AntButton, Popover, Tooltip } from 'antd'; import { ShareAltOutlined } from '@ant-design/icons'; -import { checkParam } from 'App/utils'; +import { checkParam, truncateStringToFit } from 'App/utils'; const localhostWarn = (project) => project + '_localhost_warn'; const disableDevtools = 'or_devtools_uxt_toggle'; @@ -46,13 +46,10 @@ function SubHeader(props) { return integrations.some((i) => i.token); }, [props.integrations]); - const location = - currentLocation && currentLocation.length > 70 - ? `${currentLocation.slice(0, 25)}...${currentLocation.slice(-40)}` - : currentLocation; + const locationTruncated = truncateStringToFit(currentLocation, window.innerWidth - 200); const showWarning = - location && /(localhost)|(127.0.0.1)|(0.0.0.0)/.test(location) && showWarningModal; + currentLocation && /(localhost)|(127.0.0.1)|(0.0.0.0)/.test(currentLocation) && showWarningModal; const closeWarning = () => { localStorage.setItem(localhostWarnKey, '1'); setWarning(false); @@ -116,7 +113,7 @@ function SubHeader(props) { showCopyLink={true} trigger={