-
Notifications
You must be signed in to change notification settings - Fork 399
feat: [M3-7144] - MNTP Dialog Updates for DC-specific pricing #9692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ff52867
9eab5b4
744c89b
305485b
8c581c5
a1331db
c876ffd
d51f42a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@linode/manager": Upcoming Features | ||
| --- | ||
|
|
||
| Update Monthly Network Transfer Pool dialog copy and typography ([#9692](https://github.com/linode/manager/pull/9692)) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,7 +38,7 @@ interface Props | |
| * Enables a leaveDelay of 3000ms | ||
| * @default false | ||
| */ | ||
| leaveDelay?: boolean; | ||
| leaveDelay?: number; | ||
| /** | ||
| * Sets the icon and color | ||
| */ | ||
|
|
@@ -142,6 +142,7 @@ export const TooltipIcon = (props: Props) => { | |
| return ( | ||
| <Tooltip | ||
| classes={classes} | ||
| componentsProps={props.componentsProps} | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Those were not picked up otherwise. Decided against passing {...props} to avoid regressions related to spreading everything (unknown HTML props etc) |
||
| data-qa-help-tooltip | ||
| disableInteractive={!interactive} | ||
| enterTouchDelay={0} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| import { useTheme } from '@mui/material/styles'; | ||
| import * as React from 'react'; | ||
|
|
||
| import { TooltipIcon } from 'src/components/TooltipIcon'; | ||
| import { Typography } from 'src/components/Typography'; | ||
|
|
||
| interface Props { | ||
| dataTestId: string; | ||
| headerText: string; | ||
| tooltipText: string; | ||
| } | ||
|
|
||
| export const TransferDisplayDialogHeader = React.memo((props: Props) => { | ||
| const { dataTestId, headerText, tooltipText } = props; | ||
| const theme = useTheme(); | ||
|
|
||
| return ( | ||
| <Typography | ||
| data-testid={dataTestId} | ||
| fontFamily={theme.font.bold} | ||
| fontSize={theme.typography.h3.fontSize} | ||
| > | ||
| {headerText} | ||
| <TooltipIcon | ||
| componentsProps={{ | ||
| tooltip: { | ||
| style: { | ||
| marginTop: -8, | ||
| minWidth: 250, | ||
| }, | ||
| }, | ||
| }} | ||
| status="help" | ||
| sxTooltipIcon={{ left: -2, top: -2 }} | ||
| text={tooltipText} | ||
| /> | ||
| </Typography> | ||
| ); | ||
| }); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's enough coverage of the feature to leave this new micro component without a unit test |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -103,3 +103,27 @@ export const getRegionTransferPools = ( | |
| export const formatPoolUsagePct = (pct: number): string => { | ||
| return `${pct.toFixed(pct < 1 ? 2 : 0)}%`; | ||
| }; | ||
|
|
||
| /** | ||
| * Format a list of regions into a readable string. | ||
| * @param regions | ||
| * @returns string | ||
| * | ||
| * @example formatRegionList(['Region 1', 'Region 2', 'Region 3']) // 'Region 1, Region 2 and Region 3' | ||
| * @example formatRegionList(['Region 1, Region 2']) // 'Region 1 and Region 2' | ||
| * @example formatRegionList(['Region 1']) // 'Region 1' | ||
| * @example formatRegionList([]) // '' | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. super small, but worth writing a test case for this as well (the empty [] case) just to hit all the cases 😆
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seconding this. 👍🏼
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sure thing, done |
||
| */ | ||
| export const formatRegionList = (regions: string[]) => { | ||
| const length = regions.length; | ||
|
|
||
| if (length === 0) { | ||
| return ''; | ||
| } else if (length === 1) { | ||
| return regions[0]; | ||
| } else { | ||
| const lastRegion = regions.pop(); | ||
|
|
||
| return `${regions.join(', ')} and ${lastRegion}`; | ||
| } | ||
| }; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes an existing type issue on the component (unrelated to main PR purpose)