├── src
├── App.css
├── pages
│ ├── TeamsDetails.jsx
│ ├── PlayersPage.jsx
│ ├── TeamsPage.jsx
│ ├── HomePage.jsx
│ └── PlayersDetails.jsx
├── images
│ ├── Home.png
│ ├── Team.png
│ ├── Players.png
│ ├── court-iq.png
│ ├── Player_Info.png
│ ├── court-iq-high-resolution-logo.png
│ └── Screenshot 2024-10-23 at 1.35.22 PM.png
├── index.css
├── api
│ ├── teamsApi.jsx
│ └── playersApi.jsx
├── main.jsx
├── components
│ ├── PlayerCard.jsx
│ └── Nav.jsx
├── App.jsx
└── assets
│ └── react.svg
├── postcss.config.js
├── vite.config.js
├── tailwind.config.js
├── .gitignore
├── index.html
├── package.json
├── eslint.config.js
├── README.md
└── public
└── vite.svg
/src/App.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/pages/TeamsDetails.jsx:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/images/Home.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AddyRdz/CourtIQ_Frontend/HEAD/src/images/Home.png
--------------------------------------------------------------------------------
/src/images/Team.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AddyRdz/CourtIQ_Frontend/HEAD/src/images/Team.png
--------------------------------------------------------------------------------
/src/images/Players.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AddyRdz/CourtIQ_Frontend/HEAD/src/images/Players.png
--------------------------------------------------------------------------------
/src/images/court-iq.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AddyRdz/CourtIQ_Frontend/HEAD/src/images/court-iq.png
--------------------------------------------------------------------------------
/src/images/Player_Info.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AddyRdz/CourtIQ_Frontend/HEAD/src/images/Player_Info.png
--------------------------------------------------------------------------------
/src/index.css:
--------------------------------------------------------------------------------
1 | @import "tailwindcss/base";
2 | @import "tailwindcss/components";
3 | @import "tailwindcss/utilities";
4 |
5 |
--------------------------------------------------------------------------------
/postcss.config.js:
--------------------------------------------------------------------------------
1 | 14
2 | export default {
3 | plugins: {
4 | tailwindcss: {},
5 | autoprefixer: {},
6 | }
7 | }
--------------------------------------------------------------------------------
/src/images/court-iq-high-resolution-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AddyRdz/CourtIQ_Frontend/HEAD/src/images/court-iq-high-resolution-logo.png
--------------------------------------------------------------------------------
/src/images/Screenshot 2024-10-23 at 1.35.22 PM.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AddyRdz/CourtIQ_Frontend/HEAD/src/images/Screenshot 2024-10-23 at 1.35.22 PM.png
--------------------------------------------------------------------------------
/src/api/teamsApi.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | function teamsApi() {
4 | return (
5 |
teamsApi
6 | )
7 | }
8 |
9 | export default teamsApi
--------------------------------------------------------------------------------
/src/api/playersApi.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | function playersApi() {
4 | return (
5 | playersApi
6 | )
7 | }
8 |
9 | export default playersApi
--------------------------------------------------------------------------------
/vite.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite'
2 | import react from '@vitejs/plugin-react'
3 |
4 | // https://vite.dev/config/
5 | export default defineConfig({
6 | plugins: [react()],
7 | })
8 |
--------------------------------------------------------------------------------
/src/main.jsx:
--------------------------------------------------------------------------------
1 | import { StrictMode } from 'react'
2 | import { createRoot } from 'react-dom/client'
3 | import { BrowserRouter } from 'react-router-dom'
4 | import './index.css'
5 | import App from './App.jsx'
6 |
7 | createRoot(document.getElementById('root')).render(
8 |
9 |
10 |
11 |
12 | ,
13 | )
14 |
--------------------------------------------------------------------------------
/tailwind.config.js:
--------------------------------------------------------------------------------
1 | /* cSpell:disable */
2 | const flowbite = require("flowbite/plugin");
3 |
4 | /** @type {import('tailwindcss').Config} */
5 | module.exports = {
6 | content: [
7 | "./src/**/*.{html,js,jsx}",
8 | "./node_modules/flowbite-react/**/*.{js,jsx,ts,tsx}",
9 | ],
10 | theme: {
11 | extend: {},
12 | },
13 | plugins: [
14 | flowbite,
15 | ],
16 | };
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | .env
11 | .env.development
12 | node_modules
13 | dist
14 | dist-ssr
15 | *.local
16 |
17 | # Editor directories and files
18 | .vscode/*
19 | !.vscode/extensions.json
20 | .idea
21 | .DS_Store
22 | *.suo
23 | *.ntvs*
24 | *.njsproj
25 | *.sln
26 | *.sw?
27 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Vite + React
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/pages/PlayersPage.jsx:
--------------------------------------------------------------------------------
1 | import PlayerCard from "../components/PlayerCard";
2 |
3 | function PlayersPage({players}) {
4 | return (
5 |
6 |
7 | {players &&
8 | players.map((player) => (
9 |
10 | ))}
11 |
12 |
13 | );
14 | }
15 |
16 | export default PlayersPage;
17 |
--------------------------------------------------------------------------------
/src/pages/TeamsPage.jsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | function TeamsPage({ teams }) {
4 | return (
5 |
6 |
7 | {teams &&
8 | teams.map((team) => (
9 |
10 |
NBA TEAM: {team.name}
11 | Location: {team.city}
12 | Nickname: {team.nickname}
13 |
14 | ))}
15 |
16 |
17 | );
18 | }
19 |
20 | export default TeamsPage;
21 |
--------------------------------------------------------------------------------
/src/pages/HomePage.jsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { Link } from "react-router-dom";
3 | import logo from '../images/court-iq.png'
4 |
5 | function HomePage() {
6 | return (
7 |
8 |
9 | 
10 |
11 |
12 |
13 | Players
14 |
15 |
16 |
17 |
18 |
19 | Team
20 |
21 |
22 |
23 | );
24 | }
25 |
26 | export default HomePage;
27 |
--------------------------------------------------------------------------------
/src/components/PlayerCard.jsx:
--------------------------------------------------------------------------------
1 | import { Button, Card } from "flowbite-react";
2 | import { useNavigate } from "react-router-dom";
3 |
4 | function PlayerCard({ player }) {
5 | const navigate = useNavigate();
6 |
7 | const handleClick = () => {
8 | navigate(`/player/${player._id}`);
9 | };
10 | return (
11 |
12 |
13 |
14 | {player.name}
15 |
16 |
17 |
18 | {player.team}
19 |
20 |
21 |
24 |
25 |
26 | );
27 | }
28 | export default PlayerCard;
29 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "frontend",
3 | "private": true,
4 | "version": "0.0.0",
5 | "type": "module",
6 | "scripts": {
7 | "dev": "vite",
8 | "build": "vite build",
9 | "lint": "eslint .",
10 | "preview": "vite preview"
11 | },
12 | "dependencies": {
13 | "flowbite-react": "^0.10.2",
14 | "react": "^18.3.1",
15 | "react-dom": "^18.3.1",
16 | "react-router-dom": "^6.27.0"
17 | },
18 | "devDependencies": {
19 | "@eslint/js": "^9.13.0",
20 | "@types/react": "^18.3.11",
21 | "@types/react-dom": "^18.3.1",
22 | "@vitejs/plugin-react": "^4.3.3",
23 | "autoprefixer": "^10.4.20",
24 | "eslint": "^9.13.0",
25 | "eslint-plugin-react": "^7.37.1",
26 | "eslint-plugin-react-hooks": "^5.0.0",
27 | "eslint-plugin-react-refresh": "^0.4.13",
28 | "globals": "^15.11.0",
29 | "postcss": "^8.4.47",
30 | "tailwindcss": "^3.4.14",
31 | "vite": "^5.4.9"
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/eslint.config.js:
--------------------------------------------------------------------------------
1 | import js from '@eslint/js'
2 | import globals from 'globals'
3 | import react from 'eslint-plugin-react'
4 | import reactHooks from 'eslint-plugin-react-hooks'
5 | import reactRefresh from 'eslint-plugin-react-refresh'
6 |
7 | export default [
8 | { ignores: ['dist'] },
9 | {
10 | files: ['**/*.{js,jsx}'],
11 | languageOptions: {
12 | ecmaVersion: 2020,
13 | globals: globals.browser,
14 | parserOptions: {
15 | ecmaVersion: 'latest',
16 | ecmaFeatures: { jsx: true },
17 | sourceType: 'module',
18 | },
19 | },
20 | settings: { react: { version: '18.3' } },
21 | plugins: {
22 | react,
23 | 'react-hooks': reactHooks,
24 | 'react-refresh': reactRefresh,
25 | },
26 | rules: {
27 | ...js.configs.recommended.rules,
28 | ...react.configs.recommended.rules,
29 | ...react.configs['jsx-runtime'].rules,
30 | ...reactHooks.configs.recommended.rules,
31 | 'react/jsx-no-target-blank': 'off',
32 | 'react-refresh/only-export-components': [
33 | 'warn',
34 | { allowConstantExport: true },
35 | ],
36 | },
37 | },
38 | ]
39 |
--------------------------------------------------------------------------------
/src/components/Nav.jsx:
--------------------------------------------------------------------------------
1 | import { NavbarBrand, Navbar, NavbarToggle, NavbarLink, NavbarCollapse } from 'flowbite-react'
2 | import React from 'react'
3 | import { Link } from 'react-router-dom'
4 | import logo from '../images/court-iq.png'
5 |
6 | function Nav() {
7 | return (
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | Home
17 |
18 |
19 | Players
20 |
21 |
22 | Teams
23 |
24 |
25 |
26 |
27 |
28 |
29 | )
30 | }
31 |
32 | export default Nav
33 |
34 | {/* */}
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | # Court IQ
7 | * Court IQ is a fullstack app that has information regarding your favorite NBA players and teams. Version 1.0 at the moment allows you to gather information from the top 150 basketball players and allows you to leave a rating and a comment to each player.
8 |
9 | ## Link
10 | [Court IQ](https://courtiq-ar.netlify.app/)
11 |
12 | ## Technologies Used
13 | * MongoDB
14 | * Express
15 | * React
16 | * Node
17 | * Tailwind
18 | * Flowbite React
19 |
20 | ## Wireframe
21 |
22 |
23 | ## Images
24 |
25 |
26 |
27 |
28 |
29 | ## API
30 | [api-sports.io](https://api-sports.io/documentation/nba/v2#tag/Teams/operation/get-teams)
31 |
32 | ### Acknowledgments
33 | * Previous Class Recordings
34 | * ChatGPT - created data to test my backend.
35 | * PerScholas
36 |
--------------------------------------------------------------------------------
/public/vite.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/App.jsx:
--------------------------------------------------------------------------------
1 | /* cSpell:disable */
2 | import { useEffect, useState } from "react"
3 | import { Routes, Route, useNavigate } from "react-router-dom";
4 | import HomePage from "./pages/HomePage";
5 | import TeamsPage from "./pages/TeamsPage";
6 | import PlayersPage from "./pages/PlayersPage";
7 | import PlayersDetails from "./pages/PlayersDetails";
8 | import Nav from "./components/Nav";
9 |
10 |
11 | function App() {
12 | const [teams, setTeams] = useState([]);
13 | const [players, setPlayers] = useState([]);
14 |
15 | useEffect(() => {
16 | const fetchPlayers = async () => {
17 | const res = await fetch(`${import.meta.env.VITE_API_BASE_URL}/players`);
18 | const playerData = await res.json();
19 | setPlayers(playerData)
20 |
21 | }
22 | fetchPlayers();
23 | }, []);
24 |
25 | useEffect(() => {
26 | const fetchTeams = async () => {
27 | const res = await fetch('https://v2.nba.api-sports.io/teams?id=14', {
28 | headers: {
29 | 'x-rapidapi-host': 'v2.nba.api-sports.io',
30 | 'x-rapidapi-key': import.meta.env.VITE_API_KEY
31 | }
32 | });
33 | const teamData = await res.json();
34 | setTeams(teamData.response)
35 | }
36 | fetchTeams();
37 | }, []);
38 |
39 |
40 | return (
41 | <>
42 |
43 |
44 | } />
45 | }/>
46 | }/>
47 | } />
48 |
49 | >
50 |
51 |
52 | )
53 | }
54 |
55 | export default App
--------------------------------------------------------------------------------
/src/pages/PlayersDetails.jsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { useParams } from "react-router-dom";
3 | import { Card } from "flowbite-react";
4 |
5 | function PlayersDetails({ players }) {
6 | const { id } = useParams();
7 | const player = players.find((player) => player._id === id);
8 | if (!player) {
9 | return (
10 |
11 | Player not found
12 |
13 | );
14 | }
15 |
16 | return (
17 |
18 |
19 | {player.name}
20 |
21 |
22 | Team: {player.team}
23 |
24 |
25 | Rating: {player.rating}
26 |
27 |
28 | Salary: ${player.salary}
29 |
30 |
31 | Years Active:
32 | {player.yearsActive}
33 |
34 |
35 | Comments: {player.comment}
36 |
37 |
38 |
39 |
40 | );
41 | }
42 |
43 | export default PlayersDetails;
44 |
--------------------------------------------------------------------------------
/src/assets/react.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------