From 15516490a826568cbfaccaa08b4d0136b0731188 Mon Sep 17 00:00:00 2001 From: Fayorg Date: Tue, 5 Dec 2023 21:16:39 +0100 Subject: [PATCH 1/2] fix: removed shadcn imports --- app/page.tsx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/page.tsx b/app/page.tsx index 24afb48..40740f3 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -2,8 +2,6 @@ import { useState } from 'react'; import { useRouter } from 'next/navigation'; -import { Button } from "@components/ui/button"; -import { Input } from "@/components/ui/input" export default function Home() { const [password, setPassword] = useState(''); @@ -24,8 +22,6 @@ export default function Home() { setPassword(e.target.value)}> - - ); } From 0c30f3b43a41ae07c7e377b41ae0b7244bbaed58 Mon Sep 17 00:00:00 2001 From: timhaller <67918170+timhaller@users.noreply.github.com> Date: Tue, 5 Dec 2023 21:20:43 +0100 Subject: [PATCH 2/2] Added new card --- app/page.tsx | 4 +- app/results/page.tsx | 88 ++--------------------------------- components/custom/dayCard.tsx | 48 +++++++++++++++++++ tsconfig.json | 4 +- 4 files changed, 57 insertions(+), 87 deletions(-) create mode 100644 components/custom/dayCard.tsx diff --git a/app/page.tsx b/app/page.tsx index 40740f3..99e9c00 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -15,8 +15,8 @@ export default function Home() { } return ( -
-

Calendrier-avent

+
+

Calendrier-avent

Please enter the password :

setPassword(e.target.value)}> diff --git a/app/results/page.tsx b/app/results/page.tsx index d03a1de..e278635 100644 --- a/app/results/page.tsx +++ b/app/results/page.tsx @@ -1,89 +1,11 @@ "use client"; -import {Bar} from "react-chartjs-2"; -import prisma from "@lib/prisma"; - -import Head from 'next/head' - -import { - Chart as ChartJS, - CategoryScale, - LinearScale, - PointElement, - LineElement, - Title, - Tooltip, - Legend, - Filler, -} from "chart.js"; - -ChartJS.register ( - CategoryScale, - LinearScale, - PointElement, - LineElement, - Filler, - Title, - Tooltip, - Legend -); - -interface IPower { - date: string, - value: number -} - -interface IChart { - labels : string[], - datasets: [ - { - label: string, - data: number[], - fill: true, - backgroundColor: string, - borderColor: string, - }, - ], -} - -export default async function Results() { - const grades = await prisma.grade.findMany() - const gradesArray = grades.map(grade => grade.grade.toString()) - const allGrades = ["1", "1,5", "2", "2,5", "3", "3,5", "4", "4,5", "5", "5,5", "6"] - const gradesCount = allGrades.map(grade => gradesArray.filter(g => g === grade).length) - console.log(allGrades) - console.log(gradesCount) - - const options = { - responsive: true, - plugins: { - legend: { - position: 'top' as const, - }, - title: { - display: true, - text: 'Energy Production/Consumption', - }, - }, - }; +import {DayCard} from "@components/custom/dayCard"; +export default function Results() { return ( - <> - - Solar - - - - -
- { gradesCount ? - <> - {console.log("datas", gradesArray)} - - - : null - } -
- +
+ +
) } diff --git a/components/custom/dayCard.tsx b/components/custom/dayCard.tsx new file mode 100644 index 0000000..47b0d92 --- /dev/null +++ b/components/custom/dayCard.tsx @@ -0,0 +1,48 @@ +"use client"; + +import { BellRing, Check } from "lucide-react" + +import { cn } from "@/lib/utils" +import { Button } from "@/components/ui/button" +import { + Card, + CardContent, + CardDescription, + CardFooter, + CardHeader, + CardTitle, +} from "@/components/ui/card" + +type CardProps = React.ComponentProps + +interface DayCardProps extends CardProps { + day: number, + name: string, + enabled: boolean +} + +export function DayCard({ className, ...props }: DayCardProps) { + return ( + + + {props.enabled ? +
+

1

+
+

Michal Polka

+

Description

+
+
+ : +
+

1

+
+

Michal Polka

+

Description

+
+
+ } +
+
+ ) +} diff --git a/tsconfig.json b/tsconfig.json index 8f2577e..fbc8f6b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -21,8 +21,8 @@ "paths": { "@/*": ["./*"], "@components/*": ["./components/*"], - "@lib/*": ["./lib/*"], - "@styles/*": ["./styles/*"], + "@lib/*": ["/lib/*"], + "@styles/*": ["/styles/*"], } }, "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],