From e9a8ce97d0f53a6b52294e5e8b280e5419d366c6 Mon Sep 17 00:00:00 2001 From: blam Date: Fri, 10 Feb 2023 15:45:30 +0100 Subject: [PATCH] chore: remove some more uneeded code Signed-off-by: blam --- .../TemplateEditorIntro.tsx | 144 ------------------ .../TemplateEditorPage/TemplateEditorPage.tsx | 2 +- 2 files changed, 1 insertion(+), 145 deletions(-) delete mode 100644 plugins/scaffolder/src/next/TemplateEditorPage/TemplateEditorIntro.tsx diff --git a/plugins/scaffolder/src/next/TemplateEditorPage/TemplateEditorIntro.tsx b/plugins/scaffolder/src/next/TemplateEditorPage/TemplateEditorIntro.tsx deleted file mode 100644 index 61e6c46964..0000000000 --- a/plugins/scaffolder/src/next/TemplateEditorPage/TemplateEditorIntro.tsx +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright 2022 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import React from 'react'; -import Card from '@material-ui/core/Card'; -import CardActionArea from '@material-ui/core/CardActionArea'; -import CardContent from '@material-ui/core/CardContent'; -import Tooltip from '@material-ui/core/Tooltip'; -import Typography from '@material-ui/core/Typography'; -import InfoOutlinedIcon from '@material-ui/icons/InfoOutlined'; -import { makeStyles } from '@material-ui/core/styles'; -import { WebFileSystemAccess } from '../../lib/filesystem'; - -const useStyles = makeStyles(theme => ({ - introText: { - textAlign: 'center', - marginTop: theme.spacing(2), - }, - card: { - position: 'relative', - maxWidth: 340, - marginTop: theme.spacing(4), - margin: theme.spacing(0, 2), - }, - infoIcon: { - position: 'absolute', - top: theme.spacing(1), - right: theme.spacing(1), - }, -})); - -interface EditorIntroProps { - style?: JSX.IntrinsicElements['div']['style']; - onSelect?: (option: 'local' | 'form' | 'field-explorer') => void; -} - -export function TemplateEditorIntro(props: EditorIntroProps) { - const classes = useStyles(); - const supportsLoad = WebFileSystemAccess.isSupported(); - - const cardLoadLocal = ( - - props.onSelect?.('local')} - > - - - Load Template Directory - - - Load a local template directory, allowing you to both edit and try - executing your own template. - - - - {!supportsLoad && ( -
- - - -
- )} -
- ); - - const cardFormEditor = ( - - props.onSelect?.('form')}> - - - Edit Template Form - - - Preview and edit a template form, either using a sample template or - by loading a template from the catalog. - - - - - ); - - const cardFieldExplorer = ( - - props.onSelect?.('field-explorer')}> - - - Custom Field Explorer - - - View and play around with available installed custom field - extensions. - - - - - ); - - return ( -
- - Get started by choosing one of the options below - -
- {supportsLoad && cardLoadLocal} - {cardFormEditor} - {!supportsLoad && cardLoadLocal} - {cardFieldExplorer} -
-
- ); -} diff --git a/plugins/scaffolder/src/next/TemplateEditorPage/TemplateEditorPage.tsx b/plugins/scaffolder/src/next/TemplateEditorPage/TemplateEditorPage.tsx index 03e1619bc8..92387fd69d 100644 --- a/plugins/scaffolder/src/next/TemplateEditorPage/TemplateEditorPage.tsx +++ b/plugins/scaffolder/src/next/TemplateEditorPage/TemplateEditorPage.tsx @@ -20,13 +20,13 @@ import { WebFileSystemAccess, } from '../../lib/filesystem'; import { CustomFieldExplorer } from './CustomFieldExplorer'; -import { TemplateEditorIntro } from './TemplateEditorIntro'; import { TemplateEditor } from './TemplateEditor'; import { TemplateFormPreviewer } from './TemplateFormPreviewer'; import { NextFieldExtensionOptions, type LayoutOptions, } from '@backstage/plugin-scaffolder-react'; +import { TemplateEditorIntro } from '../../components/TemplateEditorPage/TemplateEditorIntro'; type Selection = | {