V1.2.0: archive/delete campaigns and encounters, encounter sorting, change password, fuller seed

- Campaigns: DM can archive/restore; owner can delete. Archived campaigns
  move off the main list and stop accepting invite codes.
- Encounters: DM can archive/restore and delete, and arrange the campaign's
  own order; the list can also be sorted by name, status, type or date.
  Archived encounters are hidden from players' lists.
- Account page with change password (POST /auth/password).
- Seed is now additive (safe on a live database; --reset for the old wipe)
  and builds a fuller Aldenfell: earned weapons, item pool, spells, NPCs,
  and 28 battle/quest scenes with descriptions, DM notes and rewards.
- Vite preview host config for the deployed site.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-06 08:58:54 +02:00
co-authored by Claude Opus 5.5
parent 4a6a09bae8
commit 28e1a84b64
22 changed files with 1340 additions and 94 deletions
+25 -1
View File
@@ -1,5 +1,5 @@
import { useState, type ReactNode } from 'react';
import { Link, useParams } from 'react-router-dom';
import { Link, useNavigate, useParams } from 'react-router-dom';
import {
useEncounter,
useCampaign,
@@ -14,6 +14,8 @@ import {
useAdvanceRound,
useNextTurn,
usePatchEncounter,
useSetEncounterArchived,
useDeleteEncounter,
useAddReward,
useDeleteReward,
useAwardReward,
@@ -592,6 +594,9 @@ export function EncounterPage() {
const advanceRound = useAdvanceRound(encounterId);
const nextTurn = useNextTurn(encounterId);
const patchEncounter = usePatchEncounter(encounterId);
const setArchived = useSetEncounterArchived(encounter?.campaignId ?? '');
const deleteEncounter = useDeleteEncounter(encounter?.campaignId ?? '');
const navigate = useNavigate();
const [pickType, setPickType] = useState<'character' | 'monster' | 'npc'>('character');
const [pickId, setPickId] = useState('');
@@ -656,6 +661,7 @@ export function EncounterPage() {
<span className="badge badge-dm">{MODE_LABELS[encounter.mode]}</span>
<span className={`badge ${encounter.status === 'ACTIVE' ? 'badge-live' : ''}`}>{STATUS_LABELS[encounter.status]}</span>
{isBattle && <span className="badge">Round {encounter.currentRound}</span>}
{encounter.archivedAt && <span className="badge">Archived</span>}
{active && <span className="turn-marker">▶ {active.displayName}'s turn</span>}
</div>
</div>
@@ -698,6 +704,24 @@ export function EncounterPage() {
Reopen
</button>
)}
<button
className="btn btn-ghost"
title={encounter.archivedAt ? 'Put it back on the campaign list' : 'Take it off the campaign list without deleting it'}
disabled={setArchived.isPending}
onClick={() => setArchived.mutate({ encounterId, archived: !encounter.archivedAt }, fail)}
>
{encounter.archivedAt ? 'Restore' : 'Archive'}
</button>
<button
className="btn btn-ghost"
disabled={deleteEncounter.isPending}
onClick={() =>
window.confirm(`Delete "${encounter.name}" for good? Rewards already handed out stay with the characters.`) &&
deleteEncounter.mutate(encounterId, { ...fail, onSuccess: () => navigate(`/campaigns/${encounter.campaignId}`) })
}
>
Delete
</button>
</>
)}
</div>