@@ -13,16 +13,18 @@ import type { MonitorStatus } from "@/types/monitor";
1313import { formatDateWithTz } from "@/utils/TimeUtils" ;
1414import { useTheme } from "@mui/material/styles" ;
1515import { getMonitorPath } from "@/utils/MonitorUtils" ;
16+ import { useTranslation } from "react-i18next" ;
1617
1718type CheckDetailsCardProps = {
1819 check : ICheck ;
1920} ;
2021
2122export const CheckDetailsCard = ( { check } : CheckDetailsCardProps ) => {
23+ const { t } = useTranslation ( ) ;
2224 const theme = useTheme ( ) ;
2325 const uiTimezone = useAppSelector ( ( state : any ) => state . ui . timezone ) ;
2426 const phases = check ?. timings ?. phases ;
25- const phaseKeys = [
27+ type phaseKeys = [
2628 "wait" ,
2729 "dns" ,
2830 "tcp" ,
@@ -31,7 +33,7 @@ export const CheckDetailsCard = ({ check }: CheckDetailsCardProps) => {
3133 "firstByte" ,
3234 "download" ,
3335 "total" ,
34- ] as const ;
36+ ] ;
3537
3638 const status =
3739 ( check ?. status as MonitorStatus ) ?? ( "initializing" as MonitorStatus ) ;
@@ -53,7 +55,7 @@ export const CheckDetailsCard = ({ check }: CheckDetailsCardProps) => {
5355 ? formatDateWithTz ( check . createdAt , "ddd, MMM D, YYYY, HH:mm A" , uiTimezone )
5456 : "-" ;
5557 const messageText = check ?. message ?? "-" ;
56- const getPhaseMs = ( key : ( typeof phaseKeys ) [ number ] ) => {
58+ const getPhaseMs = ( key : phaseKeys [ number ] ) => {
5759 const v = Number ( ( phases as any ) ?. [ key ] ?? NaN ) ;
5860 return Number . isFinite ( v ) ? `${ Math . floor ( Math . max ( 0 , v ) ) } ms` : "-" ;
5961 } ;
@@ -62,8 +64,12 @@ export const CheckDetailsCard = ({ check }: CheckDetailsCardProps) => {
6264 < BaseBox p = { 4 } flex = { 1 } height = { "100%" } >
6365 < Stack spacing = { 8 } sx = { { width : "100%" } } >
6466 < Stack >
65- < Typography > Check details</ Typography >
66- < Typography variant = "body2" > { `Total request time: ${ getPhaseMs ( "total" ) } ` } </ Typography >
67+ < Typography > { t ( "checks.details.detailsCard.title" ) } </ Typography >
68+ < Typography variant = "body2" >
69+ { t ( "checks.details.common.requestTime" , {
70+ time : getPhaseMs ( "total" ) ,
71+ } ) }
72+ </ Typography >
6773 { ( ( ) => {
6874 const href = `/${ getMonitorPath ( check . metadata . type ) } /${ check . metadata . monitorId } ` ;
6975 return href ? (
@@ -74,7 +80,7 @@ export const CheckDetailsCard = ({ check }: CheckDetailsCardProps) => {
7480 underline = "hover"
7581 color = "primary"
7682 >
77- View monitor details
83+ { t ( "checks. details.detailsCard.linkText" ) }
7884 </ Link >
7985 </ Typography >
8086 ) : null ;
@@ -89,11 +95,13 @@ export const CheckDetailsCard = ({ check }: CheckDetailsCardProps) => {
8995 mt = { 4 }
9096 mb = { 2 }
9197 >
92- < Typography > Basic check info</ Typography >
98+ < Typography >
99+ { t ( "checks.details.detailsCard.headers.basicInfo" ) }
100+ </ Typography >
93101 </ Grid >
94102 < Grid size = { 6 } sx = { { display : "flex" , alignItems : "center" } } >
95103 < Typography variant = "body1" color = "text.secondary" >
96- Status
104+ { t ( "checks.details.detailsCard.fields.status" ) }
97105 </ Typography >
98106 </ Grid >
99107 < Grid size = { 6 } sx = { { display : "flex" , alignItems : "center" } } >
@@ -103,7 +111,7 @@ export const CheckDetailsCard = ({ check }: CheckDetailsCardProps) => {
103111 </ Grid >
104112 < Grid size = { 6 } sx = { { display : "flex" , alignItems : "center" } } >
105113 < Typography variant = "body1" color = "text.secondary" >
106- HTTP Code
114+ { t ( "checks.details.detailsCard.fields.code" ) }
107115 </ Typography >
108116 </ Grid >
109117 < Grid size = { 6 } sx = { { display : "flex" , alignItems : "center" } } >
@@ -113,7 +121,7 @@ export const CheckDetailsCard = ({ check }: CheckDetailsCardProps) => {
113121 </ Grid >
114122 < Grid size = { 6 } >
115123 < Typography variant = "body1" color = "text.secondary" >
116- Type
124+ { t ( "checks.details.detailsCard.fields.type" ) }
117125 </ Typography >
118126 </ Grid >
119127 < Grid size = { 6 } >
@@ -122,15 +130,15 @@ export const CheckDetailsCard = ({ check }: CheckDetailsCardProps) => {
122130
123131 < Grid size = { 6 } >
124132 < Typography variant = "body1" color = "text.secondary" >
125- Check time
133+ { t ( "checks.details.detailsCard.fields.checkTime" ) }
126134 </ Typography >
127135 </ Grid >
128136 < Grid size = { 6 } >
129137 < Typography variant = "body2" > { checkedAtText } </ Typography >
130138 </ Grid >
131139 < Grid size = { 6 } >
132140 < Typography variant = "body1" color = "text.secondary" >
133- Message
141+ { t ( "checks.details.detailsCard.fields.message" ) }
134142 </ Typography >
135143 </ Grid >
136144 < Grid size = { 6 } >
@@ -146,12 +154,14 @@ export const CheckDetailsCard = ({ check }: CheckDetailsCardProps) => {
146154 mb = { 4 }
147155 mt = { 2 }
148156 >
149- < Typography > Timing phases</ Typography >
157+ < Typography >
158+ { t ( "checks.details.detailsCard.headers.timing" ) }
159+ </ Typography >
150160 </ Grid >
151161
152162 < Grid size = { 6 } >
153163 < Typography variant = "body1" color = "text.secondary" >
154- Wait
164+ { t ( "checks.details.detailsCard.fields.wait" ) }
155165 </ Typography >
156166 </ Grid >
157167 < Grid size = { 6 } >
@@ -160,7 +170,7 @@ export const CheckDetailsCard = ({ check }: CheckDetailsCardProps) => {
160170
161171 < Grid size = { 6 } >
162172 < Typography variant = "body1" color = "text.secondary" >
163- DNS
173+ { t ( "checks.details.detailsCard.fields.dns" ) }
164174 </ Typography >
165175 </ Grid >
166176 < Grid size = { 6 } >
@@ -169,7 +179,7 @@ export const CheckDetailsCard = ({ check }: CheckDetailsCardProps) => {
169179
170180 < Grid size = { 6 } >
171181 < Typography variant = "body1" color = "text.secondary" >
172- TCP
182+ { t ( "checks.details.detailsCard.fields.tcp" ) }
173183 </ Typography >
174184 </ Grid >
175185 < Grid size = { 6 } >
@@ -178,7 +188,7 @@ export const CheckDetailsCard = ({ check }: CheckDetailsCardProps) => {
178188
179189 < Grid size = { 6 } >
180190 < Typography variant = "body1" color = "text.secondary" >
181- TLS
191+ { t ( "checks.details.detailsCard.fields.tls" ) }
182192 </ Typography >
183193 </ Grid >
184194 < Grid size = { 6 } >
@@ -187,7 +197,7 @@ export const CheckDetailsCard = ({ check }: CheckDetailsCardProps) => {
187197
188198 < Grid size = { 6 } >
189199 < Typography variant = "body1" color = "text.secondary" >
190- Request
200+ { t ( "checks.details.detailsCard.fields.request" ) }
191201 </ Typography >
192202 </ Grid >
193203 < Grid size = { 6 } >
@@ -196,7 +206,7 @@ export const CheckDetailsCard = ({ check }: CheckDetailsCardProps) => {
196206
197207 < Grid size = { 6 } >
198208 < Typography variant = "body1" color = "text.secondary" >
199- First Byte
209+ { t ( "checks.details.detailsCard.fields.firstByte" ) }
200210 </ Typography >
201211 </ Grid >
202212 < Grid size = { 6 } >
@@ -205,7 +215,7 @@ export const CheckDetailsCard = ({ check }: CheckDetailsCardProps) => {
205215
206216 < Grid size = { 6 } >
207217 < Typography variant = "body1" color = "text.secondary" >
208- Download
218+ { t ( "checks.details.detailsCard.fields.download" ) }
209219 </ Typography >
210220 </ Grid >
211221 < Grid size = { 6 } >
@@ -214,7 +224,7 @@ export const CheckDetailsCard = ({ check }: CheckDetailsCardProps) => {
214224
215225 < Grid size = { 6 } >
216226 < Typography variant = "body1" color = "text.secondary" >
217- Total
227+ { t ( "checks.details.detailsCard.fields.total" ) }
218228 </ Typography >
219229 </ Grid >
220230 < Grid size = { 6 } >
0 commit comments