@@ -13,7 +13,6 @@ import {
1313 Divider ,
1414 Flex ,
1515 Heading ,
16- Spinner ,
1716 Stack ,
1817 Tab ,
1918 TabList ,
@@ -23,19 +22,16 @@ import {
2322 Text ,
2423 useToast ,
2524} from '@chakra-ui/react'
26- import {
27- CheckCircleIcon ,
28- WarningIcon ,
29- WarningTwoIcon ,
30- InfoIcon ,
31- } from '@chakra-ui/icons'
25+ import { WarningTwoIcon } from '@chakra-ui/icons'
3226import { useMutation , useQuery } from '@apollo/client'
3327import { object , string } from 'yup'
3428
3529import { DomainField } from './DomainField'
30+ import { StatusBadge } from './StatusBadge'
3631
3732import { ScanCategoryDetails } from '../guidance/ScanCategoryDetails'
3833import { LoadingMessage } from '../components/LoadingMessage'
34+ import { StatusIcon } from '../components/StatusIcon'
3935import { fieldRequirements } from '../utilities/fieldRequirements'
4036import { GET_ONE_TIME_SCANS } from '../graphql/queries'
4137import { REQUEST_SCAN } from '../graphql/mutations'
@@ -120,8 +116,6 @@ export function ScanDomain() {
120116 } )
121117 }
122118
123- // TODO: Create list of collapsable scan detail cards
124-
125119 const dmarcSteps = {
126120 assess : [
127121 t `Identify all domains and subdomains used to send mail;` ,
@@ -147,16 +141,16 @@ export function ScanDomain() {
147141 ] ,
148142 }
149143
150- const generateStatusIcon = ( status ) => {
151- let statusIcon
152- if ( status === 'PASS' ) {
153- statusIcon = < CheckCircleIcon color = "strong" size = "icons.sm" />
154- } else if ( status === 'FAIL' ) {
155- statusIcon = < WarningIcon color = "weak" size = "icons.sm" />
156- } else {
157- statusIcon = < InfoIcon color = "info" size = "icons.sm" />
158- }
159- return statusIcon
144+ const statusGroupingProps = {
145+ flexDirection : { base : 'column' , md : 'row' } ,
146+ border : '1px solid' ,
147+ borderColor : 'gray.300' ,
148+ borderRadius : 'md' ,
149+ px : { base : 2 , md : 0 } ,
150+ py : { base : 1 , md : 2 } ,
151+ mx : { base : 0 , md : 1 } ,
152+ my : { base : 2 , md : 0 } ,
153+ bg : 'gray.100' ,
160154 }
161155
162156 return (
@@ -237,116 +231,50 @@ export function ScanDomain() {
237231 flexDirection = { { base : 'column' , md : 'row' } }
238232 flexGrow = { { base : 0 , md : '1' } }
239233 >
240- < Box mx = { { md : 2 } } >
241- < Stack
242- align = "center"
243- flexDirection = { { base : 'row' , md : 'column' } }
244- justifyContent = "space-between"
245- spacing = { 0 }
246- >
247- < Text
248- fontWeight = "bold"
249- fontSize = "sm"
250- mb = { { base : 0 , md : '2' } }
251- mr = { { base : '2' , md : 0 } }
252- >
253- HTTPS:
254- </ Text >
255- { mergedScan . scan . https ? (
256- generateStatusIcon ( mergedScan . scan . https . status )
257- ) : (
258- < Spinner color = "accent" size = "sm" />
259- ) }
260- </ Stack >
261- </ Box >
262- < Box mx = { { md : 2 } } >
263- < Stack
264- align = "center"
265- flexDirection = { { base : 'row' , md : 'column' } }
266- justifyContent = "space-between"
267- spacing = { 0 }
268- >
269- < Text
270- fontWeight = "bold"
271- fontSize = "sm"
272- mb = { { base : 0 , md : '2' } }
273- mr = { { base : '2' , md : 0 } }
274- >
275- SSL:
276- </ Text >
277- { mergedScan . scan . ssl ? (
278- generateStatusIcon ( mergedScan . scan . ssl . status )
279- ) : (
280- < Spinner color = "accent" size = "sm" />
281- ) }
282- </ Stack >
283- </ Box >
284- < Box mx = { { md : 2 } } >
285- < Stack
286- align = "center"
287- flexDirection = { { base : 'row' , md : 'column' } }
288- justifyContent = "space-between"
289- spacing = { 0 }
290- >
291- < Text
292- fontWeight = "bold"
293- fontSize = "sm"
294- mb = { { base : 0 , md : '2' } }
295- mr = { { base : '2' , md : 0 } }
296- >
297- SPF:
298- </ Text >
299- { mergedScan . scan . spf ? (
300- generateStatusIcon ( mergedScan . scan . spf . status )
301- ) : (
302- < Spinner color = "accent" size = "sm" />
303- ) }
304- </ Stack >
305- </ Box >
306- < Box mx = { { md : 2 } } >
307- < Stack
308- align = "center"
309- flexDirection = { { base : 'row' , md : 'column' } }
310- justifyContent = "space-between"
311- spacing = { 0 }
312- >
313- < Text
314- fontWeight = "bold"
315- fontSize = "sm"
316- mb = { { base : 0 , md : '2' } }
317- mr = { { base : '2' , md : 0 } }
318- >
319- DKIM:
320- </ Text >
321- { mergedScan . scan . dkim ? (
322- generateStatusIcon ( mergedScan . scan . dkim . status )
323- ) : (
324- < Spinner color = "accent" size = "sm" />
325- ) }
326- </ Stack >
327- </ Box >
328- < Box mx = { { md : 2 } } >
329- < Stack
330- align = "center"
331- flexDirection = { { base : 'row' , md : 'column' } }
332- justifyContent = "space-between"
333- spacing = { 0 }
334- >
335- < Text
336- fontWeight = "bold"
337- fontSize = "sm"
338- mb = { { base : 0 , md : '2' } }
339- mr = { { base : '2' , md : '0' } }
340- >
341- DMARC:
342- </ Text >
343- { mergedScan . scan . dmarc ? (
344- generateStatusIcon ( mergedScan . scan . dmarc . status )
345- ) : (
346- < Spinner color = "accent" size = "sm" />
347- ) }
348- </ Stack >
349- </ Box >
234+ < Flex { ...statusGroupingProps } >
235+ < StatusBadge
236+ text = "HTTPS:"
237+ status = {
238+ mergedScan . scan ?. https
239+ ? mergedScan . scan . https . status
240+ : 'LOADING'
241+ }
242+ />
243+ < StatusBadge
244+ text = "SSL:"
245+ status = {
246+ mergedScan . scan ?. ssl
247+ ? mergedScan . scan . ssl . status
248+ : 'LOADING'
249+ }
250+ />
251+ </ Flex >
252+ < Flex { ...statusGroupingProps } >
253+ < StatusBadge
254+ text = "SPF:"
255+ status = {
256+ mergedScan . scan ?. spf
257+ ? mergedScan . scan . spf . status
258+ : 'LOADING'
259+ }
260+ />
261+ < StatusBadge
262+ text = "DKIM:"
263+ status = {
264+ mergedScan . scan ?. dkim
265+ ? mergedScan . scan . dkim . status
266+ : 'LOADING'
267+ }
268+ />
269+ < StatusBadge
270+ text = "DMARC:"
271+ status = {
272+ mergedScan . scan ?. dmarc
273+ ? mergedScan . scan . dmarc . status
274+ : 'LOADING'
275+ }
276+ />
277+ </ Flex >
350278 < Divider
351279 orientation = { { base : 'horizontal' , md : 'vertical' } }
352280 alignSelf = "stretch"
@@ -393,10 +321,7 @@ export function ScanDomain() {
393321 mergedScan . scan . https . status === 'PASS' &&
394322 mergedScan . scan . ssl . status === 'PASS' ? (
395323 < Stack isInline align = "center" px = "2" >
396- < CheckCircleIcon
397- color = "strong"
398- size = "icons.sm"
399- />
324+ < StatusIcon status = "PASS" />
400325 < Text fontWeight = "bold" fontSize = "2xl" >
401326 < Trans > ITPIN Compliant</ Trans >
402327 </ Text >
@@ -415,12 +340,7 @@ export function ScanDomain() {
415340 </ Stack >
416341 )
417342 ) : (
418- < Stack isInline align = "center" px = "2" >
419- < Spinner color = "accent" size = "md" />
420- < Text fontWeight = "bold" fontSize = "2xl" >
421- < Trans > Loading Compliance Status</ Trans >
422- </ Text >
423- </ Stack >
343+ < LoadingMessage > One Time Scan</ LoadingMessage >
424344 ) }
425345 </ Box >
426346 < Accordion allowMultiple defaultIndex = { [ 0 , 1 ] } >
@@ -493,12 +413,7 @@ export function ScanDomain() {
493413 ) }
494414 </ Box >
495415 ) : (
496- < Stack isInline align = "center" px = "2" >
497- < Spinner color = "accent" size = "md" />
498- < Text fontWeight = "bold" fontSize = "2xl" >
499- < Trans > Loading DMARC Phase</ Trans >
500- </ Text >
501- </ Stack >
416+ < LoadingMessage > One Time Scan</ LoadingMessage >
502417 ) }
503418 </ Box >
504419 < Accordion allowMultiple defaultIndex = { [ 0 , 1 , 2 ] } >
0 commit comments