diff --git a/backend/src/routes/program.ts b/backend/src/routes/program.ts index c1cd0b7b..05e24645 100644 --- a/backend/src/routes/program.ts +++ b/backend/src/routes/program.ts @@ -9,7 +9,6 @@ import * as ProgramValidator from "../validators/program"; const router = express.Router(); -router.post("/", ProgramValidator.createProgram, ProgramController.createProgram); router.patch("/:id", ProgramValidator.updateProgram, ProgramController.updateProgram); router.post("/create", ProgramValidator.createProgram, ProgramController.createProgram); router.get("/all", ProgramController.getAllPrograms); diff --git a/frontend/public/programs/Options.png b/frontend/public/programs/Options.png new file mode 100644 index 00000000..c0ee6e47 Binary files /dev/null and b/frontend/public/programs/Options.png differ diff --git a/frontend/public/programs/Students.png b/frontend/public/programs/Students.png new file mode 100644 index 00000000..a0613fc8 Binary files /dev/null and b/frontend/public/programs/Students.png differ diff --git a/frontend/public/programs/Vector.png b/frontend/public/programs/Vector.png new file mode 100644 index 00000000..a0613fc8 Binary files /dev/null and b/frontend/public/programs/Vector.png differ diff --git a/frontend/src/components/ProgramCard.tsx b/frontend/src/components/ProgramCard.tsx new file mode 100644 index 00000000..76d823cf --- /dev/null +++ b/frontend/src/components/ProgramCard.tsx @@ -0,0 +1,127 @@ +import { Poppins } from "next/font/google"; +import React from "react"; + +import { Program } from "../api/programs"; +import ProgramFormButton from "../components/ProgramFormButton"; +import { useWindowSize } from "../hooks/useWindowSize"; +import { cn } from "../lib/utils"; + +import { ProgramData } from "./ProgramForm/types"; + +const poppins = Poppins({ weight: ["400", "700"], style: "normal", subsets: [] }); + +export type CardProps = { + program: Program; + type: string; + title: string; + dates: string; + color: string; + className?: string; +}; + +export function ProgramCard({ program, type, title, dates, color, className }: CardProps) { + const { isTablet } = useWindowSize(); + + let outerDivClass = "text-white grow overflow-hidden tracking-wide leading-6"; + let topDivClass = "flex flex-row"; + console.log(topDivClass); + let botDivClass = "text-black bg-white"; + let typeClass; + let titleClass; + let optionsDiv = "grow"; + const optionsClass = "relative float-right hover:cursor-pointer"; + let dateClass; + // let numClass; + // let numTextClass; + // let iconClass = "relative"; + + let tempDate = new Date(program.startDate); + const startDate = + ("0" + (tempDate.getMonth() + 1)).slice(-2) + + "/" + + ("0" + tempDate.getDate()).slice(-2) + + "/" + + tempDate.getFullYear(); + + tempDate = new Date(program.endDate); + const endDate = + ("0" + (tempDate.getMonth() + 1)).slice(-2) + + "/" + + ("0" + tempDate.getDate()).slice(-2) + + "/" + + tempDate.getFullYear(); + + const programData: ProgramData = { + name: program.name, + abbreviation: program.abbreviation, + type: program.type, + days: program.daysOfWeek, + start: startDate, + end: endDate, + color: program.color, + renewal: "", + hourly: "", + sessions: [[]], + }; + + if (isTablet) { + outerDivClass += " rounded-lg h-36"; + topDivClass += " h-20"; + botDivClass += " h-16"; + typeClass = cn("uppercase relative text-[10px] top-2 left-3", poppins.className); + titleClass = cn("capitalize relative text-sm top-2 left-3 font-bold", poppins.className); + optionsDiv += " pr-[8px] pt-[12px]"; + dateClass = cn("relative text-[10px] top-2 left-3", poppins.className); + // numClass = "h-5 gap-x-1.5 flex flex-row relative top-2 left-3"; + // numTextClass = cn("text-[10px]", poppins.className); + // iconClass = "h-2 w-3 mt-[7px]"; + } else { + outerDivClass += " rounded-2xl h-68"; + topDivClass += " h-36"; + botDivClass += " h-32"; + typeClass = cn("uppercase relative text-sm top-5 left-7", poppins.className); + titleClass = cn("capitalize relative text-3xl top-8 left-7 font-bold", poppins.className); + optionsDiv += " pr-[16px] pt-[24px]"; + dateClass = cn("relative text-base top-5 left-7", poppins.className); + // numClass = "h-8 gap-x-1.5 flex flex-row relative top-14 left-7"; + // numTextClass = cn("text-base", poppins.className); + // iconClass = "h-3 w-[18px] mt-[5px]"; + } + + if (className) { + outerDivClass = cn(outerDivClass, className); + } + + console.log(topDivClass); + + return ( +
+
+
+

{type} Program

+

{title}

+
+
+
+ {" "} +
+
+
+
+

{dates}

+ {/* +
+ students +

{numStudents} Students

+
+ */} +
+
+ ); +} diff --git a/frontend/src/components/ProgramFormButton.tsx b/frontend/src/components/ProgramFormButton.tsx index aaab647f..7ddd5d44 100644 --- a/frontend/src/components/ProgramFormButton.tsx +++ b/frontend/src/components/ProgramFormButton.tsx @@ -1,3 +1,4 @@ +import Image from "next/image"; import { useMemo, useState } from "react"; import { SubmitHandler, useForm } from "react-hook-form"; @@ -55,14 +56,27 @@ export default function ProgramFormButton({ return !isMobile ? ( <> - -