feature: Use single file for global navigation, include on other pages

This commit is contained in:
Keith Solomon
2026-02-10 08:29:45 -06:00
parent a49b98f73b
commit f94b4dda95
6 changed files with 53 additions and 57 deletions

View File

@@ -36,18 +36,19 @@ $config = require __DIR__ . '/lib/project-config.php';
$storage = new SpacetradersStorage( $config['db_path'] );
$token = $storage->getAgentToken();
$statusMessage = '';
$errorMessage = '';
$actionResults = array();
$agent = array();
$ships = array();
$miningShips = array();
$activeContracts = array();
$marketWaypoints = array();
$statusMessage = '';
$errorMessage = '';
$actionResults = array();
$agent = array();
$ships = array();
$miningShips = array();
$activeContracts = array();
$marketWaypoints = array();
$selectedMarketWaypoint = '';
if (! is_string( $token ) || trim( $token ) === '' ) {
$envToken = getenv( 'SPACETRADERS_TOKEN' );
if (is_string( $envToken ) && trim( $envToken ) !== '' ) {
$token = trim( $envToken );
$storage->setAgentToken( $token );
@@ -362,6 +363,7 @@ try {
$errorMessage = $e->getMessage();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
@@ -370,14 +372,11 @@ try {
<title>Spacetraders - Mining Fleet</title>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="container mx-auto px-4 py-8 bg-stone-800 text-gray-200">
<div class="mb-6 flex gap-4">
<a href="index.php" class="text-blue-400 hover:underline">Agent Info</a>
<a href="buy-ships.php" class="text-blue-400 hover:underline">Buy Ships</a>
<a href="config.php" class="text-blue-400 hover:underline">Configuration</a>
</div>
<h1 class="text-3xl font-bold mb-6 underline decoration-gray-300 w-full">Mining Fleet</h1>
<body class="container mx-auto px-4 py-8 bg-stone-800 text-gray-200">
<?php require __DIR__ . '/main-menu.php'; ?>
<h1 class="text-3xl font-bold mb-6 underline decoration-gray-300 w-full"><a href="mining-fleet.php">Spacetraders - Mining Fleet</a></h1>
<?php if (isset( $tokenError ) ) : ?>
<div class="mb-6 border border-red-500 p-4 rounded text-red-300">