2021-05-24 14:13:24 +02:00
|
|
|
import React, { useCallback } from "react"
|
2021-04-30 16:37:28 +02:00
|
|
|
import BoxFull from "../base/BoxFull"
|
2021-05-11 16:37:15 +02:00
|
|
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
|
2021-05-21 19:52:56 +02:00
|
|
|
import { faClock } from "@fortawesome/free-solid-svg-icons"
|
2021-04-30 16:37:28 +02:00
|
|
|
import useRepositoryEditor from "../../hooks/useRepositoryEditor"
|
2021-05-23 05:03:41 +02:00
|
|
|
import FormInlineTimeRay from "./FormInlineTimeRay"
|
2021-05-22 04:57:38 +02:00
|
|
|
import { ConditionTime } from "../../objects/Condition"
|
2021-05-24 14:13:24 +02:00
|
|
|
import useStrings from "../../hooks/useStrings"
|
2021-04-30 16:37:28 +02:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2021-05-22 04:57:38 +02: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 16:37:28 +02:00
|
|
|
*
|
|
|
|
* @param props - Additional props to pass to the box.
|
|
|
|
* @returns {JSX.Element}
|
|
|
|
* @constructor
|
|
|
|
*/
|
|
|
|
export default function BoxConditionDatetime({ ...props }) {
|
2021-05-11 16:37:15 +02:00
|
|
|
const { addCondition } = useRepositoryEditor()
|
2021-05-24 14:13:24 +02:00
|
|
|
const strings = useStrings()
|
2021-04-30 16:37:28 +02:00
|
|
|
|
2021-05-22 04:57:38 +02:00
|
|
|
const submit = useCallback(
|
|
|
|
timeRay => addCondition(new ConditionTime(timeRay)),
|
2021-05-23 16:20:53 +02:00
|
|
|
[addCondition],
|
2021-05-22 04:57:38 +02:00
|
|
|
)
|
2021-04-30 16:37:28 +02:00
|
|
|
|
|
|
|
return (
|
2021-05-18 01:33:08 +02:00
|
|
|
<BoxFull
|
|
|
|
header={
|
|
|
|
<span>
|
2021-05-18 02:04:06 +02:00
|
|
|
{strings.searchBy}
|
2021-05-18 01:33:08 +02:00
|
|
|
|
|
|
|
<FontAwesomeIcon icon={faClock}/>
|
|
|
|
|
2021-05-18 02:04:06 +02:00
|
|
|
{strings.byTimePeriod}
|
2021-05-18 01:33:08 +02:00
|
|
|
</span>
|
|
|
|
}
|
|
|
|
{...props}
|
|
|
|
>
|
2021-05-23 05:03:41 +02:00
|
|
|
<FormInlineTimeRay
|
2021-05-21 19:52:56 +02:00
|
|
|
submit={submit}
|
|
|
|
/>
|
2021-04-30 16:37:28 +02:00
|
|
|
</BoxFull>
|
|
|
|
)
|
|
|
|
}
|