refactor: improve layout and styling consistency across components

This commit is contained in:
2026-04-23 21:08:54 -04:00
parent 1df2ae8164
commit c2d12ffcc9
3 changed files with 39 additions and 33 deletions

View File

@@ -127,9 +127,20 @@ const verbHandlers: Record<string, VerbHandler> = {
reason: `'${t.target.id}' cannot be taken`, reason: `'${t.target.id}' cannot be taken`,
}; };
} }
// Item must be in the same location as actor
// Item must be in the same location as actor (unless already in inventory)
const actorLocation = actor.attributes["location"]; const actorLocation = actor.attributes["location"];
const itemLocation = t.target.attributes["location"]; const itemLocation = t.target.attributes["location"];
const expectedInventory = `inventory:${actor.id}`;
// If already in inventory, it's a no-op (already holding it)
if (itemLocation === expectedInventory) {
return {
ok: true,
changes: [],
};
}
if (actorLocation !== itemLocation) { if (actorLocation !== itemLocation) {
return { return {
ok: false, ok: false,
@@ -139,7 +150,7 @@ const verbHandlers: Record<string, VerbHandler> = {
return { return {
ok: true, ok: true,
changes: [attributeChange(t.target, "location", `inventory:${actor.id}`)], changes: [attributeChange(t.target, "location", expectedInventory)],
}; };
}, },

View File

@@ -146,7 +146,7 @@ export default function App() {
<section className="result-card"> <section className="result-card">
<h2>Latest result</h2> <h2>Latest result</h2>
<p>{latest.narration}</p> <p>{latest.narration}</p>
<pre>{JSON.stringify({ actions: latest.actions, rejected: latest.rejected, latent: latest.latent_resolution }, null, 2)}</pre> <pre>{JSON.stringify({ actions: latest.actions, rejected: latest.rejected, latent: latest.latent_resolution }, null, 0)}</pre>
</section> </section>
) : null} ) : null}
@@ -160,9 +160,8 @@ export default function App() {
<ul className="entity-list"> <ul className="entity-list">
{snapshot?.entities.map((entity) => ( {snapshot?.entities.map((entity) => (
<li key={entity.id}> <li key={entity.id}>
<strong>{entity.name}</strong> <strong>{entity.name}</strong> <span>{entity.type}</span>
<span>{entity.type}</span> <pre>{JSON.stringify(entity.attributes, null, 0)}</pre>
<pre>{JSON.stringify(entity.attributes, null, 2)}</pre>
</li> </li>
))} ))}
</ul> </ul>
@@ -173,9 +172,7 @@ export default function App() {
<ul className="timeline-list"> <ul className="timeline-list">
{snapshot?.turns.slice().reverse().map((turn) => ( {snapshot?.turns.slice().reverse().map((turn) => (
<li key={turn.id}> <li key={turn.id}>
<strong>Turn {turn.turn}</strong> <strong>Turn {turn.turn}:</strong> {turn.input} {turn.output}
<p>{turn.input}</p>
<p>{turn.output}</p>
</li> </li>
))} ))}
</ul> </ul>
@@ -186,8 +183,7 @@ export default function App() {
<ul className="timeline-list compact"> <ul className="timeline-list compact">
{snapshot?.events.slice().reverse().map((event) => ( {snapshot?.events.slice().reverse().map((event) => (
<li key={event.id}> <li key={event.id}>
<strong>{event.result}</strong> <strong>{event.result}:</strong> <pre>{JSON.stringify(event.action, null, 0)}</pre>
<pre>{JSON.stringify(event.action, null, 2)}</pre>
</li> </li>
))} ))}
</ul> </ul>
@@ -199,9 +195,7 @@ export default function App() {
<ul className="timeline-list compact"> <ul className="timeline-list compact">
{snapshot?.beliefs.map((belief) => ( {snapshot?.beliefs.map((belief) => (
<li key={`${belief.entity_id}-${belief.claim}`}> <li key={`${belief.entity_id}-${belief.claim}`}>
<strong>{belief.entity_id}</strong> <strong>{belief.entity_id}:</strong> {belief.claim} ({belief.confidence})
<p>{belief.claim}</p>
<p>confidence: {belief.confidence}</p>
</li> </li>
))} ))}
</ul> </ul>
@@ -209,8 +203,7 @@ export default function App() {
<ul className="timeline-list compact"> <ul className="timeline-list compact">
{snapshot?.summaries.map((summary) => ( {snapshot?.summaries.map((summary) => (
<li key={summary.id}> <li key={summary.id}>
<strong>{summary.turn_range.join("-")}</strong> <strong>{summary.turn_range.join("-")}:</strong> {summary.text}
<p>{summary.text}</p>
</li> </li>
))} ))}
</ul> </ul>

View File

@@ -26,15 +26,15 @@ textarea {
.page-shell { .page-shell {
width: min(1400px, calc(100vw - 32px)); width: min(1400px, calc(100vw - 32px));
margin: 0 auto; margin: 0 auto;
padding: 32px 0 48px; padding: 16px 0 24px;
} }
.hero-panel { .hero-panel {
padding: 32px; padding: 20px;
border: 1px solid rgba(244, 239, 228, 0.16); border: 1px solid rgba(244, 239, 228, 0.16);
background: rgba(19, 24, 18, 0.68); background: rgba(19, 24, 18, 0.68);
backdrop-filter: blur(12px); backdrop-filter: blur(12px);
border-radius: 28px; border-radius: 20px;
box-shadow: 0 22px 70px rgba(0, 0, 0, 0.24); box-shadow: 0 22px 70px rgba(0, 0, 0, 0.24);
} }
@@ -65,8 +65,8 @@ h1 {
.turn-form { .turn-form {
display: grid; display: grid;
gap: 12px; gap: 8px;
margin-top: 24px; margin-top: 12px;
} }
.turn-form textarea { .turn-form textarea {
@@ -81,7 +81,7 @@ h1 {
.actions-row { .actions-row {
display: grid; display: grid;
gap: 12px; gap: 8px;
} }
.actions-row > button, .actions-row > button,
@@ -108,21 +108,21 @@ h1 {
.result-card, .result-card,
.panel { .panel {
border-radius: 24px; border-radius: 16px;
padding: 24px; padding: 16px;
border: 1px solid rgba(244, 239, 228, 0.12); border: 1px solid rgba(244, 239, 228, 0.12);
background: rgba(11, 16, 12, 0.58); background: rgba(11, 16, 12, 0.58);
} }
.result-card { .result-card {
margin-top: 24px; margin-top: 12px;
} }
.inspector-grid { .inspector-grid {
display: grid; display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 20px; gap: 12px;
margin-top: 24px; margin-top: 12px;
} }
.entity-list, .entity-list,
@@ -131,13 +131,13 @@ h1 {
padding: 0; padding: 0;
margin: 0; margin: 0;
display: grid; display: grid;
gap: 14px; gap: 8px;
} }
.entity-list li, .entity-list li,
.timeline-list li { .timeline-list li {
padding: 16px; padding: 10px 12px;
border-radius: 18px; border-radius: 12px;
background: rgba(255, 255, 255, 0.03); background: rgba(255, 255, 255, 0.03);
border: 1px solid rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.05);
} }
@@ -151,12 +151,14 @@ h1 {
pre { pre {
white-space: pre-wrap; white-space: pre-wrap;
word-break: break-word; word-break: break-word;
font-size: 0.85rem; font-size: 0.75rem;
color: #cfd9c2; color: #cfd9c2;
margin: 4px 0 0 0;
padding: 4px 0;
} }
.compact li { .compact li {
padding: 12px; padding: 8px 10px;
} }
.error-banner { .error-banner {
@@ -176,6 +178,6 @@ pre {
.hero-panel, .hero-panel,
.panel { .panel {
padding: 20px; padding: 14px;
} }
} }