"use client"; import React from "react"; import { Planet, Starship } from "@/types/swapi"; import { t, LocaleType } from "@/content/locales"; import { getPlanetTheme } from "@/utils/getPlanetTheme"; interface ActionPanelProps { planet?: Planet | null; enemy?: Starship | null; onAction: () => void; onEscape?: () => void; onRepair?: () => void; isLoading?: boolean; isCurrentLocation?: boolean; currentHp: number; } export default function ActionPanel({ planet, enemy, onAction, onEscape, onRepair, isLoading, isCurrentLocation, currentHp, }: ActionPanelProps) { const isCombat = !!enemy; const planetVisual = getPlanetTheme( planet?.terrain, planet?.climate, t as LocaleType, ); const uiTheme = isCombat ? { color: "text-red-500", border: "border-red-600", glow: "shadow-[0_0_30px_#dc2626]", label: t.ACTION_PANEL.MODES.HOSTILE, borderAlpha: "border-red-900/30", labelAlpha: "text-red-500/50", } : { color: "text-yellow-500", border: "border-yellow-300", glow: "shadow-[0_0_20px_rgba(234,179,8,0.2)]", label: "NEUTRAL SYSTEM", borderAlpha: "border-yellow-500/10", labelAlpha: "text-yellow-500/50", }; const stats = isCombat ? [ { label: t.ACTION_PANEL.LABELS.MANUFACTURER, value: enemy.manufacturer, }, { label: t.ACTION_PANEL.LABELS.COST, value: `${enemy.cost_in_credits} Cr`, }, ] : [ { label: t.ACTION_PANEL.LABELS.POPULATION, value: planet?.population.toLocaleString(), }, { label: t.ACTION_PANEL.LABELS.GRAVITY, value: planet?.gravity }, ]; return (
{isCombat ? `${t.ACTION_PANEL.LABELS.CLASS}: ${enemy.starship_class}` : `${t.ACTION_PANEL.LABELS.SECTOR}: ${planet?.terrain}`}
{stat.value}