diff --git a/package.json b/package.json index 8e35e7b..bb55ef1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "p0dcasters", - "version": "0.6.1", + "version": "0.6.2", "private": true, "type": "module", "scripts": { diff --git a/src/components/SubmitForm.tsx b/src/components/SubmitForm.tsx index bf4d65e..3b233a7 100644 --- a/src/components/SubmitForm.tsx +++ b/src/components/SubmitForm.tsx @@ -27,6 +27,8 @@ type Reply = { export default function SubmitForm({ initial, error, errorUrl }: { initial: string; error: string; errorUrl: string }) { const [input, setInput] = useState(initial || errorUrl); const [busy, setBusy] = useState(false); + /** An OPML file stands in for the URL box, so the box is only required without one. */ + const [hasFile, setHasFile] = useState(false); const [reply, setReply] = useState(null); const [failure, setFailure] = useState(error ? describe(error) : null); @@ -77,7 +79,7 @@ export default function SubmitForm({ initial, error, errorUrl }: { initial: stri id="input" name="input" rows={3} - required={!reply} + required={!reply && !hasFile} placeholder={"https://example.com\nhttps://example.org/podcast.rss"} value={input} onChange={(e) => setInput(e.target.value)} @@ -88,9 +90,15 @@ export default function SubmitForm({ initial, error, errorUrl }: { initial: stri - + setHasFile(Boolean(e.target.files?.length))} + />