Skip to content

Commit

Permalink
Merge pull request #24 from RoBorregos/on-call/patch/interviewPerTeam
Browse files Browse the repository at this point in the history
Interview times per team
  • Loading branch information
GilMM27 authored Nov 2, 2024
2 parents ea2af42 + 2c132ed commit 4de17a1
Show file tree
Hide file tree
Showing 2 changed files with 109 additions and 78 deletions.
30 changes: 30 additions & 0 deletions src/app/_components/team/interview.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"times": {
"Maze": "10:45am",
"ByteBites": "10:45am",
"circuitbreaker": "10:57am",
"Las chichas superponedoras": "10:57am",
"Equestria Kids": "11:09am",
"Robotertulia": "11:09am",
"S. E. E. S.": "11:21am",
"La Mera Trompa del Tren": "11:21am",
"Foreños": "11:40am",
"Paftron 3": "11:40am",
"Borregos Tim": "11:52am",
"Robonautas": "11:52am",
"Iron Codes": "12:04pm",
"Syntax": "12:04pm",
"Equipo3": "12:16pm",
"REBE": "12:16pm",
"The Best Team": "12:35pm",
"JED": "12:35pm",
"Capibot": "12:47pm",
"Spacekats": "12:47pm",
"Jarim team": "12:59pm",
"Canelitas": "12:59pm",
"Atomix": "1:11pm",
"Pollos Locos": "1:11pm",
"Los mecánicos": "2:00pm",
"Tunas terrier": "2:00pm"
}
}
157 changes: 79 additions & 78 deletions src/app/_components/team/team.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,96 +8,97 @@ import SwitchButton from "./switchButton";
import { useCallback, useState } from "react";
import { TeamType } from "rbrgs/server/api/routers/team";
import Results from "./results";
import interviewData from "./interview.json";

interface Data {
col1: string;
col2: string;
col1: string;
col2: string;
}

function transformChallengeData(challenges: Challenge[]): Data[] {
return challenges.map((challenge, key) => ({
col1: challenge.time.toLocaleTimeString("en-US", {
hour: "numeric",
minute: "2-digit",
hour12: true,
}),
col2: challenge.name,
}));
return challenges.map((challenge, key) => ({
col1: challenge.time.toLocaleTimeString("en-US", {
hour: "numeric",
minute: "2-digit",
hour12: true,
}),
col2: challenge.name,
}));
}

function transformInterviewData(members: User[]): Data[] {
return members.map((member, key) => ({
col1: member.interviewTime
? member.interviewTime.toLocaleTimeString("en-US", {
hour: "numeric",
minute: "2-digit",
hour12: true,
})
: "",
col2: member.name ? member.name : "",
}));
return members.map((member, key) => ({
col1: member.interviewTime
? member.interviewTime.toLocaleTimeString("en-US", {
hour: "numeric",
minute: "2-digit",
hour12: true,
})
: "",
col2: member.name ? member.name : "",
}));
}

const TeamInfo = ({ team }: { team: TeamType }) => {

const [variant, setSelected] = useState("INFO");
const toggleVariant = useCallback(() => {
setSelected(variant === "INFO" ? "RESULTS" : "INFO");
}, [variant]);

return (
<div>
<SwitchButton variant={variant} onClick={toggleVariant} />
{team?.name ? (

<div className="pb-40">

{variant === "INFO" ? (
<Schedules team={team} />
) : (
<Results team={team} />
)}


<h1 className="mb-5 text-center text-4xl mt-16">Documents</h1>
<Input teamId={team.id} prevLink={team.link ?? ""} />
</div>
) : !team ? (
<div>
<div className="flex h-[30rem] items-center justify-center">
<Spinner size="lg" />
</div>
</div>
) : (
<div className="flex h-[30rem] items-center justify-center">
<Title title="No data found" />
</div>

)}
const [variant, setSelected] = useState("INFO");
const toggleVariant = useCallback(() => {
setSelected(variant === "INFO" ? "RESULTS" : "INFO");
}, [variant]);

return (
<div>
<SwitchButton variant={variant} onClick={toggleVariant} />
{team?.name ? (
<div className="pb-40">
{variant === "INFO" ? (
<Schedules team={team} />
) : (
<Results team={team} />
)}

<h1 className="mb-5 mt-16 text-center font-archivo text-4xl">
Documents
</h1>
<Input teamId={team.id} prevLink={team.link ?? ""} />
</div>
)
}

const Schedules = ({ team }: { team: TeamType }) => {
const rounds = team?.rounds;
return (
) : !team ? (
<div>
<h1 className="mb-5 text-center text-4xl ">Rounds</h1>
{rounds?.map((round, key) => (
<Table
key={key}
data={transformChallengeData(round.challenges)}
title={`Round ${round.number}`}
/>
))}

<h1 className="mb-5 text-center text-4xl mt-16">Interviews</h1>

<Table data={team?.members ? transformInterviewData(team.members) : []} title={""} />
<div className="flex h-[30rem] items-center justify-center">
<Spinner size="lg" />
</div>
</div>
)
}


) : (
<div className="flex h-[30rem] items-center justify-center">
<Title title="No data found" />
</div>
)}
</div>
);
};

export default TeamInfo;
const Schedules = ({ team }: { team: TeamType }) => {
const rounds = team?.rounds;
const interviewsTimes = interviewData.times;
return (
<div>
<h1 className="mb-5 text-center font-archivo text-4xl">Rounds</h1>
{rounds?.map((round, key) => (
<Table
key={key}
data={transformChallengeData(round.challenges)}
title={`Round ${round.number}`}
/>
))}

<h1 className="mb-5 mt-16 text-center font-archivo text-4xl">
Interview time
</h1>
<div className="text-center font-archivo text-3xl">
{interviewsTimes[team?.name as keyof typeof interviewsTimes] ??
"No interview time available, contact us"}
</div>
</div>
);
};

export default TeamInfo;

0 comments on commit 4de17a1

Please sign in to comment.