@ -2,7 +2,7 @@ import React, { memo, useState, useEffect, useCallback } from 'react';
import { useDebounce } from 'use-debounce' ;
import { useDebounce } from 'use-debounce' ;
import i18n from 'i18next' ;
import i18n from 'i18next' ;
import { useTranslation } from 'react-i18next' ;
import { useTranslation } from 'react-i18next' ;
import { Text , Button , Alert , IconButton , TickIcon , ResetIcon } from 'evergreen-ui' ;
import { Text , Button , Alert , IconButton , TickIcon , ResetIcon , Heading } from 'evergreen-ui' ;
import Swal from 'sweetalert2' ;
import Swal from 'sweetalert2' ;
import withReactContent from 'sweetalert2-react-content' ;
import withReactContent from 'sweetalert2-react-content' ;
@ -12,6 +12,8 @@ import useUserSettings from '../hooks/useUserSettings';
const ReactSwal = withReactContent ( Swal ) ;
const ReactSwal = withReactContent ( Swal ) ;
/ / e s l i n t - d i s a b l e - n e x t - l i n e n o - t e m p l a t e - c u r l y - i n - s t r i n g
const extVar = '${EXT}' ;
const inputStyle = { flexGrow : 1 , fontFamily : 'inherit' , fontSize : '.8em' } ;
const inputStyle = { flexGrow : 1 , fontFamily : 'inherit' , fontSize : '.8em' } ;
@ -49,6 +51,9 @@ const OutSegTemplateEditor = memo(({ helpIcon, outSegTemplate, setOutSegTemplate
}
}
} , [ debouncedText , generateOutSegFileNames , getOutSegError , t ] ) ;
} , [ debouncedText , generateOutSegFileNames , getOutSegError , t ] ) ;
/ / e s l i n t - d i s a b l e - n e x t - l i n e n o - t e m p l a t e - c u r l y - i n - s t r i n g
const isMissingExtension = validText != null && ! validText . endsWith ( extVar ) ;
const onAllSegmentsPreviewPress = ( ) => ReactSwal . fire ( {
const onAllSegmentsPreviewPress = ( ) => ReactSwal . fire ( {
title : t ( 'Resulting segment file names' ) ,
title : t ( 'Resulting segment file names' ) ,
html : (
html : (
@ -95,8 +100,9 @@ const OutSegTemplateEditor = memo(({ helpIcon, outSegTemplate, setOutSegTemplate
< IconButton title = { t ( 'Reset' ) } icon = { ResetIcon } height = { 20 } onClick = { reset } marginLeft = { 5 } intent = "danger" / >
< IconButton title = { t ( 'Reset' ) } icon = { ResetIcon } height = { 20 } onClick = { reset } marginLeft = { 5 } intent = "danger" / >
< IconButton title = { t ( 'Close' ) } icon = { TickIcon } height = { 20 } onClick = { onHideClick } marginLeft = { 5 } intent = "success" / >
< IconButton title = { t ( 'Close' ) } icon = { TickIcon } height = { 20 } onClick = { onHideClick } marginLeft = { 5 } intent = "success" / >
< / div >
< / div >
< div >
< div style = { { maxWidth : 600 } } >
{ error != null && < Alert intent = "danger" appearance = "card" > < Text > { i18n . t ( 'There is an error in the file name template:' ) } < / Text > < br / > < Text > { error } < / Text > < / Alert > }
{ error != null && < Alert intent = "danger" appearance = "card" > < Heading color = "danger" > { i18n . t ( 'There is an error in the file name template:' ) } < / Heading > < Text > { error } < / Text > < / Alert > }
{ isMissingExtension && < Alert intent = "warning" appearance = "card" > { i18n . t ( 'The file name template is missing {{ext}} and will result in a file without the suggested extension. This may result in an unplayable output file.' , { ext : extVar } ) } < / Alert > }
{ /* eslint-disable-next-line no-template-curly-in-string */ }
{ /* eslint-disable-next-line no-template-curly-in-string */ }
< div style = { { fontSize : '.8em' , color : 'rgba(255,255,255,0.7)' } } >
< div style = { { fontSize : '.8em' , color : 'rgba(255,255,255,0.7)' } } >
{ ` ${ i18n . t ( 'Variables' ) } ` } { ': ' }
{ ` ${ i18n . t ( 'Variables' ) } ` } { ': ' }