Merge branch 'dev'
This commit is contained in:
@@ -15,9 +15,10 @@ export const ChoresGrouper = (groupBy, chores, filter) => {
|
|||||||
case 'due_date':
|
case 'due_date':
|
||||||
var groupRaw = {
|
var groupRaw = {
|
||||||
Today: [],
|
Today: [],
|
||||||
'In a week': [],
|
Tomorrow: [],
|
||||||
'This month': [],
|
'Next 7 Days': [],
|
||||||
Later: [],
|
'Later This Month': [],
|
||||||
|
Future: [],
|
||||||
Overdue: [],
|
Overdue: [],
|
||||||
Anytime: [],
|
Anytime: [],
|
||||||
}
|
}
|
||||||
@@ -32,17 +33,24 @@ export const ChoresGrouper = (groupBy, chores, filter) => {
|
|||||||
) {
|
) {
|
||||||
groupRaw['Today'].push(chore)
|
groupRaw['Today'].push(chore)
|
||||||
} else if (
|
} else if (
|
||||||
new Date(chore.nextDueDate) <
|
new Date(chore.nextDueDate).toDateString() ===
|
||||||
new Date(Date.now() + 7 * 24 * 60 * 60 * 1000) &&
|
new Date(Date.now() + 24 * 60 * 60 * 1000).toDateString()
|
||||||
new Date(chore.nextDueDate) > new Date()
|
|
||||||
) {
|
) {
|
||||||
groupRaw['In a week'].push(chore)
|
groupRaw['Tomorrow'].push(chore)
|
||||||
} else if (
|
} else if (
|
||||||
new Date(chore.nextDueDate).getMonth() === new Date().getMonth()
|
new Date(chore.nextDueDate) <
|
||||||
|
new Date(Date.now() + 8 * 24 * 60 * 60 * 1000) &&
|
||||||
|
new Date(chore.nextDueDate) >
|
||||||
|
new Date(Date.now() + 24 * 60 * 60 * 1000)
|
||||||
) {
|
) {
|
||||||
groupRaw['This month'].push(chore)
|
groupRaw['Next 7 Days'].push(chore)
|
||||||
|
} else if (
|
||||||
|
new Date(chore.nextDueDate).getMonth() === new Date().getMonth() &&
|
||||||
|
new Date(chore.nextDueDate).getFullYear() === new Date().getFullYear()
|
||||||
|
) {
|
||||||
|
groupRaw['Later This Month'].push(chore)
|
||||||
} else {
|
} else {
|
||||||
groupRaw['Later'].push(chore)
|
groupRaw['Future'].push(chore)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
groups = [
|
groups = [
|
||||||
@@ -53,16 +61,25 @@ export const ChoresGrouper = (groupBy, chores, filter) => {
|
|||||||
},
|
},
|
||||||
{ name: 'Today', content: groupRaw['Today'], color: TASK_COLOR.TODAY },
|
{ name: 'Today', content: groupRaw['Today'], color: TASK_COLOR.TODAY },
|
||||||
{
|
{
|
||||||
name: 'In a week',
|
name: 'Tomorrow',
|
||||||
content: groupRaw['In a week'],
|
content: groupRaw['Tomorrow'],
|
||||||
color: TASK_COLOR.IN_A_WEEK,
|
color: TASK_COLOR.TOMORROW,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'This month',
|
name: 'Next 7 Days',
|
||||||
content: groupRaw['This month'],
|
content: groupRaw['Next 7 Days'],
|
||||||
color: TASK_COLOR.THIS_MONTH,
|
color: TASK_COLOR.NEXT_7_DAYS,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Later This Month',
|
||||||
|
content: groupRaw['Later This Month'],
|
||||||
|
color: TASK_COLOR.LATER_THIS_MONTH,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Future',
|
||||||
|
content: groupRaw['Future'],
|
||||||
|
color: TASK_COLOR.FUTURE,
|
||||||
},
|
},
|
||||||
{ name: 'Later', content: groupRaw['Later'], color: TASK_COLOR.LATER },
|
|
||||||
{
|
{
|
||||||
name: 'Anytime',
|
name: 'Anytime',
|
||||||
content: groupRaw['Anytime'],
|
content: groupRaw['Anytime'],
|
||||||
|
|||||||
@@ -64,10 +64,16 @@ export const TASK_COLOR = {
|
|||||||
// For the calendar
|
// For the calendar
|
||||||
OVERDUE: '#F03A47',
|
OVERDUE: '#F03A47',
|
||||||
TODAY: '#ffc107',
|
TODAY: '#ffc107',
|
||||||
|
TOMORROW: '#4ec1a2',
|
||||||
|
NEXT_7_DAYS: '#00bcd4',
|
||||||
|
LATER_THIS_MONTH: '#b39ddb',
|
||||||
|
FUTURE: '#d7ccc8',
|
||||||
|
ANYTIME: '#90a4ae',
|
||||||
|
|
||||||
|
// Legacy colors for backward compatibility
|
||||||
IN_A_WEEK: '#4ec1a2',
|
IN_A_WEEK: '#4ec1a2',
|
||||||
THIS_MONTH: '#00bcd4',
|
THIS_MONTH: '#00bcd4',
|
||||||
LATER: '#d7ccc8',
|
LATER: '#d7ccc8',
|
||||||
ANYTIME: '#90a4ae',
|
|
||||||
|
|
||||||
// FOR ASSIGNEE:
|
// FOR ASSIGNEE:
|
||||||
ASSIGNED_TO_ME: '#4ec1a2',
|
ASSIGNED_TO_ME: '#4ec1a2',
|
||||||
|
|||||||
@@ -123,12 +123,12 @@ const MarkChoreComplete = (id, body, completedDate, performer) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const CompleteSubTask = (id, choreId, performedAt) => {
|
const CompleteSubTask = (id, choreId, completedAt) => {
|
||||||
var markChoreURL = `/chores/${choreId}/subtask`
|
var markChoreURL = `/chores/${choreId}/subtask`
|
||||||
return Fetch(markChoreURL, {
|
return Fetch(markChoreURL, {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
headers: HEADERS(),
|
headers: HEADERS(),
|
||||||
body: JSON.stringify({ performedAt, id, choreId }),
|
body: JSON.stringify({ completedAt, id, choreId }),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -420,7 +420,7 @@ const ChoreCard = ({
|
|||||||
</Typography>
|
</Typography>
|
||||||
<Chip variant='outlined'>
|
<Chip variant='outlined'>
|
||||||
{
|
{
|
||||||
performers.find(p => p.id === chore.assignedTo)
|
performers.find(p => p.userId === chore.assignedTo)
|
||||||
?.displayName
|
?.displayName
|
||||||
}
|
}
|
||||||
</Chip>
|
</Chip>
|
||||||
|
|||||||
@@ -205,13 +205,12 @@ const CompactChoreCard = ({
|
|||||||
// Utility functions
|
// Utility functions
|
||||||
const getDueDateText = nextDueDate => {
|
const getDueDateText = nextDueDate => {
|
||||||
if (chore.nextDueDate === null) return 'No Due Date'
|
if (chore.nextDueDate === null) return 'No Due Date'
|
||||||
|
// if due in next 48 hours, we should it in this format : Tomorrow 11:00 AM
|
||||||
const diff = moment(nextDueDate).diff(moment(), 'hours')
|
const diff = moment(nextDueDate).diff(moment(), 'hours')
|
||||||
if (diff < 24 && diff > 0) {
|
if (diff < 48 && diff > 0) {
|
||||||
return moment(nextDueDate).calendar().replace(' at', '')
|
return moment(nextDueDate).calendar().replace(' at', '')
|
||||||
}
|
}
|
||||||
if (diff < 0) {
|
|
||||||
return 'Overdue'
|
|
||||||
}
|
|
||||||
return moment(nextDueDate).fromNow()
|
return moment(nextDueDate).fromNow()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user