diff --git a/module.json b/module.json index 3e41e19..dd63e2e 100644 --- a/module.json +++ b/module.json @@ -2,11 +2,11 @@ "id": "seitime-bridge", "title": "Seitime Bridge", "description": "Pushes dnd5e character data from Foundry VTT to a Seitime Frappe site at session end. Companion to the st Frappe app.", - "version": "0.1.0", + "version": "0.2.0", "compatibility": { "minimum": "12", - "verified": "12", - "maximum": "13" + "verified": "13", + "maximum": "14" }, "authors": [ { "name": "Vassili" } diff --git a/scripts/macros.js b/scripts/macros.js index 40c241f..ddf5ae4 100644 --- a/scripts/macros.js +++ b/scripts/macros.js @@ -101,45 +101,44 @@ async function showAttendanceDialog(proposal) { }) .join(""); - return new Promise((resolve) => { - new Dialog( + const result = await foundry.applications.api.DialogV2.wait({ + window: { title: "Finalize Attendance" }, + content: ` +
Confirm each player's attendance for this session.
+| Player | +Character(s) | +Status | +
|---|
Confirm each player's attendance for this session.
-| Player | -Character(s) | -Status | -
|---|
End ${escapeHtml(s.session_title)}?
This will mark it Completed, schedule the next session, and push snapshots for all PCs.
`, - yes: () => true, - no: () => false, - defaultYes: true, + yes: { default: true }, + rejectClose: false, }); return confirmed ? s.session_id : null; } @@ -187,29 +185,27 @@ async function pickSession(sessions) { ) .join(""); - return new Promise((resolve) => { - new Dialog({ - title: "End Session", - content: ` -Multiple scheduled sessions match this Foundry world. Pick one to end:
- - `, - buttons: { - cancel: { label: "Cancel", callback: () => resolve(null) }, - end: { - label: "End Session", - callback: (html) => { - const value = html.find("#seitime-session-pick").val(); - resolve(value || null); - }, - }, + const value = await foundry.applications.api.DialogV2.wait({ + window: { title: "End Session" }, + content: ` +Multiple scheduled sessions match this Foundry world. Pick one to end:
+ + `, + buttons: [ + { action: "cancel", label: "Cancel", callback: () => null }, + { + action: "end", + label: "End Session", + default: true, + callback: (_event, _button, dialog) => + dialog.element.querySelector("#seitime-session-pick")?.value || null, }, - default: "end", - close: () => resolve(null), - }).render(true); + ], + rejectClose: false, }); + return value ?? null; } function summarizeAttendance(attendance) {