import {
Box,
Card,
Checkbox,
Grid,
List,
ListItem,
Option,
Select,
Typography,
} from '@mui/joy'
import { useState } from 'react'
const ASSIGN_STRATEGIES = [
'random',
'least_assigned',
'least_completed',
'keep_last_assigned',
]
const DemoAssignee = () => {
const [assignStrategy, setAssignStrategy] = useState('random')
const [assignees, setAssignees] = useState([
{
userId: 3,
id: 3,
displayName: 'Ryan',
},
])
const [assignedTo, setAssignedTo] = useState(3)
const performers = [
{
userId: 1,
id: 1,
displayName: 'Mo',
},
{
userId: 2,
id: 2,
displayName: 'Jiji',
},
{
userId: 3,
id: 3,
displayName: 'Ryan',
},
]
return (
<>
Assignees :
Who can do this chore?
{performers?.map(item => (
a.userId == item.id) != null}
onClick={() => {
if (assignees.find(a => a.userId == item.id)) {
setAssignees(
assignees.filter(i => i.userId !== item.id),
)
} else {
setAssignees([...assignees, { userId: item.id }])
}
}}
overlay
disableIcon
variant='soft'
label={item.displayName}
/>
))}
Assigned :
Who is assigned the next due chore?
Picking Mode :
How to pick the next assignee for the following chore?
{ASSIGN_STRATEGIES.map((item, idx) => (
setAssignStrategy(item)}
overlay
disableIcon
variant='soft'
label={item
.split('_')
.map(x => x.charAt(0).toUpperCase() + x.slice(1))
.join(' ')}
/>
))}
Flexible Task Assignment
Whether you’re a solo user managing personal tasks or coordinating
chores with others, Donetick provides robust assignment options.
Assign tasks to different people and choose specific rotation
strategies, such as assigning tasks based on who completed the most
or least, randomly rotating assignments, or sticking with the last
assigned person.
>
)
}
export default DemoAssignee