feat(upload): label YouTube category options
This commit is contained in:
@@ -35,6 +35,23 @@ import {
|
||||
import { Switch } from "@/components/ui/switch";
|
||||
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() {
|
||||
const formRef = useRef<HTMLFormElement>(null);
|
||||
const uploadRequestRef = useRef<XMLHttpRequest | null>(null);
|
||||
@@ -267,8 +284,8 @@ export function UploadForm() {
|
||||
</FieldGroup>
|
||||
</CardContent>
|
||||
<CardFooter className="border-t text-sm text-muted-foreground">
|
||||
YouTube uploads default to category 20 (Gaming). You can change it
|
||||
in the YouTube settings.
|
||||
YouTube uploads default to 20 — Gaming. The category dropdown shows
|
||||
the meaning of every supported ID.
|
||||
</CardFooter>
|
||||
</Card>
|
||||
|
||||
@@ -308,16 +325,28 @@ export function UploadForm() {
|
||||
|
||||
<Field>
|
||||
<FieldLabel htmlFor="category">Category ID</FieldLabel>
|
||||
<Input
|
||||
id="category"
|
||||
<Select
|
||||
value={youtube.categoryId}
|
||||
onChange={(event) =>
|
||||
onValueChange={(value) =>
|
||||
setYoutube((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>
|
||||
|
||||
Reference in New Issue
Block a user