2021-05-22 02:57:38 +00:00
|
|
|
import React, { useCallback, useContext } from "react"
|
2021-04-30 14:37:28 +00:00
|
|
|
import BoxFull from "../base/BoxFull"
|
2021-05-11 14:37:15 +00:00
|
|
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
|
2021-05-21 17:52:56 +00:00
|
|
|
import { faClock } from "@fortawesome/free-solid-svg-icons"
|
2021-04-30 14:37:28 +00:00
|
|
|
import useRepositoryEditor from "../../hooks/useRepositoryEditor"
|
2021-05-18 00:04:06 +00:00
|
|
|
import ContextLanguage from "../../contexts/ContextLanguage"
|
2021-05-21 17:52:56 +00:00
|
|
|
import FormInlineBADatetime from "./FormInlineBADatetime"
|
2021-05-22 02:57:38 +00:00
|
|
|
import { ConditionTime } from "../../objects/Condition"
|
2021-04-30 14:37:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2021-05-22 02:57:38 +00:00
|
|
|
* A {@link BoxFull} that allows the user to select a Twitter user to search for, and then to add it as a
|
|
|
|
* {@link ConditionTime} of a RepositoryEditor.
|
2021-04-30 14:37:28 +00:00
|
|
|
*
|
|
|
|
* @param props - Additional props to pass to the box.
|
|
|
|
* @returns {JSX.Element}
|
|
|
|
* @constructor
|
|
|
|
*/
|
|
|
|
export default function BoxConditionDatetime({ ...props }) {
|
2021-05-11 14:37:15 +00:00
|
|
|
const { addCondition } = useRepositoryEditor()
|
2021-05-18 00:48:34 +00:00
|
|
|
const { strings } = useContext(ContextLanguage)
|
2021-04-30 14:37:28 +00:00
|
|
|
|
2021-05-22 02:57:38 +00:00
|
|
|
const submit = useCallback(
|
|
|
|
timeRay => addCondition(new ConditionTime(timeRay)),
|
|
|
|
[addCondition]
|
|
|
|
)
|
2021-04-30 14:37:28 +00:00
|
|
|
|
|
|
|
return (
|
2021-05-17 23:33:08 +00:00
|
|
|
<BoxFull
|
|
|
|
header={
|
|
|
|
<span>
|
2021-05-18 00:04:06 +00:00
|
|
|
{strings.searchBy}
|
2021-05-17 23:33:08 +00:00
|
|
|
|
|
|
|
<FontAwesomeIcon icon={faClock}/>
|
|
|
|
|
2021-05-18 00:04:06 +00:00
|
|
|
{strings.byTimePeriod}
|
2021-05-17 23:33:08 +00:00
|
|
|
</span>
|
|
|
|
}
|
|
|
|
{...props}
|
|
|
|
>
|
2021-05-21 17:52:56 +00:00
|
|
|
<FormInlineBADatetime
|
|
|
|
submit={submit}
|
|
|
|
/>
|
2021-04-30 14:37:28 +00:00
|
|
|
</BoxFull>
|
|
|
|
)
|
|
|
|
}
|