🐞 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'; ?>
<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 ) ) : ?>
<div class="mb-6 border border-red-500 p-4 rounded text-red-300">
@@ -156,8 +153,7 @@ try {
<?php endif; ?>
<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>
</p>
@@ -173,39 +169,35 @@ try {
$exports = (array) ( $record['data']['exports'] ?? array() );
$exchange = (array) ( $record['data']['exchange'] ?? array() );
?>
<div class="mb-6 border border-gray-600 p-4 rounded">
<h2 class="text-2xl font-bold mb-2">
<?php echo htmlspecialchars( (string) ( $record['waypointSymbol'] ?? '' ) ); ?>
</h2>
<p class="text-sm text-gray-300 mb-3">
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>
<?php if ((string) ( $record['error'] ?? '' ) !== '' ) : ?>
<p class="text-red-300"><?php echo htmlspecialchars( (string) $record['error'] ); ?></p>
<?php else : ?>
<p class="mb-3">
<a
href="shop.php?waypoint=<?php echo urlencode( (string) ( $record['waypointSymbol'] ?? '' ) ); ?>"
class="text-blue-300 hover:underline"
>
Shop At This Waypoint
</a>
<a class="text-blue-300 hover:underline" href="shop.php?waypoint=<?php echo urlencode( (string) ( $record['waypointSymbol'] ?? '' ) ); ?>">Shop At This Waypoint</a>
</p>
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
<div>
<h3 class="font-bold mb-2">Imports</h3>
<?php if (empty( $imports ) ) : ?>
<p class="text-gray-400 text-sm">None</p>
<?php else : ?>
<ul class="list-disc list-inside text-sm">
<?php foreach ( $imports as $item ) : ?>
<li>
<?php echo htmlspecialchars( (string) ( $item['symbol'] ?? '' ) ); ?>
<?php if ((string) ( $item['name'] ?? '' ) !== '' ) : ?>
(<?php echo htmlspecialchars( (string) $item['name'] ); ?>)
<?php endif; ?>
<?php echo htmlspecialchars( (string) ( formatString( $item['symbol'] ?? '' ) ) ); ?>
</li>
<?php endforeach; ?>
</ul>
@@ -214,16 +206,14 @@ try {
<div>
<h3 class="font-bold mb-2">Exports</h3>
<?php if (empty( $exports ) ) : ?>
<p class="text-gray-400 text-sm">None</p>
<?php else : ?>
<ul class="list-disc list-inside text-sm">
<?php foreach ( $exports as $item ) : ?>
<li>
<?php echo htmlspecialchars( (string) ( $item['symbol'] ?? '' ) ); ?>
<?php if ((string) ( $item['name'] ?? '' ) !== '' ) : ?>
(<?php echo htmlspecialchars( (string) $item['name'] ); ?>)
<?php endif; ?>
<?php echo htmlspecialchars( (string) ( formatString( $item['symbol'] ?? '' ) ) ); ?>
</li>
<?php endforeach; ?>
</ul>
@@ -238,10 +228,7 @@ try {
<ul class="list-disc list-inside text-sm">
<?php foreach ( $exchange as $item ) : ?>
<li>
<?php echo htmlspecialchars( (string) ( $item['symbol'] ?? '' ) ); ?>
<?php if ((string) ( $item['name'] ?? '' ) !== '' ) : ?>
(<?php echo htmlspecialchars( (string) $item['name'] ); ?>)
<?php endif; ?>
<?php echo htmlspecialchars( (string) ( formatString( $item['symbol'] ?? '' ) ) ); ?>
</li>
<?php endforeach; ?>
</ul>

View File

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