Skip to content

Commit fa010e8

Browse files
fix(usage overview): Correct overflows (#104566)
Fixes some overflows at smaller screen sizes with secondary nav open. # usage overview table header ## before <img width="1217" height="859" alt="Screenshot 2025-12-08 at 5 52 45 PM" src="https://github.com/user-attachments/assets/a3794b02-b1fd-449b-aa1d-f627170f7b2a" /> ## after <img width="1216" height="859" alt="Screenshot 2025-12-08 at 5 53 14 PM" src="https://github.com/user-attachments/assets/eb4347e2-02c9-43cd-9ac7-c0c41e8f8e54" /> # header cards ## before <img width="1072" height="859" alt="Screenshot 2025-12-08 at 5 36 49 PM" src="https://github.com/user-attachments/assets/8e969b92-3057-4c35-a8a4-aa484e781b3d" /> ## after <img width="1070" height="858" alt="Screenshot 2025-12-08 at 5 37 00 PM" src="https://github.com/user-attachments/assets/434f3232-efe7-4c57-aaf4-05767e8a89a8" /> # table with gifts ## before <img width="1215" height="858" alt="Screenshot 2025-12-08 at 5 56 31 PM" src="https://github.com/user-attachments/assets/d5e422d7-1d36-458a-9e4a-e7da1990a602" /> ## after <img width="1214" height="861" alt="Screenshot 2025-12-08 at 5 56 44 PM" src="https://github.com/user-attachments/assets/739e2aed-c6c9-4005-818f-7172ca415333" />
1 parent 49bdb5c commit fa010e8

File tree

4 files changed

+27
-12
lines changed

4 files changed

+27
-12
lines changed

static/gsApp/views/subscriptionPage/headerCards/headerCards.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {Grid} from 'sentry/components/core/layout';
22
import ErrorBoundary from 'sentry/components/errorBoundary';
33
import type {Organization} from 'sentry/types/organization';
4+
import {useNavContext} from 'sentry/views/nav/context';
45

56
import type {Subscription} from 'getsentry/types';
67
import {
@@ -77,6 +78,7 @@ function getCards(organization: Organization, subscription: Subscription) {
7778
function HeaderCards({organization, subscription}: HeaderCardsProps) {
7879
const isNewBillingUI = hasNewBillingUI(organization);
7980
const cards = getCards(organization, subscription);
81+
const {isCollapsed: navIsCollapsed} = useNavContext();
8082

8183
return (
8284
<ErrorBoundary mini>
@@ -86,7 +88,8 @@ function HeaderCards({organization, subscription}: HeaderCardsProps) {
8688
columns={{
8789
xs: '1fr',
8890
sm: `repeat(min(${cards.length}, 2), minmax(0, 1fr))`,
89-
md: `repeat(${cards.length}, minmax(0, 1fr))`,
91+
md: navIsCollapsed ? `repeat(${cards.length}, minmax(0, 1fr))` : undefined,
92+
lg: `repeat(${cards.length}, minmax(0, 1fr))`,
9093
}}
9194
gap="xl"
9295
data-test-id="subscription-header-cards"

static/gsApp/views/subscriptionPage/usageOverview/components/actions.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,31 @@
1+
import {useTheme} from '@emotion/react';
2+
13
import {Button} from 'sentry/components/core/button';
24
import {LinkButton} from 'sentry/components/core/button/linkButton';
35
import {Flex} from 'sentry/components/core/layout';
46
import {DropdownMenu} from 'sentry/components/dropdownMenu';
57
import {IconDownload, IconEllipsis, IconTable} from 'sentry/icons';
68
import {t} from 'sentry/locale';
79
import type {Organization} from 'sentry/types/organization';
10+
import useMedia from 'sentry/utils/useMedia';
811
import {useNavContext} from 'sentry/views/nav/context';
912
import {NavLayout} from 'sentry/views/nav/types';
1013

1114
import {useCurrentBillingHistory} from 'getsentry/hooks/useCurrentBillingHistory';
1215
import trackGetsentryAnalytics from 'getsentry/utils/trackGetsentryAnalytics';
1316

1417
function UsageOverviewActions({organization}: {organization: Organization}) {
15-
const {layout: navLayout} = useNavContext();
18+
const {layout: navLayout, isCollapsed: navIsCollapsed} = useNavContext();
1619
const isMobile = navLayout === NavLayout.MOBILE;
20+
const theme = useTheme();
21+
const shouldCollapseOnLargeScreen =
22+
useMedia(
23+
`(min-width: ${theme.breakpoints.lg}) and (max-width: ${theme.breakpoints.xl})`
24+
) && !navIsCollapsed;
25+
const shouldCollapseOnMobile =
26+
useMedia(`(max-width: ${theme.breakpoints.sm})`) && isMobile;
27+
28+
const shouldCollapseActions = shouldCollapseOnLargeScreen || shouldCollapseOnMobile;
1729

1830
const {currentHistory, isPending, isError} = useCurrentBillingHistory();
1931
const hasBillingPerms = organization.access.includes('org:billing');
@@ -49,7 +61,7 @@ function UsageOverviewActions({organization}: {organization: Organization}) {
4961
},
5062
];
5163

52-
if (isMobile) {
64+
if (shouldCollapseActions) {
5365
return (
5466
<DropdownMenu
5567
triggerProps={{
@@ -70,7 +82,7 @@ function UsageOverviewActions({organization}: {organization: Organization}) {
7082
}
7183

7284
return (
73-
<Flex gap="lg" direction={{xs: 'column', sm: 'row'}}>
85+
<Flex gap="lg" direction="row">
7486
{buttons.map(buttonInfo =>
7587
buttonInfo.to ? (
7688
<LinkButton

static/gsApp/views/subscriptionPage/usageOverview/components/table.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ export default UsageOverviewTable;
145145

146146
const Table = styled('table')`
147147
display: grid;
148-
grid-template-columns: auto max-content auto;
148+
grid-template-columns: repeat(3, auto);
149149
background: ${p => p.theme.background};
150150
border-top: 1px solid ${p => p.theme.border};
151151
border-radius: 0 0 ${p => p.theme.borderRadius} ${p => p.theme.borderRadius};
@@ -160,10 +160,6 @@ const Table = styled('table')`
160160
grid-template-columns: subgrid;
161161
grid-column: 1 / -1;
162162
}
163-
164-
@media (max-width: ${p => p.theme.breakpoints.md}) {
165-
grid-template-columns: repeat(3, auto);
166-
}
167163
`;
168164

169165
const TableHeaderRow = styled('tr')`

static/gsApp/views/subscriptionPage/usageOverview/components/tableRow.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {Container, Flex} from 'sentry/components/core/layout';
88
import {Text} from 'sentry/components/core/text';
99
import ProgressRing from 'sentry/components/progressRing';
1010
import {IconLock, IconWarning} from 'sentry/icons';
11-
import {t} from 'sentry/locale';
11+
import {t, tct} from 'sentry/locale';
1212
import {DataCategory} from 'sentry/types/core';
1313
import useMedia from 'sentry/utils/useMedia';
1414

@@ -60,7 +60,7 @@ function UsageOverviewTableRow({
6060
}: UsageOverviewTableProps & (ChildProductRowProps | ParentProductRowProps)) {
6161
const theme = useTheme();
6262
const showPanelInline = useMedia(
63-
`(max-width: ${theme.breakpoints[SIDE_PANEL_MIN_SCREEN_BREAKPOINT]})`
63+
`(max-width: calc(${theme.breakpoints[SIDE_PANEL_MIN_SCREEN_BREAKPOINT]} - 1px))`
6464
);
6565
const [isHovered, setIsHovered] = useState(false);
6666
const showAdditionalSpendColumn =
@@ -288,8 +288,12 @@ function UsageOverviewTableRow({
288288
) : (
289289
`${formattedUsage} / ${shouldFormatWithDisplayName ? formatCategoryQuantityWithDisplayName({dataCategory: billedCategory, quantity: prepaid, formattedQuantity: formattedPrepaid, subscription, options: {capitalize: false}}) : formattedPrepaid}`
290290
)}
291-
{formattedFree && ` (${formattedFree} gifted)`}
292291
</Text>
292+
{formattedFree && (
293+
<Text size="xs">
294+
{tct(` ([formattedFree] gifted)`, {formattedFree})}
295+
</Text>
296+
)}
293297
</Flex>
294298
</td>
295299
{showAdditionalSpendColumn && (

0 commit comments

Comments
 (0)