From b64df1ab15c72ec15214c4947d33889baf6a7973 Mon Sep 17 00:00:00 2001 From: Mo Tarbin Date: Sun, 7 Jul 2024 00:54:43 -0400 Subject: Handle Adaptive freqtype, improve emoji name handling, styling around labels --- src/views/Chores/ChoreCard.jsx | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'src') 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 } } + 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]} - {chore.name} + {getName(chore.name)} Assigned to{' '} @@ -396,17 +406,16 @@ const ChoreCard = ({ chore, performers, onChoreUpdate, onChoreRemove, sx }) => { - {chore.labels?.split(',').map(label => ( + {chore.labels?.split(',').map((label, index) => ( -- cgit