#!/bin/bash
# Pomodoro Timer - Mac/Linux Launcher
# Double-click this file or run in terminal to start the Pomodoro Timer

clear
echo "======================================"
echo "🍅 Pomodoro Timer v1.0.0"
echo "======================================"
echo ""

# Check if Node.js is installed
if ! command -v node &> /dev/null; then
    echo "❌ Node.js is not installed!"
    echo ""
    echo "Please install Node.js from:"
    echo "https://nodejs.org/"
    read -p "Press Enter to exit..."
    exit 1
fi

# Check if npm is available
if ! command -v npm &> /dev/null; then
    echo "❌ npm is not available!"
    read -p "Press Enter to exit..."
    exit 1
fi

echo "✅ Node.js is installed"
echo ""

# Start the Pomodoro Timer server
echo "Starting Pomodoro Timer..."
echo ""
echo "Server will run at: http://localhost:8080"
echo "Press Ctrl+C to stop"
echo ""

# Find the directory of this script
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"

# Start the server
node "$DIR/launcher.js"