Added bookmark and past used in /calculators
This commit is contained in:
@@ -1,9 +1,15 @@
|
||||
import { Interpretation } from "./calculators/types";
|
||||
|
||||
export default function Result({interpretation, calculated_value, unit} : {interpretation:Interpretation, calculated_value:string | number, unit:string
|
||||
import { Calculator, Interpretation } from "./calculators/types";
|
||||
import { CalculatorRegistry } from "./calculators/registry";
|
||||
export default function Result({interpretation, calculated_value, unit, id, section} : {
|
||||
interpretation:Interpretation,
|
||||
calculated_value:string | number,
|
||||
unit:string | undefined,
|
||||
id: string | undefined,
|
||||
section:string | undefined
|
||||
}){
|
||||
var {level, message, diagnosis, advice} = interpretation;
|
||||
var levelClass = "";
|
||||
const calc : Calculator | undefined = id && section ? CalculatorRegistry[section].calculators.find(e => e.id === id) : undefined;
|
||||
if(level === "none" || level === "low"){
|
||||
levelClass = "bg-success";
|
||||
}else if(level === "moderate"){
|
||||
@@ -16,6 +22,7 @@ export default function Result({interpretation, calculated_value, unit} : {inter
|
||||
return(
|
||||
<div className={`card max-w-auto ${levelClass} bg-base-100 shadow-sm mt-5 ${levelClass}`}>
|
||||
<div className="card-body">
|
||||
{calc ? <h2>{calc.name}</h2> : null}
|
||||
<h2 className="card-title self-center">Calculated Score/Value: {calculated_value} {unit}</h2>
|
||||
<p>{message}</p>
|
||||
{diagnosis ? <p>Diagnosis: {diagnosis}</p> : null}
|
||||
|
||||
Reference in New Issue
Block a user