Skip to content

Commit

Permalink
Visualize Student Data
Browse files Browse the repository at this point in the history
  • Loading branch information
mraysu committed Oct 30, 2024
1 parent a5a3912 commit 78f0a9e
Show file tree
Hide file tree
Showing 5 changed files with 376 additions and 247 deletions.
6 changes: 5 additions & 1 deletion frontend/src/api/programs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ export type Enrollment = {
dateUpdated: Date;
hoursLeft: number;
schedule: string[];
sessionTime: string[];
sessionTime: {
start_time: string;
end_time: string;
};
required: true;
startDate: Date;
renewalDate: Date;
authNumber: string;
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/api/students.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export type Student = CreateStudentRequest & {
medication: string;
otherString: string;
progressNotes?: string[];
UCINumber?: string;
conservation?: boolean;
};

export async function createStudent(student: CreateStudentRequest): Promise<APIResult<Student>> {
Expand Down Expand Up @@ -43,7 +45,6 @@ export async function getAllStudents(): Promise<APIResult<[Student]>> {

export async function getStudent(id: string): Promise<APIResult<Student>> {
try {
console.log(id);
const response = await GET(`/student/${id}`);
const json = (await response.json()) as Student;
return { success: true, data: json };
Expand Down
23 changes: 15 additions & 8 deletions frontend/src/components/StudentFormButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import Image from "next/image";
import { Dispatch, SetStateAction, useContext, useState } from "react";
import { SubmitHandler, useForm } from "react-hook-form";

Expand Down Expand Up @@ -161,13 +160,21 @@ export default function StudentFormButton({
<Dialog open={openForm} onOpenChange={setOpenForm}>
<DialogTrigger asChild>
{type === "edit" ? (
<Image
src="/eye.svg"
alt="view student"
width={40}
height={40}
className="cursor-pointer"
/>
<div className="flex cursor-pointer space-x-[5px]">
<svg
width="20"
height="22"
viewBox="0 0 10 11"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M9.02645 1.38024C8.86568 1.21944 8.67481 1.09189 8.46475 1.00486C8.25468 0.917838 8.02953 0.873047 7.80215 0.873047C7.57477 0.873047 7.34962 0.917838 7.13955 1.00486C6.92948 1.09189 6.73861 1.21944 6.57785 1.38024L1.37812 6.57996C1.13117 6.82707 0.955067 7.13594 0.868192 7.47432L0.293527 9.71089C0.279277 9.76654 0.279787 9.82494 0.295008 9.88033C0.310229 9.93573 0.339634 9.98619 0.38032 10.0267C0.421006 10.0673 0.471565 10.0965 0.527006 10.1116C0.582447 10.1266 0.640852 10.1269 0.696453 10.1125L2.93236 9.53849C3.27081 9.45177 3.57971 9.27564 3.82672 9.02856L9.02645 3.82884C9.18724 3.66807 9.3148 3.4772 9.40182 3.26713C9.48884 3.05707 9.53364 2.83191 9.53364 2.60454C9.53364 2.37716 9.48884 2.152 9.40182 1.94194C9.3148 1.73187 9.18724 1.541 9.02645 1.38024ZM7.04485 1.84723C7.24569 1.64638 7.5181 1.53355 7.80215 1.53355C8.08619 1.53355 8.3586 1.64638 8.55945 1.84723C8.7603 2.04808 8.87313 2.32049 8.87313 2.60454C8.87313 2.88858 8.7603 3.16099 8.55945 3.36184L8.04489 3.87639L6.53029 2.36179L7.04485 1.84723ZM6.06329 2.82879L7.5779 4.34339L3.35973 8.56156C3.19616 8.72481 2.99177 8.84115 2.76789 8.89843L1.0723 9.33439L1.50825 7.6388C1.56511 7.41474 1.68151 7.21024 1.84512 7.04696L6.06329 2.82879Z"
fill="black"
/>
</svg>
<div>Edit Mode</div>
</div>
) : (
<Button
label="Add Student"
Expand Down
Loading

0 comments on commit 78f0a9e

Please sign in to comment.