Add CookiePermissionSnackbar component to Landing page, Better UI to selected dates
This commit is contained in:
parent
7e93e80a72
commit
3a4519cb64
4 changed files with 73 additions and 12 deletions
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "donetick",
|
"name": "donetick",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.1.73",
|
"version": "0.1.74",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"*.{js,jsx,ts,tsx}": [
|
"*.{js,jsx,ts,tsx}": [
|
||||||
|
|
|
@ -3,7 +3,6 @@ import {
|
||||||
Check,
|
Check,
|
||||||
Delete,
|
Delete,
|
||||||
Edit,
|
Edit,
|
||||||
HowToReg,
|
|
||||||
KeyboardDoubleArrowUp,
|
KeyboardDoubleArrowUp,
|
||||||
LocalOffer,
|
LocalOffer,
|
||||||
ManageSearch,
|
ManageSearch,
|
||||||
|
@ -39,7 +38,11 @@ import moment from 'moment'
|
||||||
import React, { useEffect } from 'react'
|
import React, { useEffect } from 'react'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
import { API_URL } from '../../Config'
|
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 { Fetch } from '../../utils/TokenManager'
|
||||||
import ConfirmationModal from '../Modals/Inputs/ConfirmationModal'
|
import ConfirmationModal from '../Modals/Inputs/ConfirmationModal'
|
||||||
import DateModal from '../Modals/Inputs/DateModal'
|
import DateModal from '../Modals/Inputs/DateModal'
|
||||||
|
@ -226,9 +229,7 @@ const ChoreCard = ({
|
||||||
onChoreUpdate(newChore, 'assigned')
|
onChoreUpdate(newChore, 'assigned')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
const handleCompleteWithNote = note => {
|
const handleCompleteWithNote = note => {
|
||||||
Fetch(`${API_URL}/chores/${chore.id}/do`, {
|
Fetch(`${API_URL}/chores/${chore.id}/do`, {
|
||||||
|
@ -314,8 +315,28 @@ const ChoreCard = ({
|
||||||
return 'Yearly'
|
return 'Yearly'
|
||||||
} else if (chore.frequencyType === 'days_of_the_week') {
|
} else if (chore.frequencyType === 'days_of_the_week') {
|
||||||
let days = JSON.parse(chore.frequencyMetadata).days
|
let days = JSON.parse(chore.frequencyMetadata).days
|
||||||
days = days.map(d => moment().day(d).format('ddd'))
|
if (days.length > 4) {
|
||||||
return days.join(', ')
|
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') {
|
} else if (chore.frequencyType === 'day_of_the_month') {
|
||||||
let freqData = JSON.parse(chore.frequencyMetadata)
|
let freqData = JSON.parse(chore.frequencyMetadata)
|
||||||
const months = freqData.months.map(m => moment().month(m).format('MMM'))
|
const months = freqData.months.map(m => moment().month(m).format('MMM'))
|
||||||
|
@ -629,10 +650,9 @@ const ChoreCard = ({
|
||||||
onClose={() => {
|
onClose={() => {
|
||||||
setIsChangeAssigneeModalOpen(false)
|
setIsChangeAssigneeModalOpen(false)
|
||||||
}}
|
}}
|
||||||
onSave={(selected)=>{
|
onSave={selected => {
|
||||||
handleAssigneChange(selected.id)
|
handleAssigneChange(selected.id)
|
||||||
}
|
}}
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
<ConfirmationModal config={confirmModelConfig} />
|
<ConfirmationModal config={confirmModelConfig} />
|
||||||
<TextModal
|
<TextModal
|
||||||
|
|
40
src/views/Landing/CookiePermissionSnackbar.jsx
Normal file
40
src/views/Landing/CookiePermissionSnackbar.jsx
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
import { Button, Snackbar } from '@mui/joy'
|
||||||
|
import Cookies from 'js-cookie'
|
||||||
|
import { useEffect, useState } from 'react'
|
||||||
|
|
||||||
|
const CookiePermissionSnackbar = () => {
|
||||||
|
useEffect(() => {
|
||||||
|
const cookiePermission = Cookies.get('cookies_permission')
|
||||||
|
|
||||||
|
if (cookiePermission !== 'true') {
|
||||||
|
setOpen(true)
|
||||||
|
}
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
const [open, setOpen] = useState(false)
|
||||||
|
const handleClose = () => {
|
||||||
|
// Cookies.set('cookies_permission', 'true')
|
||||||
|
setOpen(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Snackbar
|
||||||
|
open={open}
|
||||||
|
anchorOrigin={{ vertical: 'bottom', horizontal: 'center' }}
|
||||||
|
onClose={(event, reason) => {
|
||||||
|
if (reason === 'clickaway') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// Cookies.set('cookies_permission', 'true')
|
||||||
|
handleClose()
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
We use cookies to ensure you get the best experience on our website.
|
||||||
|
<Button variant='soft' onClick={handleClose}>
|
||||||
|
Accept
|
||||||
|
</Button>
|
||||||
|
</Snackbar>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default CookiePermissionSnackbar
|
|
@ -3,6 +3,7 @@ import AOS from 'aos'
|
||||||
import 'aos/dist/aos.css'
|
import 'aos/dist/aos.css'
|
||||||
import { useEffect } from 'react'
|
import { useEffect } from 'react'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
|
import CookiePermissionSnackbar from './CookiePermissionSnackbar'
|
||||||
import DemoAssignee from './DemoAssignee'
|
import DemoAssignee from './DemoAssignee'
|
||||||
import DemoHistory from './DemoHistory'
|
import DemoHistory from './DemoHistory'
|
||||||
import DemoMyChore from './DemoMyChore'
|
import DemoMyChore from './DemoMyChore'
|
||||||
|
@ -52,7 +53,7 @@ const Landing = () => {
|
||||||
mb: 5,
|
mb: 5,
|
||||||
}}
|
}}
|
||||||
></Box>
|
></Box>
|
||||||
|
<CookiePermissionSnackbar />
|
||||||
<Footer />
|
<Footer />
|
||||||
</Container>
|
</Container>
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue