better quest adventurer choice ux

This commit is contained in:
2025-05-11 16:37:58 +02:00
parent e71326d89b
commit d962c85629
5 changed files with 44 additions and 21 deletions
+2 -1
View File
@@ -1,5 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import {RouterLink, RouterView} from 'vue-router' import {RouterLink, RouterView} from 'vue-router'
import {version} from "@/../package.json";
</script> </script>
<template> <template>
@@ -104,7 +105,7 @@ export default defineComponent({
methods: { methods: {
async updateMissives() { async updateMissives() {
for (const missive of this.missives) { for (const missive of this.missives) {
if (missive.adventurers.length <= 0) { if (missive.adventurers.length < missive.maxAdventurers) {
missive.progressPoints = 0; missive.progressPoints = 0;
continue; continue;
} }
+2 -1
View File
@@ -1,12 +1,13 @@
* { * {
box-sizing: border-box; box-sizing: border-box;
font-family: 'EB Garamond', serif;
scrollbar-color: #8f7256 rgba(0, 0, 0, 0.1);
} }
body { body {
margin: 0; margin: 0;
padding: 0 0 2rem; padding: 0 0 2rem;
min-height: calc(100vh - 10rem); min-height: calc(100vh - 10rem);
font-family: 'EB Garamond', serif;
overflow-y: scroll; overflow-y: scroll;
user-select: none; user-select: none;
background-size: 25rem; background-size: 25rem;
+35 -16
View File
@@ -21,7 +21,9 @@ import { vOnClickOutside } from '@vueuse/components'
<span>+</span> <span>+</span>
</article> </article>
<div class="selection" v-if="selection" v-on-click-outside="closeSelect"> <div class="selection" v-if="selection" v-on-click-outside="closeSelect">
<button <span>Choose adventurer</span>
<div class="list">
<button
class="slot" class="slot"
v-for="adventurer in allAdventurers" v-for="adventurer in allAdventurers"
:key="adventurer.id" :key="adventurer.id"
@@ -31,11 +33,12 @@ import { vOnClickOutside } from '@vueuse/components'
$emit('hireAdventurer', adventurer.id); $emit('hireAdventurer', adventurer.id);
selection = false; selection = false;
}" }"
> >
<AdventurerTile <AdventurerTile
:adventurer="adventurer" :adventurer="adventurer"
/> />
</button> </button>
</div>
</div> </div>
</template> </template>
@@ -61,9 +64,9 @@ export default defineComponent({
}, },
}, },
allAdventurers: { allAdventurers: {
type: Object as PropType<{[key: string]: Adventurer}>, type: Object as PropType<Array<Adventurer>>,
default() { default() {
return {} as {[key: string]: Adventurer}; return [] as Array<Adventurer>;
}, },
}, },
}, },
@@ -82,22 +85,35 @@ export default defineComponent({
.selection { .selection {
position: absolute; position: absolute;
bottom: 0; bottom: 0;
left: 50%; left: 0;
width: max-content; width: 100%;
max-width: 17rem; max-width: 100%;
transform: translateX(-50%) translateY(104%);
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: center; justify-content: center;
align-items: center; align-items: flex-start;
flex-wrap: wrap; flex-wrap: wrap;
gap: 0.5rem; gap: 0.5rem;
padding: 0.5rem; padding: 0.5rem;
background-color: rgba(0,0,0, 0.2); background-color: rgba(0,0,0, 0.6);
backdrop-filter: blur(4px);
z-index: 2; z-index: 2;
cursor: default; cursor: default;
max-height: 12rem; height: 100%;
overflow-y: auto; overflow-y: scroll;
scrollbar-gutter: stable;
.list {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
gap: 1rem;
max-width: 100%;
}
span {
font-size: 1.5rem;
color: #fff;
}
.slot { .slot {
width: 5rem; width: 5rem;
height: 5rem; height: 5rem;
@@ -132,5 +148,8 @@ export default defineComponent({
height: 100%; height: 100%;
font-size: 4.5rem; font-size: 4.5rem;
color: #000; color: #000;
span {
transform: translateY(-0.5rem);
}
} }
</style> </style>
+1 -1
View File
@@ -83,7 +83,7 @@ h1 {
grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
grid-auto-rows: auto; grid-auto-rows: auto;
gap: 1rem; gap: 1rem;
overflow-x: visible;
} }
} }
</style> </style>
+4 -2
View File
@@ -19,7 +19,7 @@
<button class="slot"> <button class="slot">
<AdventurerComponent <AdventurerComponent
:adventurer="missive.adventurers[0]" :adventurer="missive.adventurers[0]"
:all-adventurers="adventurers" :all-adventurers="notBusyAdventurers"
@hire-adventurer="(id) => { @hire-adventurer="(id) => {
adventurers[id].busy = true; adventurers[id].busy = true;
missive.adventurers[0] = adventurers[id]; missive.adventurers[0] = adventurers[id];
@@ -63,6 +63,9 @@ export default defineComponent({
progressPercentageValue(): string { progressPercentageValue(): string {
return `${this.missive.progressPoints / this.missive.maxProgress * 100}%`; return `${this.missive.progressPoints / this.missive.maxProgress * 100}%`;
}, },
notBusyAdventurers(): Adventurer[] {
return Object.values(this.adventurers).filter(adventurer => !adventurer.busy);
},
}, },
props: { props: {
missive: { missive: {
@@ -232,7 +235,6 @@ export default defineComponent({
background-color: rgba(0, 0, 0, 0.2); background-color: rgba(0, 0, 0, 0.2);
cursor: pointer; cursor: pointer;
border-radius: 0.2rem; border-radius: 0.2rem;
position: relative;
} }
} }