|
1 | 1 | import React from 'react'; |
2 | | -import './App.css'; |
3 | | -import { useFHIRPathUI } from './hooks'; |
4 | | -import Editor from '@monaco-editor/react'; |
5 | | -import { Allotment } from "allotment"; |
6 | | -import "allotment/dist/style.css"; |
7 | | -import { Play, ShareFat, FileArrowDown, Gear, Copy, Info, ClockCounterClockwise } from "@phosphor-icons/react"; |
8 | | -import Loader from './components/loader'; |
9 | | -import logo from './assets/logo.png'; |
10 | | -import { ToastContainer } from 'react-toastify'; |
11 | | -import 'react-toastify/dist/ReactToastify.css'; |
12 | | -import { ResultOutput } from './components/ResultOutput'; |
13 | | -import { DrawerButton } from './components/DrawerButton'; |
14 | | -import { SettingsContainer } from './containers/Settings'; |
15 | | -import { CredentialsContainer } from './containers/Credentials'; |
16 | | -import { HistoryContainer } from './containers/HistoryContainer'; |
17 | | - |
| 2 | +import { AppHeader } from './containers/AppHeader'; |
| 3 | +import { AppContainer } from './containers/AppContainer'; |
| 4 | +import { AppContent } from './containers/AppContent'; |
18 | 5 |
|
19 | 6 | const App: React.FC = () => { |
20 | | - const { url, setUrl, handleUrlChange, handleFetch, |
21 | | - resource, expression, setExpression, setResource, |
22 | | - handleExecute, result, handleShare, isLoading, isExecuteActive, isGetResourceActive, isShareActive, handleShareResult, isShareResultActive, copyToClipboard } = useFHIRPathUI(); |
23 | | - |
24 | 7 | return ( |
25 | | - <div className="App"> |
26 | | - {isLoading ? <Loader /> : null} |
27 | | - <div className='header'> |
28 | | - <img src={logo} alt="Logo" className='logo' /> |
29 | | - <div className='searchBlock'> |
30 | | - <input className="input" type="url" value={url} onChange={handleUrlChange} placeholder='You can paste the URL to get the FHIR Resource' /> |
31 | | - </div> |
32 | | - <div className="buttonsBlock"> |
33 | | - <button onClick={() => handleFetch(url)} disabled={!isGetResourceActive}><FileArrowDown fontSize={24} /></button> |
34 | | - <button onClick={() => handleExecute(resource, expression)} disabled={!isExecuteActive}><Play fontSize={24} /></button> |
35 | | - <DrawerButton |
36 | | - content={ |
37 | | - <HistoryContainer |
38 | | - setResource={setResource} |
39 | | - setUrl={setUrl} |
40 | | - setExpression={setExpression} |
41 | | - copyToClickboard={copyToClipboard } |
42 | | - /> |
43 | | - } |
44 | | - button={<button><ClockCounterClockwise fontSize={24} /></button>} |
45 | | - title="History" |
46 | | - size="large" |
47 | | - /> |
48 | | - <button onClick={handleShare} disabled={!isShareActive}><ShareFat fontSize={24} /></button> |
49 | | - <button onClick={handleShareResult} disabled={!isShareResultActive}><Copy fontSize={24} /></button> |
50 | | - <DrawerButton content={<SettingsContainer />} button={<button><Gear fontSize={24} /></button>} title="Settings" size="large" /> |
51 | | - <DrawerButton content={<CredentialsContainer />} button={<button><Info fontSize={24} /></button>} title="Credentials" /> |
52 | | - </div> |
53 | | - </div> |
54 | | - <div className='editor'> |
55 | | - <Allotment defaultSizes={[550, 250]}> |
56 | | - <div className='editorWrapper'> |
57 | | - <Editor height="100vh" defaultLanguage="json" value={resource} onChange={(value) => setResource(value as string)} options={{ formatOnPaste: true, formatOnType: true }} /> |
58 | | - </div> |
59 | | - <div style={{ height: '100vh' }}> |
60 | | - <Allotment defaultSizes={[100, 300]} vertical> |
61 | | - <div className='editorWrapper'> |
62 | | - <Editor defaultLanguage="ruby" value={expression} onChange={(value) => setExpression(value as string)} options={{ |
63 | | - formatOnPaste: true, formatOnType: true, minimap: { |
64 | | - enabled: false, |
65 | | - }, |
66 | | - }} /> |
67 | | - </div> |
68 | | - <ResultOutput resultItems={result} /> |
69 | | - </Allotment> |
70 | | - </div> |
71 | | - </Allotment> |
72 | | - </div> |
73 | | - <ToastContainer /> |
74 | | - </div> |
| 8 | + <AppContainer |
| 9 | + header={<AppHeader />} |
| 10 | + content={<AppContent />} |
| 11 | + /> |
75 | 12 | ); |
76 | 13 | }; |
77 | 14 |
|
|
0 commit comments