feat(upload): label YouTube category options

This commit is contained in:
2026-08-02 17:22:17 +07:00 Unverified
parent cbd72787d7
commit eda4c17d3c
+36 -7
View File
@@ -35,6 +35,23 @@ import {
import { Switch } from "@/components/ui/switch"; import { Switch } from "@/components/ui/switch";
import { Textarea } from "@/components/ui/textarea"; import { Textarea } from "@/components/ui/textarea";
const YOUTUBE_CATEGORIES = [
["1", "Film & Animation"],
["2", "Autos & Vehicles"],
["10", "Music"],
["15", "Pets & Animals"],
["17", "Sports"],
["19", "Travel & Events"],
["20", "Gaming"],
["22", "People & Blogs"],
["23", "Comedy"],
["24", "Entertainment"],
["25", "News & Politics"],
["26", "Howto & Style"],
["27", "Education"],
["28", "Science & Technology"],
] as const;
export function UploadForm() { export function UploadForm() {
const formRef = useRef<HTMLFormElement>(null); const formRef = useRef<HTMLFormElement>(null);
const uploadRequestRef = useRef<XMLHttpRequest | null>(null); const uploadRequestRef = useRef<XMLHttpRequest | null>(null);
@@ -267,8 +284,8 @@ export function UploadForm() {
</FieldGroup> </FieldGroup>
</CardContent> </CardContent>
<CardFooter className="border-t text-sm text-muted-foreground"> <CardFooter className="border-t text-sm text-muted-foreground">
YouTube uploads default to category 20 (Gaming). You can change it YouTube uploads default to 20 — Gaming. The category dropdown shows
in the YouTube settings. the meaning of every supported ID.
</CardFooter> </CardFooter>
</Card> </Card>
@@ -308,16 +325,28 @@ export function UploadForm() {
<Field> <Field>
<FieldLabel htmlFor="category">Category ID</FieldLabel> <FieldLabel htmlFor="category">Category ID</FieldLabel>
<Input <Select
id="category"
value={youtube.categoryId} value={youtube.categoryId}
onChange={(event) => onValueChange={(value) =>
setYoutube((state) => ({ setYoutube((state) => ({
...state, ...state,
categoryId: event.target.value, categoryId: value,
})) }))
} }
/> >
<SelectTrigger id="category">
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectGroup>
{YOUTUBE_CATEGORIES.map(([id, label]) => (
<SelectItem key={id} value={id}>
{id} — {label}
</SelectItem>
))}
</SelectGroup>
</SelectContent>
</Select>
</Field> </Field>
<Field> <Field>