@@ -86,12 +86,16 @@ function SettingsMenuStudios() {
8686 MeteorCall . studio . insertStudio ( ) . catch ( catchError ( 'studio.insertStudio' ) )
8787 } , [ ] )
8888
89+ // An installation should have only one studio https://github.com/Sofie-Automation/sofie-core/issues/1450
90+ const canAddStudio = studios . length === 0
91+ const canDeleteStudio = studios . length > 1
92+
8993 return (
9094 < >
91- < SectionHeading title = { t ( 'Studios' ) } addClick = { onAddStudio } />
95+ < SectionHeading title = { t ( 'Studios' ) } addClick = { canAddStudio ? onAddStudio : undefined } />
9296
9397 { studios . map ( ( studio ) => (
94- < SettingsMenuStudio key = { unprotectString ( studio . _id ) } studio = { studio } />
98+ < SettingsMenuStudio key = { unprotectString ( studio . _id ) } studio = { studio } canDelete = { canDeleteStudio } />
9599 ) ) }
96100 </ >
97101 )
@@ -241,8 +245,9 @@ function SettingsCollapsibleGroup({
241245
242246interface SettingsMenuStudioProps {
243247 studio : DBStudio
248+ canDelete : boolean
244249}
245- function SettingsMenuStudio ( { studio } : Readonly < SettingsMenuStudioProps > ) {
250+ function SettingsMenuStudio ( { studio, canDelete } : Readonly < SettingsMenuStudioProps > ) {
246251 const { t } = useTranslation ( )
247252
248253 const onDeleteStudio = React . useCallback (
@@ -291,9 +296,11 @@ function SettingsMenuStudio({ studio }: Readonly<SettingsMenuStudioProps>) {
291296 < FontAwesomeIcon icon = { faExclamationTriangle } />
292297 </ button >
293298 ) : null }
294- < button className = "action-btn" onClick = { onDeleteStudio } >
295- < FontAwesomeIcon icon = { faTrash } />
296- </ button >
299+ { canDelete && (
300+ < button className = "action-btn" onClick = { onDeleteStudio } >
301+ < FontAwesomeIcon icon = { faTrash } />
302+ </ button >
303+ ) }
297304 </ SettingsCollapsibleGroup >
298305 )
299306}
0 commit comments