Skip to content

Commit 209c48a

Browse files
committed
refactor(scenario-selection): ♻️ use scenario-url attr, refine UI
Rename data attribute from data-scenario-id to data-scenario-url and update click handler to use the URL for navigation Adjust CSS sizing and spacing (paddings, font sizes, grid min-widths/gaps, card/header/footer heights) to tighten layout and improve responsiveness
1 parent 61ea4fb commit 209c48a

2 files changed

Lines changed: 43 additions & 42 deletions

File tree

src/pages/scenario-selection.css

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
display: flex;
33
flex-direction: column;
44
align-items: center;
5-
padding: 2rem;
5+
padding: 2rem 2rem;
66
min-height: 100vh;
77
background: linear-gradient(135deg, #1a1a1a 0%, #0f0f0f 100%);
88
color: #fff;
@@ -14,29 +14,29 @@
1414
}
1515

1616
.scenario-selection-header h1 {
17-
font-size: 2.5rem;
17+
font-size: 2rem;
1818
font-weight: bold;
1919
letter-spacing: 3px;
2020
text-transform: uppercase;
2121
color: #fff;
2222
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
23-
margin-bottom: 0.5rem;
23+
margin-bottom: 0.25rem;
2424
}
2525

2626
.scenario-selection-header .subtitle {
27-
font-size: 1rem;
27+
font-size: 0.9rem;
2828
color: #aaa;
2929
letter-spacing: 1px;
3030
text-transform: uppercase;
3131
}
3232

3333
.scenario-grid {
3434
display: grid;
35-
grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
36-
gap: 2rem;
35+
grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
36+
gap: 1rem;
3737
width: 100%;
38-
max-width: 1400px;
39-
margin-bottom: 2rem;
38+
max-width: 1800px;
39+
margin-bottom: 1rem;
4040
}
4141

4242
/* Scenario Card - Equipment Case Style */
@@ -98,7 +98,7 @@
9898
display: flex;
9999
justify-content: space-between;
100100
align-items: center;
101-
height: 50px;
101+
height: 40px;
102102
padding: 0 24px;
103103
background: linear-gradient(180deg, #3a3a3a 0%, #2a2a2a 100%);
104104
border-bottom: 2px solid #444;
@@ -196,72 +196,72 @@
196196
.scenario-card-body {
197197
display: flex;
198198
flex-direction: column;
199-
padding: 1.5rem;
199+
padding: 1rem;
200200
flex-grow: 1;
201201
}
202202

203203
.scenario-title {
204-
font-size: 1.25rem;
204+
font-size: 1.1rem;
205205
font-weight: bold;
206206
color: var(--color-text-accent);
207-
margin-bottom: 0.5rem;
207+
margin-bottom: 0.35rem;
208208
line-height: 1.3;
209209
}
210210

211211
.scenario-subtitle {
212-
font-size: 0.95rem;
212+
font-size: 0.85rem;
213213
color: #ccc;
214-
margin-bottom: 1rem;
214+
margin-bottom: 0.75rem;
215215
font-style: italic;
216216
}
217217

218218
.scenario-mission-type {
219219
display: inline-block;
220-
padding: 4px 12px;
220+
padding: 3px 10px;
221221
background-color: #1a1a1a;
222222
border: 1px solid #444;
223223
border-radius: 4px;
224-
font-size: 12px;
224+
font-size: 11px;
225225
color: #aaa;
226-
margin-bottom: 1rem;
226+
margin-bottom: 0.75rem;
227227
letter-spacing: 0.5px;
228228
}
229229

230230
.scenario-description {
231-
font-size: 0.9rem;
232-
line-height: 1.6;
231+
font-size: 0.85rem;
232+
line-height: 1.5;
233233
color: #ddd;
234-
margin-bottom: 1rem;
234+
margin-bottom: 0.75rem;
235235
flex-grow: 1;
236236
}
237237

238238
/* Equipment Info Section */
239239
.scenario-equipment {
240-
margin-top: 1rem;
241-
padding-top: 1rem;
240+
margin-top: 0.75rem;
241+
padding-top: 0.75rem;
242242
border-top: 1px solid #333;
243243
}
244244

245245
.scenario-equipment-title {
246-
font-size: 0.85rem;
246+
font-size: 0.75rem;
247247
font-weight: bold;
248248
color: #aaa;
249249
text-transform: uppercase;
250250
letter-spacing: 1px;
251-
margin-bottom: 0.75rem;
251+
margin-bottom: 0.5rem;
252252
}
253253

254254
.equipment-list {
255255
display: grid;
256256
grid-template-columns: repeat(2, 1fr);
257-
gap: 0.5rem;
257+
gap: 0.4rem;
258258
}
259259

260260
.equipment-item {
261261
display: flex;
262262
align-items: center;
263-
gap: 0.5rem;
264-
font-size: 0.85rem;
263+
gap: 0.4rem;
264+
font-size: 0.8rem;
265265
color: #ccc;
266266
}
267267

@@ -278,7 +278,7 @@
278278
display: flex;
279279
justify-content: space-between;
280280
align-items: center;
281-
padding: 12px 1.5rem;
281+
padding: 8px 1rem;
282282
background: linear-gradient(180deg, #1a1a1a 0%, #0f0f0f 100%);
283283
border-top: 1px solid #333;
284284
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.6);
@@ -314,16 +314,16 @@
314314
gap: 1rem;
315315
width: 100%;
316316
max-width: 600px;
317-
margin-top: 1rem;
317+
margin-bottom: 1rem;
318318
}
319319

320320
.btn-start-scenario {
321-
padding: 14px 40px;
321+
padding: 10px 32px;
322322
background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
323323
color: #fff;
324324
border: none;
325325
border-radius: 6px;
326-
font-size: 16px;
326+
font-size: 14px;
327327
font-weight: bold;
328328
letter-spacing: 2px;
329329
text-transform: uppercase;
@@ -348,12 +348,12 @@
348348
}
349349

350350
.btn-back {
351-
padding: 14px 40px;
351+
padding: 10px 32px;
352352
background: linear-gradient(135deg, #3a3a3a 0%, #2a2a2a 100%);
353353
color: #fff;
354354
border: 2px solid #444;
355355
border-radius: 6px;
356-
font-size: 16px;
356+
font-size: 14px;
357357
font-weight: bold;
358358
letter-spacing: 2px;
359359
text-transform: uppercase;
@@ -372,23 +372,24 @@
372372
}
373373

374374
/* Responsive Design */
375-
@media (max-width: 1024px) {
375+
@media (max-width: 1200px) {
376376
.scenario-grid {
377-
grid-template-columns: 1fr;
377+
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
378378
}
379379
}
380380

381381
@media (max-width: 768px) {
382382
.scenario-selection-page {
383-
padding: 1rem;
383+
padding: 0.75rem;
384384
}
385385

386386
.scenario-selection-header h1 {
387-
font-size: 2rem;
387+
font-size: 1.5rem;
388388
}
389389

390390
.scenario-grid {
391-
gap: 1rem;
391+
grid-template-columns: 1fr;
392+
gap: 0.75rem;
392393
}
393394

394395
.equipment-list {

src/pages/scenario-selection.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export class ScenarioSelectionPage extends BasePage {
4646

4747
private renderScenarioCard_(scenario: ScenarioData): string {
4848
return html`
49-
<div class="scenario-card" data-scenario-id="${scenario.id}">
49+
<div class="scenario-card" data-scenario-url="${scenario.url}">
5050
<div class="scenario-card-header">
5151
<div class="scenario-number">Scenario ${scenario.number}</div>
5252
<div class="scenario-badges">
@@ -106,17 +106,17 @@ export class ScenarioSelectionPage extends BasePage {
106106

107107
private handleScenarioCardClick_(event: Event): void {
108108
const card = (event.currentTarget as HTMLElement);
109-
const scenarioId = card.dataset.scenarioId;
109+
const scenarioUrl = card.dataset.scenarioUrl;
110110

111-
if (!scenarioId) return;
111+
if (!scenarioUrl) return;
112112

113113
// Remove selection from all cards
114114
const allCards = qsa('.scenario-card', this.dom_);
115115
allCards.forEach(c => c.classList.remove('selected'));
116116

117117
// Add selection to clicked card
118118
card.classList.add('selected');
119-
this.selectedScenario_ = scenarioId;
119+
this.selectedScenario_ = scenarioUrl;
120120

121121
// Enable start button
122122
(this.domCacehe_['btn-start'] as HTMLButtonElement).disabled = false;

0 commit comments

Comments
 (0)