new api structure

This commit is contained in:
2025-09-09 16:48:34 -04:00
parent 8a38d0ecc1
commit f35e213963
3 changed files with 13 additions and 47 deletions
+4 -27
View File
@@ -1,34 +1,11 @@
import type { NFLMatchupState, NFLPlayer } from "../../utils/types";
export default function PlayerCell({
player,
matchupData,
}: {
player: NFLPlayer | null;
matchupData: NFLMatchupState | null;
}) {
const getScoreForPlayer = () => {
const rosterPosition = matchupData?.starters.findIndex(
(v) => v === player?.player_id
);
return matchupData?.starters_points[rosterPosition!] || 0;
};
const truncatedName = () => {
if (player) {
const firstName = player?.full_name.split(" ")[0];
const shortened =
firstName[0].toUpperCase() + "." + " " + player.last_name;
return shortened;
}
};
import type { NFLPlayer } from "../../utils/types";
export default function PlayerCell({ player }: { player: NFLPlayer | null }) {
if (player && player.full_name) {
return (
<div className="flex-wrap flex space-x-2">
<div>
<h1 className="font-semibold text-1xl">{truncatedName()}</h1>
<h1 className="font-semibold text-1xl">{player.abv_name}</h1>
<p>
{player?.position} · {player?.team} {player?.injury_status && "·"}{" "}
{player?.injury_status && (
@@ -39,7 +16,7 @@ export default function PlayerCell({
</p>
</div>
<p className="flex justify-center items-center">
<span className="font-semibold">{getScoreForPlayer()}</span>
<span className="font-semibold">{player.points}</span>
</p>
<div className="inline-block min-h-[1em] w-0.5 self-stretch bg-neutral-100 dark:bg-white/30"></div>
</div>