mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-29 11:26:25 -05:00
Add responsive mobile view for Inventory with configurable columns
Portrait mobile shows a condensed, read-only table; landscape/tablet+ keeps the full editable spreadsheet. The columns shown on mobile are configurable per field via a new "Mobile" toggle in the Customize Fields editor. - defaults.py: seed `mobile` on each type's default columns (food: Name, Subcategory, Size, Count; fuel/tool: sensible analogs). - FieldSchemaEditor: per-field Mobile toggle (persists through PUT /<slug>/fields). - InventoryItemsMobile: read-only condensed view driven by the `mobile` flag, falling back to a default column set for schemas predating the flag. - InventoryRoute: split Items tab via <Media> — mobile vs tablet+. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
3d6aead072
commit
cc5afe3fbc
6 changed files with 190 additions and 29 deletions
|
|
@ -4,9 +4,11 @@ import {Button, Confirm, Header, Icon, Loader, Menu, Modal, Segment} from "../Th
|
|||
import {PageContainer, useTitle} from "../Common";
|
||||
import {collectLocations, useCatalog, useInventories} from "../../hooks/customHooks";
|
||||
import {InventoryTable} from "./InventoryTable";
|
||||
import {InventoryItemsMobile} from "./InventoryItemsMobile";
|
||||
import {InventorySummary} from "./InventorySummary";
|
||||
import {FieldSchemaEditor} from "./FieldSchemaEditor";
|
||||
import {CatalogEditor} from "./CatalogEditor";
|
||||
import {Media} from "../../contexts/contexts";
|
||||
|
||||
const INVENTORY_TYPES = [
|
||||
{key: 'food', value: 'food', text: 'Food Storage'},
|
||||
|
|
@ -140,8 +142,17 @@ export function InventoryRoute() {
|
|||
</Menu>
|
||||
|
||||
{tab === 'items'
|
||||
? <InventoryTable slug={slug} fields={fields} items={items} locations={locations} catalog={catalog}
|
||||
onChange={newItems => persistInventory(slug, {items: newItems})}/>
|
||||
? <>
|
||||
{/* Portrait mobile: condensed, read-only. Rotate to landscape (tablet+) for the full editor. */}
|
||||
<Media at='mobile'>
|
||||
<InventoryItemsMobile fields={fields} items={items}/>
|
||||
</Media>
|
||||
<Media greaterThanOrEqual='tablet'>
|
||||
<InventoryTable slug={slug} fields={fields} items={items} locations={locations}
|
||||
catalog={catalog}
|
||||
onChange={newItems => persistInventory(slug, {items: newItems})}/>
|
||||
</Media>
|
||||
</>
|
||||
: <InventorySummary fields={fields} items={items}/>}
|
||||
|
||||
<FieldSchemaEditor fields={fields} open={editFieldsOpen}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue