diff --git a/src/components/modal/configureOutputModal/Decision.tsx b/src/components/modal/configureOutputModal/Decision.tsx index 426e173f..bf02ba1f 100644 --- a/src/components/modal/configureOutputModal/Decision.tsx +++ b/src/components/modal/configureOutputModal/Decision.tsx @@ -5,9 +5,15 @@ interface IDecision { onClose: () => void; onSave: () => void; className?: string; + buttonText?: string; } -export default function Decision({ onClose, onSave, className }: IDecision) { +export default function Decision({ + onClose, + onSave, + className, + buttonText +}: IDecision) { const t = useTranslate(); return ( @@ -17,7 +23,7 @@ export default function Decision({ onClose, onSave, className }: IDecision) { }`} > - )} - {multiviews.length === index + 1 && ( - - )} - +
+ {(multiviews && + multiviews.length > 0 && + multiviews.map((singleItem, index) => { + return ( +
+ {index !== 0 && ( +
+ )} +
+ + handleUpdateMultiview(input, index) + } + portDuplicateError={ + portDuplicateIndexes.length > 0 + ? portDuplicateIndexes.includes(index) + : false + } + streamIdDuplicateError={ + streamIdDuplicateIndexes.length > 0 + ? streamIdDuplicateIndexes.includes(index) + : false + } + refresh={refresh} + /> +
1 + ? 'justify-between' + : 'justify-end' + }`} + > + {multiviews.length > 1 && ( + + )} + {multiviews.length === index + 1 && ( + + )}
- ); - })) ||
No Multiviews
} -
- )} +
+ ); + })) ||
{t('preset.no_multiview')}
} +
clearInputs()} onSave={() => onSave()} /> diff --git a/src/hooks/multiviewLayout.ts b/src/hooks/multiviewLayout.ts index bd324f06..83da5b08 100644 --- a/src/hooks/multiviewLayout.ts +++ b/src/hooks/multiviewLayout.ts @@ -39,8 +39,6 @@ export function useMultiviewLayouts( ); useEffect(() => { - setmultiviewLayouts([]); - if (!refresh) { return; } diff --git a/src/hooks/multiviews.ts b/src/hooks/multiviews.ts index 58f0005c..684c462f 100644 --- a/src/hooks/multiviews.ts +++ b/src/hooks/multiviews.ts @@ -2,6 +2,7 @@ import { useState } from 'react'; import { SourceReference } from '../interfaces/Source'; import { CallbackHook } from './types'; import { MultiviewSettings } from '../interfaces/multiview'; +import { useTranslate } from '../i18n/useTranslate'; export function useMultiviews(): CallbackHook< ( @@ -12,6 +13,7 @@ export function useMultiviews(): CallbackHook< ) => void > { const [loading, setLoading] = useState(true); + const t = useTranslate(); const putMultiviewView = ( pipelineId: string, @@ -21,7 +23,7 @@ export function useMultiviews(): CallbackHook< ) => { setLoading(true); - if (!singleMultiview) throw 'no multiview'; + if (!singleMultiview) throw t('preset.no_multiview'); const rest = singleMultiview.layout.views.filter( (v) => v.input_slot !== source.input_slot diff --git a/src/hooks/productions.ts b/src/hooks/productions.ts index 8e2b1e7f..c68a06e5 100644 --- a/src/hooks/productions.ts +++ b/src/hooks/productions.ts @@ -1,4 +1,3 @@ -import { defaultMultiview } from './../api/mongoClient/defaults/preset'; import { ObjectId } from 'mongodb'; import { Production } from '../interfaces/production'; import { API_SECRET_KEY } from '../utils/constants'; diff --git a/src/hooks/useConfigureMultiviewLayout.tsx b/src/hooks/useConfigureMultiviewLayout.tsx index 1338d1a3..682f3414 100644 --- a/src/hooks/useConfigureMultiviewLayout.tsx +++ b/src/hooks/useConfigureMultiviewLayout.tsx @@ -50,7 +50,7 @@ export function useConfigureMultiviewLayout( } }); } - }, [defaultLabel, name, source, viewId]); + }, [defaultLabel, name, productionId, source, viewId]); return { multiviewLayout: updatedPreset }; } diff --git a/src/hooks/useGetFirstEmptySlot.ts b/src/hooks/useGetFirstEmptySlot.ts index 3df677ce..a5a8c698 100644 --- a/src/hooks/useGetFirstEmptySlot.ts +++ b/src/hooks/useGetFirstEmptySlot.ts @@ -1,5 +1,4 @@ import { useState } from 'react'; -import { Production } from '../interfaces/production'; import { CallbackHook } from './types'; import { SourceReference } from '../interfaces/Source'; diff --git a/src/hooks/useMultiviewDefaultPresets.tsx b/src/hooks/useMultiviewDefaultPresets.tsx index 7bb43c20..f5e2e256 100644 --- a/src/hooks/useMultiviewDefaultPresets.tsx +++ b/src/hooks/useMultiviewDefaultPresets.tsx @@ -43,7 +43,9 @@ export function useMultiviewDefaultPresets({ return { ...view, label: sourceSlot >= 0 ? source.label : view.label, - id: sourceSlot >= 0 ? source._id : view.id + id: sourceSlot >= 0 ? source._id : view.id, + input_slot: + sourceSlot >= 0 ? source.input_slot : view.input_slot }; }) } diff --git a/src/i18n/locales/en.ts b/src/i18n/locales/en.ts index 28f0c6df..2d5443f4 100644 --- a/src/i18n/locales/en.ts +++ b/src/i18n/locales/en.ts @@ -698,9 +698,11 @@ export const en = { video_kilobit_rate: 'Kilobit rate', add_stream: 'Add stream', stream_name: 'Stream', + no_multiview: 'No multiview can be found', multiview_output_settings: 'Multiview output', select_multiview_layout: 'Layout', configure_layouts: 'Configure layouts', + no_avaliable_layouts: 'No available layouts', create_layout: 'Create new layout', update_layout: 'Update layout', no_updated_layout: 'No layout updated', @@ -722,6 +724,8 @@ export const en = { clear_layout: 'Clear layout', add_another_multiview: 'Add another multiview', could_not_delete_layout: 'Could not delete layout', + could_not_delete_layout_in_use: + 'The layout is being used and can not be deleted', layout_deleted: 'Layout deleted', confirm_update_multiviewers: 'Are you sure you want to update multiviewers for the running production?', diff --git a/src/i18n/locales/sv.ts b/src/i18n/locales/sv.ts index c125dc72..b4e7a8ad 100644 --- a/src/i18n/locales/sv.ts +++ b/src/i18n/locales/sv.ts @@ -702,6 +702,7 @@ export const sv = { video_kilobit_rate: 'Kilobit rate', add_stream: 'Lägg till ström', stream_name: 'Ström', + no_multiview: 'Ingen multiview hittas', multiview_output_settings: 'Multiview utgång', no_multiview_selected: 'Ingen multiview vald', no_ip_selected: 'Ingen IP-adress vald', @@ -709,6 +710,7 @@ export const sv = { no_multiview_found: 'Hittade ingen multiview', select_multiview_layout: 'Komposition', configure_layouts: 'Justera kompositioner', + no_avaliable_layouts: 'Inga kompositioner finns', create_layout: 'Skapa komposition', update_layout: 'Uppdatera komposition', no_updated_layout: 'Ingen uppdaterad komposition', @@ -727,6 +729,8 @@ export const sv = { add_another_multiview: 'Lägg till ny multiview', layout_deleted: 'Kompositionen har tagits bort', could_not_delete_layout: 'Kunde inte ta bort kompositionen', + could_not_delete_layout_in_use: + 'Kompositionen används och kan inte tas bort', confirm_update_multiviewers: 'Är du säker på att du vill uppdatera multiview för pågående produktion?', confirm_update: 'Uppdatera multiviewers'