File tree Expand file tree Collapse file tree 2 files changed +141
-0
lines changed Expand file tree Collapse file tree 2 files changed +141
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { differenceInDays } from 'date-fns' ;
1
2
import {
2
3
Dialog ,
3
4
DialogActions ,
@@ -47,6 +48,12 @@ const CippStandardDialog = ({
47
48
[ ]
48
49
) ;
49
50
51
+ const isNewStandard = ( dateAdded ) => {
52
+ const currentDate = new Date ( ) ;
53
+ const addedDate = new Date ( dateAdded ) ;
54
+ return differenceInDays ( currentDate , addedDate ) <= 30 ;
55
+ } ;
56
+
50
57
return (
51
58
< Dialog
52
59
open = { dialogOpen }
@@ -90,6 +97,9 @@ const CippStandardDialog = ({
90
97
>
91
98
< CardContent sx = { { flexGrow : 1 } } >
92
99
< Typography variant = "h6" gutterBottom >
100
+ { isNewStandard ( standard . addedDate ) && (
101
+ < > < Chip label = "New" size = "small" color = "success" sx = { { ml : 1 } } /> </ >
102
+ ) }
93
103
{ standard . label }
94
104
</ Typography >
95
105
{ standard . helpText && (
@@ -151,6 +161,18 @@ const CippStandardDialog = ({
151
161
</ Typography >
152
162
</ >
153
163
) }
164
+ { standard . addedDate ?. length > 0 && (
165
+ < >
166
+ < Typography variant = "subtitle2" sx = { { mt : 2 } } >
167
+ Date Added:
168
+ </ Typography >
169
+ < Box sx = { { display : "flex" , alignItems : "center" } } >
170
+ < Typography variant = "body2" color = "textSecondary" >
171
+ { standard . addedDate }
172
+ </ Typography >
173
+ </ Box >
174
+ </ >
175
+ ) }
154
176
</ CardContent >
155
177
156
178
< CardContent >
You can’t perform that action at this time.
0 commit comments