feat(ui): right rail inventory placeholder and optional event log
- RightRail: add Inventory section (placeholder "Items coming soon") between Resources and Event Log, matching the existing heading style - RightRail: gate Event Log section on prefs.showEventLog; add local-state collapse toggle with aria-expanded and chevron indicator - SettingsPanel: add "Show event log" checkbox row bound to prefs.showEventLog via setPrefs, matching existing card styling - PlayPanel: gate mobile EventLog behind prefs.showEventLog for consistency with desktop; mobile ResourceBar unchanged
This commit is contained in:
@@ -5,6 +5,7 @@ import { EventLog } from './EventLog';
|
|||||||
import { ResourceBar } from './ResourceBar';
|
import { ResourceBar } from './ResourceBar';
|
||||||
|
|
||||||
export function PlayPanel() {
|
export function PlayPanel() {
|
||||||
|
const showEventLog = useGameStore((s) => s.prefs.showEventLog);
|
||||||
const columns = useGameStore((s) => s.actionColumns).filter(
|
const columns = useGameStore((s) => s.actionColumns).filter(
|
||||||
(col) => col.groups.length > 0 && col.groups.some((g) => g.actions.length > 0),
|
(col) => col.groups.length > 0 && col.groups.some((g) => g.actions.length > 0),
|
||||||
);
|
);
|
||||||
@@ -55,9 +56,11 @@ export function PlayPanel() {
|
|||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
<div className="block md:hidden">
|
{showEventLog && (
|
||||||
<EventLog />
|
<div className="block md:hidden">
|
||||||
</div>
|
<EventLog />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+31
-2
@@ -1,18 +1,47 @@
|
|||||||
|
import { useState } from 'react';
|
||||||
|
import { useGameStore } from '../state/store';
|
||||||
import { EventLog } from './EventLog';
|
import { EventLog } from './EventLog';
|
||||||
import { ResourceBar } from './ResourceBar';
|
import { ResourceBar } from './ResourceBar';
|
||||||
|
|
||||||
export function RightRail() {
|
export function RightRail() {
|
||||||
|
const showEventLog = useGameStore((s) => s.prefs.showEventLog);
|
||||||
|
const [logOpen, setLogOpen] = useState(true);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex h-full flex-col gap-6">
|
<div className="flex h-full flex-col gap-6">
|
||||||
|
{/* Resources */}
|
||||||
<div>
|
<div>
|
||||||
<h2 className="mb-3 font-semibold text-slate-400 text-xs tracking-wider uppercase">
|
<h2 className="mb-3 font-semibold text-slate-400 text-xs tracking-wider uppercase">
|
||||||
Resources
|
Resources
|
||||||
</h2>
|
</h2>
|
||||||
<ResourceBar />
|
<ResourceBar />
|
||||||
</div>
|
</div>
|
||||||
<div className="flex-1 border-slate-900 border-t pt-4">
|
|
||||||
<EventLog />
|
{/* Inventory placeholder */}
|
||||||
|
<div className="border-slate-900 border-t pt-4">
|
||||||
|
<h2 className="mb-3 font-semibold text-slate-400 text-xs tracking-wider uppercase">
|
||||||
|
Inventory
|
||||||
|
</h2>
|
||||||
|
<p className="text-slate-600 text-xs">Items coming soon.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* Event log — gated by pref, collapsible via local state */}
|
||||||
|
{showEventLog && (
|
||||||
|
<div className="flex-1 border-slate-900 border-t pt-4">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
aria-expanded={logOpen}
|
||||||
|
onClick={() => setLogOpen((prev) => !prev)}
|
||||||
|
className="mb-3 flex w-full items-center justify-between font-semibold text-slate-400 text-xs tracking-wider uppercase hover:text-slate-300"
|
||||||
|
>
|
||||||
|
<span>Event Log</span>
|
||||||
|
<span aria-hidden="true" className="text-slate-500">
|
||||||
|
{logOpen ? '▾' : '▸'}
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
{logOpen && <EventLog />}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,6 +80,23 @@ export function SettingsPanel() {
|
|||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{/* Show event log */}
|
||||||
|
<div className="flex flex-col gap-2 rounded-xl border border-slate-800 bg-slate-900/40 p-5">
|
||||||
|
<label className="flex cursor-pointer items-center justify-between gap-4">
|
||||||
|
<div className="flex flex-col">
|
||||||
|
<span className="font-semibold text-slate-200 text-sm">Show event log</span>
|
||||||
|
<span className="text-slate-400 text-xs">
|
||||||
|
Display the scrollable event log in the right rail and on mobile.
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
checked={prefs.showEventLog}
|
||||||
|
onChange={(e) => setPrefs({ showEventLog: e.target.checked })}
|
||||||
|
className="h-4 w-4 cursor-pointer accent-amber-500"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user