File tree Expand file tree Collapse file tree 1 file changed +30
-20
lines changed
frontend/src/presentation/components Expand file tree Collapse file tree 1 file changed +30
-20
lines changed Original file line number Diff line number Diff line change @@ -208,26 +208,36 @@ export const RecentAttemptsTable: React.FC = () => {
208
208
{
209
209
title : 'Actions' ,
210
210
key : 'action' ,
211
- render : ( _text , record ) => (
212
- < Space size = "middle" className = { styles . actionsButton } >
213
- < Button
214
- type = "link"
215
- onClick = { ( ) => showModal ( record . attemptCodes , record . key ) }
216
- icon = { < EyeOutlined /> }
217
- aria-label = { `View past code for attempt ${ record . key } ` }
218
- >
219
- View Past Code
220
- </ Button >
221
- < Button
222
- type = "link"
223
- onClick = { ( ) => navigate ( `/room/${ record . roomId } ` ) }
224
- icon = { < TeamOutlined /> }
225
- aria-label = { `Rejoin room ${ record . roomId } ` }
226
- >
227
- Rejoin
228
- </ Button >
229
- </ Space >
230
- ) ,
211
+ render : ( _text , record ) => {
212
+ const attemptStartDate = new Date ( record . attemptStartedAt ) ;
213
+ const now = new Date ( ) ;
214
+ const timeDiffMs = now . getTime ( ) - attemptStartDate . getTime ( ) ;
215
+
216
+ const isWithin24Hours = timeDiffMs < 86400000 ; // Should be same as ROOM_LIFESPAN in MatchingService
217
+
218
+ return (
219
+ < Space size = "middle" className = { styles . actionsButton } >
220
+ < Button
221
+ type = "link"
222
+ onClick = { ( ) => showModal ( record . attemptCodes , record . key ) }
223
+ icon = { < EyeOutlined /> }
224
+ aria-label = { `View past code for attempt ${ record . key } ` }
225
+ >
226
+ View Past Code
227
+ </ Button >
228
+ { isWithin24Hours && (
229
+ < Button
230
+ type = "link"
231
+ onClick = { ( ) => navigate ( `/room/${ record . roomId } ` ) }
232
+ icon = { < TeamOutlined /> }
233
+ aria-label = { `Rejoin room ${ record . roomId } ` }
234
+ >
235
+ Rejoin
236
+ </ Button >
237
+ ) }
238
+ </ Space >
239
+ ) ;
240
+ } ,
231
241
} ,
232
242
] ;
233
243
You can’t perform that action at this time.
0 commit comments