Dead code cleanups
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<script>
|
||||
import { slide } from 'svelte/transition';
|
||||
import { apiRequest } from '../../lib/api';
|
||||
import { crewLabel } from '../../lib/cards';
|
||||
import CharacterSheet from './CharacterSheet.svelte';
|
||||
|
||||
@@ -7,6 +8,19 @@
|
||||
|
||||
let openTargetId = null;
|
||||
let showObjectives = false;
|
||||
let objError = '';
|
||||
|
||||
$: isDeep = state.player.role === 'deep';
|
||||
|
||||
// The Deep ticks Crew Objectives off here (moved from the old Deep panel).
|
||||
async function toggleCrew(type) {
|
||||
objError = '';
|
||||
try {
|
||||
await apiRequest(`/game/${state.game.id}/player/${state.player.id}/objective/toggle`, 'POST', { type });
|
||||
} catch (e) {
|
||||
objError = e.message;
|
||||
}
|
||||
}
|
||||
|
||||
// Pi-Rats first, the Deep last; otherwise keep join order.
|
||||
$: crew = [...state.players].sort((a, b) => (a.role === 'deep' ? 1 : 0) - (b.role === 'deep' ? 1 : 0));
|
||||
@@ -56,18 +70,20 @@
|
||||
</button>
|
||||
{#if showObjectives}
|
||||
<div class="crew-objectives-detail" transition:slide>
|
||||
{#if objError}<div class="alert alert-danger">{objError}</div>{/if}
|
||||
<label class="checkbox-label">
|
||||
<input type="checkbox" checked={state.game.completed_crew_1} disabled>
|
||||
<input type="checkbox" checked={state.game.completed_crew_1} disabled={!isDeep} on:change={() => toggleCrew('crew_1')}>
|
||||
<span>Steal a Ship</span>
|
||||
</label>
|
||||
<label class="checkbox-label">
|
||||
<input type="checkbox" checked={state.game.completed_crew_2} disabled>
|
||||
<input type="checkbox" checked={state.game.completed_crew_2} disabled={!isDeep} on:change={() => toggleCrew('crew_2')}>
|
||||
<span>Choose a Captain</span>
|
||||
</label>
|
||||
<label class="checkbox-label">
|
||||
<input type="checkbox" checked={state.game.completed_crew_3} disabled>
|
||||
<input type="checkbox" checked={state.game.completed_crew_3} disabled={!isDeep} on:change={() => toggleCrew('crew_3')}>
|
||||
<span>Commit Piracy</span>
|
||||
</label>
|
||||
{#if isDeep}<p class="info-text" style="font-size: 0.75rem; margin: 0.25rem 0 0;">As the Deep, tick these off as the crew earns them.</p>{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user