Make composer reducer source of truth for images/video when publishing (#5595)

* Move caption and altText state into video reducer

* Make composer state source of truth for images and video publish
This commit is contained in:
dan
2024-10-05 03:45:34 +09:00
committed by GitHub
parent 282db85c06
commit 09caf327d9
4 changed files with 89 additions and 50 deletions
@@ -22,13 +22,13 @@ import {SubtitleFilePicker} from './SubtitleFilePicker'
const MAX_NUM_CAPTIONS = 1
type CaptionsTrack = {lang: string; file: File}
interface Props {
defaultAltText: string
captions: {lang: string; file: File}[]
captions: CaptionsTrack[]
saveAltText: (altText: string) => void
setCaptions: React.Dispatch<
React.SetStateAction<{lang: string; file: File}[]>
>
setCaptions: (updater: (prev: CaptionsTrack[]) => CaptionsTrack[]) => void
}
export function SubtitleDialogBtn(props: Props) {
@@ -198,9 +198,7 @@ function SubtitleFileRow({
language: string
file: File
otherLanguages: {code2: string; code3: string; name: string}[]
setCaptions: React.Dispatch<
React.SetStateAction<{lang: string; file: File}[]>
>
setCaptions: (updater: (prev: CaptionsTrack[]) => CaptionsTrack[]) => void
style: StyleProp<ViewStyle>
}) {
const {_} = useLingui()