aboutsummaryrefslogtreecommitdiffstats
path: root/src/views/Chores
diff options
context:
space:
mode:
authorLibravatar Mo Tarbin <mhed.t91@gmail.com>2024-09-01 14:11:08 -0400
committerLibravatar Mo Tarbin <mhed.t91@gmail.com>2024-09-01 14:11:08 -0400
commit3a4519cb640fee59cdb4e6d9e3e9ddbcef46a37d (patch)
treec1b8f93a9d57fd9c2699f3c88406c265eb459c87 /src/views/Chores
parent7e93e80a72c9116cb7a2e567b7b14025e422a2b0 (diff)
downloaddonetick-frontend-3a4519cb640fee59cdb4e6d9e3e9ddbcef46a37d.tar.gz
donetick-frontend-3a4519cb640fee59cdb4e6d9e3e9ddbcef46a37d.tar.bz2
donetick-frontend-3a4519cb640fee59cdb4e6d9e3e9ddbcef46a37d.zip
Add CookiePermissionSnackbar component to Landing page, Better UI to selected dates
Diffstat (limited to 'src/views/Chores')
-rw-r--r--src/views/Chores/ChoreCard.jsx40
1 files changed, 30 insertions, 10 deletions
diff --git a/src/views/Chores/ChoreCard.jsx b/src/views/Chores/ChoreCard.jsx
index fdf025e..29ee933 100644
--- a/src/views/Chores/ChoreCard.jsx
+++ b/src/views/Chores/ChoreCard.jsx
@@ -3,7 +3,6 @@ import {
Check,
Delete,
Edit,
- HowToReg,
KeyboardDoubleArrowUp,
LocalOffer,
ManageSearch,
@@ -39,7 +38,11 @@ import moment from 'moment'
import React, { useEffect } from 'react'
import { useNavigate } from 'react-router-dom'
import { API_URL } from '../../Config'
-import { MarkChoreComplete, SkipChore, UpdateChoreAssignee } from '../../utils/Fetcher'
+import {
+ MarkChoreComplete,
+ SkipChore,
+ UpdateChoreAssignee,
+} from '../../utils/Fetcher'
import { Fetch } from '../../utils/TokenManager'
import ConfirmationModal from '../Modals/Inputs/ConfirmationModal'
import DateModal from '../Modals/Inputs/DateModal'
@@ -226,9 +229,7 @@ const ChoreCard = ({
onChoreUpdate(newChore, 'assigned')
})
}
- }
- )
-
+ })
}
const handleCompleteWithNote = note => {
Fetch(`${API_URL}/chores/${chore.id}/do`, {
@@ -314,8 +315,28 @@ const ChoreCard = ({
return 'Yearly'
} else if (chore.frequencyType === 'days_of_the_week') {
let days = JSON.parse(chore.frequencyMetadata).days
- days = days.map(d => moment().day(d).format('ddd'))
- return days.join(', ')
+ if (days.length > 4) {
+ const allDays = [
+ 'Sunday',
+ 'Monday',
+ 'Tuesday',
+ 'Wednesday',
+ 'Thursday',
+ 'Friday',
+ 'Saturday',
+ ]
+ const selectedDays = days.map(d => moment().day(d).format('dddd'))
+ const notSelectedDay = allDays.filter(
+ day => !selectedDays.includes(day),
+ )
+ const notSelectedShortdays = notSelectedDay.map(d =>
+ moment().day(d).format('ddd'),
+ )
+ return `Daily except ${notSelectedShortdays.join(', ')}`
+ } else {
+ days = days.map(d => moment().day(d).format('ddd'))
+ return days.join(', ')
+ }
} else if (chore.frequencyType === 'day_of_the_month') {
let freqData = JSON.parse(chore.frequencyMetadata)
const months = freqData.months.map(m => moment().month(m).format('MMM'))
@@ -629,10 +650,9 @@ const ChoreCard = ({
onClose={() => {
setIsChangeAssigneeModalOpen(false)
}}
- onSave={(selected)=>{
+ onSave={selected => {
handleAssigneChange(selected.id)
- }
- }
+ }}
/>
<ConfirmationModal config={confirmModelConfig} />
<TextModal