strat-gameplay-webapp/scripts/env-switch.sh
Cal Corum e0c12467b0 CLAUDE: Improve UX with single-click OAuth, enhanced games list, and layout fix
Frontend UX improvements:
- Single-click Discord OAuth from home page (no intermediate /auth page)
- Auto-redirect authenticated users from home to /games
- Fixed Nuxt layout system - app.vue now wraps NuxtPage with NuxtLayout
- Games page now has proper card container with shadow/border styling
- Layout header includes working logout with API cookie clearing

Games list enhancements:
- Display team names (lname) instead of just team IDs
- Show current score for each team
- Show inning indicator (Top/Bot X) for active games
- Responsive header with wrapped buttons on mobile

Backend improvements:
- Added team caching to SbaApiClient (1-hour TTL)
- Enhanced GameListItem with team names, scores, inning data
- Games endpoint now enriches response with SBA API team data

Docker optimizations:
- Optimized Dockerfile using --chown flag on COPY (faster than chown -R)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-05 16:14:00 -06:00

73 lines
1.9 KiB
Bash
Executable File

#!/bin/bash
# Switch between dev and prod environments
# Usage: ./scripts/env-switch.sh [dev|prod]
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
ENV=${1:-dev}
if [[ "$ENV" != "dev" && "$ENV" != "prod" ]]; then
echo "Usage: $0 [dev|prod]"
echo " dev - localhost URLs for local development"
echo " prod - gameplay-demo.manticorum.com URLs"
exit 1
fi
echo "Switching to $ENV environment..."
# Backend
if [[ -f "$PROJECT_ROOT/backend/.env.$ENV" ]]; then
cp "$PROJECT_ROOT/backend/.env.$ENV" "$PROJECT_ROOT/backend/.env"
echo " ✓ backend/.env -> $ENV"
else
echo " ✗ backend/.env.$ENV not found"
exit 1
fi
# Frontend SBA
if [[ -f "$PROJECT_ROOT/frontend-sba/.env.$ENV" ]]; then
cp "$PROJECT_ROOT/frontend-sba/.env.$ENV" "$PROJECT_ROOT/frontend-sba/.env"
echo " ✓ frontend-sba/.env -> $ENV"
else
echo " ✗ frontend-sba/.env.$ENV not found"
exit 1
fi
# Frontend PD (if exists)
if [[ -f "$PROJECT_ROOT/frontend-pd/.env.$ENV" ]]; then
cp "$PROJECT_ROOT/frontend-pd/.env.$ENV" "$PROJECT_ROOT/frontend-pd/.env"
echo " ✓ frontend-pd/.env -> $ENV"
fi
echo ""
echo "Environment switched to: $ENV"
if [[ "$ENV" == "dev" ]]; then
echo ""
echo "Local URLs:"
echo " Backend: http://localhost:8000"
echo " Frontend SBA: http://localhost:3000"
echo " Frontend PD: http://localhost:3001"
echo ""
echo "Start manually:"
echo " cd backend && uv run python -m app.main"
echo " cd frontend-sba && npm run dev"
echo ""
echo "Or with Docker:"
echo " docker compose up"
else
echo ""
echo "Production URLs:"
echo " https://gameplay-demo.manticorum.com"
echo ""
echo "Start manually:"
echo " cd backend && uv run python -m app.main"
echo " cd frontend-sba && npm run dev"
echo ""
echo "Or with Docker:"
echo " docker compose up -d"
fi