From 24e4272d7c451794eac0c09dac3039759ab08bb1 Mon Sep 17 00:00:00 2001 From: alvaromaoc Date: Tue, 3 Jun 2025 19:11:44 +0200 Subject: [PATCH] First iteration cool UI (responsive and clean) --- src/pages/webapp/Dashboard.tsx | 4 +- src/pages/webapp/Simulation.tsx | 119 ++++++++++++++------------------ 2 files changed, 53 insertions(+), 70 deletions(-) diff --git a/src/pages/webapp/Dashboard.tsx b/src/pages/webapp/Dashboard.tsx index edaadc8..c3d21ef 100644 --- a/src/pages/webapp/Dashboard.tsx +++ b/src/pages/webapp/Dashboard.tsx @@ -102,7 +102,7 @@ function Summary() { return (
navigate("/news")} - className={"md:flex-1 bg-neutral-100 shadow-none border-none cursor-pointer"}> + className={"md:flex-1 bg-neutral-100 shadow-none hover:inset-ring-1 hover:inset-ring-neutral-200 border-none cursor-pointer"}>
@@ -115,7 +115,7 @@ function Summary() { navigate("/alerts")} - className={"md:flex-1 bg-neutral-100 shadow-none border-none cursor-pointer"}> + className={"md:flex-1 bg-neutral-100 shadow-none hover:inset-ring-1 hover:inset-ring-neutral-200 border-none cursor-pointer"}>
diff --git a/src/pages/webapp/Simulation.tsx b/src/pages/webapp/Simulation.tsx index 0a4f4f6..3853a07 100644 --- a/src/pages/webapp/Simulation.tsx +++ b/src/pages/webapp/Simulation.tsx @@ -6,16 +6,9 @@ import {PortfolioHttpService} from "@/services/portfolio-http-service.ts"; import {AssetsHttpService} from "@/services/assets-http-service.ts"; import {Badge} from "@/components/ui/badge.tsx"; -import {Area, AreaChart, CartesianGrid, XAxis, YAxis} from "recharts" +import {CartesianGrid, Line, LineChart, XAxis, YAxis} from "recharts" import {Card, CardContent, CardDescription, CardHeader, CardTitle,} from "@/components/ui/card" -import { - ChartConfig, - ChartContainer, - ChartLegend, - ChartLegendContent, - ChartTooltip, - ChartTooltipContent, -} from "@/components/ui/chart" +import {ChartConfig, ChartContainer, ChartTooltip, ChartTooltipContent,} from "@/components/ui/chart" import {Decision} from "@/model/Decision.ts"; import {DecisionHttpService} from "@/services/decision-http-service.ts"; import {Select, SelectContent, SelectItem, SelectTrigger, SelectValue} from "@/components/ui/select.tsx"; @@ -57,7 +50,7 @@ function Simulation() { const [simulationConfig, setSimulationConfig] = useState(); return ( -
+
@@ -387,7 +380,14 @@ function DataChart config={chartConfig} className="aspect-auto h-[250px] w-full" > - + tickLine={false} axisLine={false} tickMargin={8} + domain={([dataMin, dataMax]) => { + const margin = (dataMax - dataMin)/10; + return [Math.max(0, dataMin - margin), dataMax + margin] + }} tickFormatter={(value) => { const cents = Number(value); return (cents / 100).toLocaleString("en-US", { @@ -417,72 +421,51 @@ function DataChart /> ( - <> -
- {chartConfig[name as keyof typeof chartConfig]?.label || name} -
- {(Number(value) / 100).toLocaleString("en-US", { - style: "currency", - currency: "USD" - })} -
- - )} - indicator="dot" - /> - } + content={ ( + <> +
+ {((chartConfig["name" as keyof typeof chartConfig]?.label || name) as string) + .replace(/^./, c => c.toUpperCase())} +
+ {(Number(value) / 100).toLocaleString("en-US", { + style: "currency", + currency: "USD" + })} +
+ + )} + />} /> - - - - - - - - - - - - - }/> - +