@@ -32,7 +32,6 @@ import {
3232 commands ,
3333 type ExportCompression ,
3434 type ExportSettings ,
35- events ,
3635 type FramesRendered ,
3736 type UploadProgress ,
3837} from "~/utils/tauri" ;
@@ -133,6 +132,10 @@ export function ExportDialog() {
133132
134133 if ( ! [ "Mp4" , "Gif" ] . includes ( settings . format ) ) setSettings ( "format" , "Mp4" ) ;
135134
135+ // Ensure GIF is not selected when exportTo is "link"
136+ if ( settings . format === "Gif" && settings . exportTo === "link" )
137+ setSettings ( "format" , "Mp4" ) ;
138+
136139 const exportWithSettings = ( onProgress : ( progress : FramesRendered ) => void ) =>
137140 exportVideo (
138141 projectPath ,
@@ -160,8 +163,6 @@ export function ExportDialog() {
160163
161164 const [ outputPath , setOutputPath ] = createSignal < string | null > ( null ) ;
162165
163- const selectedStyle = "bg-gray-7" ;
164-
165166 const projectPath = editorInstance . path ;
166167
167168 const exportEstimates = createQuery ( ( ) => ( {
@@ -496,7 +497,20 @@ export function ExportDialog() {
496497 < For each = { EXPORT_TO_OPTIONS } >
497498 { ( option ) => (
498499 < Button
499- onClick = { ( ) => setSettings ( "exportTo" , option . value ) }
500+ onClick = { ( ) => {
501+ setSettings (
502+ produce ( ( newSettings ) => {
503+ newSettings . exportTo = option . value ;
504+ // If switching to link and GIF is selected, change to MP4
505+ if (
506+ option . value === "link" &&
507+ settings . format === "Gif"
508+ ) {
509+ newSettings . format = "Mp4" ;
510+ }
511+ } ) ,
512+ ) ;
513+ } }
500514 data-selected = { settings . exportTo === option . value }
501515 class = "flex flex-1 gap-2 items-center text-nowrap"
502516 variant = "gray"
@@ -515,49 +529,62 @@ export function ExportDialog() {
515529 < h3 class = "text-gray-12" > Format</ h3 >
516530 < div class = "flex flex-row gap-2" >
517531 < For each = { FORMAT_OPTIONS } >
518- { ( option ) => (
519- < Button
520- variant = "gray"
521- onClick = { ( ) => {
522- setSettings (
523- produce ( ( newSettings ) => {
524- newSettings . format = option . value as ExportFormat ;
532+ { ( option ) => {
533+ const isGifDisabled = ( ) =>
534+ option . value === "Gif" && settings . exportTo === "link" ;
525535
526- if (
527- option . value === "Gif" &&
528- ! (
529- settings . resolution . value === "720p" ||
530- settings . resolution . value === "1080p"
536+ return (
537+ < Button
538+ variant = "gray"
539+ disabled = { isGifDisabled ( ) }
540+ onClick = { ( ) => {
541+ if ( isGifDisabled ( ) ) return ;
542+ setSettings (
543+ produce ( ( newSettings ) => {
544+ newSettings . format =
545+ option . value as ExportFormat ;
546+
547+ if (
548+ option . value === "Gif" &&
549+ ! (
550+ settings . resolution . value === "720p" ||
551+ settings . resolution . value === "1080p"
552+ )
531553 )
532- )
533- newSettings . resolution = {
534- ...RESOLUTION_OPTIONS . _720p ,
535- } ;
554+ newSettings . resolution = {
555+ ...RESOLUTION_OPTIONS . _720p ,
556+ } ;
536557
537- if (
538- option . value === "Gif" &&
539- GIF_FPS_OPTIONS . every (
540- ( v ) => v . value === settings . fps ,
558+ if (
559+ option . value === "Gif" &&
560+ GIF_FPS_OPTIONS . every (
561+ ( v ) => v . value === settings . fps ,
562+ )
541563 )
542- )
543- newSettings . fps = 15 ;
564+ newSettings . fps = 15 ;
544565
545- if (
546- option . value === "Mp4" &&
547- FPS_OPTIONS . every (
548- ( v ) => v . value !== settings . fps ,
566+ if (
567+ option . value === "Mp4" &&
568+ FPS_OPTIONS . every (
569+ ( v ) => v . value !== settings . fps ,
570+ )
549571 )
550- )
551- newSettings . fps = 30 ;
552- } ) ,
553- ) ;
554- } }
555- autofocus = { false }
556- data-selected = { settings . format === option . value }
557- >
558- { option . label }
559- </ Button >
560- ) }
572+ newSettings . fps = 30 ;
573+ } ) ,
574+ ) ;
575+ } }
576+ autofocus = { false }
577+ data-selected = { settings . format === option . value }
578+ class = {
579+ isGifDisabled ( )
580+ ? "opacity-50 cursor-not-allowed"
581+ : ""
582+ }
583+ >
584+ { option . label }
585+ </ Button >
586+ ) ;
587+ } }
561588 </ For >
562589 </ div >
563590 </ div >
0 commit comments