feat(web): add Inventar öffnen button to the victory screen

This commit is contained in:
Bastian Wagner
2026-08-20 18:04:13 +02:00
parent 724443de1e
commit b1968da754
4 changed files with 32 additions and 3 deletions

View File

@@ -117,10 +117,15 @@
</section> </section>
} }
<div class="outcome__actions">
<button type="button" class="outcome__button" data-combat-to-inventory (click)="goToInventory()">
Inventar öffnen
</button>
<button type="button" class="outcome__button" data-combat-to-hunt (click)="goToHunt()"> <button type="button" class="outcome__button" data-combat-to-hunt (click)="goToHunt()">
Zur Jagd Zur Jagd
</button> </button>
</div> </div>
</div>
} @else if (combat.status === 'LOST') { } @else if (combat.status === 'LOST') {
<div class="outcome outcome--lost" data-combat-result="LOST"> <div class="outcome outcome--lost" data-combat-result="LOST">
<h2 class="outcome__title">Niederlage</h2> <h2 class="outcome__title">Niederlage</h2>

View File

@@ -490,6 +490,17 @@
margin-block-start: var(--ar-space-2); margin-block-start: var(--ar-space-2);
} }
.outcome__actions {
display: flex;
gap: var(--ar-space-2);
justify-content: center;
margin-block-start: var(--ar-space-2);
}
.outcome__actions .outcome__button {
margin-block-start: 0;
}
.outcome__button:hover, .outcome__button:hover,
.combat__notice--error button:hover { .combat__notice--error button:hover {
border-color: var(--ar-gold); border-color: var(--ar-gold);

View File

@@ -275,6 +275,15 @@ describe('CombatPageComponent', () => {
expect(router.navigate).toHaveBeenCalledWith(['/hunt']); expect(router.navigate).toHaveBeenCalledWith(['/hunt']);
}); });
it('navigates to /inventory from the victory screen', async () => {
const fixture = await setup({ ...activeCombat, status: 'WON' });
const element = fixture.nativeElement as HTMLElement;
element.querySelector<HTMLButtonElement>('[data-combat-to-inventory]')?.click();
expect(router.navigate).toHaveBeenCalledWith(['/inventory']);
});
it('shows an error and retries loading the combat', async () => { it('shows an error and retries loading the combat', async () => {
const fixture = await setup(null); const fixture = await setup(null);
combatStore.error.set('Dieser Kampf wurde nicht gefunden.'); combatStore.error.set('Dieser Kampf wurde nicht gefunden.');

View File

@@ -161,6 +161,10 @@ export class CombatPageComponent implements OnInit {
void this.router.navigate(['/hunt']); void this.router.navigate(['/hunt']);
} }
protected goToInventory(): void {
void this.router.navigate(['/inventory']);
}
protected monsterSprite(monsterKey: string, artworkPath: string): string { protected monsterSprite(monsterKey: string, artworkPath: string): string {
return monsterCutoutPath(monsterKey) ?? runtimeMonsterArtworkPath(artworkPath) ?? artworkPath; return monsterCutoutPath(monsterKey) ?? runtimeMonsterArtworkPath(artworkPath) ?? artworkPath;
} }