🐞 fix: Update market/shop styles

This commit is contained in:
Keith Solomon
2026-02-11 22:36:10 -06:00
parent 86c58e8930
commit e74e8a3ff8
2 changed files with 22 additions and 34 deletions

View File

@@ -136,9 +136,6 @@ try {
<?php require __DIR__ . '/main-menu.php'; ?> <?php require __DIR__ . '/main-menu.php'; ?>
<h1 class="text-3xl font-bold mb-6 underline decoration-gray-300 w-full"><a href="market.php">Spacetraders - Markets</a></h1> <h1 class="text-3xl font-bold mb-6 underline decoration-gray-300 w-full"><a href="market.php">Spacetraders - Markets</a></h1>
<p class="mb-4">
<a href="shop.php" class="px-3 py-2 bg-emerald-700 rounded hover:bg-emerald-600 inline-block">Open Shop</a>
</p>
<?php if (isset( $tokenError ) ) : ?> <?php if (isset( $tokenError ) ) : ?>
<div class="mb-6 border border-red-500 p-4 rounded text-red-300"> <div class="mb-6 border border-red-500 p-4 rounded text-red-300">
@@ -156,8 +153,7 @@ try {
<?php endif; ?> <?php endif; ?>
<p class="mb-6"> <p class="mb-6">
Credits: <span class="font-semibold"><?php echo number_format( (int) ( $agent['credits'] ?? 0 ) ); ?></span> Ships: <span class="font-semibold"><?php echo number_format( count( $ships ) ); ?></span>
| Ships: <span class="font-semibold"><?php echo number_format( count( $ships ) ); ?></span>
| Stationed Waypoints: <span class="font-semibold"><?php echo number_format( count( $marketRecords ) ); ?></span> | Stationed Waypoints: <span class="font-semibold"><?php echo number_format( count( $marketRecords ) ); ?></span>
</p> </p>
@@ -173,39 +169,35 @@ try {
$exports = (array) ( $record['data']['exports'] ?? array() ); $exports = (array) ( $record['data']['exports'] ?? array() );
$exchange = (array) ( $record['data']['exchange'] ?? array() ); $exchange = (array) ( $record['data']['exchange'] ?? array() );
?> ?>
<div class="mb-6 border border-gray-600 p-4 rounded"> <div class="mb-6 border border-gray-600 p-4 rounded">
<h2 class="text-2xl font-bold mb-2"> <h2 class="text-2xl font-bold mb-2">
<?php echo htmlspecialchars( (string) ( $record['waypointSymbol'] ?? '' ) ); ?> <?php echo htmlspecialchars( (string) ( $record['waypointSymbol'] ?? '' ) ); ?>
</h2> </h2>
<p class="text-sm text-gray-300 mb-3"> <p class="text-sm text-gray-300 mb-3">
System: <?php echo htmlspecialchars( (string) ( $record['systemSymbol'] ?? '' ) ); ?> System: <?php echo htmlspecialchars( (string) ( $record['systemSymbol'] ?? '' ) ); ?>
| Ships Here: <?php echo htmlspecialchars( implode( ', ', (array) ( $record['shipSymbols'] ?? array() ) ) ); ?> | Ships Here: <?php echo htmlspecialchars( formatString( implode( ', ', (array) ( $record['shipSymbols'] ?? array() ) ) ) ); ?>
</p> </p>
<?php if ((string) ( $record['error'] ?? '' ) !== '' ) : ?> <?php if ((string) ( $record['error'] ?? '' ) !== '' ) : ?>
<p class="text-red-300"><?php echo htmlspecialchars( (string) $record['error'] ); ?></p> <p class="text-red-300"><?php echo htmlspecialchars( (string) $record['error'] ); ?></p>
<?php else : ?> <?php else : ?>
<p class="mb-3"> <p class="mb-3">
<a <a class="text-blue-300 hover:underline" href="shop.php?waypoint=<?php echo urlencode( (string) ( $record['waypointSymbol'] ?? '' ) ); ?>">Shop At This Waypoint</a>
href="shop.php?waypoint=<?php echo urlencode( (string) ( $record['waypointSymbol'] ?? '' ) ); ?>"
class="text-blue-300 hover:underline"
>
Shop At This Waypoint
</a>
</p> </p>
<div class="grid grid-cols-1 md:grid-cols-3 gap-4"> <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
<div> <div>
<h3 class="font-bold mb-2">Imports</h3> <h3 class="font-bold mb-2">Imports</h3>
<?php if (empty( $imports ) ) : ?> <?php if (empty( $imports ) ) : ?>
<p class="text-gray-400 text-sm">None</p> <p class="text-gray-400 text-sm">None</p>
<?php else : ?> <?php else : ?>
<ul class="list-disc list-inside text-sm"> <ul class="list-disc list-inside text-sm">
<?php foreach ( $imports as $item ) : ?> <?php foreach ( $imports as $item ) : ?>
<li> <li>
<?php echo htmlspecialchars( (string) ( $item['symbol'] ?? '' ) ); ?> <?php echo htmlspecialchars( (string) ( formatString( $item['symbol'] ?? '' ) ) ); ?>
<?php if ((string) ( $item['name'] ?? '' ) !== '' ) : ?>
(<?php echo htmlspecialchars( (string) $item['name'] ); ?>)
<?php endif; ?>
</li> </li>
<?php endforeach; ?> <?php endforeach; ?>
</ul> </ul>
@@ -214,16 +206,14 @@ try {
<div> <div>
<h3 class="font-bold mb-2">Exports</h3> <h3 class="font-bold mb-2">Exports</h3>
<?php if (empty( $exports ) ) : ?> <?php if (empty( $exports ) ) : ?>
<p class="text-gray-400 text-sm">None</p> <p class="text-gray-400 text-sm">None</p>
<?php else : ?> <?php else : ?>
<ul class="list-disc list-inside text-sm"> <ul class="list-disc list-inside text-sm">
<?php foreach ( $exports as $item ) : ?> <?php foreach ( $exports as $item ) : ?>
<li> <li>
<?php echo htmlspecialchars( (string) ( $item['symbol'] ?? '' ) ); ?> <?php echo htmlspecialchars( (string) ( formatString( $item['symbol'] ?? '' ) ) ); ?>
<?php if ((string) ( $item['name'] ?? '' ) !== '' ) : ?>
(<?php echo htmlspecialchars( (string) $item['name'] ); ?>)
<?php endif; ?>
</li> </li>
<?php endforeach; ?> <?php endforeach; ?>
</ul> </ul>
@@ -238,10 +228,7 @@ try {
<ul class="list-disc list-inside text-sm"> <ul class="list-disc list-inside text-sm">
<?php foreach ( $exchange as $item ) : ?> <?php foreach ( $exchange as $item ) : ?>
<li> <li>
<?php echo htmlspecialchars( (string) ( $item['symbol'] ?? '' ) ); ?> <?php echo htmlspecialchars( (string) ( formatString( $item['symbol'] ?? '' ) ) ); ?>
<?php if ((string) ( $item['name'] ?? '' ) !== '' ) : ?>
(<?php echo htmlspecialchars( (string) $item['name'] ); ?>)
<?php endif; ?>
</li> </li>
<?php endforeach; ?> <?php endforeach; ?>
</ul> </ul>

View File

@@ -146,6 +146,7 @@ try {
$errorMessage = $e->getMessage(); $errorMessage = $e->getMessage();
} }
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
@@ -154,6 +155,7 @@ try {
<title>Spacetraders - Shop</title> <title>Spacetraders - Shop</title>
<script src="https://cdn.tailwindcss.com"></script> <script src="https://cdn.tailwindcss.com"></script>
</head> </head>
<body class="container mx-auto px-4 py-8 bg-stone-800 text-gray-200"> <body class="container mx-auto px-4 py-8 bg-stone-800 text-gray-200">
<?php require __DIR__ . '/main-menu.php'; ?> <?php require __DIR__ . '/main-menu.php'; ?>
@@ -180,11 +182,6 @@ try {
</div> </div>
<?php endif; ?> <?php endif; ?>
<p class="mb-4">
Credits: <span class="font-semibold"><?php echo number_format( (int) ( $agent['credits'] ?? 0 ) ); ?></span>
| Stationed Ships: <span class="font-semibold"><?php echo number_format( count( $stationedShips ) ); ?></span>
</p>
<form method="post" class="mb-6 border border-gray-600 rounded p-4 flex flex-wrap items-end gap-3"> <form method="post" class="mb-6 border border-gray-600 rounded p-4 flex flex-wrap items-end gap-3">
<div> <div>
<label for="ship_symbol" class="block text-sm mb-1">Ship</label> <label for="ship_symbol" class="block text-sm mb-1">Ship</label>
@@ -195,11 +192,12 @@ try {
$shipWaypoint = (string) ( $ship['nav']['waypointSymbol'] ?? '' ); $shipWaypoint = (string) ( $ship['nav']['waypointSymbol'] ?? '' );
?> ?>
<option value="<?php echo htmlspecialchars( $shipSymbol ); ?>" <?php echo $shipSymbol === $selectedShipSymbol ? 'selected' : ''; ?>> <option value="<?php echo htmlspecialchars( $shipSymbol ); ?>" <?php echo $shipSymbol === $selectedShipSymbol ? 'selected' : ''; ?>>
<?php echo htmlspecialchars( $shipSymbol . ' @ ' . $shipWaypoint ); ?> <?php echo htmlspecialchars( formatString( $shipSymbol ) . ' @ ' . $shipWaypoint ); ?>
</option> </option>
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>
</div> </div>
<button type="submit" class="px-4 py-2 bg-blue-700 rounded hover:bg-blue-600">Load Market</button> <button type="submit" class="px-4 py-2 bg-blue-700 rounded hover:bg-blue-600">Load Market</button>
</form> </form>
@@ -211,12 +209,14 @@ try {
<div class="mb-6 border border-gray-600 rounded p-4"> <div class="mb-6 border border-gray-600 rounded p-4">
<p> <p>
<span class="font-bold">Selected Ship:</span> <span class="font-bold">Selected Ship:</span>
<?php echo htmlspecialchars( $selectedShipSymbol ); ?> <?php echo htmlspecialchars( formatString( $selectedShipSymbol ) ); ?>
</p> </p>
<p> <p>
<span class="font-bold">Location:</span> <span class="font-bold">Location:</span>
<?php echo htmlspecialchars( $selectedWaypointSymbol ); ?> <?php echo htmlspecialchars( $selectedWaypointSymbol ); ?>
</p> </p>
<p> <p>
<span class="font-bold">Cargo:</span> <span class="font-bold">Cargo:</span>
<?php echo number_format( (int) ( $selectedShip['cargo']['units'] ?? 0 ) ); ?> <?php echo number_format( (int) ( $selectedShip['cargo']['units'] ?? 0 ) ); ?>
@@ -231,6 +231,7 @@ try {
</div> </div>
<?php else : ?> <?php else : ?>
<?php $tradeGoods = (array) ( $selectedMarketData['tradeGoods'] ?? array() ); ?> <?php $tradeGoods = (array) ( $selectedMarketData['tradeGoods'] ?? array() ); ?>
<?php if (empty( $tradeGoods ) ) : ?> <?php if (empty( $tradeGoods ) ) : ?>
<div class="border border-gray-600 rounded p-4"> <div class="border border-gray-600 rounded p-4">
No trade goods available for this market yet. No trade goods available for this market yet.
@@ -251,9 +252,9 @@ try {
$purchasePrice = (int) ( $tradeGood['purchasePrice'] ?? 0 ); $purchasePrice = (int) ( $tradeGood['purchasePrice'] ?? 0 );
?> ?>
<tr> <tr>
<td class="border border-gray-300 px-3 py-2"><?php echo htmlspecialchars( $tradeSymbol ); ?></td> <td class="border border-gray-300 px-3 py-2"><?php echo htmlspecialchars( formatString( $tradeSymbol ) ); ?></td>
<td class="border border-gray-300 px-3 py-2"><?php echo htmlspecialchars( (string) ( $tradeGood['type'] ?? '' ) ); ?></td> <td class="border border-gray-300 px-3 py-2"><?php echo htmlspecialchars( (string) ( formatString( $tradeGood['type'] ?? '' ) ) ); ?></td>
<td class="border border-gray-300 px-3 py-2"><?php echo htmlspecialchars( (string) ( $tradeGood['supply'] ?? '' ) ); ?></td> <td class="border border-gray-300 px-3 py-2"><?php echo htmlspecialchars( (string) ( formatString( $tradeGood['supply'] ?? '' ) ) ); ?></td>
<td class="border border-gray-300 px-3 py-2"><?php echo number_format( $purchasePrice ); ?></td> <td class="border border-gray-300 px-3 py-2"><?php echo number_format( $purchasePrice ); ?></td>
<td class="border border-gray-300 px-3 py-2"><?php echo number_format( (int) ( $tradeGood['sellPrice'] ?? 0 ) ); ?></td> <td class="border border-gray-300 px-3 py-2"><?php echo number_format( (int) ( $tradeGood['sellPrice'] ?? 0 ) ); ?></td>
<td class="border border-gray-300 px-3 py-2"> <td class="border border-gray-300 px-3 py-2">