Merge pull request #1 from Fayorg/dev

Merging dev to master for build testing
This commit is contained in:
Elie Baier 2023-12-05 21:27:33 +01:00 committed by GitHub
commit a885de52cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 57 additions and 91 deletions

View File

@ -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('');
@ -17,15 +15,13 @@ export default function Home() {
}
return (
<div>
<h1>Calendrier-avent</h1>
<div className={""}>
<h1 className={"border-l-blue-600"}>Calendrier-avent</h1>
<p>Please enter the password :</p>
<form onSubmit={handleSubmit}>
<input type="password" id="password" name="password" value={password} onChange={(e) => setPassword(e.target.value)}></input>
<input type="submit" value="Submit"></input>
</form>
<Button>Button</Button>
<Input type="text" />
</div>
);
}

View File

@ -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 (
<>
<Head>
<title>Solar</title>
<meta name="description" content="Generated by create next app" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" href="/favicon.ico" />
</Head>
<main>
{ gradesCount ?
<>
{console.log("datas", gradesArray)}
<Bar data={gradesCount} width={100} height={40} options={options}/>
</>
: null
}
</main>
</>
<div>
<DayCard day={1} enabled={true} name={"Michal Polka"}/>
</div>
)
}

View File

@ -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<typeof Card>
interface DayCardProps extends CardProps {
day: number,
name: string,
enabled: boolean
}
export function DayCard({ className, ...props }: DayCardProps) {
return (
<Card className={cn("w-[300px]", className)} {...props}>
<CardContent className="grid gap-4">
{props.enabled ?
<div className="rounded-md p-4">
<h1 className="text-[100px] font-bold bg-red-700">1</h1>
<div className="flex flex-col bg-blue-500">
<h2 className="text-2xl font-bold">Michal Polka</h2>
<p className="text-xl">Description</p>
</div>
</div>
:
<div className="rounded-md p-4">
<h1 className="text-[100px] font-bold bg-red-700">1</h1>
<div className="flex flex-col bg-blue-500">
<h2 className="text-2xl font-bold">Michal Polka</h2>
<p className="text-xl">Description</p>
</div>
</div>
}
</CardContent>
</Card>
)
}

View File

@ -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"],