Initialize project using Create React App
This commit is contained in:
36
.gitignore
vendored
Normal file
36
.gitignore
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
package-lock.json
|
||||
/.pnp
|
||||
.pnp.js
|
||||
yarn.lock
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# production
|
||||
/build
|
||||
/dist
|
||||
|
||||
# IDE
|
||||
.vscode/
|
||||
.idea/
|
||||
.vs/
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
# Other
|
||||
*.log
|
||||
*.tgz
|
||||
/.env
|
||||
/public/static/
|
||||
70
README.create-react-app.md
Normal file
70
README.create-react-app.md
Normal file
@@ -0,0 +1,70 @@
|
||||
# Getting Started with Create React App
|
||||
|
||||
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
|
||||
|
||||
## Available Scripts
|
||||
|
||||
In the project directory, you can run:
|
||||
|
||||
### `npm start`
|
||||
|
||||
Runs the app in the development mode.\
|
||||
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
|
||||
|
||||
The page will reload when you make changes.\
|
||||
You may also see any lint errors in the console.
|
||||
|
||||
### `npm test`
|
||||
|
||||
Launches the test runner in the interactive watch mode.\
|
||||
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
||||
|
||||
### `npm run build`
|
||||
|
||||
Builds the app for production to the `build` folder.\
|
||||
It correctly bundles React in production mode and optimizes the build for the best performance.
|
||||
|
||||
The build is minified and the filenames include the hashes.\
|
||||
Your app is ready to be deployed!
|
||||
|
||||
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
||||
|
||||
### `npm run eject`
|
||||
|
||||
**Note: this is a one-way operation. Once you `eject`, you can't go back!**
|
||||
|
||||
If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
||||
|
||||
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
|
||||
|
||||
You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
|
||||
|
||||
## Learn More
|
||||
|
||||
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
||||
|
||||
To learn React, check out the [React documentation](https://reactjs.org/).
|
||||
|
||||
### Code Splitting
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
|
||||
|
||||
### Analyzing the Bundle Size
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
|
||||
|
||||
### Making a Progressive Web App
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
|
||||
|
||||
### Advanced Configuration
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
|
||||
|
||||
### Deployment
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
|
||||
|
||||
### `npm run build` fails to minify
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
|
||||
45
README.md
Normal file
45
README.md
Normal file
@@ -0,0 +1,45 @@
|
||||
# Medication Plan Assistant
|
||||
|
||||
## Setup
|
||||
|
||||
```sh
|
||||
# Install dependencies
|
||||
npm install -D recharts tailwindcss postcss autoprefixer
|
||||
|
||||
# Initialize tailwind CSS (creates config files)
|
||||
npx tailwindcss init -p
|
||||
```
|
||||
|
||||
## Fresh Start
|
||||
|
||||
```sh
|
||||
npm uninstall tailwindcss postcss autoprefixer recharts
|
||||
npm install -D tailwindcss@^3.0.0 postcss@^8.0.0 autoprefixer@^10.0.0
|
||||
npm install --save recharts
|
||||
rm -rf node_modules package-lock.json
|
||||
npm install
|
||||
npx tailwindcss init -p
|
||||
```
|
||||
|
||||
./tailwind.config.js:
|
||||
|
||||
```javascript
|
||||
/** @type {import('tailwindcss').Config} */
|
||||
module.exports = {
|
||||
content: [
|
||||
"./src/**/*.{js,jsx,ts,tsx}",
|
||||
],
|
||||
theme: {
|
||||
extend: {},
|
||||
},
|
||||
plugins: [],
|
||||
}
|
||||
```
|
||||
|
||||
./src/index.css:
|
||||
|
||||
```css
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
```
|
||||
22537
package-lock.json
generated
Normal file
22537
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
46
package.json
Normal file
46
package.json
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"name": "med-plan-assistant",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@testing-library/dom": "^10.4.1",
|
||||
"@testing-library/jest-dom": "^6.8.0",
|
||||
"@testing-library/react": "^16.3.0",
|
||||
"@testing-library/user-event": "^13.5.0",
|
||||
"npx": "^10.2.2",
|
||||
"react": "^19.1.1",
|
||||
"react-dom": "^19.1.1",
|
||||
"react-scripts": "5.0.1",
|
||||
"recharts": "^3.3.0",
|
||||
"web-vitals": "^2.1.4"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"react-app",
|
||||
"react-app/jest"
|
||||
]
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.2%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"development": [
|
||||
"last 1 chrome version",
|
||||
"last 1 firefox version",
|
||||
"last 1 safari version"
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"autoprefixer": "^10.4.21",
|
||||
"postcss": "^8.5.6",
|
||||
"tailwindcss": "^3.4.18"
|
||||
}
|
||||
}
|
||||
6
postcss.config.js
Normal file
6
postcss.config.js
Normal file
@@ -0,0 +1,6 @@
|
||||
module.exports = {
|
||||
plugins: {
|
||||
tailwindcss: {},
|
||||
autoprefixer: {},
|
||||
},
|
||||
}
|
||||
BIN
public/favicon.ico
Normal file
BIN
public/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.8 KiB |
43
public/index.html
Normal file
43
public/index.html
Normal file
@@ -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>
|
||||
BIN
public/logo192.png
Normal file
BIN
public/logo192.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.2 KiB |
BIN
public/logo512.png
Normal file
BIN
public/logo512.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.4 KiB |
25
public/manifest.json
Normal file
25
public/manifest.json
Normal file
@@ -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"
|
||||
}
|
||||
3
public/robots.txt
Normal file
3
public/robots.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
# https://www.robotstxt.org/robotstxt.html
|
||||
User-agent: *
|
||||
Disallow:
|
||||
38
src/App.css
Normal file
38
src/App.css
Normal file
@@ -0,0 +1,38 @@
|
||||
.App {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.App-logo {
|
||||
height: 40vmin;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
.App-logo {
|
||||
animation: App-logo-spin infinite 20s linear;
|
||||
}
|
||||
}
|
||||
|
||||
.App-header {
|
||||
background-color: #282c34;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: calc(10px + 2vmin);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.App-link {
|
||||
color: #61dafb;
|
||||
}
|
||||
|
||||
@keyframes App-logo-spin {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
488
src/App.js
Normal file
488
src/App.js
Normal file
@@ -0,0 +1,488 @@
|
||||
import React from 'react';
|
||||
import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ReferenceLine, ResponsiveContainer } from 'recharts';
|
||||
|
||||
// --- Constants ---
|
||||
const LOCAL_STORAGE_KEY = 'medPlanAssistantState_v5';
|
||||
const LDX_TO_DAMPH_CONVERSION_FACTOR = 0.2948;
|
||||
|
||||
|
||||
// --- Helper Functions ---
|
||||
const timeToMinutes = (timeStr) => {
|
||||
if (!timeStr || !timeStr.includes(':')) return 0;
|
||||
const [hours, minutes] = timeStr.split(':').map(Number);
|
||||
return hours * 60 + minutes;
|
||||
};
|
||||
|
||||
// --- Default State ---
|
||||
const getDefaultState = () => ({
|
||||
pkParams: {
|
||||
damph: { halfLife: '11' },
|
||||
ldx: { halfLife: '0.8', absorptionRate: '1.5' },
|
||||
},
|
||||
doses: [
|
||||
{ time: '06:30', dose: '25', label: 'Morgens' },
|
||||
{ time: '12:30', dose: '10', label: 'Mittags' },
|
||||
{ time: '17:00', dose: '10', label: 'Nachmittags' },
|
||||
{ time: '21:00', dose: '10', label: 'Abends' },
|
||||
{ time: '01:00', dose: '0', label: 'Nachts' },
|
||||
],
|
||||
steadyStateConfig: { daysOnMedication: '7' },
|
||||
therapeuticRange: { min: '11.5', max: '14' },
|
||||
doseIncrement: '2.5',
|
||||
uiSettings: {
|
||||
showDayTimeXAxis: true,
|
||||
chartView: 'damph',
|
||||
yAxisMin: '',
|
||||
yAxisMax: '',
|
||||
simulationDays: '3',
|
||||
displayedDays: '2',
|
||||
}
|
||||
});
|
||||
|
||||
// --- Custom Components ---
|
||||
const TimeInput = ({ value, onChange }) => {
|
||||
const [displayValue, setDisplayValue] = React.useState(value);
|
||||
const [isPickerOpen, setIsPickerOpen] = React.useState(false);
|
||||
const [pickerHours, pickerMinutes] = (value || "00:00").split(':').map(Number);
|
||||
React.useEffect(() => { setDisplayValue(value); }, [value]);
|
||||
const handleBlur = (e) => {
|
||||
let input = e.target.value.replace(/[^0-9]/g, '');
|
||||
let hours = '00', minutes = '00';
|
||||
if (input.length <= 2) { hours = input.padStart(2, '0'); }
|
||||
else if (input.length === 3) { hours = input.substring(0, 1).padStart(2, '0'); minutes = input.substring(1, 3); }
|
||||
else { hours = input.substring(0, 2); minutes = input.substring(2, 4); }
|
||||
hours = Math.min(23, parseInt(hours, 10) || 0).toString().padStart(2, '0');
|
||||
minutes = Math.min(59, parseInt(minutes, 10) || 0).toString().padStart(2, '0');
|
||||
const formattedTime = `${hours}:${minutes}`;
|
||||
setDisplayValue(formattedTime);
|
||||
onChange(formattedTime);
|
||||
};
|
||||
const handleChange = (e) => { setDisplayValue(e.target.value); };
|
||||
const handlePickerChange = (part, val) => {
|
||||
let newHours = pickerHours, newMinutes = pickerMinutes;
|
||||
if (part === 'h') { newHours = val; } else { newMinutes = val; }
|
||||
const formattedTime = `${String(newHours).padStart(2, '0')}:${String(newMinutes).padStart(2, '0')}`;
|
||||
onChange(formattedTime);
|
||||
};
|
||||
return (
|
||||
<div className="relative flex items-center">
|
||||
<input type="text" value={displayValue} onChange={handleChange} onBlur={handleBlur} placeholder="HH:MM" className="p-2 border rounded-md w-24 text-sm text-center"/>
|
||||
<button onClick={() => setIsPickerOpen(!isPickerOpen)} className="ml-2 p-2 text-gray-500 hover:text-gray-700">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"><path fillRule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm1-12a1 1 0 10-2 0v4a1 1 0 00.293.707l2.828 2.829a1 1 0 101.414-1.415L11 9.586V6z" clipRule="evenodd" /></svg>
|
||||
</button>
|
||||
{isPickerOpen && (
|
||||
<div className="absolute top-full mt-2 z-10 bg-white p-4 rounded-lg shadow-xl border w-64">
|
||||
<div className="text-center text-lg font-bold mb-3">{value}</div>
|
||||
<div>
|
||||
<div className="mb-2"><span className="font-semibold">Stunde:</span></div>
|
||||
<div className="grid grid-cols-6 gap-1">{[...Array(24).keys()].map(h => (<button key={h} onClick={() => handlePickerChange('h', h)} className={`p-1 rounded text-xs ${h === pickerHours ? 'bg-sky-500 text-white' : 'bg-gray-200 hover:bg-sky-200'}`}>{String(h).padStart(2,'0')}</button>))}</div>
|
||||
</div>
|
||||
<div className="mt-4">
|
||||
<div className="mb-2"><span className="font-semibold">Minute:</span></div>
|
||||
<div className="grid grid-cols-4 gap-1">{[0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55].map(m => (<button key={m} onClick={() => handlePickerChange('m', m)} className={`p-1 rounded text-xs ${m === pickerMinutes ? 'bg-sky-500 text-white' : 'bg-gray-200 hover:bg-sky-200'}`}>{String(m).padStart(2,'0')}</button>))}</div>
|
||||
</div>
|
||||
<button onClick={() => setIsPickerOpen(false)} className="mt-4 w-full bg-gray-600 text-white py-1 rounded-md text-sm">Schließen</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const NumericInput = ({ value, onChange, increment, min = -Infinity, max = Infinity, placeholder, unit }) => {
|
||||
const updateValue = (direction) => {
|
||||
const numIncrement = parseFloat(increment) || 1;
|
||||
let numValue = parseFloat(value) || 0;
|
||||
numValue += direction * numIncrement;
|
||||
numValue = Math.max(min, numValue);
|
||||
numValue = Math.min(max, numValue);
|
||||
const finalValue = String(Math.round(numValue * 100) / 100);
|
||||
onChange(finalValue);
|
||||
};
|
||||
const handleKeyDown = (e) => { if (e.key === 'ArrowUp' || e.key === 'ArrowDown') { e.preventDefault(); updateValue(e.key === 'ArrowUp' ? 1 : -1); } };
|
||||
const handleChange = (e) => { const val = e.target.value; if (val === '' || /^-?\d*\.?\d*$/.test(val)) { onChange(val); } };
|
||||
return (
|
||||
<div className="flex items-center w-full">
|
||||
<button onClick={() => updateValue(-1)} className="px-2 py-1 border rounded-l-md bg-gray-100 hover:bg-gray-200 text-lg font-bold">-</button>
|
||||
<input type="text" value={value} onChange={handleChange} onKeyDown={handleKeyDown} placeholder={placeholder} className="p-2 border-t border-b w-full text-sm text-center"/>
|
||||
<button onClick={() => updateValue(1)} className="px-2 py-1 border rounded-r-md bg-gray-100 hover:bg-gray-200 text-lg font-bold">+</button>
|
||||
{unit && <span className="ml-2 text-gray-500 text-sm whitespace-nowrap">{unit}</span>}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// --- Main Component ---
|
||||
const MedPlanAssistant = () => {
|
||||
const [appState, setAppState] = React.useState(getDefaultState);
|
||||
const [isLoaded, setIsLoaded] = React.useState(false);
|
||||
|
||||
React.useEffect(() => {
|
||||
try {
|
||||
const savedState = window.localStorage.getItem(LOCAL_STORAGE_KEY);
|
||||
if (savedState) {
|
||||
const parsedState = JSON.parse(savedState);
|
||||
const defaults = getDefaultState();
|
||||
setAppState({
|
||||
...defaults, ...parsedState,
|
||||
pkParams: {...defaults.pkParams, ...parsedState.pkParams},
|
||||
uiSettings: {...defaults.uiSettings, ...parsedState.uiSettings},
|
||||
});
|
||||
}
|
||||
} catch (error) { console.error("Failed to load state", error); }
|
||||
setIsLoaded(true);
|
||||
}, []);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (isLoaded) {
|
||||
try {
|
||||
const stateToSave = {
|
||||
pkParams: appState.pkParams,
|
||||
doses: appState.doses,
|
||||
steadyStateConfig: appState.steadyStateConfig,
|
||||
therapeuticRange: appState.therapeuticRange,
|
||||
doseIncrement: appState.doseIncrement,
|
||||
uiSettings: appState.uiSettings,
|
||||
};
|
||||
window.localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(stateToSave));
|
||||
} catch (error) { console.error("Failed to save state", error); }
|
||||
}
|
||||
}, [appState, isLoaded]);
|
||||
|
||||
const { pkParams, doses, steadyStateConfig, therapeuticRange, doseIncrement, uiSettings } = appState;
|
||||
const { showDayTimeXAxis, chartView, yAxisMin, yAxisMax, simulationDays, displayedDays } = uiSettings;
|
||||
|
||||
const [deviations, setDeviations] = React.useState([]);
|
||||
const [suggestion, setSuggestion] = React.useState(null);
|
||||
|
||||
const updateState = (key, value) => { setAppState(prev => ({ ...prev, [key]: value })); };
|
||||
const updateNestedState = (parentKey, childKey, value) => { setAppState(prev => ({ ...prev, [parentKey]: { ...prev[parentKey], ...value } })); };
|
||||
const updateUiSetting = (key, value) => {
|
||||
const newUiSettings = { ...appState.uiSettings, [key]: value };
|
||||
if (key === 'simulationDays') {
|
||||
const simDaysNum = parseInt(value, 10) || 1;
|
||||
const dispDaysNum = parseInt(newUiSettings.displayedDays, 10) || 1;
|
||||
if (dispDaysNum > simDaysNum) {
|
||||
newUiSettings.displayedDays = String(simDaysNum);
|
||||
}
|
||||
}
|
||||
setAppState(prev => ({ ...prev, uiSettings: newUiSettings }));
|
||||
};
|
||||
|
||||
const calculateSingleDoseConcentration = React.useCallback((dose, timeSinceDoseHours) => {
|
||||
const numDose = parseFloat(dose) || 0;
|
||||
if (timeSinceDoseHours < 0 || numDose <= 0) return { ldx: 0, damph: 0 };
|
||||
const ka_ldx = Math.log(2) / (parseFloat(pkParams.ldx.absorptionRate) || 1);
|
||||
const k_conv = Math.log(2) / (parseFloat(pkParams.ldx.halfLife) || 1);
|
||||
const ke_damph = Math.log(2) / (parseFloat(pkParams.damph.halfLife) || 1);
|
||||
let ldxConcentration = 0;
|
||||
if (Math.abs(ka_ldx - k_conv) > 0.0001) {
|
||||
ldxConcentration = (numDose * ka_ldx / (ka_ldx - k_conv)) * (Math.exp(-k_conv * timeSinceDoseHours) - Math.exp(-ka_ldx * timeSinceDoseHours));
|
||||
}
|
||||
let damphConcentration = 0;
|
||||
if (Math.abs(ka_ldx - ke_damph) > 0.0001 && Math.abs(k_conv - ke_damph) > 0.0001 && Math.abs(ka_ldx - k_conv) > 0.0001) {
|
||||
const term1 = Math.exp(-ke_damph * timeSinceDoseHours) / ((ka_ldx - ke_damph) * (k_conv - ke_damph));
|
||||
const term2 = Math.exp(-k_conv * timeSinceDoseHours) / ((ka_ldx - k_conv) * (ke_damph - k_conv));
|
||||
const term3 = Math.exp(-ka_ldx * timeSinceDoseHours) / ((k_conv - ka_ldx) * (ke_damph - ka_ldx));
|
||||
damphConcentration = LDX_TO_DAMPH_CONVERSION_FACTOR * numDose * ka_ldx * k_conv * (term1 + term2 + term3);
|
||||
}
|
||||
return { ldx: Math.max(0, ldxConcentration), damph: Math.max(0, damphConcentration) };
|
||||
}, [pkParams]);
|
||||
|
||||
const calculateCombinedProfile = React.useCallback((doseSchedule, deviationList = [], correction = null) => {
|
||||
const dataPoints = [];
|
||||
const timeStepHours = 0.25;
|
||||
const totalHours = (parseInt(simulationDays, 10) || 3) * 24;
|
||||
const daysToSimulate = Math.min(parseInt(steadyStateConfig.daysOnMedication, 10) || 0, 5);
|
||||
for (let t = 0; t <= totalHours; t += timeStepHours) {
|
||||
let totalLdx = 0;
|
||||
let totalDamph = 0;
|
||||
let allDoses = [];
|
||||
const maxDayOffset = (parseInt(simulationDays, 10) || 3) -1;
|
||||
for (let day = -daysToSimulate; day <= maxDayOffset; day++) {
|
||||
const dayOffset = day * 24 * 60;
|
||||
doseSchedule.forEach(d => { allDoses.push({ ...d, time: timeToMinutes(d.time) + dayOffset, isPlan: true }); });
|
||||
}
|
||||
|
||||
const currentDeviations = [...deviationList];
|
||||
if (correction) {
|
||||
currentDeviations.push({ ...correction, isAdditional: true });
|
||||
}
|
||||
|
||||
currentDeviations.forEach(dev => {
|
||||
const devTime = timeToMinutes(dev.time) + (dev.dayOffset || 0) * 24 * 60;
|
||||
if (!dev.isAdditional) {
|
||||
const closestDoseIndex = allDoses.reduce((closest, dose, index) => {
|
||||
if (!dose.isPlan) return closest;
|
||||
const diff = Math.abs(dose.time - devTime);
|
||||
if (diff <= 60 && diff < closest.minDiff) { return { index, minDiff: diff }; }
|
||||
return closest;
|
||||
}, { index: -1, minDiff: 61 }).index;
|
||||
if (closestDoseIndex !== -1) { allDoses.splice(closestDoseIndex, 1); }
|
||||
}
|
||||
allDoses.push({ ...dev, time: devTime });
|
||||
});
|
||||
|
||||
allDoses.forEach(doseInfo => {
|
||||
const timeSinceDoseHours = t - doseInfo.time / 60;
|
||||
const concentrations = calculateSingleDoseConcentration(doseInfo.dose, timeSinceDoseHours);
|
||||
totalLdx += concentrations.ldx;
|
||||
totalDamph += concentrations.damph;
|
||||
});
|
||||
dataPoints.push({ timeHours: t, ldx: totalLdx, damph: totalDamph });
|
||||
}
|
||||
return dataPoints;
|
||||
}, [steadyStateConfig, calculateSingleDoseConcentration, simulationDays]);
|
||||
|
||||
const generateSuggestion = React.useCallback(() => {
|
||||
if (deviations.length === 0) {
|
||||
setSuggestion(null);
|
||||
return;
|
||||
}
|
||||
const lastDeviation = [...deviations].sort((a, b) => timeToMinutes(a.time) + (a.dayOffset || 0) * 1440 - (timeToMinutes(b.time) + (b.dayOffset || 0) * 1440)).pop();
|
||||
const deviationTimeTotalMinutes = timeToMinutes(lastDeviation.time) + (lastDeviation.dayOffset || 0) * 1440;
|
||||
|
||||
let nextDose = null;
|
||||
let minDiff = Infinity;
|
||||
|
||||
doses.forEach(d => {
|
||||
const doseTimeInMinutes = timeToMinutes(d.time);
|
||||
for (let i=0; i < (parseInt(simulationDays, 10) || 1); i++) {
|
||||
const absoluteTime = doseTimeInMinutes + i * 1440;
|
||||
const diff = absoluteTime - deviationTimeTotalMinutes;
|
||||
if (diff > 0 && diff < minDiff) {
|
||||
minDiff = diff;
|
||||
nextDose = {...d, dayOffset: i};
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (!nextDose) {
|
||||
setSuggestion({ text: "Keine passende nächste Dosis für Korrektur gefunden." });
|
||||
return;
|
||||
}
|
||||
|
||||
const numDoseIncrement = parseFloat(doseIncrement) || 1;
|
||||
const idealProfile = calculateCombinedProfile(doses);
|
||||
const deviatedProfile = calculateCombinedProfile(doses, deviations);
|
||||
|
||||
const nextDoseTimeHours = (timeToMinutes(nextDose.time) + (nextDose.dayOffset || 0) * 1440) / 60;
|
||||
|
||||
const idealConcentration = idealProfile.find(p => Math.abs(p.timeHours - nextDoseTimeHours) < 0.1)?.damph || 0;
|
||||
const deviatedConcentration = deviatedProfile.find(p => Math.abs(p.timeHours - nextDoseTimeHours) < 0.1)?.damph || 0;
|
||||
const concentrationDifference = idealConcentration - deviatedConcentration;
|
||||
|
||||
if (Math.abs(concentrationDifference) < 0.5) {
|
||||
setSuggestion({ text: "Keine signifikante Korrektur notwendig." });
|
||||
return;
|
||||
}
|
||||
|
||||
const doseAdjustmentFactor = 0.5;
|
||||
let doseChange = concentrationDifference / doseAdjustmentFactor;
|
||||
doseChange = Math.round(doseChange / numDoseIncrement) * numDoseIncrement;
|
||||
let suggestedDoseValue = (parseFloat(nextDose.dose) || 0) + doseChange;
|
||||
suggestedDoseValue = Math.max(0, Math.min(70, suggestedDoseValue));
|
||||
|
||||
setSuggestion({
|
||||
time: nextDose.time,
|
||||
dose: String(suggestedDoseValue),
|
||||
isAdditional: false,
|
||||
originalDose: nextDose.dose,
|
||||
dayOffset: nextDose.dayOffset
|
||||
});
|
||||
}, [doses, deviations, calculateCombinedProfile, doseIncrement, simulationDays]);
|
||||
|
||||
React.useEffect(() => {
|
||||
generateSuggestion();
|
||||
}, [deviations, doses, pkParams, doseIncrement, generateSuggestion]);
|
||||
|
||||
|
||||
const idealProfile = React.useMemo(() => calculateCombinedProfile(doses), [doses, calculateCombinedProfile]);
|
||||
const deviatedProfile = React.useMemo(() => deviations.length > 0 ? calculateCombinedProfile(doses, deviations) : null, [doses, deviations, calculateCombinedProfile]);
|
||||
const correctedProfile = React.useMemo(() => suggestion && suggestion.dose ? calculateCombinedProfile(doses, deviations, suggestion) : null, [doses, deviations, suggestion, calculateCombinedProfile]);
|
||||
|
||||
const handleReset = () => {
|
||||
if (window.confirm("Bist du sicher, dass du alle Einstellungen auf die Standardwerte zurücksetzen möchtest? Dies kann nicht rückgängig gemacht werden.")) {
|
||||
window.localStorage.removeItem(LOCAL_STORAGE_KEY);
|
||||
window.location.reload();
|
||||
}
|
||||
};
|
||||
|
||||
const addDeviation = () => {
|
||||
const sortedDoses = [...doses].sort((a,b) => timeToMinutes(a.time) - timeToMinutes(b.time));
|
||||
let nextDose = sortedDoses[0] || { time: '08:00', dose: '25' };
|
||||
if (deviations.length > 0) {
|
||||
const lastDev = deviations[deviations.length - 1];
|
||||
const lastDevTime = timeToMinutes(lastDev.time) + (lastDev.dayOffset || 0) * 24 * 60;
|
||||
const nextPlanned = sortedDoses.find(d => timeToMinutes(d.time) > (lastDevTime % (24*60)));
|
||||
if (nextPlanned) {
|
||||
nextDose = { ...nextPlanned, dayOffset: lastDev.dayOffset };
|
||||
} else {
|
||||
nextDose = { ...sortedDoses[0], dayOffset: (lastDev.dayOffset || 0) + 1 };
|
||||
}
|
||||
}
|
||||
setDeviations([...deviations, { ...nextDose, isAdditional: false, dayOffset: nextDose.dayOffset || 0 }]);
|
||||
};
|
||||
|
||||
const removeDeviation = (index) => { setDeviations(deviations.filter((_, i) => i !== index)); };
|
||||
const handleDeviationChange = (index, field, value) => {
|
||||
const newDeviations = [...deviations];
|
||||
newDeviations[index][field] = value;
|
||||
setDeviations(newDeviations);
|
||||
};
|
||||
|
||||
const applySuggestion = () => {
|
||||
if (!suggestion || !suggestion.dose) return;
|
||||
setDeviations([...deviations, suggestion]);
|
||||
setSuggestion(null);
|
||||
}
|
||||
|
||||
const chartDomain = React.useMemo(() => {
|
||||
const numMin = parseFloat(yAxisMin);
|
||||
const numMax = parseFloat(yAxisMax);
|
||||
const domainMin = !isNaN(numMin) ? numMin : 'auto';
|
||||
const domainMax = !isNaN(numMax) ? numMax : 'auto';
|
||||
return [domainMin, domainMax];
|
||||
}, [yAxisMin, yAxisMax]);
|
||||
|
||||
const totalHours = (parseInt(simulationDays, 10) || 3) * 24;
|
||||
const chartTicks = Array.from({length: Math.floor(totalHours / 6) + 1}, (_, i) => i * 6);
|
||||
const chartWidthPercentage = Math.max(100, (totalHours / ( (parseInt(displayedDays, 10) || 2) * 24)) * 100);
|
||||
|
||||
return (
|
||||
<div className="bg-gray-100 font-sans p-4 sm:p-6 lg:p-8">
|
||||
<div className="max-w-7xl mx-auto">
|
||||
<header className="mb-8">
|
||||
<h1 className="text-3xl md:text-4xl font-bold text-gray-800">Medikationsplan-Assistent</h1>
|
||||
<p className="text-gray-600 mt-1">Simulation für Lisdexamfetamin (LDX) und d-Amphetamin (d-amph)</p>
|
||||
</header>
|
||||
<div className="grid grid-cols-1 lg:grid-cols-3 gap-6">
|
||||
<div className="lg:col-span-1 space-y-6 lg:order-1">
|
||||
<div className="bg-white p-5 rounded-lg shadow-sm border">
|
||||
<h2 className="text-xl font-semibold mb-4 text-gray-700">Mein Plan</h2>
|
||||
{doses.map((dose, index) => (
|
||||
<div key={index} className="flex items-center space-x-3 mb-3">
|
||||
<TimeInput value={dose.time} onChange={newTime => updateState('doses', doses.map((d, i) => i === index ? {...d, time: newTime} : d))} />
|
||||
<div className="w-40">
|
||||
<NumericInput value={dose.dose} onChange={newDose => updateState('doses', doses.map((d, i) => i === index ? {...d, dose: newDose} : d))} increment={doseIncrement} min={0} unit="mg" />
|
||||
</div>
|
||||
<span className="text-gray-600 text-sm flex-1">{dose.label}</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="bg-amber-50 p-5 rounded-lg shadow-sm border border-amber-200">
|
||||
<h2 className="text-xl font-semibold mb-4 text-gray-700">Abweichungen vom Plan</h2>
|
||||
{deviations.map((dev, index) => (
|
||||
<div key={index} className="flex items-center space-x-2 mb-2 p-2 bg-white rounded flex-wrap">
|
||||
<select value={dev.dayOffset || 0} onChange={e => handleDeviationChange(index, 'dayOffset', parseInt(e.target.value, 10))} className="p-2 border rounded-md text-sm">
|
||||
{ [...Array(parseInt(simulationDays, 10) || 1).keys()].map(day => (
|
||||
<option key={day} value={day}>Tag {day + 1}</option>
|
||||
)) }
|
||||
</select>
|
||||
<TimeInput value={dev.time} onChange={newTime => handleDeviationChange(index, 'time', newTime)} />
|
||||
<div className="w-32">
|
||||
<NumericInput value={dev.dose} onChange={newDose => handleDeviationChange(index, 'dose', newDose)} increment={doseIncrement} min={0} unit="mg"/>
|
||||
</div>
|
||||
<button onClick={() => removeDeviation(index)} className="text-red-500 hover:text-red-700 font-bold text-lg">×</button>
|
||||
<div className="flex items-center mt-1" title="Mark this if it was an extra dose instead of a replacement for a planned one.">
|
||||
<input type="checkbox" id={`add_dose_${index}`} checked={dev.isAdditional} onChange={e => handleDeviationChange(index, 'isAdditional', e.target.checked)} className="h-4 w-4 rounded border-gray-300 text-sky-600 focus:ring-sky-500" />
|
||||
<label htmlFor={`add_dose_${index}`} className="ml-2 text-xs text-gray-600">Zusätzlich</label>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
<button onClick={addDeviation} className="mt-2 w-full bg-amber-500 text-white py-2 rounded-md hover:bg-amber-600 text-sm">Abweichung hinzufügen</button>
|
||||
</div>
|
||||
|
||||
{suggestion && (
|
||||
<div className="bg-sky-100 border-l-4 border-sky-500 p-4 rounded-r-lg shadow-md">
|
||||
<h3 className="font-bold text-lg mb-2">Was wäre wenn?</h3>
|
||||
{suggestion.dose ? (
|
||||
<>
|
||||
<p className="text-sm text-sky-800 mb-3">Vorschlag: <span className="font-bold">{suggestion.dose}mg</span> (statt {suggestion.originalDose}mg) um <span className="font-bold">{suggestion.time}</span>.</p>
|
||||
<button onClick={applySuggestion} className="w-full bg-sky-600 text-white py-2 rounded-md hover:bg-sky-700 text-sm">Vorschlag als Abweichung übernehmen</button>
|
||||
</>
|
||||
) : (
|
||||
<p className="text-sm text-sky-800">{suggestion.text}</p>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
</div>
|
||||
<div className="lg:col-span-2 bg-white p-5 rounded-lg shadow-sm border min-h-[600px] flex flex-col lg:order-2">
|
||||
<div className="flex justify-center space-x-2 mb-4">
|
||||
<button onClick={() => updateUiSetting('chartView', 'damph')} className={`px-4 py-2 text-sm font-medium rounded-md ${chartView === 'damph' ? 'bg-sky-600 text-white' : 'bg-gray-200 text-gray-700'}`}>d-Amphetamin</button>
|
||||
<button onClick={() => updateUiSetting('chartView', 'ldx')} className={`px-4 py-2 text-sm font-medium rounded-md ${chartView === 'ldx' ? 'bg-sky-600 text-white' : 'bg-gray-200 text-gray-700'}`}>Lisdexamfetamin</button>
|
||||
<button onClick={() => updateUiSetting('chartView', 'both')} className={`px-4 py-2 text-sm font-medium rounded-md ${chartView === 'both' ? 'bg-sky-600 text-white' : 'bg-gray-200 text-gray-700'}`}>Beide</button>
|
||||
</div>
|
||||
<div className="flex-grow w-full overflow-x-auto">
|
||||
<div style={{ width: `${chartWidthPercentage}%`, height: '100%', minWidth: '100%' }}>
|
||||
<ResponsiveContainer width="100%" height="100%">
|
||||
<LineChart margin={{ top: 20, right: 20, left: 0, bottom: 5 }}>
|
||||
<CartesianGrid strokeDasharray="3 3" />
|
||||
<XAxis dataKey="timeHours" type="number" domain={[0, totalHours]} ticks={chartTicks} tickFormatter={(h) => `${h}h`} xAxisId="continuous" />
|
||||
{showDayTimeXAxis && <XAxis dataKey="timeHours" type="number" domain={[0, totalHours]} ticks={chartTicks} tickFormatter={(h) => `${h % 24}h`} xAxisId="daytime" orientation="top" />}
|
||||
<YAxis label={{ value: 'Konzentration (ng/ml)', angle: -90, position: 'insideLeft', offset: -10 }} domain={chartDomain} allowDecimals={false} />
|
||||
<Tooltip formatter={(value, name) => [`${value.toFixed(1)} ng/ml`, name]} labelFormatter={(label) => `Stunde: ${label}h`}/>
|
||||
<Legend verticalAlign="top" height={36} />
|
||||
{(chartView === 'damph' || chartView === 'both') && <ReferenceLine y={parseFloat(therapeuticRange.min) || 0} label={{ value: 'Min', position: 'insideTopLeft' }} stroke="green" strokeDasharray="3 3" xAxisId="continuous" />}
|
||||
{(chartView === 'damph' || chartView === 'both') && <ReferenceLine y={parseFloat(therapeuticRange.max) || 0} label={{ value: 'Max', position: 'insideTopLeft' }} stroke="red" strokeDasharray="3 3" xAxisId="continuous" />}
|
||||
|
||||
{[...Array(parseInt(simulationDays, 10) || 0).keys()].map(day => (
|
||||
day > 0 && <ReferenceLine key={day} x={day * 24} stroke="#999" strokeDasharray="5 5" xAxisId="continuous" />
|
||||
))}
|
||||
|
||||
{(chartView === 'damph' || chartView === 'both') && <Line type="monotone" data={idealProfile} dataKey="damph" name="d-Amphetamin (Ideal)" stroke="#3b82f6" strokeWidth={2.5} dot={false} xAxisId="continuous"/>}
|
||||
{(chartView === 'ldx' || chartView === 'both') && <Line type="monotone" data={idealProfile} dataKey="ldx" name="Lisdexamfetamin (Ideal)" stroke="#8b5cf6" strokeWidth={2} dot={false} strokeDasharray="3 3" xAxisId="continuous"/>}
|
||||
|
||||
{deviatedProfile && (chartView === 'damph' || chartView === 'both') && <Line type="monotone" data={deviatedProfile} dataKey="damph" name="d-Amphetamin (Abweichung)" stroke="#f59e0b" strokeWidth={2} strokeDasharray="5 5" dot={false} xAxisId="continuous"/>}
|
||||
{deviatedProfile && (chartView === 'ldx' || chartView === 'both') && <Line type="monotone" data={deviatedProfile} dataKey="ldx" name="Lisdexamfetamin (Abweichung)" stroke="#f97316" strokeWidth={1.5} strokeDasharray="5 5" dot={false} xAxisId="continuous"/>}
|
||||
|
||||
{correctedProfile && (chartView === 'damph' || chartView === 'both') && <Line type="monotone" data={correctedProfile} dataKey="damph" name="d-Amphetamin (Korrektur)" stroke="#10b981" strokeWidth={2.5} strokeDasharray="3 7" dot={false} xAxisId="continuous"/>}
|
||||
{correctedProfile && (chartView === 'ldx' || chartView === 'both') && <Line type="monotone" data={correctedProfile} dataKey="ldx" name="Lisdexamfetamin (Korrektur)" stroke="#059669" strokeWidth={2} strokeDasharray="3 7" dot={false} xAxisId="continuous"/>}
|
||||
|
||||
</LineChart>
|
||||
</ResponsiveContainer>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="lg:col-span-1 space-y-6 lg:order-3">
|
||||
<div className="bg-white p-5 rounded-lg shadow-sm border">
|
||||
<h2 className="text-xl font-semibold mb-4 text-gray-700">Erweiterte Einstellungen</h2>
|
||||
<div className="space-y-4 text-sm">
|
||||
<div className="flex items-center"><input type="checkbox" id="showDayTimeXAxis" checked={showDayTimeXAxis} onChange={e => updateUiSetting('showDayTimeXAxis', e.target.checked)} className="h-4 w-4 rounded border-gray-300 text-sky-600 focus:ring-sky-500" /><label htmlFor="showDayTimeXAxis" className="ml-3 block font-medium text-gray-600">24h-Zeitachse anzeigen</label></div>
|
||||
<label className="block font-medium text-gray-600 pt-2">Simulationsdauer</label><div className="w-40"><NumericInput value={simulationDays} onChange={val => updateUiSetting('simulationDays', val)} increment={'1'} min={2} max={7} unit="Tage"/></div>
|
||||
<label className="block font-medium text-gray-600">Angezeigte Tage</label><div className="w-40"><NumericInput value={displayedDays} onChange={val => updateUiSetting('displayedDays', val)} increment={'1'} min={1} max={parseInt(simulationDays, 10) || 1} unit="Tage"/></div>
|
||||
<label className="block font-medium text-gray-600 pt-2">Y-Achsen-Bereich</label>
|
||||
<div className="flex items-center space-x-2 mt-1">
|
||||
<div className="w-32"><NumericInput value={yAxisMin} onChange={val => updateUiSetting('yAxisMin', val)} increment={'5'} min={0} placeholder="Auto" unit="ng/ml"/></div>
|
||||
<span className="text-gray-500">-</span>
|
||||
<div className="w-32"><NumericInput value={yAxisMax} onChange={val => updateUiSetting('yAxisMax', val)} increment={'5'} min={0} placeholder="Auto" unit="ng/ml"/></div>
|
||||
</div>
|
||||
<label className="block font-medium text-gray-600">Therapeutischer Bereich</label>
|
||||
<div className="flex items-center space-x-2 mt-1">
|
||||
<div className="w-32"><NumericInput value={therapeuticRange.min} onChange={val => updateNestedState('therapeuticRange', 'min', val)} increment={'0.5'} min={0} placeholder="Min" unit="ng/ml"/></div>
|
||||
<span className="text-gray-500">-</span>
|
||||
<div className="w-32"><NumericInput value={therapeuticRange.max} onChange={val => updateNestedState('therapeuticRange', 'max', val)} increment={'0.5'} min={0} placeholder="Max" unit="ng/ml"/></div>
|
||||
</div>
|
||||
<h3 className="text-lg font-semibold mt-4 pt-4 border-t">d-Amphetamin Parameter</h3>
|
||||
<div className="w-40"><label className="block font-medium text-gray-600">Halbwertszeit</label><NumericInput value={pkParams.damph.halfLife} onChange={val => updateNestedState('pkParams', 'damph', { halfLife: val })} increment={'0.5'} min={0.1} unit="h"/></div>
|
||||
<h3 className="text-lg font-semibold mt-4 pt-4 border-t">Lisdexamfetamin Parameter</h3>
|
||||
<div className="w-40"><label className="block font-medium text-gray-600">Umwandlungs-Halbwertszeit</label><NumericInput value={pkParams.ldx.halfLife} onChange={val => updateNestedState('pkParams', 'ldx', { halfLife: val })} increment={'0.1'} min={0.1} unit="h"/></div>
|
||||
<div className="w-40"><label className="block font-medium text-gray-600">Absorptionsrate</label><NumericInput value={pkParams.ldx.absorptionRate} onChange={val => updateNestedState('pkParams', 'ldx', { absorptionRate: val })} increment={'0.1'} min={0.1} unit="(schneller >)"/></div>
|
||||
<div className="pt-4">
|
||||
<button onClick={handleReset} className="w-full bg-red-600 text-white py-2 rounded-md hover:bg-red-700 text-sm">Alle Einstellungen zurücksetzen</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<footer className="mt-8 p-4 bg-gray-100 rounded-lg text-sm text-gray-700 border">
|
||||
<h3 className="font-semibold mb-2">Wichtiger Hinweis</h3>
|
||||
<p>Dieses Tool dient ausschließlich zu Illustrations- und Informationszwecken. Es ist kein medizinisches Gerät und ersetzt nicht die Beratung durch einen Arzt oder Apotheker. Alle Berechnungen sind Simulationen, die auf allgemeinen pharmakokinetischen Modellen basieren und von individuellen Faktoren erheblich abweichen können. Bitte konsultiere deinen behandelnden Arzt, bevor du Anpassungen an deiner Medikation vornimmst.</p>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
};
|
||||
|
||||
export default MedPlanAssistant;
|
||||
8
src/App.test.js
Normal file
8
src/App.test.js
Normal file
@@ -0,0 +1,8 @@
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import App from './App';
|
||||
|
||||
test('renders learn react link', () => {
|
||||
render(<App />);
|
||||
const linkElement = screen.getByText(/learn react/i);
|
||||
expect(linkElement).toBeInTheDocument();
|
||||
});
|
||||
3
src/index.css
Normal file
3
src/index.css
Normal file
@@ -0,0 +1,3 @@
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
17
src/index.js
Normal file
17
src/index.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom/client';
|
||||
import './index.css';
|
||||
import App from './App';
|
||||
import reportWebVitals from './reportWebVitals';
|
||||
|
||||
const root = ReactDOM.createRoot(document.getElementById('root'));
|
||||
root.render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>
|
||||
);
|
||||
|
||||
// If you want to start measuring performance in your app, pass a function
|
||||
// to log results (for example: reportWebVitals(console.log))
|
||||
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
||||
reportWebVitals();
|
||||
1
src/logo.svg
Normal file
1
src/logo.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3"><g fill="#61DAFB"><path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/><circle cx="420.9" cy="296.5" r="45.7"/><path d="M520.5 78.1z"/></g></svg>
|
||||
|
After Width: | Height: | Size: 2.6 KiB |
13
src/reportWebVitals.js
Normal file
13
src/reportWebVitals.js
Normal file
@@ -0,0 +1,13 @@
|
||||
const reportWebVitals = onPerfEntry => {
|
||||
if (onPerfEntry && onPerfEntry instanceof Function) {
|
||||
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
|
||||
getCLS(onPerfEntry);
|
||||
getFID(onPerfEntry);
|
||||
getFCP(onPerfEntry);
|
||||
getLCP(onPerfEntry);
|
||||
getTTFB(onPerfEntry);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export default reportWebVitals;
|
||||
5
src/setupTests.js
Normal file
5
src/setupTests.js
Normal file
@@ -0,0 +1,5 @@
|
||||
// jest-dom adds custom jest matchers for asserting on DOM nodes.
|
||||
// allows you to do things like:
|
||||
// expect(element).toHaveTextContent(/react/i)
|
||||
// learn more: https://github.com/testing-library/jest-dom
|
||||
import '@testing-library/jest-dom';
|
||||
10
tailwind.config.js
Normal file
10
tailwind.config.js
Normal file
@@ -0,0 +1,10 @@
|
||||
/** @type {import('tailwindcss').Config} */
|
||||
module.exports = {
|
||||
content: [
|
||||
"./src/**/*.{js,jsx,ts,tsx}",
|
||||
],
|
||||
theme: {
|
||||
extend: {},
|
||||
},
|
||||
plugins: [],
|
||||
}
|
||||
Reference in New Issue
Block a user