import DateFilter from 'components/input/DateFilter'; import WebsiteSelect from 'components/input/WebsiteSelect'; import useMessages from 'hooks/useMessages'; import { parseDateRange } from 'lib/date'; import { useState } from 'react'; import { Button, Form, FormButtons, FormInput, FormRow, SubmitButton, TextField, } from 'react-basics'; import styles from './FunnelForm.module.css'; export function FunnelForm({ onSearch }) { const { formatMessage, labels } = useMessages(); const [dateRange, setDateRange] = useState(''); const [startAt, setStartAt] = useState(); const [endAt, setEndAt] = useState(); const [urls, setUrls] = useState(['/', '/docs/getting-started', '/docs/intall']); const [websiteId, setWebsiteId] = useState(''); const [window, setWindow] = useState(60); const handleSubmit = async data => { onSearch(data); }; const handleDateChange = value => { const { startDate, endDate } = parseDateRange(value); setDateRange(value); setStartAt(startDate.getTime()); setEndAt(endDate.getTime()); }; const handleAddUrl = () => setUrls([...urls, '']); const handleRemoveUrl = i => { const nextUrls = [...urls]; nextUrls.splice(i, 1); setUrls(nextUrls); }; const handleWindowChange = value => setWindow(value.target.value); const handleUrlChange = (value, i) => { const nextUrls = [...urls]; nextUrls[i] = value.target.value; setUrls(nextUrls); }; return ( <>
> ); } export default FunnelForm;