Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 3 additions & 17 deletions static/app/components/version.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {css, useTheme} from '@emotion/react';
import {css} from '@emotion/react';
import styled from '@emotion/styled';

import {CopyToClipboardButton} from 'sentry/components/copyToClipboardButton';
Expand Down Expand Up @@ -68,7 +68,7 @@ function Version({
const versionToDisplay = shouldFormatVersion
? formatVersion(version, withPackage)
: version;
const theme = useTheme();
const isHashVersion = /\b[a-f0-9]{40}\b|\b[a-f0-9]{64}\b/.test(version);

let releaseDetailProjectId: null | undefined | string | string[];
if (projectId) {
Expand Down Expand Up @@ -132,27 +132,13 @@ function Version({
</TooltipContent>
);

const getOverlayStyle = () => {
// if the version name is not a hash (sha1 or sha265) and we are not on
// mobile, allow tooltip to be as wide as 500px
if (/(^[a-f0-9]{40}$)|(^[a-f0-9]{64}$)/.test(version)) {
return undefined;
}

return css`
@media (min-width: ${theme.breakpoints.sm}) {
max-width: 500px;
}
`;
};

return (
<Tooltip
title={renderTooltipContent()}
disabled={!tooltipRawVersion}
isHoverable
containerDisplayMode={truncate ? 'block' : 'inline-block'}
overlayStyle={getOverlayStyle()}
maxWidth={isHashVersion ? undefined : 400}
>
{renderVersion()}
</Tooltip>
Expand Down
Loading