1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-22 04:54:18 +00:00

🐛 Fix reloading on enter

This commit is contained in:
Stefano Pigozzi 2021-05-08 00:35:13 +02:00
parent 01ed2eadc9
commit df1f043a49
Signed by untrusted user who does not match committer: steffo
GPG key ID: 6965406171929D01
3 changed files with 15 additions and 6 deletions

View file

@ -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}

View file

@ -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"}

View file

@ -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"}