feat: add graphql support (#349)
* fix: eslint warnings * refactor: use ramda + sanctuary instead of lodash * refactor: use prettier-standard for formatting * feat: enable security * feat: add graphql * chore: remove trailing commas from linter * docs: new scripts on react and new-admin-server * feat: handle authentication on graphql * fix: perf improvement to date picker * chore: add insecure-dev script to run servers
This commit is contained in:
parent
49f434f1d1
commit
b8e0c2175b
182 changed files with 8827 additions and 4623 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import React, { useState, useEffect } from 'react'
|
||||
import classnames from 'classnames'
|
||||
import { makeStyles } from '@material-ui/core/styles'
|
||||
import classnames from 'classnames'
|
||||
import React, { useState, useEffect } from 'react'
|
||||
|
||||
import Calendar from './Calendar'
|
||||
|
||||
|
|
@ -13,18 +13,22 @@ const styles = {
|
|||
|
||||
const useStyles = makeStyles(styles)
|
||||
|
||||
const DateRangePicker = ({ minDate, maxDate, className, onRangeChange, ...props }) => {
|
||||
const DateRangePicker = ({ minDate, maxDate, className, onRangeChange }) => {
|
||||
const [from, setFrom] = useState(null)
|
||||
const [to, setTo] = useState(null)
|
||||
|
||||
useEffect(() => {
|
||||
onRangeChange(from, to)
|
||||
}, [from, to])
|
||||
}, [from, onRangeChange, to])
|
||||
|
||||
const classes = useStyles()
|
||||
|
||||
const handleSelect = (day, minDate, maxDate) => {
|
||||
if ((maxDate && day.isAfter(maxDate, 'day')) || (minDate && day.isBefore(minDate, 'day'))) return
|
||||
if (
|
||||
(maxDate && day.isAfter(maxDate, 'day')) ||
|
||||
(minDate && day.isBefore(minDate, 'day'))
|
||||
)
|
||||
return
|
||||
|
||||
if (from && !to && day.isBefore(from, 'day')) {
|
||||
setTo(from)
|
||||
|
|
@ -44,7 +48,13 @@ const DateRangePicker = ({ minDate, maxDate, className, onRangeChange, ...props
|
|||
return (
|
||||
<>
|
||||
<div className={classnames(classes.wrapper, className)}>
|
||||
<Calendar from={from} to={to} minDate={minDate} maxDate={maxDate} handleSelect={handleSelect} />
|
||||
<Calendar
|
||||
from={from}
|
||||
to={to}
|
||||
minDate={minDate}
|
||||
maxDate={maxDate}
|
||||
handleSelect={handleSelect}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue