V1.13.0: a campaign page in parts, pop-outs, and a search
- The campaign page shows one part at a time, picked from a row of buttons under its name: Overview (characters and encounters), NPCs, Locations, Weapons, Items, Spells, Monsters, Notes and Settings for the DM; Overview, Places and Notes for a player. Each button counts what is in its part. On a phone the row scrolls sideways. The part showing is in the address (?view=weapons), so the back button steps through the parts. - NPCs, weapons, items, spells and monsters are lists of short rows. Clicking a row opens a pop-out with everything about it and everything that can be changed. Adding one, by hand or from the library, is a pop-out too: a window on a wide screen, the whole screen on a phone. - "Search this campaign" looks through everything added to the campaign at once: characters, encounters, locations and notes, and for the DM also NPCs, weapons, items, spells and monsters. Each of the DM's lists has a search box of its own as well. - With three pages or more, the page number of a paged list is a menu to jump straight to any page. - The invite code, the party and archive or delete are under Settings. - A weapon's properties and range, and a spell's casting time, range and duration, are shown in its pop-out. - All packages at version 1.13.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -4,11 +4,14 @@ export function Pagination({
|
||||
pageCount,
|
||||
onPrev,
|
||||
onNext,
|
||||
onJump,
|
||||
}: {
|
||||
page: number;
|
||||
pageCount: number;
|
||||
onPrev: () => void;
|
||||
onNext: () => void;
|
||||
// Given this, the page number is a list to pick any page from.
|
||||
onJump?: (page: number) => void;
|
||||
}) {
|
||||
if (pageCount <= 1) return null;
|
||||
return (
|
||||
@@ -16,9 +19,23 @@ export function Pagination({
|
||||
<button type="button" className="btn btn-ghost" onClick={onPrev} disabled={page <= 1}>
|
||||
← Prev
|
||||
</button>
|
||||
<span className="pagination-status">
|
||||
Page {page} of {pageCount}
|
||||
</span>
|
||||
{onJump && pageCount > 2 ? (
|
||||
<label className="pagination-status flex-row gap-sm">
|
||||
Page
|
||||
<select aria-label="Go to page" value={page} onChange={(e) => onJump(Number(e.target.value))}>
|
||||
{Array.from({ length: pageCount }, (_, i) => i + 1).map((n) => (
|
||||
<option key={n} value={n}>
|
||||
{n}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
of {pageCount}
|
||||
</label>
|
||||
) : (
|
||||
<span className="pagination-status">
|
||||
Page {page} of {pageCount}
|
||||
</span>
|
||||
)}
|
||||
<button type="button" className="btn btn-ghost" onClick={onNext} disabled={page >= pageCount}>
|
||||
Next →
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user