Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "p0dcasters",
"version": "0.6.1",
"version": "0.6.2",
"private": true,
"type": "module",
"scripts": {
Expand Down
14 changes: 11 additions & 3 deletions src/components/SubmitForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<Reply | null>(null);
const [failure, setFailure] = useState<string | null>(error ? describe(error) : null);

Expand Down Expand Up @@ -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)}
Expand All @@ -88,9 +90,15 @@ export default function SubmitForm({ initial, error, errorUrl }: { initial: stri
<label htmlFor="opml" className="small">
Or upload an OPML file (up to 50 feeds)
</label>
<input id="opml" name="opml" type="file" accept=".opml,.xml,.txt,text/xml,text/plain" />
<input
id="opml"
name="opml"
type="file"
accept=".opml,.xml,.txt,text/xml,text/x-opml,text/plain"
onChange={(e) => setHasFile(Boolean(e.target.files?.length))}
/>
<button className="btn primary wide" type="submit" disabled={busy}>
{busy ? "Reading the feed…" : "Add it"}
{busy ? (hasFile ? "Reading the file…" : "Reading the feed…") : "Add it"}
</button>
</form>

Expand Down
Loading