feat: implement ActivitiesCard component to display recent activities with enhanced status and time display

Support the new Status and Performed By
This commit is contained in:
Mo Tarbin
2025-05-29 01:01:07 -04:00
parent 5c000f50aa
commit 1f2d38730d
9 changed files with 492 additions and 33 deletions

View File

@@ -35,7 +35,7 @@ const groupByDate = history => {
const aggregated = {}
for (let i = 0; i < history.length; i++) {
const item = history[i]
const date = new Date(item.completedAt).toLocaleDateString()
const date = new Date(item.performedAt).toLocaleDateString()
if (!aggregated[date]) {
aggregated[date] = []
}
@@ -114,7 +114,7 @@ const ChoreHistoryTimeline = ({ history }) => {
<>
<ChoreHistoryItem
key={record.id}
time={new Date(record.completedAt).toLocaleTimeString([], {
time={new Date(record.performedAt).toLocaleTimeString([], {
hour: '2-digit',
minute: '2-digit',
})}
@@ -289,9 +289,9 @@ const UserActivites = () => {
const generateHistoryPieChartData = history => {
const totalCompleted =
history.filter(item => item.dueDate > item.completedAt).length || 0
history.filter(item => item.dueDate > item.performedAt).length || 0
const totalLate =
history.filter(item => item.dueDate < item.completedAt).length || 0
history.filter(item => item.dueDate < item.performedAt).length || 0
const totalNoDueDate = history.filter(item => !item.dueDate).length || 0
return [

View File

@@ -107,7 +107,7 @@ const UserPoints = () => {
})
}
history.forEach(chore => {
const dayName = new Date(chore.completedAt).toLocaleString('en-US', {
const dayName = new Date(chore.performedAt).toLocaleString('en-US', {
weekday: 'short',
})
@@ -136,7 +136,7 @@ const UserPoints = () => {
})
}
history.forEach(chore => {
const dayName = new Date(chore.completedAt).toLocaleString('en-US', {
const dayName = new Date(chore.performedAt).toLocaleString('en-US', {
day: 'numeric',
})
@@ -167,7 +167,7 @@ const UserPoints = () => {
})
}
history.forEach(chore => {
const monthName = new Date(chore.completedAt).toLocaleString('en-US', {
const monthName = new Date(chore.performedAt).toLocaleString('en-US', {
month: 'short',
})
@@ -198,7 +198,7 @@ const UserPoints = () => {
})
}
history.forEach(chore => {
const yearName = new Date(chore.completedAt).toLocaleString('en-US', {
const yearName = new Date(chore.performedAt).toLocaleString('en-US', {
year: 'numeric',
})