diff --git a/CHANGELOG.md b/CHANGELOG.md index dbadcd5b..338d730f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -106,7 +106,8 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Added -- **Where a type sits on the sheet.** Each item type on the builder's TYPES tab now has ON THE SHEET: EQUIPPED (worn or wielded), USABLE (used up or used often: potions, ammo, kits) or PACK. WEAPON and ARMOR presets start EQUIPPED, CONSUMABLE and SPELL start USABLE, and GEAR and every type you already have start in PACK. The sheet's GEAR tab sorts lines into these bands next. +- **GEAR in bands.** The sheet's GEAR tab now sorts what you carry into EQUIPPED, USABLE and PACK, by each item type's ON THE SHEET, with a count on each band and what's in hand first. A fourth band, STASH, holds everything left in the stash whatever its type, and says each one's type; it starts closed. Click a band's head to close or open it, and the sheet remembers. The + buttons for adding a thing by hand sit in one row at the top, and the band it lands in opens. SHEET.EXE and the sheet's own tab are the same. +- **Where a type sits on the sheet.** Each item type on the builder's TYPES tab now has ON THE SHEET: EQUIPPED (worn or wielded), USABLE (used up or used often: potions, ammo, kits) or PACK. WEAPON and ARMOR presets start EQUIPPED, CONSUMABLE and SPELL start USABLE, and GEAR and every type you already have start in PACK. - **EDIT CURRENT in SHOP_CATALOGUES.** A new button beside DOWNLOAD CURRENT puts what your shops sell now straight into the box, ready to change, PREVIEW and SAVE, with no file to download and upload again. If the box already has text in it, it asks before replacing it. - **Publishing tidies the shop catalogue.** When you publish a system, any catalogue line that is now exactly one of your items, same name, price and columns, is taken out of the file, since the item sells itself. That includes lines that ADD NEW LINES TO ITEMS turned into items. The builder's publish message says how many. Lines naming an item kept out of the shops stay, so they sell again if you switch it back on. - **Catalogue lines can become items.** In SHOP_CATALOGUES, PREVIEW now offers ADD NEW LINES TO ITEMS, off to start. Switched on, it lists what it will add and how many items your system will hold. SAVE then makes each line that isn't one of your items yet into an item: of its section's type (a shelf's lines go to your DEFAULT type), with its columns, price and words, in the shops. They go into the builder's draft and are kept once you publish; until then the catalogue line sells them. If the builder is open, it takes them in, so its next save keeps them. diff --git a/README.md b/README.md index 66aafba5..c2fd1816 100644 --- a/README.md +++ b/README.md @@ -796,7 +796,7 @@ CITY_NET/ │ │ │ ├── SystemPicker.tsx # GAME tab's system picker: a searchable dropdown, BUILT-IN then YOUR SYSTEMS, portalled into the theme, asking before it switches the game for everyone │ │ │ ├── systemPickerRules.ts # The picker's rules on their own: grouping and order, search, arrow-key movement, what the button says │ │ │ ├── InventorySection.tsx # The inventory table, on every system. Its own file because SheetRenderer is long enough, and generic: which rows carry an extra button, and what pressing it does, is supplied from outside - so a drug offers CONSUME and a skillplug offers LOAD without either knowing about the other A custom system's items (7e3b): the slot counters over it, and WEAR and ATTUNE under a line of an item's name (GearItemLine); an installed item's line locked, named and in place, until REMOVE (7e4c); a custom system with item types gets a table per type instead (8a3a, GearTypeTables.tsx) -│ │ │ ├── GearTypeTables.tsx # The GEAR tab as a table per item type (8a3a; approved mockup item-types, 2026-11-14): each type's lines under its own column heads, units said; a line's own value over its item's, shown faint until typed over; + a type's one to add a line of it by hand; name, quantity, where and location as the one list has them; ROLL beside each DAMAGE and DICE (8a3b), read only or not, where the viewer may roll; since 8a3c1 a compact line per thing (name, QTY, WHERE, ✎, ×; only the columns it has as words under it, its item's faint, ROLL beside DAMAGE and DICE, a stashed one's place), ✎ opening every column as a box, one line at a time, a line made by hand opened; under ✎ a DAMAGE or DICE with eˣ (8a3c2): what it reads on this character, a name the system hasn't got flagged, SHAPE and INSERT; a COUNT as "AMMO 4 / 6" with its button (FIRE) and RELOAD beside it (8a4b), held while the server answers, RELOAD FROM asking which carried line where there are several, a refusal said on the line +│ │ │ ├── GearTypeTables.tsx # The GEAR tab as a table per item type (8a3a; approved mockup item-types, 2026-11-14): each type's lines under its own column heads, units said; a line's own value over its item's, shown faint until typed over; + a type's one to add a line of it by hand; name, quantity, where and location as the one list has them; ROLL beside each DAMAGE and DICE (8a3b), read only or not, where the viewer may roll; since 8a3c1 a compact line per thing (name, QTY, WHERE, ✎, ×; only the columns it has as words under it, its item's faint, ROLL beside DAMAGE and DICE, a stashed one's place), ✎ opening every column as a box, one line at a time, a line made by hand opened; under ✎ a DAMAGE or DICE with eˣ (8a3c2): what it reads on this character, a name the system hasn't got flagged, SHAPE and INSERT; a COUNT as "AMMO 4 / 6" with its button (FIRE) and RELOAD beside it (8a4b), held while the server answers, RELOAD FROM asking which carried line where there are several, a refusal said on the line; in bands (G2): EQUIPPED, USABLE and PACK by each type's ON THE SHEET, a group per type with lines, in hand first, and STASH, closed to start, each line's type said; a band's head closes it, remembered; a row of + at the top adds a thing of any type by hand, opening its band │ │ │ ├── GearItemLine.tsx # A system's item on its GEAR line (7e3b): its NEEDS tag, WEAR or WORN · TAKE OFF, ATTUNE (ATTUNED · END, the GM's ATTUNE ANYWAY), what it is doing, and its features' uses; the slot counters over the gear (ATTUNED 2 OF 3, amber when full) with the GM's box for one character's own count; and each install's counter, amber at its limit (7e4c) │ │ │ ├── PharmaSection.tsx # What is currently in the bloodstream, drawn in the sheet HEADER rather than a tab: a drug that wears off at the end of a scene and bills System Strain for it is not something to hide behind a tab somebody might not open. Draws nothing at all while a character is on nothing │ │ │ ├── XpWindow.tsx # AWARD_EXPERIENCE — points each rather than a pot to divide, with LEVEL_UP and LEVEL_DOWN for correcting a level on purpose; in a game that spends XP, given to spend, with no level buttons where there are no levels (7f2c2) @@ -1083,7 +1083,7 @@ CITY_NET/ │ │ │ ├── SheetCyberware.test.tsx # The sheet showing what the chrome does, so a correct effects layer is actually read │ │ │ ├── InventorySection.test.tsx # The inventory table editing one field cleanly, though every keystroke rewrites the whole list │ │ │ ├── GearItemLine.test.tsx # WEAR and ATTUNE on GEAR (7e3b): the counter, an item's line under its own row, what pressing asks, a full slot disabled and why, the GM's ATTUNE ANYWAY and own count, read-only, uses ticking, a refusal said, a system without items unchanged; installs (7e4c): the counter, an installed line locked, REMOVE and INSTALL asked, a player's disabled past the limit, the GM's anyway, amber when full -│ │ │ ├── GearTypeTables.test.tsx # The GEAR tab as a table per type (8a3a): each type's lines and heads, an empty type its heading and + only, an item's values faint until typed over, + a type's one by hand staying in its table, read only, a system without types keeping the one list; ROLL beside DAMAGE sending its line and column, nothing to roll nothing to press, read only still there (8a3b); compact lines (8a3c1): only the columns a line has, ✎ one at a time with "none" where it has none, a hand-made line opened, read only without ✎; a DAMAGE under ✎ read on this character, a bad name flagged, never an older text's words, eˣ SHAPE and INSERT (8a3c2); a COUNT's "4 / 6" with FIRE and RELOAD, held while waiting, none left or full, USE by default, RELOAD FROM asked and CANCEL, a refusal on its line (8a4b) +│ │ │ ├── GearTypeTables.test.tsx # The GEAR tab as a table per type (8a3a): each type's lines and heads, an empty type its heading and + only, an item's values faint until typed over, + a type's one by hand staying in its table, read only, a system without types keeping the one list; ROLL beside DAMAGE sending its line and column, nothing to roll nothing to press, read only still there (8a3b); compact lines (8a3c1): only the columns a line has, ✎ one at a time with "none" where it has none, a hand-made line opened, read only without ✎; a DAMAGE under ✎ read on this character, a bad name flagged, never an older text's words, eˣ SHAPE and INSERT (8a3c2); a COUNT's "4 / 6" with FIRE and RELOAD, held while waiting, none left or full, USE by default, RELOAD FROM asked and CANCEL, a refusal on its line (8a4b); in bands (G2): the four in order and counted, in hand first, STASH closed, a head closing and opening its band remembered, the STASH saying each type, an empty band saying so, a thing made by hand opening its band │ │ │ ├── conditionNote.test.tsx # The conditions on the token under the number they change (8a5e3): SLOWED: Speed ×0.5 · typed 30 with the halved Speed the big number, clicked to edit what is typed, a skill's line, two on one number, a system with no picks or items, none on the token │ │ │ ├── PharmaSection.test.tsx # Taking a dose from a Readied inventory row, and what is running shown in the sheet header │ │ │ ├── Skillplugs.test.tsx # LOAD on a Readied plug, the granted skill on SKILLS, and what is loaded in the header @@ -1174,6 +1174,7 @@ CITY_NET/ │ │ │ ├── useFormulaReads.ts # Many formulas read by the server at once (formula box 3): one request a moment after typing stops, twenty to a request, empty ones never asked, an answer kept only for the text it was for, nothing read with an api without the call │ │ │ ├── usePreviewValues.ts # A draft's formulas worked out by the server for its sample character a moment after editing stops, and with each house rule an alternative follows on: FORMULAS and the graph view show the same values; the graph view asks with the house rules TRY ON THE MAP has on │ │ │ ├── usePlayerSheet.ts # Shared sheet state, debounced saves, house-rule flags, action emitters (roll/deathSave/stabilize/castSpell); used by CharacterSheetWindow and SheetPage; onGearRoll (8a3b); sheetProps (8s1a): every play prop both sheet surfaces hand the sheet, Phase 7's choices, levels, items, spending, improving and rests with what the server refused and whether recovery is open; the vitals strip's props (8s3b), with the sign-in each surface passes; onGearCount (8a4b), FIRE and RELOAD by countAction, a gear edit still waiting sent first so it never lands after the count; SHOW ENCUMBRANCE read with the house rules, CARRYING hidden where it is off (8a6b) +│ │ │ ├── useGearBands.ts # Which of the GEAR tab's bands are closed (G2), kept in this browser: STASH closed to start, a head toggling its band, a band opened when a line lands in it │ │ │ └── __tests__/ │ │ │ ├── useApi.test.ts # Fetch helper unit tests │ │ │ ├── useMapData.test.ts # The location list asks anonymously until the GM signs in, then with their token, and again without after sign-out @@ -1288,7 +1289,7 @@ CITY_NET/ │ │ │ ├── encumbrance.ts # The builder's ENCUMBRANCE as logic (8a5c; approved mockup item-types, 2026-11-14, decision 7): read and written back tidy, the NUMBER columns it can count with their types, how it starts (WEIGHT, ten times the first stat, LIGHT 50 / ENCUMBERED 100 / OVERLOADED), the bands, and the names formulas read of the gear for INSERT; a band's words and condition, and past them, kept through every edit (8a5d1); blank words and NONE kept as nothing, words cut at 200 (8a5d2) │ │ │ ├── ranks.ts # The builder's ranks as logic (7f1b): lists from four presets or empty, renamed and removed (their stats back to numbers), ranks added, changed, moved and removed (a stat's highest at the start following), a stat's HOLDS and AT START │ │ │ ├── gearItems.ts # Items on the GEAR tab as logic (7e3b): which gear line draws which item (by name, the first carried), what the last save worked out, each line's buttons and words (WEAR, ATTUNE, the GM's ATTUNE ANYWAY, WORKING, why it does nothing), a slot's verb from its name (ATTUNED → ATTUNE), the counters, the GM's own count asked, an item's uses; installed items (7e4c): INSTALL with room, a player's disabled past the limit and why, the GM's INSTALL ANYWAY, INSTALLED · REMOVE, each install's counter (CYBERWARE · STRAIN 2.75 OF 3, or NEVER BELOW), the names installed; the render copy's item types, and each item's type and values (8a3a) -│ │ │ ├── gearTypes.ts # The GEAR tab's tables as logic (8a3a): the types from the render copy, what fits each column, a line's type (its own, its item's, the first) and its cells (its own value over its item's, the item's only on a line of its type), the tables in the system's order, a value typed, a new line of a type; mirrors the server's lineColumns; shownCells and cellWords, what a compact line shows (8a3c1); countOf, a COUNT left as the server counts it, and "4 / 6" in words (8a4b) +│ │ │ ├── gearTypes.ts # The GEAR tab's tables as logic (8a3a): the types from the render copy, what fits each column, a line's type (its own, its item's, the first) and its cells (its own value over its item's, the item's only on a line of its type), the tables in the system's order, a value typed, a new line of a type; mirrors the server's lineColumns; shownCells and cellWords, what a compact line shows (8a3c1); countOf, a COUNT left as the server counts it, and "4 / 6" in words (8a4b); gearBands, the GEAR tab's bands (G2): each type's lines in its ON THE SHEET band, in hand first, groups only for types with lines, and every stashed line in STASH │ │ │ ├── gearDice.ts # A gear line's DAMAGE or DICE in words (8a3c2): ON THIS CHARACTER with each name's value and the range, or what is wrong; the eˣ shapes and INSERT at the cursor │ │ │ ├── rollTotal.ts # A roll line's final total, found for the dice history to bold: after the last = in its first [ ], or the lone number; never what follows a · │ │ │ ├── catalogueItems.ts # A system's items in the shops' catalogues (7e3c): the preview's lines read against the items (named as one, landing as gear or not; nearly named, the closest said), the shelf a starter file uses (the gear's, or the first landing as gear), and the starter file itself, prices left blank; with types of its own, DOWNLOAD ITEMS puts each item in its type's section with its columns, and a type's section counts as gear in the preview (8a7a1); ITEMS_ADDED_EVENT and withAddedItems, a catalogue's new items merged into a draft by id (8a7a4a) @@ -1342,7 +1343,7 @@ CITY_NET/ │ │ │ ├── encumbrance.test.ts # The builder's ENCUMBRANCE as logic (8a5c): written tidy with the items kept, what it can count, how it starts held to the server's check, COUNTED BY's unit, the bands, the names formulas read held to the server's; a band's words and condition kept through every edit (8a5d1); blank words and NONE kept as nothing, cut at 200, held to the server's check (8a5d2) │ │ │ ├── ranks.test.ts # Ranks as logic (7f1b): each preset sound as the server checks it, copies never the preset, lists and ranks changed, moved and removed with AT START following, HOLDS and AT START │ │ │ ├── gearItems.test.ts # Items on GEAR as logic (7e3b): the line each item draws on, what a save worked out read safely, the slot's verb, every state's buttons and words for player, GM and read-only, the counters, the GM's box, uses; installs (7e4c): room each way with rounding, every state's buttons and words, the counters, the names installed -│ │ │ ├── gearTypes.test.ts # The GEAR tab's tables as logic (8a3a): the types read, what fits each kind as the server's check, each line's type and values as the server's lineColumns on the same lines, the tables, values typed, a line's type, values and counts kept on the sheet and on the server, bought one more of; a COUNT left held to the server's lineColumns on the same lines (8a4b) +│ │ │ ├── gearTypes.test.ts # The GEAR tab's tables as logic (8a3a): the types read, what fits each kind as the server's check, each line's type and values as the server's lineColumns on the same lines, the tables, values typed, a line's type, values and counts kept on the sheet and on the server, bought one more of; a COUNT left held to the server's lineColumns on the same lines (8a4b); gearBands (G2): each band's lines and count, in hand first then as listed, no group for a type with none there, an unknown band as PACK, stashed lines in STASH whatever the type │ │ │ ├── rollTotal.test.ts # A roll line's final total: the new and old forms, the tray's own, symbols, a later [ ] or · passed over, the line put back unchanged │ │ │ ├── catalogueItems.test.ts # Items in catalogues (7e3c): how far apart two names are, a line named as an item, one landing in its own rows, near misses by marks or a letter or two, the closest named, nothing without items, the starter file on the gear's shelf or the next │ │ │ ├── levels.test.ts # The table held to the server's, the ranges staying joined, adding and taking one off, typing over, what the boxes show, how they advance, the word @@ -1543,9 +1544,10 @@ CITY_NET/ │ ├── sheet-increases.spec.ts # Ability increases at the table (7d6b2): points spread in ABILITY INCREASE within what it allows, named on the stat's badge, taken off by LEVEL_DOWN; a Feat taken instead, under the feature and on the badge (7d6c2) │ ├── sheet-bonus-ways.spec.ts # The ways a bonus counts at the table (7e1): two +2s each stopping at 20, the cut one named on the badge; an AT LEAST lifts what they leave │ ├── sheet-worn-items.spec.ts # Items at the table (7e3b): WEAR and ATTUNE on GEAR, the ring's +2 CON once attuned and the slot full, a second worn with nothing to press, the GM's ATTUNE ANYWAY and own count, END, taken off still attuned; GIVE.EXE's ITEMS handing the ring to a player, who wears it; TERMINATE_SESSION closing GIVE.EXE at once -│ ├── sheet-item-types.spec.ts # The GEAR tab as a table per type (8a3a): a stick made by hand with its own DAMAGE and GRADE, a line named like the Pistol showing its values faint, RANGE typed over, a rope in GEAR, saved as made, each in its table after a reload; compact lines with ✎ and DONE, and nothing on the GEAR tab scrolling sideways in SHEET.EXE (8a3c1); the Pistol's DAMAGE read on this character under ✎, a bad name flagged, eˣ INSERT (8a3c2) +│ ├── sheet-item-types.spec.ts # The GEAR tab as a table per type (8a3a): a stick made by hand with its own DAMAGE and GRADE, a line named like the Pistol showing its values faint, RANGE typed over, a rope in GEAR, saved as made, each in its table after a reload; compact lines with ✎ and DONE, and nothing on the GEAR tab scrolling sideways in SHEET.EXE (8a3c1); the Pistol's DAMAGE read on this character under ✎, a bad name flagged, eˣ INSERT (8a3c2); in bands (G2), PACK saying "Nothing here." and things added from the row of + at the top +│ ├── sheet-gear-bands.spec.ts # The GEAR tab in bands (G2): a Sword, a Draught and a Rope added by hand land in EQUIPPED, USABLE and PACK, counted; the Sword stashed moves to STASH, which opens and says WEAPONS; USABLE closed by its head stays closed on the next visit │ ├── sheet-gear-counts.spec.ts # A gear line's COUNT at the table (8a4): the Pistol's AMMO 2 / 6, FIRE spending one, RELOAD asking between Pistol Rounds and AP Rounds and using the AP Rounds up, then full from the Pistol Rounds; the Wand's CHARGES filled by a short rest from the sheet -│ ├── sheet-standalone-tab.spec.ts # The sheet in a new tab (8s1a): opened with ⧉, in the theme, WEAR there works and SHEET.EXE says so, a weapon's DAMAGE rolled from it; the roll from the tab opening the main app's dice tray (8s1b); a character being made: CREATING · CONTINUE on the tab opening NEW_CHARACTER.EXE there (8s1c); Cash on the tab opening BANK.EXE in the main window, and with that window closed the tab saying to open it (8s1d) +│ ├── sheet-standalone-tab.spec.ts # The sheet in a new tab (8s1a): opened with ⧉, in the theme, WEAR there works and SHEET.EXE says so, a weapon's DAMAGE rolled from it; the roll from the tab opening the main app's dice tray (8s1b); a character being made: CREATING · CONTINUE on the tab opening NEW_CHARACTER.EXE there (8s1c); Cash on the tab opening BANK.EXE in the main window, and with that window closed the tab saying to open it (8s1d); gear added from the row of + at the top of GEAR (G2) │ ├── sheet-vitals.spec.ts # The vitals strip (8s3b): DAMAGE in SHEET.EXE and HEAL on the ⧉ tab moving the token and both sheets; the HP bar opening HEALTH in place on the tab; a condition put on in SHEET.EXE shown on the tab and taken off there, and a long rest taken from the tab's REST ▾ (8s3c); two tracks: STUN picked, damage past its maximum spilling into PHYSICAL, said (8s3d1); the GM taking damage off a player from the box in their view of the sheet, the player's SHEET.EXE following (8s3d2) │ ├── sheet-ranks.spec.ts # A rank on the sheet (7f1c1): Athletics picked as EXPERT, its worth = 7 beside it, a formula reading it at 8, the step and worth kept by the server │ ├── sheet-ranks-start.spec.ts # Ranks making a character (7f1c2): Lore under RANKS in NEW CHARACTER, EXPERT off past AT START, TRAINED picked and kept with its worth diff --git a/e2e/COVERAGE.md b/e2e/COVERAGE.md index ecb6b7f6..9894aff1 100644 --- a/e2e/COVERAGE.md +++ b/e2e/COVERAGE.md @@ -35,7 +35,7 @@ panel), so a control that looks fine but does nothing is caught for all of them. | Shop catalogues by item type | a section per item type (8a7a1), its columns checked, blanks kept | `shop_catalogue_types`, `catalogueTypes` | `catalogue-types`, `shop-typed-lines` (bought at the General Store and given, landing typed, 8a7a2) | **AT THE TABLE** | | The shops under load | 1000+ lines on a shelf, 200 items, a full cart, a long gear list (8n3); a long shelf drawn 200 rows at a time | `shop_stress`, `ShopWindow` | `shop-stress` | **AT THE TABLE** | | An item type's SOLD AT | the kinds of shop that sell its lines (8a7a2), the General Store where unsaid; set in the builder in 8a7b | `shop_typed_lines`, `typedShelves` | `shop-typed-lines` (unsaid: the General Store) | **AT THE TABLE** unsaid; a kind of shop picked waits for 8a7b's box | -| An item type's ON THE SHEET band | EQUIPPED, USABLE or PACK (G1), PACK where unsaid; the sheet's GEAR bands come in G2 | `system_builder_item_types`, `itemTypes`, `ItemsPage` | `builder-item-types` (the WEAPON preset EQUIPPED) | **SET IN THE BUILDER**; at the table with G2 | +| An item type's ON THE SHEET band | EQUIPPED, USABLE or PACK (G1), PACK where unsaid; the sheet's GEAR tab in those bands plus STASH, closed to start, a band's head closing it, remembered (G2) | `system_builder_item_types`, `itemTypes`, `ItemsPage`, `gearBands`, `GearTypeTables` | `builder-item-types` (the WEAPON preset EQUIPPED), `sheet-gear-bands` (a Sword, a Draught and a Rope in EQUIPPED, USABLE and PACK; the Sword stashed into STASH; USABLE kept closed) | **AT THE TABLE** | | An item's PRICE and IN SHOPS | priced and IN SHOPS, it sells itself at its type's shops (8a7a3a); off, never sold, not even from a file, but bought back at its price by a shop of its type (8a7a3c2); a type's PRICE column read as its price; set on ITEMS under TYPE, NOT SOLD in the list, a new item's price asked for (8a7a3b1); in the ITEMS import and downloads, price and in shops columns (8a7a3b2) | `shop_items_on_sale`, `itemPrice`, `ItemsPage`, `system_builder_items_import`, `itemsImport` | `shop-items-on-sale` (a type's PRICE column; a ring turned off; sold back from the window at 50%), `builder-item-price` (set by clicks), `builder-items-import` (imported priced and IN SHOPS) | **AT THE TABLE** | | A catalogue file held against the game's items | an exact copy of an item left out, an item kept out of the shops left out, one of an item's name overruling it, ALSO ON SALE FROM ITEMS (8a7a3c1) | `shop_items_on_sale`, `CatalogueWindow` | `catalogue-and-items` | **AT THE TABLE** | | ADD NEW LINES TO ITEMS | a catalogue's new lines made items in the draft (8a7a4a), off to start; on PUBLISH the lines now exactly an item leave the file (8a7a4b) | `catalogue_into_items`, `CatalogueWindow`, `catalogueItems`, `BuilderScreen` | `catalogue-and-items` (the Hand Cannon into the draft, then out of the file once published) | **AT THE TABLE** | diff --git a/e2e/README.md b/e2e/README.md index 004986e9..cdbf8856 100644 --- a/e2e/README.md +++ b/e2e/README.md @@ -205,9 +205,10 @@ kept; the job itself stops at 30 (`timeout-minutes`), for a hang outside the tes | `tests/sheet-ranks.spec.ts` | A rank on the sheet (7f1c1): a player with Level 3 sees Athletics as a picker of UNTRAINED, TRAINED and EXPERT, picks EXPERT, its worth = 7 shows beside it, the formula Climb reading it shows 8, and the server keeps the step 2 with Athletics 7 and Climb 8 | | `tests/sheet-ranks-start.spec.ts` | Ranks making a character (7f1c2): a player in NEW CHARACTER types Grit, finds Lore under RANKS with UP TO TRAINED TO START and EXPERT off, picks TRAINED, and the server keeps the step 1 with Lore worth 2 | | `tests/sheet-worn-items.spec.ts` | Items at the table (7e3b): two GEAR lines named like items get WEAR and ATTUNE; the ring worn does nothing yet, attuned it is WORKING, ATTUNED 1 OF 1, CON 14 → 16; the cloak worn with no slot free says so and can't attune; the GM, on the player's sheet, ATTUNES it ANYWAY (2 OF 1) and gives them 2 of their own; END frees the ring's slot and its +2 goes; the cloak taken off stays attuned and does nothing. A second test: the GM's GIVE.EXE lists the ring under ITEMS with NEEDS ATTUNED and its words, gives it to the player as a stowed gear line, the player is told and WEARS it; TERMINATE_SESSION closes GIVE.EXE while the session is still ending | -| `tests/sheet-item-types.spec.ts` | The GEAR tab as a table per item type (8a3a): a player's sheet with WEAPONS and GEAR tables, each empty with its +; + WEAPON made A stick with DAMAGE 1d4 and GRADE HEAVY; a second line named Pistol showing 2d6 + @might faint, its RANGE typed over to 50 m; + GEAR made Rope at 10 lb; saved as made, each in its table after a reload; since 8a3b the stick's DAMAGE rolled with ROLL, "rolled A stick DAMAGE 1d4" in the dice tray's history; and (8a3c1) as compact lines: a line made by hand opened under ✎, DONE showing its words with ROLL, the Pistol's RANGE read as words after the reload, and no box on the GEAR tab scrolling sideways in SHEET.EXE; and (8a3c2) the Pistol's DAMAGE under ✎ said ON THIS CHARACTER: 2d6 + Might (12): 14 to 24, @strength flagged as not the system's, eˣ INSERT putting in @might | +| `tests/sheet-item-types.spec.ts` | The GEAR tab as a table per item type (8a3a): a player's sheet with WEAPONS and GEAR tables, each empty with its +; + WEAPON made A stick with DAMAGE 1d4 and GRADE HEAVY; a second line named Pistol showing 2d6 + @might faint, its RANGE typed over to 50 m; + GEAR made Rope at 10 lb; saved as made, each in its table after a reload; since 8a3b the stick's DAMAGE rolled with ROLL, "rolled A stick DAMAGE 1d4" in the dice tray's history; and (8a3c1) as compact lines: a line made by hand opened under ✎, DONE showing its words with ROLL, the Pistol's RANGE read as words after the reload, and no box on the GEAR tab scrolling sideways in SHEET.EXE; and (8a3c2) the Pistol's DAMAGE under ✎ said ON THIS CHARACTER: 2d6 + Might (12): 14 to 24, @strength flagged as not the system's, eˣ INSERT putting in @might; and (G2) in bands: PACK says "Nothing here." with no WEAPONS group before anything is carried, and things are added from the row of + at the top | +| `tests/sheet-gear-bands.spec.ts` | The GEAR tab in bands (G2): a game with WEAPONS EQUIPPED, POTIONS USABLE and GEAR unsaid; a player adds a Sword, a Draught and a Rope from the row of + at the top, each in its band and counted (EQUIPPED · 1, USABLE · 1, PACK · 1, STASH · 0 closed), saved as made; the Sword moved to the stash goes to STASH, which opens and says WEAPONS, EQUIPPED left at 0; USABLE closed by its head, and on the next visit USABLE is still closed and PACK open | | `tests/sheet-gear-counts.spec.ts` | A gear line's COUNT at the table (8a4): a player's Pistol at AMMO 2 / 6 spends one with FIRE; RELOAD, with Pistol Rounds and AP Rounds both carried, asks which and takes all 3 AP Rounds, their line gone; RELOAD again takes 2 of the Pistol Rounds alone, full, RELOAD held; the Wand's CHARGES, with no RELOAD, filled by a SHORT REST from the sheet | -| `tests/sheet-standalone-tab.spec.ts` | The sheet in a new tab is the window (8s1a): a player makes two gear lines in SHEET.EXE, opens the tab with ⧉ (a `.crt-container`, so in the theme), WEARs the boots there and SHEET.EXE says WORKING too, and rolls the club's DAMAGE from the tab, said on it once the dice land; since 8s1b the roll from the tab opens DICE_TRAY.EXE in the main app's window; and (8s1c) a character being made: the flow left, SHEET.EXE says CREATING · CONTINUE, the tab says it too and opens NEW_CHARACTER.EXE on itself; and (8s1d) Cash on the tab opens BANK.EXE in the main window and the tab says so, then with the main window closed the tab says to open it | +| `tests/sheet-standalone-tab.spec.ts` | The sheet in a new tab is the window (8s1a): a player makes two gear lines in SHEET.EXE, opens the tab with ⧉ (a `.crt-container`, so in the theme), WEARs the boots there and SHEET.EXE says WORKING too, and rolls the club's DAMAGE from the tab, said on it once the dice land; since 8s1b the roll from the tab opens DICE_TRAY.EXE in the main app's window; and (8s1c) a character being made: the flow left, SHEET.EXE says CREATING · CONTINUE, the tab says it too and opens NEW_CHARACTER.EXE on itself; and (8s1d) Cash on the tab opens BANK.EXE in the main window and the tab says so, then with the main window closed the tab says to open it; and (G2) gear added from the row of + at the top of GEAR | | `tests/sheet-vitals.spec.ts` | The vitals strip (8s3b): a player with a token takes 5 with DAMAGE in SHEET.EXE (the token and the bar at 15/20), opens the ⧉ tab and HEALs 3 there (18/20 on the token, the tab and SHEET.EXE), then clicks the tab's HP bar and HEALTH's own panel opens in place; and (8s3c) PRONE put on under the box in SHEET.EXE, shown on the tab as a chip and taken off there, then REST ▾ on the tab taking a LONG REST, asked first, the stat it refills set; the box's HIT POINTS ▾ wholly under the numbers with the slash centered over it, and the conditions list as wide as the box; and CWN in SHEET.EXE: MELEE AC and RANGED AC shown, no two of HEAL, DAMAGE, STIM, HIT POINTS, + CONDITION, the AC and REST overlapping, and every button's words inside it; the AC centered between + CONDITION and REST; and (8s3d1) a two-track system: STUN MAX set on the sheet, STUN picked above the box, 6 damage filling it with 2 spilling into PHYSICAL (18/20 on the token), STUN FULL · 2 SPILLED INTO PHYSICAL said; and (8s3d2) the GM opens a player's sheet (GLOBAL_CHAT, VIEW_PLAYER_INFO, OPEN_SHEET) and takes 5 with the box there: the token at 15, the GM's box and the player's own SHEET.EXE saying 15. Since 8a6c the chip is clicked open, as wide as the box, and taken off with TAKE OFF | | `tests/sheet-installed-items.spec.ts` | Items installed (7e4c): a player with Might 2 installs a Cranial Jack (cost 1): WORKING, CYBERWARE · STRAIN 1 OF 2, its line's × and WHERE locked, Strain's badge 0 → 1 (Cranial Jack +1); Dermal Plating (cost 2) can't be installed by the player and says why; the GM, on their sheet, INSTALLS it ANYWAY (3 OF 2); REMOVE gives the jack's cost back and unlocks its line | | `tests/sheet-spend-xp.spec.ts` | SPEND XP at the table (7f2c1): with purchases waiting for the GM, a player on CHARACTER sees XP 40 UNSPENT, BUYs Body 2 to 3 for 15 and a feat for 10, each PENDING with its XP held and Body still 2; the GM, on the player's sheet, APPROVES Body (3 on the server), DECLINES the feat, then UNDOES Body (2 again, all 40 back). And AWARD XP in a game that only spends it (7f2c2): KARMA.EXE with no level buttons gives a player 30, and their SPEND KARMA has it to spend | diff --git a/e2e/tests/sheet-gear-bands.spec.ts b/e2e/tests/sheet-gear-bands.spec.ts new file mode 100644 index 00000000..45c9ddc0 --- /dev/null +++ b/e2e/tests/sheet-gear-bands.spec.ts @@ -0,0 +1,72 @@ +import { test, expect } from '@playwright/test'; +import { signInAsPlayer, gmToken, asGm, runningSystem, approvedPlayer, sheetTab } from './helpers'; + +// The GEAR tab in bands (G2; approved mockup docs/mockups/sheet-gear-layout.html, layout A): a game whose WEAPONS are +// EQUIPPED, POTIONS USABLE and GEAR unsaid (PACK). Things made by hand land in their bands, counted; a sword moved to the +// stash goes to the STASH band, which opens to show it; USABLE closed by its head stays closed on the next visit. + +test('GEAR in bands: EQUIPPED, USABLE, PACK by type, a sword stashed into the STASH, a band closed and kept closed (G2)', async ({ browser, request }, info) => { + test.setTimeout(120_000); + const again = info.retry ? `_${info.retry + 1}` : ''; + const gm = await gmToken(request); + await runningSystem(request, gm, { + format: 1, name: `Bandhold${again}`, core: { health: { model: 'pool' } }, + stats: [{ id: 'abilities', label: 'ABILITIES', stats: [{ id: 'might', label: 'Might' }] }], + items: { + types: [ + { id: 'gear', label: 'GEAR', one: 'Gear', columns: [{ id: 'weight', label: 'WEIGHT', kind: 'number', unit: 'LB' }] }, + { id: 'weapons', label: 'WEAPONS', one: 'Weapon', on_sheet: 'equipped', columns: [{ id: 'damage', label: 'DAMAGE', kind: 'damage' }] }, + { id: 'potions', label: 'POTIONS', one: 'Potion', on_sheet: 'usable', columns: [{ id: 'heals', label: 'HEALS', kind: 'dice' }] }, + ], + list: [], + }, + }); + const player = { username: `e2e_bandhold${again}`, password: 'e2e-player-password' }; + await approvedPlayer(request, gm, player); + const sheetOf = async () => (await asGm(request, gm, 'get', `/api/sheets/user/${player.username}`)).data; + + const context = await browser.newContext({ baseURL: info.project.use.baseURL, viewport: { width: 1280, height: 800 } }); + const mine = await context.newPage(); + await signInAsPlayer(mine, player); + await mine.getByRole('button', { name: 'CHARACTER_CONTROLS', exact: true }).click(); + await mine.getByRole('button', { name: 'CHARACTER_SHEET', exact: true }).click(); + await sheetTab(mine, 'GEAR'); + + // One of each, made by hand: each in its type's band. + const add = mine.getByRole('group', { name: 'Add by hand' }); + const band = (label: string) => mine.getByRole('region', { name: `${label} band` }); + const head = (label: string) => band(label).getByRole('button', { name: new RegExp(`^[▸▾] ${label} · \\d+$`) }); + await add.getByRole('button', { name: 'Add a Weapon by hand' }).click(); + await mine.getByLabel('Item 1 name', { exact: true }).fill('Sword'); + await add.getByRole('button', { name: 'Add a Potion by hand' }).click(); + await mine.getByLabel('Item 2 name', { exact: true }).fill('Draught'); + await add.getByRole('button', { name: 'Add a Gear by hand' }).click(); + await mine.getByLabel('Item 3 name', { exact: true }).fill('Rope'); + await expect(head('EQUIPPED')).toHaveText('▾ EQUIPPED · 1'); + await expect(head('USABLE')).toHaveText('▾ USABLE · 1'); + await expect(head('PACK')).toHaveText('▾ PACK · 1'); + await expect(head('STASH')).toHaveText('▸ STASH · 0'); + await expect(band('USABLE').getByRole('region', { name: 'POTIONS gear' })).toBeVisible(); + await expect.poll(async () => JSON.parse(String((await sheetOf()).inventory ?? '[]')).map((l: { name: string }) => l.name), { timeout: 15_000 }).toEqual(['Sword', 'Draught', 'Rope']); + + // The sword to the stash: into the STASH band, opened to show it, its type said. + await band('EQUIPPED').getByLabel('Item 1 carried', { exact: true }).selectOption('stash'); + await expect(head('STASH')).toHaveText('▾ STASH · 1'); + await expect(band('STASH').getByLabel('Item 1 name', { exact: true })).toHaveValue('Sword'); + await expect(band('STASH').getByText('WEAPONS', { exact: true })).toBeVisible(); + await expect(head('EQUIPPED')).toHaveText('▾ EQUIPPED · 0'); + + // USABLE closed by its head; still closed after a reload. + await head('USABLE').click(); + await expect(head('USABLE')).toHaveAttribute('aria-expanded', 'false'); + await expect(band('USABLE').getByLabel('Item 2 name', { exact: true })).toHaveCount(0); + await expect.poll(async () => JSON.parse(String((await sheetOf()).inventory ?? '[]'))[0]?.carry, { timeout: 15_000 }).toBe('stash'); + // A fresh visit, signed in again: which bands are closed is kept in this browser. + await signInAsPlayer(mine, player); + await mine.getByRole('button', { name: 'CHARACTER_CONTROLS', exact: true }).click(); + await mine.getByRole('button', { name: 'CHARACTER_SHEET', exact: true }).click(); + await sheetTab(mine, 'GEAR'); + await expect(head('USABLE')).toHaveAttribute('aria-expanded', 'false'); + await expect(head('PACK')).toHaveAttribute('aria-expanded', 'true'); + await context.close(); +}); diff --git a/e2e/tests/sheet-item-types.spec.ts b/e2e/tests/sheet-item-types.spec.ts index e0d6b7ad..55dc3227 100644 --- a/e2e/tests/sheet-item-types.spec.ts +++ b/e2e/tests/sheet-item-types.spec.ts @@ -34,15 +34,16 @@ test('GEAR as a table per type: a stick made by hand and its DAMAGE rolled, the await mine.getByLabel('Might', { exact: true }).fill('12'); await expect.poll(async () => (await sheetOf()).might, { timeout: 15_000 }).toBe(12); - // A table per type, each empty with its own +. + // In bands (G2): nothing carried yet, a + for each type in the row at the top. await sheetTab(mine, 'GEAR'); const weapons = mine.getByRole('region', { name: 'WEAPONS gear' }); const gear = mine.getByRole('region', { name: 'GEAR gear' }); - await expect(weapons.getByText('WEAPONS · 0')).toBeVisible(); - await expect(gear.getByText('GEAR · 0')).toBeVisible(); + const add = mine.getByRole('group', { name: 'Add by hand' }); + await expect(mine.getByRole('region', { name: 'PACK band' }).getByText('Nothing here.')).toBeVisible(); + await expect(weapons).toHaveCount(0); // A stick, made by hand: its own DAMAGE and GRADE. - await weapons.getByRole('button', { name: 'Add a Weapon by hand' }).click(); + await add.getByRole('button', { name: 'Add a Weapon by hand' }).click(); await weapons.getByLabel('Item 1 name', { exact: true }).fill('A stick'); await weapons.getByLabel('Item 1 DAMAGE', { exact: true }).fill('1d4'); await weapons.getByLabel('Item 1 GRADE', { exact: true }).selectOption('HEAVY'); @@ -61,13 +62,13 @@ test('GEAR as a table per type: a stick made by hand and its DAMAGE rolled, the await expect(tray).toBeHidden(); // A line named like the Pistol: its values faint, until RANGE is typed over. - await weapons.getByRole('button', { name: 'Add a Weapon by hand' }).click(); + await add.getByRole('button', { name: 'Add a Weapon by hand' }).click(); await weapons.getByLabel('Item 2 name', { exact: true }).fill('Pistol'); await expect(weapons.getByLabel('Item 2 DAMAGE', { exact: true })).toHaveAttribute('placeholder', '2d6 + @might'); await weapons.getByLabel('Item 2 RANGE', { exact: true }).fill('50 m'); // A rope, in GEAR. - await gear.getByRole('button', { name: 'Add a Gear by hand' }).click(); + await add.getByRole('button', { name: 'Add a Gear by hand' }).click(); await gear.getByLabel('Item 3 name', { exact: true }).fill('Rope'); await gear.getByLabel('Item 3 WEIGHT', { exact: true }).fill('10'); diff --git a/e2e/tests/sheet-standalone-tab.spec.ts b/e2e/tests/sheet-standalone-tab.spec.ts index a7e48a3d..4df615bd 100644 --- a/e2e/tests/sheet-standalone-tab.spec.ts +++ b/e2e/tests/sheet-standalone-tab.spec.ts @@ -37,9 +37,10 @@ test('the sheet in a new tab: in the theme, WEAR and a DAMAGE ROLL work there as // Two lines, made in the window: the boots and the club. await sheetTab(mine, 'GEAR'); - await mine.getByRole('region', { name: 'GEAR gear' }).getByRole('button', { name: 'Add a Gear by hand' }).click(); + // From the row of + at the top of GEAR (G2). + await mine.getByRole('group', { name: 'Add by hand' }).getByRole('button', { name: 'Add a Gear by hand' }).click(); await mine.getByLabel('Item 1 name', { exact: true }).fill('Boots of Quiet'); - await mine.getByRole('region', { name: 'WEAPONS gear' }).getByRole('button', { name: 'Add a Weapon by hand' }).click(); + await mine.getByRole('group', { name: 'Add by hand' }).getByRole('button', { name: 'Add a Weapon by hand' }).click(); await mine.getByLabel('Item 2 name', { exact: true }).fill('Club'); await expect.poll(async () => JSON.parse(String((await sheetOf()).inventory ?? '[]')).length, { timeout: 15_000 }).toBe(2); diff --git a/frontend/src/components/GearTypeTables.tsx b/frontend/src/components/GearTypeTables.tsx index 57720f0c..bc64e3db 100644 --- a/frontend/src/components/GearTypeTables.tsx +++ b/frontend/src/components/GearTypeTables.tsx @@ -1,7 +1,8 @@ import React, { useEffect, useEffectEvent, useRef, useState } from 'react'; import { CARRY_STATES, type InventoryItem } from '../sheets/inventory'; import type { ItemsShown } from '../sheets/gearItems'; -import { gearTables, valueText, withLineValue, newLineOf, shownCells, cellWords, countOf, type Cell, type CountAnswer, type CountKind } from '../sheets/gearTypes'; +import { gearTables, gearBands, valueText, withLineValue, newLineOf, shownCells, cellWords, countOf, type Cell, type CountAnswer, type CountKind, type TableRow, type TypeShown } from '../sheets/gearTypes'; +import { useGearBands } from '../hooks/useGearBands'; import { diceWords, SHAPES, shapeText, insertName, type GearDiceRead } from '../sheets/gearDice'; import { FormulaIcon } from './FormulaIcon'; @@ -12,7 +13,10 @@ import { FormulaIcon } from './FormulaIcon'; // at a time, closed by DONE, ✎ again or opening another; a line made by hand opens so. One layout in SHEET.EXE and the // standalone tab, the wider fitting more on a line. What goes where is sheets/gearTypes.ts; the lines are the one // inventory, written back whole. A COUNT reads "AMMO 4 / 6" with its button (FIRE) and RELOAD beside it (8a4b), done by -// the server, which asks which carried line to reload from when there are several. +// the server, which asks which carried line to reload from when there are several. The lines in bands (G2; approved mockup +// docs/mockups/sheet-gear-layout.html, layout A): EQUIPPED, USABLE and PACK by each type's ON THE SHEET, a group per type, +// in hand first; STASH, closed to start, whatever the type; a band's head closes it and the sheet remembers. A thing is +// made by hand from the row of + buttons at the top. interface Props { items: InventoryItem[]; @@ -161,32 +165,27 @@ export function GearTypeTables({ items, itemsShown, readOnly, write, locked, und else if (!answer.ok) setSaid({ index, text: answer.error }); }); }; - return ( -