Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 31 additions & 9 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -643,23 +643,45 @@
.rarity-border-rare { border: 2px solid var(--rarity-rare); }
.rarity-border-legendary { border: 2px solid var(--rarity-legendary); }

/* ===== GAME LOG ===== */
.game-log {
padding: 8px 16px;
/* ===== STATS BAR (header HUD) ===== */
.stats-bar {
display: flex;
justify-content: center;
gap: 24px;
padding: 8px 0 4px;
border-top: 1px solid rgba(255,255,255,0.06);
margin-top: 8px;
}

.stats-bar {
.stat-item {
display: flex;
justify-content: center;
gap: 16px;
padding: 6px 0;
font-size: 0.75rem;
flex-direction: column;
align-items: center;
gap: 1px;
}

.stat-value {
font-size: 0.85rem;
font-weight: 700;
color: var(--text-primary);
letter-spacing: 0.5px;
}

.stat-label {
font-size: 0.6rem;
color: var(--text-muted);
text-transform: uppercase;
letter-spacing: 1px;
}

/* ===== GAME LOG ===== */
.game-log {
padding: 4px 16px 6px;
border-top: 1px solid rgba(255,255,255,0.06);
}

.log-entries {
max-height: 100px;
max-height: 72px;
overflow-y: auto;
display: flex;
flex-direction: column;
Expand Down
16 changes: 16 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { useTranslation } from 'react-i18next';
import { useConvexAuth } from 'convex/react';
import { useAuthActions } from '@convex-dev/auth/react';
import { GameProvider } from './context/GameContext';
import { useGame } from './context/GameContext';
import PlanetView from './components/PlanetView';
import StarMap from './components/StarMap';
import Inventory from './components/Inventory';
Expand Down Expand Up @@ -39,6 +40,7 @@ const TABS: Tab[] = [

function GameUI() {
const { t } = useTranslation();
const { stats } = useGame();
const [activeTab, setActiveTab] = useState('planet');
const ActiveComponent = TABS.find(t => t.id === activeTab)!.component;
const haptics = useHaptics();
Expand All @@ -53,6 +55,20 @@ function GameUI() {
</div>
<AuthUpgrade />
</div>
<div className="stats-bar">
<div className="stat-item">
<span className="stat-value">⛏️ {stats.itemsMined}</span>
<span className="stat-label">{t('stats.mined')}</span>
</div>
<div className="stat-item">
<span className="stat-value">🔧 {stats.itemsCrafted}</span>
<span className="stat-label">{t('stats.crafted')}</span>
</div>
<div className="stat-item">
<span className="stat-value">🌍 {stats.planetsVisited}</span>
<span className="stat-label">{t('stats.planets')}</span>
</div>
</div>
</header>

<main className="game-main">
Expand Down
7 changes: 1 addition & 6 deletions src/components/GameLog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,10 @@ function LogMessage({ entry }: { entry: LogEntry }) {
}

export default function GameLog() {
const { log, stats } = useGame();
const { log } = useGame();

return (
<div className="game-log">
<div className="stats-bar">
<span>⛏️ {stats.itemsMined}</span>
<span>🔧 {stats.itemsCrafted}</span>
<span>🌍 {stats.planetsVisited}</span>
</div>
<div className="log-entries">
{log.map((entry, i) => (
<div key={`${entry.type}-${entry.key}-${i}`} className={`log-entry log-${entry.type}`}>
Expand Down
5 changes: 5 additions & 0 deletions src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@
"accountTooltip": "Account: {{email}}",
"linkTooltip": "Link account to save progress"
},
"stats": {
"mined": "mined",
"crafted": "crafted",
"planets": "planets"
},
"log": {
"welcome": "Welcome to space, explorer! You are on Terra Nova.",
"welcomeBack": "Welcome back! Your progress has been restored.",
Expand Down
5 changes: 5 additions & 0 deletions src/i18n/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@
"accountTooltip": "Cuenta: {{email}}",
"linkTooltip": "Vincular cuenta para guardar progreso"
},
"stats": {
"mined": "minados",
"crafted": "crafteados",
"planets": "planetas"
},
"log": {
"welcome": "¡Bienvenido al espacio, explorador! Estás en Terra Nova.",
"welcomeBack": "¡Bienvenido de vuelta! Tu progreso ha sido restaurado.",
Expand Down