11import React from 'react' ;
22import { GlobeAltIcon , NoSymbolIcon } from '@heroicons/react/24/solid' ;
33import Badge from './Badge' ;
4+ import {
5+ CHECK_STATUS ,
6+ getCheckStatusBadgeColor ,
7+ } from '@/Utils/checkStatusSeverity' ;
48
59export default function MonitorDomainIcon ( { monitor } ) {
610
711 let badgeProps = { icon : null , text : '' , color : '' } ;
812
913 if ( ! monitor . domain_expires_at ) {
1014 badgeProps = {
11- icon : < NoSymbolIcon className = "h-4 w-4 text-red -600" /> ,
15+ icon : < NoSymbolIcon className = "h-4 w-4 text-gray -600" /> ,
1216 text : 'No Data' ,
13- color : 'red'
17+ color : getCheckStatusBadgeColor ( CHECK_STATUS . UNKNOWN ) ,
1418 } ;
1519 } else {
1620 const today = new Date ( ) ;
@@ -21,42 +25,42 @@ export default function MonitorDomainIcon({ monitor }) {
2125 badgeProps = {
2226 icon : < GlobeAltIcon className = "h-4 w-4 text-green-600" /> ,
2327 text : '100+ days left' ,
24- color : 'green'
28+ color : getCheckStatusBadgeColor ( CHECK_STATUS . SUCCESS ) ,
2529 } ;
2630 break ;
2731 case daysLeft <= 100 && daysLeft > 30 :
2832 badgeProps = {
2933 icon : < GlobeAltIcon className = "h-4 w-4 text-blue-600" /> ,
3034 text : `${ daysLeft } days left` ,
31- color : 'blue'
35+ color : getCheckStatusBadgeColor ( CHECK_STATUS . SUCCESS ) ,
3236 } ;
3337 break ;
3438 case daysLeft <= 30 && daysLeft > 7 :
3539 badgeProps = {
36- icon : < GlobeAltIcon className = "h-4 w-4 text-purple -600" /> ,
40+ icon : < GlobeAltIcon className = "h-4 w-4 text-yellow -600" /> ,
3741 text : `${ daysLeft } days left` ,
38- color : 'purple'
42+ color : getCheckStatusBadgeColor ( CHECK_STATUS . WARNING ) ,
3943 } ;
4044 break ;
4145 case daysLeft <= 7 && daysLeft > 1 :
4246 badgeProps = {
4347 icon : < GlobeAltIcon className = "h-4 w-4 text-yellow-600" /> ,
4448 text : `${ daysLeft } days left` ,
45- color : 'yellow'
49+ color : getCheckStatusBadgeColor ( CHECK_STATUS . WARNING ) ,
4650 } ;
4751 break ;
4852 case daysLeft === 1 :
4953 badgeProps = {
50- icon : < GlobeAltIcon className = "h-4 w-4 text-pink -600" /> ,
54+ icon : < GlobeAltIcon className = "h-4 w-4 text-yellow -600" /> ,
5155 text : `${ daysLeft } day left` ,
52- color : 'pink'
56+ color : getCheckStatusBadgeColor ( CHECK_STATUS . WARNING ) ,
5357 } ;
5458 break ;
5559 case daysLeft <= 0 :
5660 badgeProps = {
5761 icon : < GlobeAltIcon className = "h-4 w-4 text-red-600" /> ,
5862 text : 'Domain Expired' ,
59- color : 'red'
63+ color : getCheckStatusBadgeColor ( CHECK_STATUS . FAILED ) ,
6064 } ;
6165 break ;
6266 default :
0 commit comments