From 287e684424c6526fd6599280ec13570fcf4d9a78 Mon Sep 17 00:00:00 2001 From: Alvaro Ortiz Date: Mon, 23 Oct 2023 18:19:11 -0700 Subject: [PATCH 01/11] interest form input components done --- src/app/cases/page.tsx | 26 ++++---- src/app/interest/page.tsx | 48 --------------- src/components/Button.tsx | 20 +++++++ src/components/CaseDetails/index.tsx | 35 +++++++++++ src/components/CaseDetails/styles.tsx | 42 +++++++++++++ src/components/InterestForm/index.tsx | 83 ++++++++++++++++++++++++++ src/components/InterestForm/styles.tsx | 66 ++++++++++++++++++++ src/components/ListingCard/index.tsx | 4 +- src/components/Radio.tsx | 8 +++ 9 files changed, 268 insertions(+), 64 deletions(-) delete mode 100644 src/app/interest/page.tsx create mode 100644 src/components/Button.tsx create mode 100644 src/components/CaseDetails/index.tsx create mode 100644 src/components/CaseDetails/styles.tsx create mode 100644 src/components/InterestForm/index.tsx create mode 100644 src/components/InterestForm/styles.tsx create mode 100644 src/components/Radio.tsx diff --git a/src/app/cases/page.tsx b/src/app/cases/page.tsx index 7b84cf79..b94f7694 100644 --- a/src/app/cases/page.tsx +++ b/src/app/cases/page.tsx @@ -2,19 +2,18 @@ import { useEffect, useState } from 'react'; import { UUID } from 'crypto'; -import { CaseListing } from '@/types/schema'; -import { getNCases } from '@/api/supabase/queries/cases'; import ListingCard from '@/components/ListingCard'; -import { H1, H2 } from '@/styles/text'; import FilterDropdown from '@/components/FilterDropdown'; +import { CaseListing } from '../../types/schema'; +import { getNCases } from '../../api/supabase/queries/cases'; +import CaseDetailDisplay from '../../components/CaseDetails'; import { CardColumn, - CaseDetailDisplay, - CaseDetails, - FiltersContainer, MainDisplay, PageContainer, + FiltersContainer, } from './styles'; +import { H1 } from '../../styles/text'; type FilterType = { remote: string; @@ -27,6 +26,7 @@ type FilterType = { export default function Page() { const [caseData, setCaseData] = useState([]); const [selectedCard, setSelectedCard] = useState(); + const [caseInfo, setCaseInfo] = useState(); const [caseFilters, setCaseFilters] = useState({ remote: 'Remote/In Person', role: 'Attorney/Interpreter', @@ -39,10 +39,10 @@ export default function Page() { useEffect(() => { getNCases(20).then(casesData => { setCaseData(casesData); + setCaseInfo(casesData[0]); }); }, []); - // page structure return (

Browse Available Cases

@@ -126,16 +126,14 @@ export default function Page() { key={c.id} caseData={c} isSelected={c.id === selectedCard} - onClick={() => setSelectedCard(c.id)} + onClick={() => { + setSelectedCard(c.id); + setCaseInfo(c); + }} /> ))} - - {/* proof of concept -- to turn into component later */} - -

Case details.

-
-
+ {caseInfo && }
); diff --git a/src/app/interest/page.tsx b/src/app/interest/page.tsx deleted file mode 100644 index 44e8e6ff..00000000 --- a/src/app/interest/page.tsx +++ /dev/null @@ -1,48 +0,0 @@ -'use client'; - -import { useState } from 'react'; -import { UUID } from 'crypto'; -import { insertInterest } from '../../api/supabase/queries/interest'; -import { Interest } from '../../types/schema'; -import styles from '../page.module.css'; - -export default function Interest() { - const [reason, setReason] = useState(''); - - const handleInsert = async () => { - if (reason !== '') { - const newInterest: Interest = { - // hardcoded values for now - id: crypto.randomUUID() as UUID, - listing_id: '36b8f84d-df4e-4d49-b662-bcde71a8764f', - listing_type: 100, - user_id: '36b8f84d-df4e-4d49-b662-bcde71a8764f', - form_response: { - interestType: 'IJP-6-test', - interestReason: reason, - start_date: 'Jan 1 2020 8:00:00 PM UTC-7', - }, - }; - await insertInterest(newInterest); - setReason(''); - } else { - // console.log('cannot create an empty interest'); - } - }; - - return ( -
-
Interest Form
-
-