From 19a73df3d02965666f9a9c8d222fa87f61af1357 Mon Sep 17 00:00:00 2001 From: Niklas Palm Date: Mon, 18 Mar 2024 21:01:00 +0100 Subject: [PATCH] feat: parse json in frontend --- frontend/src/App.tsx | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index c9ec1e8..9186d0f 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -1,6 +1,6 @@ import React from "react"; import { useState, useEffect } from "react"; -import { Loading } from "@geist-ui/core"; +import { Loading, Grid, Card, Text } from "@geist-ui/core"; import { getSummary, postData } from "./utils"; import "./App.css"; @@ -43,6 +43,44 @@ function App() { setWaitingForSummary(true); }; + const renderSummary = () => { + if (summary) { + return ( + + + `Name: ${summary.animal_name}` + `Species: ${summary.animal_species}` + `Sex: ${summary.animal_sex}` + `Date of birth: ${summary.animal_date_of_birth}` + `Weight: ${summary.animal_weight}` + `Address: ${summary.animal_address}` + `Owner: ${summary.animal_owner}` + `Address: ${summary.animal_address}` + `Email: ${summary.animal_email}` + + {summary.visits.map((visit: any) => { + return ( + + + + `Date: ${visit.date}` + `Clinic: ${summary.clinic}` + `Reason: ${summary.reason}` + `Diagnosis: ${summary.diagnosis}` + `Treatment: ${summary.treatment}` + `Notes: ${summary.notes}` + + + + ); + })} + + ); + } else { + return null; + } + }; + return (
@@ -52,7 +90,7 @@ function App() { ) : ( )} - {summary ?
{summary}
: null} + {renderSummary()}
);