#!/bin/bash
# Pomodoro Timer - Linux Launcher
# Run in terminal: ./PomodoroTimer-Linux.sh

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 using your package manager:"
    echo "  Debian/Ubuntu: sudo apt install nodejs npm"
    echo "  Fedora: sudo dnf install nodejs npm"
    echo "  Arch: sudo pacman -S nodejs npm"
    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"