|
|
@@ -9,6 +9,7 @@ import getMeta from '@/utils/meta'
|
|
|
import MaterialIcon from '@/shared/components/material-icon'
|
|
|
import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher'
|
|
|
import { bsVersion } from '@/features/utils/bootstrap-5'
|
|
|
+import { usePermissionsContext } from '@/features/ide-react/context/permissions-context'
|
|
|
|
|
|
export const FigureModalSourcePicker: FC = () => {
|
|
|
const { t } = useTranslation()
|
|
|
@@ -17,26 +18,32 @@ export const FigureModalSourcePicker: FC = () => {
|
|
|
hasLinkedProjectOutputFileFeature,
|
|
|
hasLinkUrlFeature,
|
|
|
} = getMeta('ol-ExposedSettings')
|
|
|
+
|
|
|
+ const { write } = usePermissionsContext()
|
|
|
+
|
|
|
return (
|
|
|
<div className="figure-modal-source-button-grid">
|
|
|
- <FigureModalSourceButton
|
|
|
- type={FigureModalSource.FILE_UPLOAD}
|
|
|
- title={t('replace_from_computer')}
|
|
|
- icon={bsVersion({ bs3: 'upload', bs5: 'upload' })}
|
|
|
- />
|
|
|
+ {write && (
|
|
|
+ <FigureModalSourceButton
|
|
|
+ type={FigureModalSource.FILE_UPLOAD}
|
|
|
+ title={t('replace_from_computer')}
|
|
|
+ icon={bsVersion({ bs3: 'upload', bs5: 'upload' })}
|
|
|
+ />
|
|
|
+ )}
|
|
|
<FigureModalSourceButton
|
|
|
type={FigureModalSource.FILE_TREE}
|
|
|
title={t('replace_from_project_files')}
|
|
|
icon={bsVersion({ bs3: 'archive', bs5: 'inbox' })}
|
|
|
/>
|
|
|
- {(hasLinkedProjectFileFeature || hasLinkedProjectOutputFileFeature) && (
|
|
|
- <FigureModalSourceButton
|
|
|
- type={FigureModalSource.OTHER_PROJECT}
|
|
|
- title={t('replace_from_another_project')}
|
|
|
- icon={bsVersion({ bs3: 'folder-open', bs5: 'folder_open' })}
|
|
|
- />
|
|
|
- )}
|
|
|
- {hasLinkUrlFeature && (
|
|
|
+ {write &&
|
|
|
+ (hasLinkedProjectFileFeature || hasLinkedProjectOutputFileFeature) && (
|
|
|
+ <FigureModalSourceButton
|
|
|
+ type={FigureModalSource.OTHER_PROJECT}
|
|
|
+ title={t('replace_from_another_project')}
|
|
|
+ icon={bsVersion({ bs3: 'folder-open', bs5: 'folder_open' })}
|
|
|
+ />
|
|
|
+ )}
|
|
|
+ {write && hasLinkUrlFeature && (
|
|
|
<FigureModalSourceButton
|
|
|
type={FigureModalSource.FROM_URL}
|
|
|
title={t('replace_from_url')}
|