From 90efb5be001393134aaef07fe11e9ad605692043 Mon Sep 17 00:00:00 2001
From: Mo Tarbin <mhed.t91@gmail.com>
Date: Sat, 20 Jul 2024 03:40:41 -0400
Subject: Support for history Modification and deletion

---
 src/views/History/HistoryCard.jsx | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

(limited to 'src/views/History/HistoryCard.jsx')

diff --git a/src/views/History/HistoryCard.jsx b/src/views/History/HistoryCard.jsx
index 5e71f52..34a0b33 100644
--- a/src/views/History/HistoryCard.jsx
+++ b/src/views/History/HistoryCard.jsx
@@ -11,7 +11,13 @@ import {
 } from '@mui/joy'
 import moment from 'moment'
 
-const HistoryCard = ({ allHistory, performers, historyEntry, index }) => {
+const HistoryCard = ({
+  allHistory,
+  performers,
+  historyEntry,
+  index,
+  onClick,
+}) => {
   function formatTimeDifference(startDate, endDate) {
     const diffInMinutes = moment(startDate).diff(endDate, 'minutes')
     let timeValue = diffInMinutes
@@ -64,7 +70,7 @@ const HistoryCard = ({ allHistory, performers, historyEntry, index }) => {
       icon = <Timelapse />
     } else {
       text = 'No Due Date'
-      color = 'info'
+      color = 'neutral'
       icon = <CalendarViewDay />
     }
 
@@ -77,7 +83,7 @@ const HistoryCard = ({ allHistory, performers, historyEntry, index }) => {
 
   return (
     <>
-      <ListItem sx={{ gap: 1.5, alignItems: 'flex-start' }}>
+      <ListItem sx={{ gap: 1.5, alignItems: 'flex-start' }} onClick={onClick}>
         {' '}
         {/* Adjusted spacing and alignment */}
         <ListItemDecorator>
@@ -98,7 +104,11 @@ const HistoryCard = ({ allHistory, performers, historyEntry, index }) => {
             }}
           >
             <Typography level='body1' sx={{ fontWeight: 'md' }}>
-              {moment(historyEntry.completedAt).format('ddd MM/DD/yyyy HH:mm')}
+              {historyEntry.completedAt
+                ? moment(historyEntry.completedAt).format(
+                    'ddd MM/DD/yyyy HH:mm',
+                  )
+                : 'Skipped'}
             </Typography>
             {getCompletedChip(historyEntry)}
           </Box>
-- 
cgit 

