-
Notifications
You must be signed in to change notification settings - Fork 0
Playoff Schedule #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
yoavs8
wants to merge
22
commits into
master
Choose a base branch
from
playoff-schedule/init
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
62c995a
close to end added alot of things including css and html waiting for cr
aeb81a9
yoni check i am done
d5c385b
looks good needs polish
2c47d2d
i am done pls no comments :)
e4acc8b
added green to see better our team
544a992
fixed most of the staff yoni told me to
0cf47ed
switched to curr time
266e579
fixed the eslint problem
77591f1
added the calendar part dont cr till a check if it works
009b0ae
fixed some eslint problem still dont cr till i check if the code works
42698d8
code works but ugly and messy dont cr pls i am fixing it ty :)
5d0c30a
yoni be nice with cr pls :) spit up the messy code
917d41d
save before changes
414a774
yoni pls no fixes
2de731e
yoni pls i need this
84f8480
yoni (:':) efn
b3424a9
fuck ctrl s
fcfe25a
kovler pls i need this :(
707c7c1
Merge branch 'master' of https://github.com/GreenBlitz/Full-Stack-Pro…
9fc6873
crazy
bc7a61b
checkpoit 1 codes works (kov1)
361305e
no more comments pls
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| FROM node:20-alpine | ||
| WORKDIR /usr/src/app | ||
| COPY ./dist /usr/src/app | ||
| EXPOSE 4590 | ||
| CMD ["node","bundle.js"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| // בס"ד | ||
| import { build, context } from "esbuild"; | ||
| import { spawn } from "child_process"; | ||
|
|
||
| const isDev = process.env.NODE_ENV === "DEV"; | ||
|
|
||
| const bundlePath = "dist/bundle.js"; | ||
|
|
||
| const buildSettings = { | ||
| entryPoints: ["src/main.ts"], | ||
| outfile: "dist/bundle.js", | ||
| bundle: true, | ||
| plugins: [], | ||
| minify: true, | ||
| platform: "node", | ||
| target: ["ES2022"], | ||
| format: "cjs", | ||
| external: ["@repo/config-env"], | ||
| } satisfies Parameters<typeof build>[0]; | ||
|
|
||
| const buildDev = async () => | ||
| context(buildSettings) | ||
| .then(async (ctx) => ctx.watch()) | ||
| .then(() => { | ||
| console.log("Starting nodemon to manage execution of bundle.js"); | ||
| spawn( | ||
| "nodemon", | ||
| [bundlePath, "--watch", bundlePath, "--ext", "js", "--exec", "node"], | ||
| { stdio: "inherit", shell: true } | ||
| ); | ||
| }); | ||
|
|
||
| const buildedProject = isDev ? buildDev() : build(buildSettings); | ||
|
|
||
| buildedProject.catch((error: unknown) => { | ||
| console.warn(error); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| services: | ||
| backend: | ||
| build: | ||
| context: . | ||
| dockerfile: Dockerfile | ||
|
|
||
| env_file: | ||
| - ../../../.public.env | ||
| - ../../../.secret.env | ||
| ports: | ||
| - "${BACKEND_PORT}:4590" # Maps host:${FRONTEND_PORT} to container:4590 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| { | ||
| "name": "playoff-schedule-backend", | ||
| "version": "1.0.0", | ||
| "description": "Backend for the application", | ||
| "main": "index.js", | ||
| "scripts": { | ||
| "test": "echo Backend Test Succeeded && exit 0", | ||
| "build": "tsx build.ts", | ||
| "serve": "node dist/bundle.js", | ||
| "dev": "tsx build.ts" | ||
| }, | ||
| "author": "", | ||
| "license": "ISC", | ||
| "dependencies": { | ||
| "process": "^0.11.10" | ||
| }, | ||
| "devDependencies": { | ||
| "@types/node": "^24.8.1" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| // בס"ד | ||
| import express from "express"; | ||
| import { apiRouter } from "./routes"; | ||
| import cors from "cors"; | ||
| import dotenv from "dotenv"; | ||
| import path from "path"; | ||
|
|
||
| // Load environment variables from monorepo root | ||
| const rootDir = path.resolve(__dirname, "../.."); | ||
| dotenv.config({ path: path.join(rootDir, ".dev.env") }); | ||
| dotenv.config({ path: path.join(rootDir, ".public.env") }); | ||
| dotenv.config({ path: path.join(rootDir, ".secret.env") }); | ||
|
|
||
| const app = express(); | ||
|
|
||
| // Register middleware before routes | ||
| app.use(express.json({ limit: "10mb" })); | ||
| app.use(express.urlencoded({ limit: "10mb", extended: true })); | ||
|
|
||
| app.use( | ||
| cors({ | ||
Check warningCode scanning / ESLint Disallow calling a value with type `any` Warning
Unsafe call of a type that could not be resolved.
|
||
| origin: "*", | ||
| }) | ||
| ); | ||
|
|
||
| app.use("/api/v1", apiRouter); | ||
|
|
||
| const defaultPort = 4590; | ||
| const port = process.env.BACKEND_PORT ?? defaultPort; | ||
|
|
||
| const apiKey: string | undefined = process.env.TBA_API_KEY; | ||
| if (apiKey === undefined) { | ||
| throw new Error("TBA_API_KEY is not defined."); | ||
| } | ||
|
|
||
| app.listen(port, () => { | ||
| console.log(`Production server running at http://localhost:${port}`); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| // בס"ד | ||
| import { Router } from "express"; | ||
| import { StatusCodes } from "http-status-codes"; | ||
| import { tbaRouter } from "./tba"; | ||
|
|
||
| export const apiRouter = Router(); | ||
|
|
||
| apiRouter.get("/health", (req, res) => { | ||
| res.status(StatusCodes.OK).send({ message: "Healthy!" }); | ||
| }); | ||
|
|
||
| apiRouter.use("/tba", tbaRouter); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| // בס"ד | ||
| import { Router, type Request, type Response } from "express"; | ||
| import { StatusCodes } from "http-status-codes"; | ||
| import { fetchTba } from "../utils/tbaClient"; | ||
|
|
||
| export const tbaRouter = Router(); | ||
|
|
||
| const createTbaHandler = | ||
yoavs8 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| (name: string, suffix?: string) => | ||
| async (req: Request, res: Response): Promise<void> => { | ||
| try { | ||
| const path = `/event/${req.params.eventKey}/${name}${suffix}`; | ||
| const data = await fetchTba(path); | ||
| res.status(StatusCodes.OK).json(data); | ||
| } catch (error) { | ||
| console.error("Error in tba handler:", error); | ||
| res | ||
| .status(StatusCodes.INTERNAL_SERVER_ERROR) | ||
| .json({ error: "Failed to fetch data" }); | ||
| } | ||
| }; | ||
|
|
||
| tbaRouter.get("/events/:eventKey/teams", createTbaHandler("teams", "/simple")); | ||
|
|
||
| tbaRouter.get( | ||
| "/events/:eventKey/matches", | ||
| createTbaHandler("matches", "/simple") | ||
| ); | ||
|
|
||
| tbaRouter.get("/events/:eventKey/rankings", createTbaHandler("rankings")); | ||
|
|
||
| tbaRouter.get("/events/:eventKey/alliances", createTbaHandler("alliances")); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| // בס"ד | ||
| const tbaApiBase = "https://www.thebluealliance.com/api/v3"; | ||
|
|
||
| const getApiKey = (): string => { | ||
| const key = process.env.TBA_API_KEY; | ||
| if (!key) { | ||
| throw new Error("Missing TBA_API_KEY in environment variables"); | ||
| } | ||
| return key; | ||
| }; | ||
|
|
||
| export const fetchTba = async <T>(path: string): Promise<T> => { | ||
| const response = await fetch(tbaApiBase + path, { | ||
| method: "GET", | ||
yoavs8 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| headers: { | ||
| "X-TBA-Auth-Key": getApiKey(), | ||
| "Content-Type": "application/json", | ||
| }, | ||
| }); | ||
|
|
||
| if (!response.ok) { | ||
| throw new Error(`HTTP error, status: ${response.status}`); | ||
| } | ||
|
|
||
| return response.json() as Promise<T>; | ||
Check warningCode scanning / ESLint Disallow type assertions that narrow a type Warning
Unsafe assertion from any detected: consider using type guards or a safer assertion.
|
||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| // בס"ד | ||
| /// <reference types="vite/client" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| { | ||
| "extends": [ | ||
| "//" | ||
| ], | ||
| "tasks": { | ||
| "build": { | ||
| "outputs": [ | ||
| "dist/**" | ||
| ] | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| FROM node:20-alpine | ||
| WORKDIR /app | ||
| COPY ./start.ts /app/start.ts | ||
| COPY ./dist /app/dist | ||
| EXPOSE 443 | ||
| RUN ["npm","install","express"] | ||
| CMD ["npm","exec","--","tsx","start.ts"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| services: | ||
| frontend: | ||
| build: | ||
| context: . | ||
| dockerfile: Dockerfile | ||
|
|
||
| env_file: | ||
| - ../../../.public.env | ||
| - ../../../.secret.env | ||
| ports: | ||
| - "${FRONTEND_PORT}:443" # Maps host:${FRONTEND_PORT} to container:443 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <link rel="icon" type="image/svg+xml" href="./src/assets/greenblitz.svg" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <title>GreenBlitz 4590</title> | ||
| </head> | ||
| <body> | ||
| <div id="root"></div> | ||
| <script type="module" src="/src/main.tsx"></script> | ||
| </body> | ||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| { | ||
| "name": "playoff-schedule-frontend", | ||
| "version": "1.0.0", | ||
| "description": "Frontend for the application", | ||
| "main": "index.js", | ||
| "scripts": { | ||
| "test": "echo Frontend Test Succeeded && exit 0", | ||
| "dev": "vite", | ||
| "build": "tsc -b && vite build", | ||
| "serve": "tsx start.ts", | ||
| "lint": "eslint .", | ||
| "preview": "vite preview" | ||
| }, | ||
| "author": "", | ||
| "license": "ISC", | ||
| "dependencies": { | ||
| "react": "^19.1.1", | ||
| "react-dom": "^19.1.1", | ||
| "tailwindcss": "^4.1.16", | ||
| "@tailwindcss/vite": "^4.1.16" | ||
| }, | ||
| "devDependencies": { | ||
| "@eslint/js": "^9.36.0", | ||
| "@types/node": "^24.6.0", | ||
| "@types/react": "^19.1.16", | ||
| "@types/react-dom": "^19.1.9", | ||
| "@vitejs/plugin-react": "^5.0.4", | ||
| "babel-plugin-react-compiler": "^19.1.0-rc.3", | ||
| "globals": "^16.4.0", | ||
| "vite": "^7.1.7" | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.