- Support nest sub tasks

- Support filters in ChoreGrouper
- completion window only available if due date selected
- Add SortAndGrouping Component : support Filter by Assignee
- update Notification Switch to align left of the text
- Support caching filters
This commit is contained in:
Mo Tarbin 2025-03-05 19:43:32 -05:00
parent bbea27d380
commit a16309c69a
9 changed files with 679 additions and 224 deletions

View file

@ -3,7 +3,11 @@ import { TASK_COLOR } from './Colors.jsx'
const priorityOrder = [1, 2, 3, 4, 0]
export const ChoresGrouper = (groupBy, chores) => {
export const ChoresGrouper = (groupBy, chores, filter) => {
if (filter) {
chores = chores.filter(chore => filter(chore))
}
// sort by priority then due date:
chores.sort(ChoreSorter)
var groups = []
@ -172,3 +176,12 @@ export const notInCompletionWindow = chore => {
moment().add(chore.completionWindow, 'hours') < moment(chore.nextDueDate)
)
}
export const ChoreFilters = userProfile => ({
anyone: () => true,
assigned_to_me: chore => {
return chore.assignedTo && chore.assignedTo === userProfile.id
},
assigned_to_others: chore => {
return chore.assignedTo && chore.assignedTo !== userProfile.id
},
})