Skip to content

johnny0595/hackathonSOEWinner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

9 Commits
ย 
ย 
ย 
ย 

Repository files navigation

NC State Sports Daily Predictor ๐Ÿบ

A modern web application for predicting NC State sports game winners with live statistics, leaderboards, and championship recognition. Made in 1 hour during SOE Coding Hackathon so no real backend.

Next.js React TypeScript Tailwind CSS

Images

image image image image image

๐ŸŽฏ Features

Core Functionality

  • ๐Ÿ“… Daily Sports Schedule: View all NC State sports scheduled for today
  • ๐ŸŽฒ Smart Predictions: Pick winners based on team win percentages and stats
  • ๐Ÿ’พ Local Storage: Predictions saved automatically in browser storage
  • ๐Ÿ”„ One-Click Toggle: Click team buttons to predict, click again to deselect
  • ๐Ÿ“ฑ Responsive Design: Optimized for mobile, tablet, and desktop

Leaderboard System

  • ๐Ÿ† Champion Recognition: Special Pack Madness Champ showcase for #1 player
  • ๐Ÿ“Š Accuracy Rankings: Users ranked by prediction success rate
  • ๐Ÿ“ˆ Detailed Stats: Win/loss records, accuracy percentages, progress bars
  • ๐Ÿ‘ค User Identification: Highlight current user in leaderboard
  • ๐ŸŽจ Visual Hierarchy: Gold, silver, bronze styling for top performers

User Experience

  • ๐ŸŒ™ Dark/Light Theme: Toggle between themes with system detection
  • ๐ŸŽ‰ Toast Notifications: Success feedback for all prediction actions
  • ๐ŸŽฏ Prediction Drawer: View and manage all current selections
  • โ™ฟ Accessibility: Full keyboard navigation and screen reader support
  • ๐Ÿ“Š Statistics Overview: Total players, average accuracy, best scores

๐Ÿš€ Quick Start

Prerequisites

  • Node.js 18+
  • npm or yarn

Installation

# Clone the repository
git clone https://github.com/johnny0595/hackathonSOEWinner.git
cd soehackathon

# Install dependencies
npm install

# Start development server
npm run dev

Visit http://localhost:3001 to view the application.

Available Scripts

npm run dev          # Start development server with Turbopack
npm run build        # Build for production
npm start           # Start production server
npm run lint        # Run ESLint

๐Ÿ“ Project Structure

src/
โ”œโ”€โ”€ app/                    # Next.js App Router pages
โ”‚   โ”œโ”€โ”€ page.tsx           # Main predictions interface
โ”‚   โ”œโ”€โ”€ leaderboard/       # Leaderboard page
โ”‚   โ”œโ”€โ”€ layout.tsx         # Root layout with providers
โ”‚   โ””โ”€โ”€ globals.css        # Global styles and Tailwind
โ”œโ”€โ”€ components/            # Reusable UI components
โ”‚   โ”œโ”€โ”€ ui/               # shadcn/ui base components
โ”‚   โ”œโ”€โ”€ sports-header.tsx  # Sports selection navigation
โ”‚   โ”œโ”€โ”€ game-card.tsx      # Individual game prediction card
โ”‚   โ”œโ”€โ”€ games-list.tsx     # List of games for selected sport
โ”‚   โ”œโ”€โ”€ leaderboard.tsx    # Main leaderboard component
โ”‚   โ”œโ”€โ”€ leaderboard-card.tsx # Individual user ranking card
โ”‚   โ”œโ”€โ”€ prediction-sidebar.tsx # Current selections drawer
โ”‚   โ”œโ”€โ”€ submit-button.tsx  # Predictions submission
โ”‚   โ””โ”€โ”€ theme-toggle.tsx   # Dark/light theme switcher
โ”œโ”€โ”€ hooks/                 # Custom React hooks
โ”‚   โ”œโ”€โ”€ use-sports.ts      # Sports data fetching
โ”‚   โ”œโ”€โ”€ use-games.ts       # Games data fetching
โ”‚   โ””โ”€โ”€ use-predictions.ts # Predictions management
โ”œโ”€โ”€ services/             # Business logic and external services
โ”‚   โ””โ”€โ”€ predictions-storage.ts # LocalStorage operations
โ”œโ”€โ”€ data/                 # Mock data and providers
โ”‚   โ”œโ”€โ”€ mock-provider.ts   # Mock API implementation
โ”‚   โ”œโ”€โ”€ http-provider.ts   # Real API stub
โ”‚   โ”œโ”€โ”€ data-provider.ts   # Provider factory
โ”‚   โ”œโ”€โ”€ mock-predictions.ts # Sample predictions
โ”‚   โ””โ”€โ”€ mock-leaderboard.ts # Sample leaderboard data
โ”œโ”€โ”€ types/                # TypeScript type definitions
โ”‚   โ””โ”€โ”€ index.ts          # All app interfaces
โ”œโ”€โ”€ lib/                  # Utility functions
โ”‚   โ”œโ”€โ”€ utils.ts          # General utilities
โ”‚   โ””โ”€โ”€ date-utils.ts     # Date formatting helpers
โ””โ”€โ”€ providers/            # React context providers
    โ”œโ”€โ”€ query-provider.tsx # React Query setup
    โ””โ”€โ”€ theme-provider.tsx # Theme management

๐Ÿ—๏ธ Architecture

Data Layer

The application uses an abstracted data provider pattern:

  • MockProvider: Local JSON files for development/demo
  • HttpProvider: Real API integration (configurable via environment variables)
  • React Query: Caching and synchronization

State Management

  • React Query: Server state and caching
  • LocalStorage: Predictions persistence
  • React Context: Theme and global providers
  • Local State: Component-specific state

Design System

  • shadcn/ui: Base component library
  • Tailwind CSS: Utility-first styling
  • Lucide React: Consistent iconography
  • CSS Variables: Dynamic theming

๐ŸŽฎ User Guide

Making Predictions

  1. Select Sport: Click sport tabs in the header to filter games
  2. Pick Winners: Click team buttons to predict winners
  3. Change Mind: Click the same team again to remove prediction
  4. View Selections: Click "Predictions" button (shows count badge)
  5. Submit: Use bottom submit button to save all predictions

Leaderboard

  1. View Rankings: Click "Leaderboard" in header navigation
  2. Champion Recognition: Top player gets Pack Madness Champ showcase
  3. Track Progress: See accuracy percentages and win/loss records
  4. Find Yourself: Current user is highlighted with "You" badge

๐Ÿ”ง Configuration

Environment Variables

# Enable real API (default: false, uses mock data)
NEXT_PUBLIC_USE_API=true

# API base URL (default: http://localhost:3001)
NEXT_PUBLIC_API_BASE_URL=https://your-api.com

Mock Data Customization

Edit files in /src/data/ to customize:

  • mock-predictions.ts: Pre-loaded predictions
  • mock-leaderboard.ts: User rankings and stats
  • public/mock/: Sports and games JSON files

๐Ÿ›ก๏ธ API Integration

Expected Endpoints

GET /sports?date=YYYY-MM-DD        // Available sports for date
GET /games?sport={id}&date=YYYY-MM-DD  // Games for sport/date
GET /games/{gameId}                // Individual game details
POST /predictions                  // Submit user predictions

Data Formats

See /src/types/index.ts for complete TypeScript interfaces.

Automated Testing Setup

Framework configured for:

  • Vitest: Unit testing
  • React Testing Library: Component testing
  • ESLint: Code quality
  • TypeScript: Type checking

๐ŸŽจ Customization

Theming

  • Colors: Edit CSS variables in globals.css
  • Components: Customize shadcn/ui components
  • Layout: Modify responsive breakpoints in Tailwind config

Sports & Games

  • Add new sports to mock-provider.ts
  • Update team logos and branding
  • Modify win percentage calculations
  • Add new game statistics

Leaderboard

  • Customize ranking algorithms
  • Add achievement badges
  • Modify champion rewards
  • Update user avatar system

๐Ÿค Contributing

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open Pull Request

Go Pack! ๐Ÿบ Built with โค๏ธ for NC State Sports fans.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published