2026-03-30 14:17:31 +02:00
|
|
|
import SimpleString from "@/back/Components/Inputs/SimpleString";
|
|
|
|
|
import str from "@/hooks/use-string";
|
2026-10-19 17:43:33 +02:00
|
|
|
import trans from "@/hooks/use-translations";
|
2026-03-30 14:17:31 +02:00
|
|
|
|
2026-10-16 12:07:08 +02:00
|
|
|
interface SimpleYoutubeIdProps {
|
2026-03-30 14:17:31 +02:00
|
|
|
className?: string;
|
|
|
|
|
name: string;
|
|
|
|
|
value?: string;
|
|
|
|
|
id?: string;
|
|
|
|
|
required?: boolean;
|
|
|
|
|
disabled?: boolean;
|
|
|
|
|
parentErrors?: Record<string, string> | null;
|
|
|
|
|
setData: (name: string, value: string) => void;
|
2026-10-16 12:07:08 +02:00
|
|
|
}
|
2026-03-30 14:17:31 +02:00
|
|
|
|
2026-10-19 16:24:15 +02:00
|
|
|
export default function SimpleYoutubeId(props: Readonly<SimpleYoutubeIdProps>) {
|
2026-03-30 14:17:31 +02:00
|
|
|
const pattern = "^[0-9A-Za-z_\\-]{10}[048AEIMQUYcgkosw]$";
|
2026-10-19 17:43:33 +02:00
|
|
|
const label = str(trans("uwil-backend::validation.custom.youtube_id"))
|
2026-03-30 14:17:31 +02:00
|
|
|
.ucFirst()
|
|
|
|
|
.value();
|
|
|
|
|
|
|
|
|
|
return <SimpleString pattern={pattern} label={label} {...props} />;
|
|
|
|
|
}
|