diff --git a/src/components/App.js b/src/components/App.js
index 16aab97b..52bbf55d 100644
--- a/src/components/App.js
+++ b/src/components/App.js
@@ -6,7 +6,7 @@ import theme from '../containers/styles/theme';
import { ThemeProvider } from '@mui/styles';
import Launch from '../containers/Launch';
import Index from '../containers/Index';
-
+import Gateway from '../containers/Gateway/Gateway';
const isGhPages = process.env.REACT_APP_GH_PAGES === 'true';
const Router = isGhPages ? HashRouter : BrowserRouter;
const redirect = isGhPages ? '/#/index' : '/index';
@@ -24,7 +24,7 @@ const App = () => {
}
/>
- } />
+ } />
);
diff --git a/src/containers/Gateway/Gateway.jsx b/src/containers/Gateway/Gateway.jsx
new file mode 100644
index 00000000..a360bb36
--- /dev/null
+++ b/src/containers/Gateway/Gateway.jsx
@@ -0,0 +1,119 @@
+import React, { memo, useState, useEffect } from 'react';
+import FHIR from 'fhirclient';
+import env from 'env-var';
+import {
+ Button,
+ FormControl,
+ FormHelperText,
+ IconButton,
+ TextField,
+ Accordion,
+ AccordionDetails
+} from '@mui/material';
+import Stack from '@mui/material/Stack';
+import Autocomplete from '@mui/material/Autocomplete';
+import useStyles from './styles';
+
+const Gateway = props => {
+ const classes = useStyles();
+ const envFhir = env.get('REACT_APP_EHR_SERVER').asString();
+ const envClient = env.get('REACT_APP_CLIENT').asString();
+ const envScope = env.get('REACT_APP_CLIENT_SCOPES').asString().split(' ');
+ const [clientId, setClientId] = useState(envClient || '');
+ const [fhirUrl, setFhirUrl] = useState(envFhir || '');
+ const [scope, _setScope] = useState(envScope || []);
+ const setScope = value => {
+ // split by space to facilitate copy/pasting strings of scopes into the input
+ const sv = value.map(e => {
+ if (e) {
+ return e.split(' ');
+ }
+ });
+ _setScope(sv.flat());
+ };
+ const submit = event => {
+ event.preventDefault();
+ FHIR.oauth2.authorize({
+ clientId: clientId,
+ scope: scope.join(' '),
+ redirectUri: props.redirect,
+ iss: fhirUrl
+ });
+ };
+ return (
+
+
Launch Request Generator
+
+
+ );
+};
+
+export default memo(Gateway);
diff --git a/src/containers/Gateway/styles.jsx b/src/containers/Gateway/styles.jsx
new file mode 100644
index 00000000..ae2b96db
--- /dev/null
+++ b/src/containers/Gateway/styles.jsx
@@ -0,0 +1,27 @@
+import { makeStyles } from '@mui/styles';
+export default makeStyles(
+ theme => ({
+ '@global': {
+ body: {
+ backgroundColor: '#fafafa'
+ }
+ },
+ gatewayDiv: {
+ display: 'flex',
+ flexDirection: 'column',
+ alignItems: 'center',
+ padding: '50px',
+ margin: '10% auto 0 auto',
+ width: '60%',
+ backgroundColor: '#fff'
+ },
+ gatewayHeader: {
+ marginBottom: '25px'
+ },
+ gatewayInput: {
+ padding: '50px'
+ }
+ }),
+
+ { name: 'Gateway', index: 1 }
+);
diff --git a/src/containers/Index.jsx b/src/containers/Index.jsx
index e1374b4f..3b74544b 100644
--- a/src/containers/Index.jsx
+++ b/src/containers/Index.jsx
@@ -12,13 +12,17 @@ const Index = props => {
});
}, []);
- return
- { client ?
:
-
-
Getting Client...
-
- }
-
;
+ return (
+
+ {client ? (
+
+ ) : (
+
+
Getting Client...
+
+ )}
+
+ );
};
export default Index;
diff --git a/src/containers/Launch.jsx b/src/containers/Launch.jsx
index fb9854c2..5db39527 100644
--- a/src/containers/Launch.jsx
+++ b/src/containers/Launch.jsx
@@ -23,7 +23,11 @@ const Launch = props => {
});
}, []);
- return Launching...
;
+ return (
+
+
Launching...
+
+ );
};
export default memo(Launch);