Skip to content

Commit

Permalink
fix(issues): Adjust tag progress bar (#82439)
Browse files Browse the repository at this point in the history
  • Loading branch information
scttcper authored Dec 26, 2024
1 parent 0f88319 commit 247661c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {Fragment, useState} from 'react';
import styled from '@emotion/styled';
import Color from 'color';
import type {LocationDescriptor} from 'history';

import {useFetchIssueTag, useFetchIssueTagValues} from 'sentry/actionCreators/group';
Expand All @@ -27,6 +26,7 @@ import {useNavigate} from 'sentry/utils/useNavigate';
import useOrganization from 'sentry/utils/useOrganization';
import {useParams} from 'sentry/utils/useParams';
import {hasDatasetSelector} from 'sentry/views/dashboards/utils';
import {TagBar} from 'sentry/views/issueDetails/groupTags/tagDistribution';
import {useIssueDetailsEventView} from 'sentry/views/issueDetails/streamline/hooks/useIssueDetailsDiscoverQuery';

type TagSort = 'date' | 'count';
Expand Down Expand Up @@ -176,7 +176,7 @@ function TagDetailsRow({
<RightAlignedValue>{tagValue.count.toLocaleString()}</RightAlignedValue>
<RightAlignedValue>{displayPercentage}</RightAlignedValue>
{tag.totalValues ? (
<TagBarContainer style={{width: `${percentage}%`, height: space(1.5)}} />
<TagBar percentage={percentage} style={{height: space(1.5)}} />
) : (
'--'
)}
Expand Down Expand Up @@ -294,7 +294,7 @@ function TagValueActionsMenu({

const Table = styled('div')`
display: grid;
grid-template-columns: repeat(4, auto) 1fr auto;
grid-template-columns: 1fr repeat(3, auto) 45px min-content;
column-gap: ${space(2)};
row-gap: ${space(0.5)};
margin: 0 -${space(1)};
Expand Down Expand Up @@ -385,22 +385,3 @@ const OverflowTimeSince = styled(TimeSince)`
const ExternalLinkbutton = styled(Button)`
color: ${p => p.theme.subText};
`;

const TagBarContainer = styled('div')`
height: ${space(1)};
position: relative;
flex: 1;
min-width: ${space(1)};
display: flex;
align-items: center;
&:before {
position: absolute;
inset: 0;
content: '';
border-radius: 3px;
background: ${p =>
`linear-gradient(to right, ${Color(p.theme.gray300).alpha(0.5).toString()} 20px, ${Color(p.theme.gray300).alpha(0.7).toString()} 100%)`};
box-shadow: inset 0 0 0 1px ${p => p.theme.translucentInnerBorder};
width: 100%;
}
`;
27 changes: 19 additions & 8 deletions static/app/views/issueDetails/groupTags/tagDistribution.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export function TagDistribution({tag}: {tag: GroupTag}) {
);
}

function TagBar({
export function TagBar({
percentage,
style,
...props
Expand All @@ -114,7 +114,11 @@ function TagBar({
className?: string;
style?: React.CSSProperties;
}) {
return <TagBarContainer style={{width: `${percentage}%`, ...style}} {...props} />;
return (
<TagBarPlaceholder>
<TagBarContainer style={{width: `${percentage}%`, ...style}} {...props} />
</TagBarPlaceholder>
);
}

const TagPanel = styled(Link)`
Expand Down Expand Up @@ -173,21 +177,28 @@ const TagValue = styled('div')`
margin-right: ${space(0.5)};
`;

const TagBarPlaceholder = styled('div')`
position: relative;
height: ${space(1)};
width: 100%;
border-radius: 3px;
box-shadow: inset 0 0 0 1px ${p => p.theme.translucentBorder};
background: ${p => Color(p.theme.gray300).alpha(0.1).toString()};
overflow: hidden;
`;

const TagBarContainer = styled('div')`
height: ${space(1)};
position: relative;
flex: 1;
position: absolute;
left: 0;
top: 0;
min-width: ${space(1)};
display: flex;
align-items: center;
&:before {
position: absolute;
inset: 0;
content: '';
border-radius: 3px;
background: ${p =>
`linear-gradient(to right, ${Color(p.theme.gray300).alpha(0.5).toString()} 0px, ${Color(p.theme.gray300).alpha(0.7).toString()} ${progressBarWidth})`};
box-shadow: inset 0 0 0 1px ${p => p.theme.translucentInnerBorder};
width: 100%;
}
`;
Expand Down

0 comments on commit 247661c

Please sign in to comment.