diff --git a/app/src/components/inventory/CatalogEditor.js b/app/src/components/inventory/CatalogEditor.js index 221b2ce8..3927a89d 100644 --- a/app/src/components/inventory/CatalogEditor.js +++ b/app/src/components/inventory/CatalogEditor.js @@ -2,6 +2,7 @@ import React, {useState} from "react"; import {Input, Select, TableBody, TableCell, TableHeader, TableHeaderCell, TableRow} from "semantic-ui-react"; import {Button, Header, Icon, Modal, Table} from "../Theme"; import {ALL_UNITS} from "./units"; +import {ThemeContext} from "../../contexts/contexts"; const UNIT_OPTIONS = [{key: '', value: '', text: '—'}, ...ALL_UNITS.map(u => ({key: u, value: u, text: u}))]; @@ -24,6 +25,7 @@ function blankEntry() { */ export function CatalogEditor({catalog, open, onClose, onSave}) { const [draft, setDraft] = useState([]); + const {t} = React.useContext(ThemeContext); React.useEffect(() => { if (open) { @@ -46,7 +48,7 @@ export function CatalogEditor({catalog, open, onClose, onSave}) { return Food Catalog -

+

Known items used to autocomplete and pre-fill the entry form. kcal is the total calories for one package of the given size.

diff --git a/app/src/components/inventory/InventoryExportPanel.js b/app/src/components/inventory/InventoryExportPanel.js index 601a40ee..7d7ec0f1 100644 --- a/app/src/components/inventory/InventoryExportPanel.js +++ b/app/src/components/inventory/InventoryExportPanel.js @@ -3,6 +3,7 @@ import {Select} from "semantic-ui-react"; import {Button, Header, Icon, Segment} from "../Theme"; import {downloadCSV, inventoryExportFilename, toCSV} from "./inventoryExport"; import {groupFieldsOf, summableFieldsOf} from "./summarize"; +import {ThemeContext} from "../../contexts/contexts"; const fieldOptions = (fs) => fs.map(f => ({key: f.key, value: f.key, text: f.label})); @@ -15,6 +16,7 @@ export function InventoryExportPanel({name, fields, items, groupKey, sumKey, onG const count = (items || []).length; const groupFields = groupFieldsOf(fields); const summableFields = summableFieldsOf(fields); + const {t} = React.useContext(ThemeContext); const exportCSV = () => downloadCSV(inventoryExportFilename(name, 'csv'), toCSV(fields, items)); @@ -22,7 +24,7 @@ export function InventoryExportPanel({name, fields, items, groupKey, sumKey, onG return <>
CSV
-

+

A comma-separated spreadsheet of all {count} item{count === 1 ? '' : 's'} and every field, openable in Excel, Numbers, or Google Sheets. Generated entirely on this device.

@@ -33,7 +35,7 @@ export function InventoryExportPanel({name, fields, items, groupKey, sumKey, onG
PDF
-

+

A printable table of the whole inventory, followed by a summary grouped by the field you choose. This opens your browser's print dialog — choose "Save as PDF" as the destination to get a PDF file, or print it on paper. diff --git a/app/src/components/inventory/InventoryItemsMobile.js b/app/src/components/inventory/InventoryItemsMobile.js index 165fbde6..fa3c478a 100644 --- a/app/src/components/inventory/InventoryItemsMobile.js +++ b/app/src/components/inventory/InventoryItemsMobile.js @@ -2,6 +2,7 @@ import React from "react"; import {TableBody, TableCell, TableHeader, TableHeaderCell, TableRow} from "semantic-ui-react"; import {Icon, Table} from "../Theme"; import {formatValue, isItemExpired} from "./InventoryTable"; +import {ThemeContext} from "../../contexts/contexts"; // Fallback columns for inventories whose schema predates the per-field `mobile` flag: these preferred keys in // order, else the first few fields. @@ -30,13 +31,14 @@ export function mobileColumns(fields) { */ export function InventoryItemsMobile({fields, items}) { const columns = mobileColumns(fields); + const {t} = React.useContext(ThemeContext); return <> -

+

Read-only — rotate to landscape to edit.

{(items || []).length === 0 - ?

No items yet.

+ ?

No items yet.

: diff --git a/app/src/components/inventory/InventoryRoute.js b/app/src/components/inventory/InventoryRoute.js index ce3a60bc..0d96bfef 100644 --- a/app/src/components/inventory/InventoryRoute.js +++ b/app/src/components/inventory/InventoryRoute.js @@ -12,7 +12,7 @@ import {RationEstimatePanel} from "../calculators/RationCalculator"; import {defaultGroupKey, defaultSumKey, findCaloriesKey, findCountKey} from "./summarize"; import {FieldSchemaEditor} from "./FieldSchemaEditor"; import {CatalogEditor} from "./CatalogEditor"; -import {Media} from "../../contexts/contexts"; +import {Media, ThemeContext} from "../../contexts/contexts"; const INVENTORY_TYPES = [ {key: 'food', value: 'food', text: 'Food Storage'}, @@ -23,6 +23,7 @@ const INVENTORY_TYPES = [ function NewInventoryModal({open, onClose, onCreate}) { const [name, setName] = useState(''); const [type, setType] = useState('food'); + const {t} = React.useContext(ThemeContext); const create = async () => { const inventory = await onCreate(name, type); @@ -41,7 +42,7 @@ function NewInventoryModal({open, onClose, onCreate}) {
Type:{' '}