6
6
useTheme ,
7
7
} from "@emotion/react" ;
8
8
import Link from "@mui/material/Link" ;
9
+ import { LicenseTelemetryRequiredErrorText } from "api/typesGenerated" ;
9
10
import { Expander } from "components/Expander/Expander" ;
10
11
import { Pill } from "components/Pill/Pill" ;
11
12
import { type FC , useState } from "react" ;
@@ -14,6 +15,7 @@ export const Language = {
14
15
licenseIssue : "License Issue" ,
15
16
licenseIssues : ( num : number ) : string => `${ num } License Issues` ,
16
17
upgrade : "Contact sales@coder.com." ,
18
+ exception : "Contact sales@coder.com if you need an exception." ,
17
19
exceeded : "It looks like you've exceeded some limits of your license." ,
18
20
lessDetails : "Less" ,
19
21
moreDetails : "More" ,
@@ -26,6 +28,14 @@ const styles = {
26
28
} ,
27
29
} satisfies Record < string , Interpolation < Theme > > ;
28
30
31
+ const formatMessage = ( message : string ) => {
32
+ // If the message ends with an alphanumeric character, add a period.
33
+ if ( / [ a - z 0 - 9 ] $ / i. test ( message ) ) {
34
+ return `${ message } .` ;
35
+ }
36
+ return message ;
37
+ } ;
38
+
29
39
export interface LicenseBannerViewProps {
30
40
errors : readonly string [ ] ;
31
41
warnings : readonly string [ ] ;
@@ -57,14 +67,16 @@ export const LicenseBannerView: FC<LicenseBannerViewProps> = ({
57
67
< div css = { containerStyles } >
58
68
< Pill type = { type } > { Language . licenseIssue } </ Pill >
59
69
< div css = { styles . leftContent } >
60
- < span > { messages [ 0 ] } </ span >
70
+ < span > { formatMessage ( messages [ 0 ] ) } </ span >
61
71
62
72
< Link
63
73
color = { textColor }
64
74
fontWeight = "medium"
65
75
href = "mailto:sales@coder.com"
66
76
>
67
- { Language . upgrade }
77
+ { messages [ 0 ] === LicenseTelemetryRequiredErrorText
78
+ ? Language . exception
79
+ : Language . upgrade }
68
80
</ Link >
69
81
</ div >
70
82
</ div >
@@ -90,7 +102,7 @@ export const LicenseBannerView: FC<LicenseBannerViewProps> = ({
90
102
< ul css = { { padding : 8 , margin : 0 } } >
91
103
{ messages . map ( ( message ) => (
92
104
< li css = { { margin : 4 } } key = { message } >
93
- { message }
105
+ { formatMessage ( message ) }
94
106
</ li >
95
107
) ) }
96
108
</ ul >
0 commit comments