diff options
author | Mo Tarbin <mhed.t91@gmail.com> | 2024-07-07 00:54:43 -0400 |
---|---|---|
committer | Mo Tarbin <mhed.t91@gmail.com> | 2024-07-07 00:54:43 -0400 |
commit | b64df1ab15c72ec15214c4947d33889baf6a7973 (patch) | |
tree | 0bcdf4f62a8d94c63c36af9458fd719e6fb1d9b7 /src/views | |
parent | e039b732a8f74ae2d2c9ebaf9330c74c09502099 (diff) | |
download | donetick-frontend-b64df1ab15c72ec15214c4947d33889baf6a7973.tar.gz donetick-frontend-b64df1ab15c72ec15214c4947d33889baf6a7973.tar.bz2 donetick-frontend-b64df1ab15c72ec15214c4947d33889baf6a7973.zip |
Handle Adaptive freqtype, improve emoji name handling, styling around labels
Diffstat (limited to '')
-rw-r--r-- | src/views/Chores/ChoreCard.jsx | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/views/Chores/ChoreCard.jsx b/src/views/Chores/ChoreCard.jsx index 6a38e0b..587a01a 100644 --- a/src/views/Chores/ChoreCard.jsx +++ b/src/views/Chores/ChoreCard.jsx @@ -284,6 +284,8 @@ const ChoreCard = ({ chore, performers, onChoreUpdate, onChoreRemove, sx }) => { return 'Trigger' } else if (chore.frequencyType === 'daily') { return 'Daily' + } else if (chore.frequencyType === 'adaptive') { + return 'Adaptive' } else if (chore.frequencyType === 'weekly') { return 'Weekly' } else if (chore.frequencyType === 'monthly') { @@ -318,6 +320,14 @@ const ChoreCard = ({ chore, performers, onChoreUpdate, onChoreRemove, sx }) => { return <Repeat /> } } + const getName = name => { + const split = Array.from(chore.name) + // if the first character is emoji then remove it from the name + if (/\p{Emoji}/u.test(split[0])) { + return split.slice(2).join('') + } + return name + } return ( <> @@ -385,7 +395,7 @@ const ChoreCard = ({ chore, performers, onChoreUpdate, onChoreRemove, sx }) => { {Array.from(chore.name)[0]} </Avatar> <Box display='flex' flexDirection='column'> - <Typography level='title-md'>{chore.name}</Typography> + <Typography level='title-md'>{getName(chore.name)}</Typography> <Typography level='body-md' color='text.disabled'> Assigned to{' '} <Chip variant='outlined'> @@ -396,17 +406,16 @@ const ChoreCard = ({ chore, performers, onChoreUpdate, onChoreRemove, sx }) => { </Chip> </Typography> <Box> - {chore.labels?.split(',').map(label => ( + {chore.labels?.split(',').map((label, index) => ( <Chip variant='solid' key={label} color='primary' sx={{ position: 'relative', - ml: 0.5, - top: 10, + ml: index === 0 ? 0 : 0.5, + top: 2, zIndex: 1, - left: 10, }} startDecorator={getIconForLabel(label)} > |