feat: display campaign createdAt in UI card

Campaign card now shows created date/time next to char/encounter counts.
Lets DM tell newest campaign apart (replay tool creates many).

createdAt already set at campaign create (line 2174). Display renders
formatted: 'Jul 1, 2026, 16:32'.

replay-combat.js: campaign + encounter names now include timestamp
(new Date().toLocaleString) for easy identification.

WS collection push verified live (injected test campaigns appeared
without reload).
This commit is contained in:
david raistrick
2026-07-01 16:41:17 -04:00
parent 313a897e4b
commit 750ee99080
2 changed files with 10 additions and 3 deletions
+5 -3
View File
@@ -91,7 +91,7 @@ async function main() {
const encounterId = crypto.randomUUID(); const encounterId = crypto.randomUUID();
await storage.setDoc(getPath.campaign(campaignId), { await storage.setDoc(getPath.campaign(campaignId), {
name: 'Replay Campaign', name: `Replay Campaign (${new Date().toLocaleString('en-US', { hour12: false })})`,
playerDisplayBackgroundUrl: '', playerDisplayBackgroundUrl: '',
ownerId: 'replay', ownerId: 'replay',
createdAt: new Date().toISOString(), createdAt: new Date().toISOString(),
@@ -121,7 +121,7 @@ async function main() {
]; ];
await storage.setDoc(getPath.encounter(campaignId, encounterId), { await storage.setDoc(getPath.encounter(campaignId, encounterId), {
name: 'Big Boss Replay', name: `Big Boss Replay (${new Date().toLocaleString('en-US', { hour12: false })})`,
campaignId, campaignId,
createdAt: new Date().toISOString(), createdAt: new Date().toISOString(),
participants, participants,
@@ -184,7 +184,9 @@ async function main() {
const p = enc.participants.find(x => x.id === id); const p = enc.participants.find(x => x.id === id);
return p ? `${p.name}:${p.initiative}` : id; return p ? `${p.name}:${p.initiative}` : id;
}).join(','); }).join(',');
console.log(` turn ${totalTurns} (round ${enc.round}): ${actorName} | order=[${ordStr}] cur=${enc.currentTurnParticipantId}`); // Also dump participants[] order (display source). Diverge from order = sync bug.
const pStr = enc.participants.map(p => `${p.name}:${p.initiative}`).join(',');
console.log(` turn ${totalTurns} (round ${enc.round}): ${actorName} | order=[${ordStr}] parts=[${pStr}] cur=${enc.currentTurnParticipantId}`);
// 1. damage: actor hits a random living, active target. // 1. damage: actor hits a random living, active target.
if (actor) { if (actor) {
+5
View File
@@ -2284,6 +2284,11 @@ function AdminView({ userId }) {
<span className="inline-flex items-center"> <span className="inline-flex items-center">
<Swords size={12} className="mr-1" /> {campaign.encounterCount === undefined ? '...' : campaign.encounterCount} Encounters <Swords size={12} className="mr-1" /> {campaign.encounterCount === undefined ? '...' : campaign.encounterCount} Encounters
</span> </span>
{campaign.createdAt && (
<span className="inline-flex items-center opacity-80">
{new Date(campaign.createdAt).toLocaleDateString('en-US', { year: 'numeric', month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit', hour12: false })}
</span>
)}
</div> </div>
</div> </div>
<button <button