Skip to content

Commit ef80b4f

Browse files
committed
frontend changes
1 parent b3da98f commit ef80b4f

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

site/src/modules/dashboard/LicenseBanner/LicenseBannerView.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
useTheme,
77
} from "@emotion/react";
88
import Link from "@mui/material/Link";
9+
import { LicenseTelemetryRequiredErrorText } from "api/typesGenerated";
910
import { Expander } from "components/Expander/Expander";
1011
import { Pill } from "components/Pill/Pill";
1112
import { type FC, useState } from "react";
@@ -14,6 +15,7 @@ export const Language = {
1415
licenseIssue: "License Issue",
1516
licenseIssues: (num: number): string => `${num} License Issues`,
1617
upgrade: "Contact sales@coder.com.",
18+
exception: "Contact sales@coder.com if you need an exception.",
1719
exceeded: "It looks like you've exceeded some limits of your license.",
1820
lessDetails: "Less",
1921
moreDetails: "More",
@@ -26,6 +28,14 @@ const styles = {
2628
},
2729
} satisfies Record<string, Interpolation<Theme>>;
2830

31+
const formatMessage = (message: string) => {
32+
// If the message ends with an alphanumeric character, add a period.
33+
if (/[a-z0-9]$/i.test(message)) {
34+
return `${message}.`;
35+
}
36+
return message;
37+
};
38+
2939
export interface LicenseBannerViewProps {
3040
errors: readonly string[];
3141
warnings: readonly string[];
@@ -57,14 +67,16 @@ export const LicenseBannerView: FC<LicenseBannerViewProps> = ({
5767
<div css={containerStyles}>
5868
<Pill type={type}>{Language.licenseIssue}</Pill>
5969
<div css={styles.leftContent}>
60-
<span>{messages[0]}</span>
70+
<span>{formatMessage(messages[0])}</span>
6171
&nbsp;
6272
<Link
6373
color={textColor}
6474
fontWeight="medium"
6575
href="mailto:sales@coder.com"
6676
>
67-
{Language.upgrade}
77+
{messages[0] === LicenseTelemetryRequiredErrorText
78+
? Language.exception
79+
: Language.upgrade}
6880
</Link>
6981
</div>
7082
</div>
@@ -90,7 +102,7 @@ export const LicenseBannerView: FC<LicenseBannerViewProps> = ({
90102
<ul css={{ padding: 8, margin: 0 }}>
91103
{messages.map((message) => (
92104
<li css={{ margin: 4 }} key={message}>
93-
{message}
105+
{formatMessage(message)}
94106
</li>
95107
))}
96108
</ul>

0 commit comments

Comments
 (0)