Skip to content

Commit 1a18985

Browse files
authored
sigma commit
Kacper dasz rade
2 parents 612566f + 0f70e5a commit 1a18985

16 files changed

+560
-125
lines changed

apps/web/app/dashboard/[tokenID]/_components/charts/.gitkeep

Lines changed: 0 additions & 1 deletion
This file was deleted.

apps/web/app/dashboard/[tokenID]/_components/charts/fewer-sick-days-chart.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ export function FewerSickDaysChart({ data }: FewerSickDaysChartProps) {
3737
const chartConfig = {
3838
currentPension: {
3939
label: "Aktualna Emerytura",
40-
color: "hsl(0, 70%, 50%)",
40+
color: "rgb(255,179,79)",
4141
},
4242
newPension: {
4343
label: "Nowa Emerytura",
44-
color: "hsl(160, 60%, 45%)",
44+
color: "rgb(0, 120, 52)",
4545
},
4646
improvement: {
4747
label: "Poprawa",
48-
color: "hsl(220, 70%, 50%)",
48+
color: "rgb(0, 65, 110)",
4949
},
5050
};
5151

@@ -60,8 +60,8 @@ export function FewerSickDaysChart({ data }: FewerSickDaysChartProps) {
6060
dataKey="name"
6161
className="text-muted-foreground text-xs"
6262
tick={{ fontSize: 12 }}
63-
angle={-45}
64-
textAnchor="end"
63+
angle={0}
64+
textAnchor="middle"
6565
height={80}
6666
/>
6767
<YAxis
@@ -72,7 +72,7 @@ export function FewerSickDaysChart({ data }: FewerSickDaysChartProps) {
7272
<ChartTooltip
7373
content={<ChartTooltipContent />}
7474
formatter={(value: number, name: string) => [
75-
`${value.toLocaleString()} zł`,
75+
`${value.toLocaleString()} `,
7676
name,
7777
]}
7878
/>
@@ -82,19 +82,19 @@ export function FewerSickDaysChart({ data }: FewerSickDaysChartProps) {
8282
/>
8383
<Bar
8484
dataKey="currentPension"
85-
fill="hsl(0, 70%, 50%)"
85+
fill={chartConfig.currentPension.color}
8686
name="Aktualna Emerytura"
8787
radius={[4, 4, 0, 0]}
8888
/>
8989
<Bar
9090
dataKey="newPension"
91-
fill="hsl(160, 60%, 45%)"
91+
fill={chartConfig.newPension.color}
9292
name="Nowa Emerytura"
9393
radius={[4, 4, 0, 0]}
9494
/>
9595
<Bar
9696
dataKey="improvement"
97-
fill="hsl(220, 70%, 50%)"
97+
fill={chartConfig.improvement.color}
9898
name="Poprawa"
9999
radius={[4, 4, 0, 0]}
100100
/>

apps/web/app/dashboard/[tokenID]/_components/charts/pension-comparison-chart.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ export function PensionComparisonChart({ data }: PensionComparisonChartProps) {
1717
const chartConfig = {
1818
projected: {
1919
label: "Prognozowana Emerytura",
20-
color: "hsl(160, 60%, 45%)",
20+
color: "rgb(0, 120, 52)",
2121
},
2222
expected: {
2323
label: "Oczekiwana Emerytura",
24-
color: "hsl(220, 70%, 50%)",
24+
color: "rgb(0, 65, 110)",
2525
},
2626
};
2727

@@ -44,21 +44,24 @@ export function PensionComparisonChart({ data }: PensionComparisonChartProps) {
4444
/>
4545
<ChartTooltip
4646
content={<ChartTooltipContent />}
47-
formatter={(value: number) => [`${value.toLocaleString()} zł`, ""]}
47+
formatter={(value: number, name: string) => [
48+
`${value.toLocaleString()} zł `,
49+
name,
50+
]}
4851
/>
4952
<Legend
5053
wrapperStyle={{ paddingTop: "20px", textAlign: "center" }}
5154
iconType="rect"
5255
/>
5356
<Bar
5457
dataKey="projected"
55-
fill="hsl(160, 60%, 45%)"
58+
fill={chartConfig.projected.color}
5659
name="Prognozowana Emerytura"
5760
radius={[4, 4, 0, 0]}
5861
/>
5962
<Bar
6063
dataKey="expected"
61-
fill="hsl(220, 70%, 50%)"
64+
fill={chartConfig.expected.color}
6265
name="Oczekiwana Emerytura"
6366
radius={[4, 4, 0, 0]}
6467
/>

apps/web/app/dashboard/[tokenID]/_components/charts/pension-projection-chart.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export function PensionProjectionChart({ data }: PensionProjectionChartProps) {
2121
const chartConfig = {
2222
totalBalance: {
2323
label: "Całkowity Kapitał",
24-
color: "rgb(26, 78, 218)",
24+
color: "rgb(255,179,79)",
2525
},
2626
mainAccountBalance: {
2727
label: "Konto Główne",
@@ -52,7 +52,10 @@ export function PensionProjectionChart({ data }: PensionProjectionChartProps) {
5252
/>
5353
<ChartTooltip
5454
content={<ChartTooltipContent />}
55-
formatter={(value: number) => [`${value.toLocaleString()} zł`, ""]}
55+
formatter={(value: number, name: string) => [
56+
`${value.toLocaleString()} zł `,
57+
name,
58+
]}
5659
/>
5760
<Legend
5861
wrapperStyle={{ paddingTop: "20px", textAlign: "center" }}
@@ -61,7 +64,7 @@ export function PensionProjectionChart({ data }: PensionProjectionChartProps) {
6164
<Line
6265
type="monotone"
6366
dataKey="totalBalance"
64-
stroke="hsl(220, 70%, 50%)"
67+
stroke={chartConfig.totalBalance.color}
6568
strokeWidth={3}
6669
dot={{ r: 4 }}
6770
name="Całkowity Kapitał"
@@ -70,7 +73,7 @@ export function PensionProjectionChart({ data }: PensionProjectionChartProps) {
7073
<Line
7174
type="monotone"
7275
dataKey="mainAccountBalance"
73-
stroke="hsl(160, 60%, 45%)"
76+
stroke={chartConfig.mainAccountBalance.color}
7477
strokeWidth={3}
7578
dot={{ r: 4 }}
7679
name="Konto Główne"
@@ -79,7 +82,7 @@ export function PensionProjectionChart({ data }: PensionProjectionChartProps) {
7982
<Line
8083
type="monotone"
8184
dataKey="subAccountBalance"
82-
stroke="hsl(0, 70%, 50%)"
85+
stroke={chartConfig.subAccountBalance.color}
8386
strokeWidth={3}
8487
dot={{ r: 4 }}
8588
name="Konto Podrzędne"

apps/web/app/dashboard/[tokenID]/_components/charts/salary-increase-chart.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ export function SalaryIncreaseChart({ data }: SalaryIncreaseChartProps) {
3434
const chartConfig = {
3535
currentPension: {
3636
label: "Aktualna Emerytura",
37-
color: "hsl(0, 70%, 50%)",
37+
color: "rgb(255,179,79)",
3838
},
3939
newPension: {
4040
label: "Nowa Emerytura",
41-
color: "hsl(160, 60%, 45%)",
41+
color: "rgb(0, 120, 52)",
4242
},
4343
improvement: {
4444
label: "Poprawa",
45-
color: "hsl(220, 70%, 50%)",
45+
color: "rgb(0, 65, 110)",
4646
},
4747
};
4848

@@ -66,7 +66,7 @@ export function SalaryIncreaseChart({ data }: SalaryIncreaseChartProps) {
6666
<ChartTooltip
6767
content={<ChartTooltipContent />}
6868
formatter={(value: number, name: string) => [
69-
`${value.toLocaleString()} zł`,
69+
`${value.toLocaleString()} `,
7070
name,
7171
]}
7272
/>
@@ -76,19 +76,19 @@ export function SalaryIncreaseChart({ data }: SalaryIncreaseChartProps) {
7676
/>
7777
<Bar
7878
dataKey="currentPension"
79-
fill="hsl(0, 70%, 50%)"
79+
fill={chartConfig.currentPension.color}
8080
name="Aktualna Emerytura"
8181
radius={[4, 4, 0, 0]}
8282
/>
8383
<Bar
8484
dataKey="newPension"
85-
fill="hsl(160, 60%, 45%)"
85+
fill={chartConfig.newPension.color}
8686
name="Nowa Emerytura"
8787
radius={[4, 4, 0, 0]}
8888
/>
8989
<Bar
9090
dataKey="improvement"
91-
fill="hsl(220, 70%, 50%)"
91+
fill={chartConfig.improvement.color}
9292
name="Poprawa"
9393
radius={[4, 4, 0, 0]}
9494
/>

apps/web/app/dashboard/[tokenID]/_components/charts/work-longer-chart.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ export function WorkLongerChart({ data }: WorkLongerChartProps) {
3535
const chartConfig = {
3636
currentPension: {
3737
label: "Aktualna Emerytura",
38-
color: "hsl(0, 70%, 50%)",
38+
color: "rgb(255,179,79)",
3939
},
4040
newPension: {
4141
label: "Nowa Emerytura",
42-
color: "hsl(160, 60%, 45%)",
42+
color: "rgb(0, 120, 52)",
4343
},
4444
improvement: {
4545
label: "Poprawa",
46-
color: "hsl(220, 70%, 50%)",
46+
color: "rgb(0, 65, 110)",
4747
},
4848
};
4949

@@ -68,9 +68,9 @@ export function WorkLongerChart({ data }: WorkLongerChartProps) {
6868
content={<ChartTooltipContent />}
6969
formatter={(value: number, name: string) => {
7070
if (name === "improvement") {
71-
return [`${value.toLocaleString()} zł`, "Poprawa"];
71+
return [`${value.toLocaleString()} `, "Poprawa"];
7272
}
73-
return [`${value.toLocaleString()} zł`, name];
73+
return [`${value.toLocaleString()} `, name];
7474
}}
7575
/>
7676
<Legend
@@ -79,19 +79,19 @@ export function WorkLongerChart({ data }: WorkLongerChartProps) {
7979
/>
8080
<Bar
8181
dataKey="currentPension"
82-
fill="hsl(0, 70%, 50%)"
82+
fill={chartConfig.currentPension.color}
8383
name="Aktualna Emerytura"
8484
radius={[4, 4, 0, 0]}
8585
/>
8686
<Bar
8787
dataKey="newPension"
88-
fill="hsl(160, 60%, 45%)"
88+
fill={chartConfig.newPension.color}
8989
name="Nowa Emerytura"
9090
radius={[4, 4, 0, 0]}
9191
/>
9292
<Bar
9393
dataKey="improvement"
94-
fill="hsl(220, 70%, 50%)"
94+
fill={chartConfig.improvement.color}
9595
name="Poprawa"
9696
radius={[4, 4, 0, 0]}
9797
/>

apps/web/app/dashboard/[tokenID]/_components/dashboard-form.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ import { useMutation } from "@tanstack/react-query";
2626
import { CircleAlert as AlertCircle, Calculator } from "lucide-react";
2727
import { useRouter } from "next/navigation";
2828
import { useForm } from "react-hook-form";
29-
import { usePensionScenarios } from "../../../_shared/hooks/use-pension-scenarios";
3029
import { sendSimulationClient } from "../../../form/_api/send-simulation";
30+
import { addScenario } from "../_utils/scenario-storage";
3131
import { pensionFormSchema, type PensionFormData } from "./schema";
3232

3333
// Transform form data to API format
@@ -69,7 +69,6 @@ interface DashboardFormProps {
6969

7070
export function DashboardForm({ initialData }: DashboardFormProps) {
7171
const router = useRouter();
72-
const { addScenario } = usePensionScenarios();
7372

7473
const {
7574
register,
@@ -104,9 +103,15 @@ export function DashboardForm({ initialData }: DashboardFormProps) {
104103

105104
// Zapisz dane do localStorage
106105
addScenario({
107-
id: data.id,
108-
age: variables.age,
109-
contractType: variables.contractType,
106+
actualId: data.id,
107+
name: `Scenariusz ${new Date().toLocaleDateString("pl-PL")}`,
108+
description: `Symulacja dla ${variables.age}-letniego ${variables.gender === "male" ? "mężczyzny" : "kobiety"}`,
109+
parameters: {
110+
age: variables.age,
111+
expectedPension: variables.targetPension,
112+
tokenID: data.id,
113+
typeOfEmployment: variables.contractType,
114+
},
110115
});
111116

112117
// Przekieruj na dashboard z ID symulacji

apps/web/app/dashboard/[tokenID]/_components/layout/.gitkeep

Lines changed: 0 additions & 1 deletion
This file was deleted.

apps/web/app/dashboard/[tokenID]/_components/layout/top-kpi-cards.tsx

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { Card, CardContent, CardHeader, CardTitle } from "@hackathon/ui";
2-
import { TrendingUp, Calendar, Percent, Target } from "lucide-react";
2+
import { Calendar, Percent, Target, TrendingUp } from "lucide-react";
33

44
interface TopKpiCardsProps {
55
kpiData: {
66
projectedPension: number;
7+
expectedPension: number;
78
currentSalary: number;
89
replacementRate: number;
910
yearsToRetirement: number;
@@ -15,12 +16,20 @@ interface TopKpiCardsProps {
1516
export function TopKpiCards({ kpiData }: TopKpiCardsProps) {
1617
const {
1718
projectedPension,
18-
// expectedPension,
19-
currentSalary,
19+
expectedPension,
2020
replacementRate,
2121
yearsToRetirement,
2222
} = kpiData;
2323

24+
const difference = projectedPension - expectedPension;
25+
26+
const colorClass =
27+
difference > 0
28+
? "text-[#007834]" // Positive value
29+
: difference < 0
30+
? "text-[#f05e5e]" // Negative value
31+
: "text-muted-foreground"; // Neutral (zero) or fallback
32+
2433
return (
2534
<div className="grid gap-4 md:grid-cols-4">
2635
<Card className="bg-card border-border">
@@ -31,12 +40,11 @@ export function TopKpiCards({ kpiData }: TopKpiCardsProps) {
3140
<TrendingUp className="text-chart-1 h-4 w-4" />
3241
</CardHeader>
3342
<CardContent>
34-
<div className="text-foreground flex text-3xl font-bold">
35-
{projectedPension.toLocaleString("pl-PL")}{" "}
36-
<p className="text-muted-foreground my-auto ml-4 text-lg opacity-40">
43+
<div className="text-foreground flex-col text-3xl font-bold">
44+
{projectedPension.toLocaleString("pl-PL")} {""}
45+
<p className={`${colorClass} my-auto text-lg opacity-40`}>
3746
{"("}
38-
{/* {(projectedPension - expectedPension).toLocaleString("pl-PL")} zł */}
39-
{(projectedPension - currentSalary).toLocaleString("pl-PL")}
47+
{(projectedPension - expectedPension).toLocaleString("pl-PL")}
4048
{")"}
4149
</p>
4250
</div>
@@ -55,8 +63,7 @@ export function TopKpiCards({ kpiData }: TopKpiCardsProps) {
5563
</CardHeader>
5664
<CardContent>
5765
<div className="text-foreground text-3xl font-bold">
58-
{/* {expectedPension.toLocaleString("pl-PL")} zł */}
59-
{currentSalary.toLocaleString("pl-PL")}
66+
{expectedPension.toLocaleString("pl-PL")}
6067
</div>
6168
<p className="text-muted-foreground mt-1 text-xs">
6269
{/* Docelowa kwota emerytury */}

0 commit comments

Comments
 (0)