This repository has been archived by the owner on Jan 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* initialization of profile editor without typescript * clean variables name and start adding typescript * add read me * add redux to project * redux installed * taking review and updating code Co-authored-by: Melina Chamayou & Pierrick Bellut <[email protected]>
- Loading branch information
Showing
23 changed files
with
16,358 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
##Install yarn | ||
`yarn install` | ||
|
||
##Launch project | ||
`yarn start:staging` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
{ | ||
"name": "youyoucopy", | ||
"version": "0.1.0", | ||
"private": true, | ||
"dependencies": { | ||
"@ahryman40k/ts-fhir-types": "^4.0.32", | ||
"@arkhn/fhir.ts": "^3.4.2", | ||
"@date-io/core": "^1.3.6", | ||
"@material-ui/core": "^4.11.0", | ||
"@material-ui/icons": "^4.9.1", | ||
"@material-ui/lab": "^4.0.0-alpha.53", | ||
"@material-ui/styles": "^4.9.10", | ||
"@testing-library/dom": "^7.20.2", | ||
"@testing-library/jest-dom": "^4.2.4", | ||
"@testing-library/react": "^9.5.0", | ||
"@testing-library/user-event": "^7.2.1", | ||
"@types/fhir": "^0.0.31", | ||
"@types/graphql": "^14.5.0", | ||
"@types/react": "^16.9.43", | ||
"@types/react-redux": "^7.1.9", | ||
"@types/react-router-dom": "^5.1.5", | ||
"axios": "^0.19.2", | ||
"bootstrap": "^4.5.0", | ||
"classnames": "^2.2.6", | ||
"clsx": "^1.1.0", | ||
"d3": "^5.16.0", | ||
"history": "^4.10.1", | ||
"jquery": "1.9.1", | ||
"material-table": "^1.57.2", | ||
"moment": "^2.25.3", | ||
"node-sass": "^4.14.1", | ||
"popper.js": "^1.16.0", | ||
"prop-types": "^15.7.2", | ||
"react": "^16.13.1", | ||
"react-bootstrap": "^1.0.1", | ||
"react-dom": "^16.13.1", | ||
"react-pdf": "^4.1.0", | ||
"react-player": "^2.2.0", | ||
"react-redux": "^7.2.0", | ||
"react-router": "^5.1.2", | ||
"react-router-dom": "^5.2.0", | ||
"react-scripts": "3.4.1", | ||
"redux": "^4.0.5", | ||
"redux-logger": "^3.0.6", | ||
"redux-persist": "^6.0.0", | ||
"redux-promise": "^0.6.0", | ||
"redux-thunk": "^2.3.0", | ||
"serve": "^11.3.1", | ||
"typescript": "^3.9.6" | ||
}, | ||
"scripts": { | ||
"start": "react-scripts start", | ||
"build": "react-scripts build", | ||
"test": "react-scripts test", | ||
"eject": "react-scripts eject" | ||
}, | ||
"eslintConfig": { | ||
"extends": "react-app" | ||
}, | ||
"browserslist": { | ||
"production": [ | ||
">0.2%", | ||
"not dead", | ||
"not op_mini all" | ||
], | ||
"development": [ | ||
"last 1 chrome version", | ||
"last 1 firefox version", | ||
"last 1 safari version" | ||
] | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<meta name="theme-color" content="#000000" /> | ||
<meta | ||
name="description" | ||
content="Web site created using create-react-app" | ||
/> | ||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" /> | ||
<!-- | ||
manifest.json provides metadata used when your web app is installed on a | ||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/ | ||
--> | ||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" /> | ||
<!-- | ||
Notice the use of %PUBLIC_URL% in the tags above. | ||
It will be replaced with the URL of the `public` folder during the build. | ||
Only files inside the `public` folder can be referenced from the HTML. | ||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will | ||
work correctly both with client-side routing and a non-root public URL. | ||
Learn how to configure a non-root public URL by running `npm run build`. | ||
--> | ||
<title>React App</title> | ||
</head> | ||
<body> | ||
<noscript>You need to enable JavaScript to run this app.</noscript> | ||
<div id="root"></div> | ||
<!-- | ||
This HTML file is a template. | ||
If you open it directly in the browser, you will see an empty page. | ||
You can add webfonts, meta tags, or analytics to this file. | ||
The build step will place the bundled scripts into the <body> tag. | ||
To begin the development, run `npm start` or `yarn start`. | ||
To create a production bundle, use `npm run build` or `yarn build`. | ||
--> | ||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"short_name": "React App", | ||
"name": "Create React App Sample", | ||
"icons": [ | ||
{ | ||
"src": "favicon.ico", | ||
"sizes": "64x64 32x32 24x24 16x16", | ||
"type": "image/x-icon" | ||
}, | ||
{ | ||
"src": "logo192.png", | ||
"type": "image/png", | ||
"sizes": "192x192" | ||
}, | ||
{ | ||
"src": "logo512.png", | ||
"type": "image/png", | ||
"sizes": "512x512" | ||
} | ||
], | ||
"start_url": ".", | ||
"display": "standalone", | ||
"theme_color": "#000000", | ||
"background_color": "#ffffff" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# https://www.robotstxt.org/robotstxt.html | ||
User-agent: * | ||
Disallow: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from "react"; | ||
import initStore from '../state/store'; | ||
import { Provider } from 'react-redux'; | ||
import Homepage from './homepage/Homepage'; | ||
import { getData } from "../state/thunkMiddleware"; | ||
|
||
|
||
const store = initStore() | ||
|
||
const App = () => { | ||
/* @ts-ignore */ | ||
store.dispatch(getData()) | ||
return ( | ||
<Provider store={store}> | ||
<Homepage /> | ||
</Provider> | ||
); | ||
} | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from 'react'; | ||
import { useSelector } from 'react-redux'; | ||
import { RootState } from '../../state/store'; | ||
|
||
const Homepage: React.FC<{}> = () => { | ||
const stateApp = useSelector((state: RootState) => state); | ||
if (stateApp.resource.loading === true){ | ||
return <p>Loading...</p> | ||
} | ||
|
||
return ( | ||
<div> | ||
{stateApp.resource.data?.map((data, index) => { | ||
return <button key={index}>{data.id}</button> | ||
})} | ||
</div>); | ||
|
||
} | ||
|
||
export default Homepage; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import App from './components/App'; | ||
|
||
ReactDOM.render( | ||
<App />, | ||
document.getElementById('root') | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/// <reference types="react-scripts" /> |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import axios from 'axios'; | ||
import { AUTH_TOKEN_KEY, FHIR_API_URL } from '../constants'; | ||
|
||
const token = AUTH_TOKEN_KEY; | ||
|
||
const api = axios.create({ | ||
baseURL: FHIR_API_URL, | ||
headers: { | ||
authorization: `Bearer ${token}` | ||
} | ||
}); | ||
|
||
export default api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { IStructureDefinition } from "@ahryman40k/ts-fhir-types/lib/R4"; | ||
|
||
export const SELECT_RESOURCE = 'SELECT_RESOURCE'; | ||
export const GET_DATA_START = 'GET_DATA_START'; | ||
export const GET_DATA_SUCCESS = 'GET_DATA_SUCCESS'; | ||
export const GET_DATA_FAILURE = 'GET_DATA_FAILURE'; | ||
|
||
|
||
export type SelectResourceAction = { | ||
type: typeof SELECT_RESOURCE, | ||
id: string | ||
} | ||
|
||
export type GetDataStartAction = { | ||
type: typeof GET_DATA_START, | ||
} | ||
|
||
export type GetDataSuccessAction = { | ||
type: typeof GET_DATA_SUCCESS, | ||
payload: IStructureDefinition[] | ||
} | ||
|
||
export type GetDataFailureAction = { | ||
type: typeof GET_DATA_FAILURE, | ||
payload: Error | ||
} | ||
|
||
export const selectResource = (id: string): SelectResourceAction => { | ||
return { | ||
type: SELECT_RESOURCE, | ||
id | ||
} | ||
} | ||
|
||
export const getDataStart = (): GetDataStartAction => { | ||
return { | ||
type: GET_DATA_START | ||
} | ||
} | ||
|
||
export const getDataSuccess = (allDatas: IStructureDefinition[]): GetDataSuccessAction => { | ||
return { | ||
type: GET_DATA_SUCCESS, | ||
payload: allDatas | ||
} | ||
} | ||
|
||
export const getDataFailure = (error: Error): GetDataFailureAction => { | ||
return { | ||
type: GET_DATA_FAILURE, | ||
payload: error | ||
} | ||
} | ||
|
||
|
||
export type ResourceAction = SelectResourceAction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { R4 } from '@ahryman40k/ts-fhir-types'; | ||
import { ResourceAction, SELECT_RESOURCE, GET_DATA_SUCCESS, GetDataFailureAction, GetDataStartAction, GetDataSuccessAction, GET_DATA_START, GET_DATA_FAILURE } from '../actions/resourceActions'; | ||
import { IStructureDefinition } from '@ahryman40k/ts-fhir-types/lib/R4'; | ||
|
||
export type ResourceState = { | ||
data: R4.IStructureDefinition[]; | ||
profiles: R4.IStructureDefinition[]; | ||
selectedResourceId: string | null; | ||
selectedAttributeId: string | null; | ||
loading: boolean; | ||
error: Error | null; | ||
} | ||
|
||
const initialState: ResourceState = { | ||
data: [], | ||
profiles: [], | ||
selectedResourceId: null, | ||
selectedAttributeId: null, | ||
loading: false, | ||
error: null | ||
} | ||
|
||
export type AllResourcesAction = GetDataFailureAction | GetDataStartAction | GetDataSuccessAction | ResourceAction; | ||
|
||
export const resource = (state: ResourceState = initialState, action: AllResourcesAction): ResourceState => { | ||
switch (action.type) { | ||
case SELECT_RESOURCE: | ||
return { | ||
...state, | ||
selectedResourceId: action.id | ||
} | ||
case GET_DATA_START: | ||
return { | ||
...state, | ||
loading: true | ||
} | ||
case GET_DATA_SUCCESS: | ||
return { | ||
...state, | ||
loading: false, | ||
data: action.payload, | ||
error: null | ||
} | ||
case GET_DATA_FAILURE: | ||
return { | ||
...state, | ||
loading: false, | ||
data: [], | ||
error: action.payload | ||
} | ||
default: | ||
return state; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { createStore, combineReducers, applyMiddleware } from 'redux' | ||
import { resource } from './reducers/resource'; | ||
import thunk from 'redux-thunk' | ||
|
||
const rootReducer = combineReducers({ | ||
resource | ||
}) | ||
|
||
const initStore = () => { | ||
return createStore(rootReducer, applyMiddleware(thunk)) | ||
} | ||
|
||
export type RootState = ReturnType<typeof rootReducer> | ||
|
||
export default initStore; |
Oops, something went wrong.