Add option to allow share to be downloaded

This commit is contained in:
Deluan
2023-03-10 23:01:03 -05:00
committed by Deluan Quintão
parent a22eef39f7
commit a7d3e6e1f1
13 changed files with 70 additions and 7 deletions
+16 -1
View File
@@ -8,6 +8,7 @@ import {
import {
SimpleForm,
TextInput,
BooleanInput,
useCreate,
useNotify,
useTranslate,
@@ -17,6 +18,7 @@ import { shareUrl } from '../utils'
import { useTranscodingOptions } from './useTranscodingOptions'
import { useDispatch, useSelector } from 'react-redux'
import { closeShareMenu } from '../actions'
import config from '../config'
export const ShareDialog = () => {
const {
@@ -30,6 +32,9 @@ export const ShareDialog = () => {
const notify = useNotify()
const translate = useTranslate()
const [description, setDescription] = useState('')
const [downloadable, setDownloadable] = useState(
config.defaultDownloadableShare
)
useEffect(() => {
setDescription('')
}, [ids])
@@ -41,6 +46,7 @@ export const ShareDialog = () => {
resourceType: resource,
resourceIds: ids?.join(','),
description,
downloadable,
...(!originalFormat && { format }),
...(!originalFormat && { maxBitRate }),
},
@@ -105,12 +111,21 @@ export const ShareDialog = () => {
<DialogContent>
<SimpleForm toolbar={null} variant={'outlined'}>
<TextInput
source="description"
resource={'share'}
source={'description'}
fullWidth
onChange={(event) => {
setDescription(event.target.value)
}}
/>
<BooleanInput
resource={'share'}
source={'downloadable'}
defaultValue={downloadable}
onChange={(value) => {
setDownloadable(value)
}}
/>
<TranscodingOptionsInput
fullWidth
label={translate('message.shareOriginalFormat')}