diff --git a/src/components/DevtoolsPane/VideoBitRateForm.tsx b/src/components/DevtoolsPane/VideoBitRateForm.tsx index 2ce0ff96..bbd099c8 100644 --- a/src/components/DevtoolsPane/VideoBitRateForm.tsx +++ b/src/components/DevtoolsPane/VideoBitRateForm.tsx @@ -1,10 +1,10 @@ import type React from 'react' -import { FormGroup, FormSelect } from 'react-bootstrap' +import { Dropdown, DropdownButton, Form, FormGroup, InputGroup } from 'react-bootstrap' import { setVideoBitRate } from '@/app/actions' import { useAppDispatch, useAppSelector } from '@/app/hooks' import { VIDEO_BIT_RATES } from '@/constants' -import { checkFormValue, isFormDisabled } from '@/utils' +import { isFormDisabled } from '@/utils' import { TooltipFormLabel } from './TooltipFormLabel.tsx' @@ -12,34 +12,53 @@ import { TooltipFormLabel } from './TooltipFormLabel.tsx' const DISPLAY_VIDEO_BIT_RATE: string[] = VIDEO_BIT_RATES.slice() DISPLAY_VIDEO_BIT_RATE.splice(VIDEO_BIT_RATES.indexOf('15000') + 1, 0, 'support-message') +const dropdownItemLabel = (value: string) => { + if (value === 'support-message') { + return '以下はサポート外です' + } + return value === '' ? '未指定' : value +} + export const VideoBitRateForm: React.FC = () => { const videoBitRate = useAppSelector((state) => state.videoBitRate) const connectionStatus = useAppSelector((state) => state.soraContents.connectionStatus) const disabled = isFormDisabled(connectionStatus) const dispatch = useAppDispatch() - const onChange = (event: React.ChangeEvent): void => { - if (checkFormValue(event.target.value, VIDEO_BIT_RATES)) { - dispatch(setVideoBitRate(event.target.value)) - } + const onChange = (event: React.ChangeEvent): void => { + dispatch(setVideoBitRate(event.target.value)) } return ( videoBitRate: - - {DISPLAY_VIDEO_BIT_RATE.map((value) => { - let text = value - if (value === '') { - text = '未指定' - } else if (value === 'support-message') { - text = '以下はサポート外です' - } - return ( - - ) - })} - + + + + {DISPLAY_VIDEO_BIT_RATE.map((value) => { + return ( + dispatch(setVideoBitRate(value))} + disabled={value === 'support-message'} + > + {dropdownItemLabel(value)} + + ) + })} + + ) } diff --git a/src/types.ts b/src/types.ts index a585be43..f117a02a 100644 --- a/src/types.ts +++ b/src/types.ts @@ -33,7 +33,6 @@ import type { SPOTLIGHT, SPOTLIGHT_FOCUS_RIDS, SPOTLIGHT_NUMBERS, - VIDEO_BIT_RATES, VIDEO_CODEC_TYPES, VIDEO_CONTENT_HINTS, } from '@/constants' @@ -133,7 +132,7 @@ export type SoraDevtoolsState = { spotlightFocusRid: (typeof SPOTLIGHT_FOCUS_RIDS)[number] spotlightUnfocusRid: (typeof SPOTLIGHT_FOCUS_RIDS)[number] video: boolean - videoBitRate: (typeof VIDEO_BIT_RATES)[number] + videoBitRate: string videoCodecType: (typeof VIDEO_CODEC_TYPES)[number] videoContentHint: (typeof VIDEO_CONTENT_HINTS)[number] videoInput: string