Skip to content

Commit

Permalink
fix: individual exchange classes showing options wrong
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaspalma committed Feb 6, 2025
1 parent 0f01565 commit 21e4922
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions src/components/admin/requests/cards/SingleStudentExchangeCard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState } from "react";
import { ClassDescriptor, UrgentRequest, UrgentRequestOption } from "../../../../@types"
import { ClassDescriptor, UrgentRequest } from "../../../../@types"
import { Card, CardContent, CardHeader, CardTitle } from "../../../ui/card";
import { Button } from "../../../ui/button";
import { ArrowRightIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react";
Expand Down Expand Up @@ -38,7 +38,7 @@ export const SingleStudentExchangeCard = ({
</CardTitle>
<ExchangeStatus exchange={exchangeState} />
</div>
<RequestDate
<RequestDate
date={exchange.date}
/>
</div>
Expand All @@ -61,7 +61,7 @@ export const SingleStudentExchangeCard = ({
</CardHeader>

<CardContent className="w-full ">
{open && exchange.options.map((option: UrgentRequestOption) => (
{open &&
<div className="flex flex-col gap-y-8" key={crypto.randomUUID()}>
<div className="flex justify-between">
<Person name={exchange.user_nmec} nmec={exchange.user_nmec} />
Expand All @@ -70,14 +70,17 @@ export const SingleStudentExchangeCard = ({
key={crypto.randomUUID()}
className="flex flex-col gap-y-2 items-center border-gray-200 border-2 rounded-md p-2 px-4"
>
<div className="flex gap-5 items-center">
<h2 className="font-bold">{option.course_unit.acronym}</h2>
<div className="flex gap-2 items-center">
<p>{option.class_user_goes_from.name}</p>
<ArrowRightIcon className="w-5 h-5" />
<p>{option.class_user_goes_to.name}</p>
<>{exchange.options.map((option) => (
<div key={crypto.randomUUID()} className="flex gap-5 items-center">
<h2 className="font-bold">{option.course_unit.acronym}</h2>
<div className="flex gap-2 items-center">
<p>{option.class_user_goes_from.name}</p>
<ArrowRightIcon className="w-5 h-5" />
<p>{option.class_user_goes_to.name}</p>
</div>
</div>
</div>
))}
</>
</div>
</div>
<div>
Expand All @@ -101,12 +104,12 @@ export const SingleStudentExchangeCard = ({
<p>{exchange.message}</p>
</div>
</div>
))}
}
</CardContent>

{open &&
<AdminRequestCardFooter
nmecs={[exchange.user_nmec]}
nmecs={[exchange.user_nmec]}
exchangeMessage={listEmailExchanges(
exchange.options.map(option => ({
participant_nmec: exchange.user_nmec,
Expand All @@ -119,7 +122,7 @@ export const SingleStudentExchangeCard = ({
requestId={exchange.id}
setExchange={setExchangeState}
courseId={exchange.options.map(option => option.course_unit.course)}
/>
/>
}
</Card>
</>
Expand Down

0 comments on commit 21e4922

Please sign in to comment.