feat: Add content for quest view

- New faction selection
- New detail structure
- Refactor behavior for deselecting elements
- Add events
This commit is contained in:
sthag 2026-04-19 12:21:38 +02:00
parent 1d4d5624d5
commit 5cd55ab2bc
2 changed files with 140 additions and 31 deletions

View file

@ -30,7 +30,8 @@
font-weight: bold; font-weight: bold;
} }
.subtle { .subtle,
hgroup p {
@extend .txt_smaller; @extend .txt_smaller;
color: hippie.$color_darkest; color: hippie.$color_darkest;
@ -45,10 +46,13 @@
position: relative; position: relative;
overflow: hidden; overflow: hidden;
h2, span {
color: white;
}
*:not(canvas, img) { *:not(canvas, img) {
z-index: map.get(hippie.$z-indexes, "content-bottom"); z-index: map.get(hippie.$z-indexes, "content-bottom");
position: relative; position: relative;
color: white;
} }
canvas, img { canvas, img {
@ -86,11 +90,23 @@
gap: hippie.$space_double; gap: hippie.$space_double;
min-height: 0; min-height: 0;
& > div:last-child { nav {
flex: 2; flex: 1;
display: flex;
flex-flow: column nowrap;
gap: hippie.$space_basic;
min-height: 0;
input:not([type="checkbox"], [type="range"]) {
@extend .input_io;
}
select {
@extend .io_select;
}
} }
& > div:nth-child(2) { & > div {
flex: 4; flex: 4;
display: flex; display: flex;
flex-flow: column nowrap; flex-flow: column nowrap;
@ -108,19 +124,15 @@
} }
} }
nav { aside {
flex: 1; flex: 2;
display: flex;
flex-flow: column nowrap;
gap: hippie.$space_basic;
min-height: 0;
input:not([type="checkbox"], [type="range"]) { .background {
@extend .input_io; border-bottom: 1px solid hippie.basic_color(echo);
} }
select { & > div {
@extend .io_select; display: none;
} }
} }
@ -134,7 +146,6 @@
} }
td { td {
height: 4em;
vertical-align: top; vertical-align: top;
span { span {
@ -143,12 +154,24 @@
color: white; color: white;
} }
&:last-child { &.subtle {
text-align: center; text-align: center;
vertical-align: middle; vertical-align: middle;
} }
} }
&#questSelection {
display: none;
}
&[data-type="faction"] td {
height: 6em;
}
&[data-type="quest"] td {
height: 4em;
}
.l { .l {
width: 30%; width: 30%;
} }
@ -157,7 +180,11 @@
width: 50%; width: 50%;
} }
.t, .s { .g {
width: 40%;
}
.t, .s, .c, .f {
width: 20%; width: 20%;
} }
} }
@ -173,10 +200,6 @@
} }
} }
.quest {
opacity: 0;
}
footer *:not(button[data-action="back"]) { footer *:not(button[data-action="back"]) {
display: none; display: none;
} }

View file

@ -38,7 +38,45 @@ tags:
</nav> </nav>
<div> <div>
<div> <div>
<table id="questSelection"> <table id="factionSelection" data-type="faction">
<colgroup>
<col class="g">
<col class="c">
<col class="f">
<col class="s">
</colgroup>
<tr>
<th>Giver</th>
<th>Category</th>
<th>Faction</th>
<th>Status</th>
</tr>
<tr>
<td class="background">
<span>Scavengers</span>
</td>
<td class="subtle">All</td>
<td class="subtle">Scav</td>
<td class="subtle">Open</td>
</tr>
<tr>
<td class="background">
<span>Eastern Consulate</span>
</td>
<td class="subtle">All</td>
<td class="subtle">Eurasia</td>
<td class="subtle">Closed</td>
</tr>
<tr>
<td class="background">
<span>СПЕЦНАЗ Commission</span>
</td>
<td class="subtle">All</td>
<td class="subtle">Euruska</td>
<td class="subtle">Open</td>
</tr>
</table>
<table id="questSelection" data-type="quest">
<colgroup> <colgroup>
<col class="l"> <col class="l">
<col class="q"> <col class="q">
@ -66,7 +104,7 @@ tags:
</table> </table>
</div> </div>
<div> <div>
<table id="questActive"> <table id="questActive" data-type="quest">
<colgroup> <colgroup>
<col class="l"> <col class="l">
<col class="q"> <col class="q">
@ -92,7 +130,21 @@ tags:
</table> </table>
</div> </div>
</div> </div>
<div> <aside>
<div class="faction">
<div class="background">
<hgroup>
<h2>Western Embassy</h2>
<p>Europa</p>
</hgroup>
</div>
<p>A hijacked medium mech dubbed the "Rat King" ...</p>
<hr class="dotted">
<p>Collect Rat King residue.</p>
<hr>
<p>Multiple rig container upgrades, 5000&nbsp;CR, 5000&nbsp;XP, 2 days of water, +&nbsp;Scav faction
rating</p>
</div>
<div class="quest"> <div class="quest">
<div class="background"> <div class="background">
<h2>King Of Kings</h2> <h2>King Of Kings</h2>
@ -104,7 +156,7 @@ tags:
<p>Multiple rig container upgrades, 5000&nbsp;CR, 5000&nbsp;XP, 2 days of water, +&nbsp;Scav faction <p>Multiple rig container upgrades, 5000&nbsp;CR, 5000&nbsp;XP, 2 days of water, +&nbsp;Scav faction
rating</p> rating</p>
</div> </div>
</div> </aside>
</main> </main>
<footer class="io"> <footer class="io">
<button data-action="back">Back</button> <button data-action="back">Back</button>
@ -207,8 +259,10 @@ tags:
// TODO: Allgemeinere Umsetzung anstreben // TODO: Allgemeinere Umsetzung anstreben
viewQuest.addEventListener('click', (event) => { viewQuest.addEventListener('click', (event) => {
const tableTarget = event.target.closest('table');
const rows = viewQuest.querySelectorAll('tr'); const rows = viewQuest.querySelectorAll('tr');
const rowTarget = event.target.closest('tr'); const rowTarget = event.target.closest('tr');
const rowFaction = event.target.closest('#factionSelection tr');
const rowSelection = event.target.closest('#questSelection tr'); const rowSelection = event.target.closest('#questSelection tr');
const rowActive = event.target.closest('#questActive tr:not(.complete)'); const rowActive = event.target.closest('#questActive tr:not(.complete)');
const rowComplete = event.target.closest('#questActive tr.complete'); const rowComplete = event.target.closest('#questActive tr.complete');
@ -218,14 +272,26 @@ tags:
if (event.button !== 0) return; if (event.button !== 0) return;
// TODO: Ziele unterscheiden
if (rowTarget) { if (rowTarget) {
for (const row of rows) { const rowsRemain = Array.from(rows).filter(
row.classList.remove('active'); element => element !== rowTarget
} );
const type = tableTarget.dataset.type;
const tableSibling = tableTarget.nextElementSibling;
rowsRemain.forEach((element) => {
element.classList.remove('active');
});
rowTarget.classList.add('active'); rowTarget.classList.add('active');
viewQuest.querySelector('.quest').style.opacity = 1;
viewQuest.querySelector('aside > :not(.' + type + ')').style.display = 'none';
viewQuest.querySelector('aside > .' + type).style.display = 'block';
if (rowFaction) {
tableTarget.style.display = 'none';
tableSibling.style.display = 'table';
}
if (rowSelection) { if (rowSelection) {
buttonClaim.style.display = 'none'; buttonClaim.style.display = 'none';
@ -244,6 +310,8 @@ tags:
buttonAbandon.style.display = 'none'; buttonAbandon.style.display = 'none';
buttonClaim.style.display = 'inline-block'; buttonClaim.style.display = 'inline-block';
} }
} else {
deselector('quest');
} }
}); });
@ -261,5 +329,23 @@ tags:
}); });
new Menu(menu); new Menu(menu);
function deselector(type) {
const id = 'view' + capitalizeFirstLetter(type);
const view = document.getElementById(id);
const rows = view.querySelectorAll('tr');
const buttonAccept = view.querySelector('footer button[data-action=accept]');
const buttonAbandon = view.querySelector('footer button[data-action=abandon]');
const buttonClaim = view.querySelector('footer button[data-action=claim]');
for (const row of rows) {
row.classList.remove('active');
}
view.querySelector('.' + type).style.opacity = 0;
buttonAbandon.style.display = 'none';
buttonAccept.style.display = 'none';
buttonClaim.style.display = 'none';
}
</script> </script>
{% endblock %} {% endblock %}