v0.1.11 - Editor
This commit is contained in:
@@ -11,270 +11,141 @@
|
||||
const approvedCount = $derived(scenarioRows.filter((scenario) => scenario.status === 'approved').length);
|
||||
</script>
|
||||
|
||||
<section class="metric-row">
|
||||
<article class="metric-card">
|
||||
<section class="ui-metric-row module-section">
|
||||
<article class="ui-metric-card">
|
||||
<span>Total Scenarios</span>
|
||||
<strong>{scenarioRows.length}</strong>
|
||||
<p>Saved planning workspaces</p>
|
||||
</article>
|
||||
|
||||
<article class="metric-card">
|
||||
<article class="ui-metric-card">
|
||||
<span>Approved</span>
|
||||
<strong>{approvedCount}</strong>
|
||||
<p>Ready for pricing reference</p>
|
||||
</article>
|
||||
|
||||
<article class="metric-card">
|
||||
<article class="ui-metric-card">
|
||||
<span>Overrides In Use</span>
|
||||
<strong>{scenarioRows.reduce((sum, row) => sum + row.overrideKeys.length, 0)}</strong>
|
||||
<p>Total override keys across all scenarios</p>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
<section class="scenario-list">
|
||||
{#each scenarioRows as scenario}
|
||||
<article class="surface-card">
|
||||
<div class="scenario-header">
|
||||
<div>
|
||||
<p class="eyebrow">Scenario</p>
|
||||
<h3>{scenario.name}</h3>
|
||||
<p>{scenario.description ?? 'No description provided yet.'}</p>
|
||||
</div>
|
||||
<section class="ui-panel module-section">
|
||||
<div class="ui-section-heading">
|
||||
<div>
|
||||
<p class="ui-eyebrow">Scenario Library</p>
|
||||
<h3>Planning scenarios</h3>
|
||||
</div>
|
||||
<span class="ui-pill neutral">{scenarioRows.length} saved</span>
|
||||
</div>
|
||||
|
||||
<span class={`status-pill ${scenario.status === 'approved' ? 'positive' : 'neutral'}`}>{scenario.status}</span>
|
||||
</div>
|
||||
|
||||
<div class="scenario-grid">
|
||||
<section class="detail-card">
|
||||
<div class="detail-row">
|
||||
<span>Override count</span>
|
||||
<strong>{scenario.overrideKeys.length}</strong>
|
||||
</div>
|
||||
<div class="detail-row">
|
||||
<span>Primary state</span>
|
||||
<strong>{scenario.status}</strong>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="detail-card">
|
||||
<p class="eyebrow">Override Keys</p>
|
||||
{#if scenario.overrideKeys.length}
|
||||
<div class="chip-list">
|
||||
{#each scenario.overrideKeys as key}
|
||||
<span>{key}</span>
|
||||
{/each}
|
||||
</div>
|
||||
{:else}
|
||||
<p class="empty">No overrides have been defined yet.</p>
|
||||
{/if}
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<section class="json-card">
|
||||
<div class="json-header">
|
||||
<h4>Scenario payload</h4>
|
||||
<span>JSON view</span>
|
||||
</div>
|
||||
<pre>{JSON.stringify(scenario.overrides, null, 2)}</pre>
|
||||
</section>
|
||||
</article>
|
||||
{/each}
|
||||
<div class="ui-table-wrap">
|
||||
<table class="ui-table scenario-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Scenario</th>
|
||||
<th>Status</th>
|
||||
<th>Overrides</th>
|
||||
<th>Payload</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{#each scenarioRows as scenario}
|
||||
<tr>
|
||||
<td data-label="Scenario">
|
||||
<div class="ui-table-identity scenario-identity">
|
||||
<span class="ui-row-mark">SC</span>
|
||||
<div>
|
||||
<strong>{scenario.name}</strong>
|
||||
<span>{scenario.description ?? 'No description provided yet.'}</span>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td data-label="Status">
|
||||
<span class={`ui-pill ${scenario.status === 'approved' ? 'positive' : 'neutral'}`}>{scenario.status}</span>
|
||||
</td>
|
||||
<td data-label="Overrides">
|
||||
{#if scenario.overrideKeys.length}
|
||||
<div class="chip-list">
|
||||
{#each scenario.overrideKeys as key}
|
||||
<span>{key}</span>
|
||||
{/each}
|
||||
</div>
|
||||
{:else}
|
||||
<span class="ui-muted">No overrides</span>
|
||||
{/if}
|
||||
</td>
|
||||
<td data-label="Payload">
|
||||
<details class="payload-details">
|
||||
<summary>View JSON</summary>
|
||||
<pre>{JSON.stringify(scenario.overrides, null, 2)}</pre>
|
||||
</details>
|
||||
</td>
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<style>
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
p,
|
||||
pre {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.eyebrow {
|
||||
color: #7f8e85;
|
||||
font-size: 0.78rem;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.08em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.page-intro,
|
||||
.metric-row,
|
||||
.scenario-list {
|
||||
.module-section {
|
||||
margin-bottom: 1.25rem;
|
||||
}
|
||||
|
||||
.page-intro h2 {
|
||||
margin: 0.35rem 0 0.45rem;
|
||||
max-width: 18ch;
|
||||
font-size: clamp(1.7rem, 3vw, 2.2rem);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.page-intro p:last-child,
|
||||
.metric-card p,
|
||||
.scenario-header p:last-child,
|
||||
.empty,
|
||||
.json-header span,
|
||||
pre {
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.metric-row,
|
||||
.scenario-grid {
|
||||
display: grid;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.metric-row {
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.metric-card,
|
||||
.surface-card,
|
||||
.detail-card,
|
||||
.json-card {
|
||||
background: var(--panel);
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 1.35rem;
|
||||
box-shadow: var(--shadow);
|
||||
}
|
||||
|
||||
.metric-card {
|
||||
padding: 1.15rem 1.2rem;
|
||||
}
|
||||
|
||||
.metric-card span {
|
||||
display: block;
|
||||
color: var(--muted);
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.metric-card strong {
|
||||
display: block;
|
||||
margin: 0.55rem 0 0.3rem;
|
||||
font-size: 1.9rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.scenario-list {
|
||||
display: grid;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.surface-card {
|
||||
padding: 1.2rem;
|
||||
display: grid;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.scenario-header,
|
||||
.detail-row,
|
||||
.json-header {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.scenario-header h3 {
|
||||
margin: 0.3rem 0 0.4rem;
|
||||
font-size: 1.15rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.status-pill {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0.42rem 0.78rem;
|
||||
border-radius: 999px;
|
||||
font-size: 0.84rem;
|
||||
font-weight: 600;
|
||||
text-transform: capitalize;
|
||||
}
|
||||
|
||||
.status-pill.positive {
|
||||
color: var(--green-deep);
|
||||
background: var(--green-soft);
|
||||
}
|
||||
|
||||
.status-pill.neutral {
|
||||
color: #5a6c63;
|
||||
background: #edf2ef;
|
||||
}
|
||||
|
||||
.scenario-grid {
|
||||
grid-template-columns: 0.7fr 1.3fr;
|
||||
}
|
||||
|
||||
.detail-card,
|
||||
.json-card {
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.detail-row + .detail-row {
|
||||
margin-top: 0.9rem;
|
||||
}
|
||||
|
||||
.detail-row span {
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.detail-row strong {
|
||||
font-size: 1rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.chip-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.6rem;
|
||||
margin-top: 0.7rem;
|
||||
gap: 0.42rem;
|
||||
max-width: 28rem;
|
||||
}
|
||||
|
||||
.chip-list span {
|
||||
padding: 0.45rem 0.7rem;
|
||||
padding: 0.36rem 0.62rem;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 999px;
|
||||
background: var(--panel-soft);
|
||||
color: #365044;
|
||||
font-size: 0.84rem;
|
||||
color: var(--color-text-secondary);
|
||||
font-size: 0.8rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.json-header {
|
||||
margin-bottom: 0.8rem;
|
||||
.scenario-table {
|
||||
min-width: 58rem;
|
||||
}
|
||||
|
||||
.json-header h4 {
|
||||
font-size: 1rem;
|
||||
.scenario-identity {
|
||||
min-width: 22rem;
|
||||
}
|
||||
|
||||
.payload-details {
|
||||
max-width: 24rem;
|
||||
}
|
||||
|
||||
.payload-details summary {
|
||||
width: fit-content;
|
||||
color: var(--green-deep);
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
pre {
|
||||
padding: 1rem;
|
||||
border-radius: 1rem;
|
||||
background: var(--panel-soft);
|
||||
border: 1px solid var(--line);
|
||||
.payload-details pre {
|
||||
max-height: 14rem;
|
||||
margin-top: 0.7rem;
|
||||
padding: 0.9rem;
|
||||
overflow: auto;
|
||||
font-size: 0.85rem;
|
||||
line-height: 1.55;
|
||||
}
|
||||
|
||||
@media (max-width: 960px) {
|
||||
.metric-row,
|
||||
.scenario-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 760px) {
|
||||
.scenario-header,
|
||||
.detail-row,
|
||||
.json-header {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
}
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 0.82rem;
|
||||
background: var(--panel);
|
||||
color: var(--muted);
|
||||
font-size: 0.8rem;
|
||||
line-height: 1.5;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user