diff --git a/src/App.jsx b/src/App.jsx index b909a1a3..339a41f9 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -4,14 +4,15 @@ import FileSaver from 'file-saver'; import JSZip from 'jszip'; import { debounce, partition } from 'lodash'; import clsx from 'clsx'; -import { createTheme, makeStyles } from '@material-ui/core/styles'; +import { makeStyles } from '@material-ui/core/styles'; import { Grid, ThemeProvider } from '@material-ui/core'; import { expandLink } from './utils/BitlyWorker'; import TopBar from './components/TopBar'; -import JSONOutput from './components/JSONOutput'; -import FSHOutput from './components/FSHOutput'; -import ConsoleComponent from './components/ConsoleComponent'; +import JSONEditor from './components/JSONEditor'; +import FSHEditor from './components/FSHEditor'; +import Console from './components/Console'; import FSHControls from './components/FSHControls'; +import theme from './theme'; const useStyles = makeStyles(() => ({ container: { @@ -31,7 +32,7 @@ const useStyles = makeStyles(() => ({ width: '4px', cursor: 'col-resize', '&:hover': { - background: colors.lightBlue + background: theme.palette.common.lightBlue } }, resizeBlue: { @@ -61,60 +62,7 @@ const useStyles = makeStyles(() => ({ } })); -const colors = { - lighterBlue: '#D8E2EA', - lightBlue: '#487AA2', - blue: '#30638e', - darkerBlue: '#143E61', - editorGrey: '#263238', - lightestGrey: '#E7ECEE', - lightGrey: '#D0D9DD', - grey: '#575B5C', - darkerGrey: '#3D4345', - darkestGrey: '#121D21', - red: '#FD6668' -}; - -export const theme = createTheme({ - palette: { - success: { - main: colors.blue, - dark: colors.darkerBlue, - light: colors.lightBlue - }, - common: colors - }, - typography: { - fontFamily: 'Open Sans' - }, - overrides: { - MuiTooltip: { - tooltip: { - backgroundColor: colors.darkestGrey, - fontSize: '13px' - }, - arrow: { - color: colors.darkestGrey - } - }, - MuiButton: { - text: { - textTransform: 'none', - fontWeight: 600 - } - }, - MuiIconButton: { - root: { - '&:hover': { - backgroundColor: colors.grey - } - } - } - } -}); - const githubURL = 'https://raw.githubusercontent.com/FSHSchool/FSHOnline-Examples/main/'; -const log = console.log; //eslint-disable-line no-unused-vars const defaultInfoMessage = 'There are no messages to display in the console.'; const defaultProblemMessage = 'There are no problems to display in the console.'; let infoMessages = [defaultInfoMessage]; @@ -140,7 +88,7 @@ console.log = function getMessages(message) { }; /* -Parses metadata into a seperate object and converts the manifest into a form that can +Parses metadata into a separate object and converts the manifest into a form that can be consumed by the TreeView component */ function convertManifest(childrenArr) { @@ -207,8 +155,8 @@ export default function App(props) { const [inputFSHText, setInputFSHText] = useState(''); const [inputFHIRText, setInputFHIRText] = useState(['']); const [initialText, setInitialText] = useState(''); - const [isWaitingForFHIROutput, setIsWaitingForFHIROutput] = useState(false); - const [isWaitingForFSHOutput, setIsWaitingForFSHOutput] = useState(false); + const [isWaitingForFHIR, setIsWaitingForFHIR] = useState(false); + const [isWaitingForFSH, setIsWaitingForFSH] = useState(false); const [expandConsole, setExpandConsole] = useState(false); const [exampleConfig, setExampleConfig] = useState([]); const [exampleFilePaths, setExampleFilePaths] = useState({}); @@ -267,13 +215,13 @@ export default function App(props) { function handleSUSHIControls(showNewText, sushiOutput, isWaiting) { setShowNewFHIRText(showNewText); - setInputFHIRText(sushiOutput); // JSONOutput component handles resetting initial text, so don't reset here - setIsWaitingForFHIROutput(isWaiting); + setInputFHIRText(sushiOutput); // JSONEditor component handles resetting initial text, so don't reset here + setIsWaitingForFHIR(isWaiting); } - function handleGoFSHControls(fshOutput, isWaiting) { - setIsWaitingForFSHOutput(isWaiting); - setInitialText(fshOutput === '' ? null : fshOutput); // Reset initial text to null if empty in order to display placeholder text + function handleGoFSHControls(fshText, isWaiting) { + setIsWaitingForFSH(isWaiting); + setInitialText(fshText === '' ? null : fshText); // Reset initial text to null if empty in order to display placeholder text } function updateInputFSHTextValue(text) { @@ -412,7 +360,7 @@ export default function App(props) { resetLogMessages={resetLogMessages} exampleConfig={exampleConfig} exampleMetadata={exampleFilePaths} - isWaiting={isWaitingForFSHOutput || isWaitingForFHIROutput} + isWaiting={isWaitingForFSH || isWaitingForFHIR} saveAll={saveAll} setIsLineWrapped={setLineWrap} isLineWrapped={isLineWrapped} @@ -433,11 +381,11 @@ export default function App(props) { className={clsx(classes.fullHeightGrid, classes.editorPane)} style={{ maxWidth: `calc(${leftWidth}% - 2px)`, flexBasis: `calc(${leftWidth}% - 2px)` }} > - - @@ -472,7 +420,7 @@ export default function App(props) {
- ({ } })); -export default function CodeMirrorComponent(props) { +export default function CodeEditor(props) { const classes = useStyles(); const expandedConsoleContext = useContext(ExpandedConsoleContext); const [drawerOpen, setDrawerOpen] = useState(true); diff --git a/src/components/ConsoleComponent.jsx b/src/components/Console.jsx similarity index 100% rename from src/components/ConsoleComponent.jsx rename to src/components/Console.jsx diff --git a/src/components/FSHControls.jsx b/src/components/FSHControls.jsx index 6d9be5ed..edceb246 100644 --- a/src/components/FSHControls.jsx +++ b/src/components/FSHControls.jsx @@ -31,7 +31,7 @@ import { import { runSUSHI, runGoFSH } from '../utils/FSHHelpers'; import { sliceDependency } from '../utils/helpers'; import { TreeView, TreeItem } from '@material-ui/lab'; -import CodeMirrorComponent from './CodeMirrorComponent'; +import CodeEditor from './CodeEditor'; const useStyles = makeStyles((theme) => ({ box: { @@ -292,6 +292,12 @@ export default function FSHControls(props) { return ( +
+ +
+ -
-