mirror of
https://github.com/pds-nest/nest.git
synced 2024-11-21 20:44:18 +00:00
🐛 Fix reloading on enter
This commit is contained in:
parent
01ed2eadc9
commit
df1f043a49
3 changed files with 15 additions and 6 deletions
|
@ -35,7 +35,7 @@ export default function BoxConditionDatetime({ ...props }) {
|
|||
return setDatetime(text)
|
||||
}
|
||||
|
||||
const onButtonClick = () => {
|
||||
const onButtonClick = e => {
|
||||
const naive = new Date(datetime)
|
||||
if(naive.toString() === "Invalid Date") {
|
||||
console.debug("Refusing to add condition: ", naive , " is an Invalid Date.")
|
||||
|
@ -44,11 +44,14 @@ export default function BoxConditionDatetime({ ...props }) {
|
|||
const aware = convertToLocalISODate(naive)
|
||||
addCondition(new Condition("TIME", `${ba ? ">" : "<"} ${aware}`))
|
||||
setDatetime("")
|
||||
|
||||
// Prevent reloading the page!
|
||||
e.preventDefault()
|
||||
}
|
||||
|
||||
return (
|
||||
<BoxFull header={<span>Search by <FontAwesomeIcon icon={faClock}/> time period</span>} {...props}>
|
||||
<FormInline>
|
||||
<FormInline onSubmit={onButtonClick}>
|
||||
<ButtonToggleBeforeAfter onUpdate={setBa}/>
|
||||
<InputWithIcon
|
||||
className={Style.Input}
|
||||
|
|
|
@ -32,14 +32,17 @@ export default function BoxConditionHashtag({ ...props }) {
|
|||
return setHashtag(text)
|
||||
}
|
||||
|
||||
const onButtonClick = () => {
|
||||
const onButtonClick = e => {
|
||||
addCondition(new Condition("HASHTAG", hashtag))
|
||||
setHashtag("")
|
||||
|
||||
// Prevent reloading the page!
|
||||
e.preventDefault()
|
||||
}
|
||||
|
||||
return (
|
||||
<BoxFull header={<span>Search by <FontAwesomeIcon icon={faHashtag}/> hashtag</span>} {...props}>
|
||||
<FormInline>
|
||||
<FormInline onSubmit={onButtonClick}>
|
||||
<InputWithIcon
|
||||
className={Style.Input}
|
||||
id={"condition-hashtag"}
|
||||
|
|
|
@ -31,14 +31,17 @@ export default function BoxConditionUser({ ...props }) {
|
|||
return setUser(text)
|
||||
}
|
||||
|
||||
const onButtonClick = () => {
|
||||
const onButtonClick = e => {
|
||||
addCondition(new Condition("USER", user))
|
||||
setUser("")
|
||||
|
||||
// Prevent reloading the page!
|
||||
e.preventDefault()
|
||||
}
|
||||
|
||||
return (
|
||||
<BoxFull header={<span>Search by <FontAwesomeIcon icon={faAt}/> user</span>} {...props}>
|
||||
<FormInline>
|
||||
<FormInline onSubmit={onButtonClick}>
|
||||
<InputWithIcon
|
||||
className={Style.Input}
|
||||
id={"condition-hashtag"}
|
||||
|
|
Loading…
Reference in a new issue