about summary refs log tree commit diff
path: root/src/view/com/composer/videos/SubtitleDialog.tsx
diff options
context:
space:
mode:
authordan <dan.abramov@gmail.com>2024-10-05 03:45:34 +0900
committerGitHub <noreply@github.com>2024-10-05 03:45:34 +0900
commit09caf327d9809311f78e7f0d5c2f7213924e53ae (patch)
tree259a25ae18baa208d2e2089503be6c0fbfaff067 /src/view/com/composer/videos/SubtitleDialog.tsx
parent282db85c069841ef57bb3a0a7c57a93d7d31939a (diff)
downloadvoidsky-09caf327d9809311f78e7f0d5c2f7213924e53ae.tar.zst
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
Diffstat (limited to 'src/view/com/composer/videos/SubtitleDialog.tsx')
-rw-r--r--src/view/com/composer/videos/SubtitleDialog.tsx12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/view/com/composer/videos/SubtitleDialog.tsx b/src/view/com/composer/videos/SubtitleDialog.tsx
index c07fdfc56..f66684d4e 100644
--- a/src/view/com/composer/videos/SubtitleDialog.tsx
+++ b/src/view/com/composer/videos/SubtitleDialog.tsx
@@ -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()