diff --git a/apps/web/src/components/app/EditLivestream/dialog.tsx b/apps/web/src/components/app/EditLivestream/dialog.tsx index e8f097b..37d4e26 100644 --- a/apps/web/src/components/app/EditLivestream/dialog.tsx +++ b/apps/web/src/components/app/EditLivestream/dialog.tsx @@ -13,17 +13,7 @@ import { UniversalForm } from '../UniversalForm/UniversalForm'; import { editStreamInfo } from '@/lib/form/actions'; import RegenerateKey from '../RegenerateKey/RegenerateKey'; import * as React from 'react'; -import { Check, ChevronsUpDown } from 'lucide-react'; -import { cn } from '@/lib/utils'; -import { - Command, - CommandEmpty, - CommandGroup, - CommandInput, - CommandItem, - CommandList, -} from '@/components/ui/command'; -import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'; +import { Plus } from 'lucide-react'; import { Select, SelectContent, @@ -37,10 +27,12 @@ import useSWR, { Fetcher } from 'swr'; import { fetcher } from '@/lib/services/swr'; import { Skeleton } from '@/components/ui/skeleton'; import Link from 'next/link'; +import { useRouter } from 'next/navigation'; export default function EditLivestreamDialog(props: Props) { const [selectedChannel, setSelectedChannel] = React.useState(''); const [streamInfo, setStreamInfo] = React.useState(); + const router = useRouter(); const { data, error } = useSWR( selectedChannel ? '/api/stream/info?owned=true' : null, @@ -66,6 +58,14 @@ export default function EditLivestreamDialog(props: Props) { } }, [props.ownedChannels, selectedChannel]); + React.useEffect(() => { + if (selectedChannel === 'create') { + setSelectedChannel(''); + router.push('/settings/channel/create'); + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [selectedChannel]); + return ( { @@ -106,21 +106,26 @@ export default function EditLivestreamDialog(props: Props) { function Form(props: FormProps) { return ( - } - key={props.streamInfo?.id} - /> - ) + } + key={props.streamInfo?.id} + /> + ); } function FormSkeleton() { return ( @@ -165,6 +170,9 @@ export function ChannelSelect(props: SelectProps) { ))} + } className='h-11'> + Create Channel + ); diff --git a/apps/web/src/components/ui/select.tsx b/apps/web/src/components/ui/select.tsx index cbe5a36..473809c 100644 --- a/apps/web/src/components/ui/select.tsx +++ b/apps/web/src/components/ui/select.tsx @@ -113,8 +113,10 @@ SelectLabel.displayName = SelectPrimitive.Label.displayName const SelectItem = React.forwardRef< React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, children, ...props }, ref) => ( + React.ComponentPropsWithoutRef & { + icon?: React.ReactNode + } +>(({ className, children, icon, ...props }, ref) => ( - - - + {icon ? icon : ( + + + + )} {children}