|
| 1 | +"use client"; |
| 2 | + |
| 3 | +import { GenericInfoChip } from "@/components/GenericInfoChip"; |
| 4 | +import LocationInfoChipDetails from "@/components/LocationInfoChipDetails"; |
| 5 | +import { useSidebar } from "@/components/SidebarContext"; |
| 6 | +import StudentInfoChipDetails from "@/components/StudentInfoChipDetails"; |
| 7 | +import { Location } from "@/types/api/location"; |
| 8 | +import { Student } from "@/types/api/student"; |
| 9 | + |
| 10 | +const Page = () => { |
| 11 | + const { openSidebar } = useSidebar(); |
| 12 | + const { student: defaultStudent, location: defaultLocation } = |
| 13 | + getTestChipData(); |
| 14 | + |
| 15 | + return ( |
| 16 | + <div className="font-sans min-h-screen flex flex-col items-center justify-center p-8 sm:p-20 max-w-2xl mx-auto"> |
| 17 | + <h1 className="text-3xl font-bold mb-4">Info Chip Demo Page</h1> |
| 18 | + |
| 19 | + <h2 className="text-2xl font-bold mb-4">Test Sidebar</h2> |
| 20 | + <button |
| 21 | + className="bg-gray-200 px-3 py-1 rounded mb-6" |
| 22 | + onClick={() => |
| 23 | + openSidebar( |
| 24 | + "test-sidebar", |
| 25 | + "Example", |
| 26 | + "Example Description", |
| 27 | + <div>Hello from Sidebar!</div> |
| 28 | + ) |
| 29 | + } |
| 30 | + > |
| 31 | + Open Sidebar |
| 32 | + </button> |
| 33 | + |
| 34 | + <h2 className="text-2xl font-bold mb-4">Student Info Chip</h2> |
| 35 | + <GenericInfoChip |
| 36 | + chipKey="student-1" |
| 37 | + shortName={`${defaultStudent.firstName} ${defaultStudent.lastName}`} |
| 38 | + title="Student Information" |
| 39 | + description="Detailed information about the selected student" |
| 40 | + sidebarContent={<StudentInfoChipDetails data={defaultStudent} />} |
| 41 | + /> |
| 42 | + |
| 43 | + <h2 className="text-2xl font-bold mt-6 mb-4">Location Info Chip</h2> |
| 44 | + <GenericInfoChip |
| 45 | + chipKey="location-1" |
| 46 | + title="Location Information" |
| 47 | + description="Detailed information about the selected location" |
| 48 | + shortName={defaultLocation.formattedAddress} |
| 49 | + sidebarContent={<LocationInfoChipDetails data={defaultLocation} />} |
| 50 | + /> |
| 51 | + </div> |
| 52 | + ); |
| 53 | +}; |
| 54 | + |
| 55 | +export function getTestChipData() { |
| 56 | + const student: Student = { |
| 57 | + id: 1, |
| 58 | + firstName: "Mr", |
| 59 | + lastName: "Beast", |
| 60 | + contactPreference: "text", |
| 61 | + |
| 62 | + pid: "123456789", |
| 63 | + lastRegistered: new Date("2023-08-15"), |
| 64 | + phoneNumber: "555-1234", |
| 65 | + }; |
| 66 | + |
| 67 | + const location: Location = { |
| 68 | + id: 1, |
| 69 | + warningCount: 2, |
| 70 | + citationCount: 1, |
| 71 | + hasActiveHold: true, |
| 72 | + holdExpirationDate: new Date("2025-12-31"), |
| 73 | + googlePlaceId: "abcd1234", |
| 74 | + formattedAddress: "123 Main St, Chapel Hill, NC", |
| 75 | + latitude: 35.9132, |
| 76 | + longitude: -79.0558, |
| 77 | + streetNumber: "123", |
| 78 | + streetName: "Main St", |
| 79 | + unit: "Apt 4", |
| 80 | + city: "Chapel Hill", |
| 81 | + county: "Orange", |
| 82 | + state: "NC", |
| 83 | + country: "USA", |
| 84 | + zipCode: "27514", |
| 85 | + }; |
| 86 | + |
| 87 | + return { student, location }; |
| 88 | +} |
| 89 | + |
| 90 | +export default Page; |
0 commit comments