Tailor edible ingestion flow: use mg units and hide cannabinoid % fields
Build and push image / build (push) Successful in 59s
Build and push image / build (push) Successful in 59s
Edibles are dosed in milligrams, not grams, and percentage-based cannabinoid profiles don't apply. Adds weightUnit and showCannabinoidPct to TypeConfig so the add/edit/detail views adapt per product type. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -365,9 +365,9 @@ function InstanceDetailsStep({
|
||||
weight: last?.weight ?? (isDiscrete ? 0 : 3.5),
|
||||
unitWeight: last?.unitWeight ?? (isDiscrete ? 0.7 : 0),
|
||||
price: initialPrice,
|
||||
thc: last?.thc ?? 22,
|
||||
cbd: last?.cbd ?? 0.4,
|
||||
totalCannabinoids: last?.totalCannabinoids ?? 26,
|
||||
thc: last?.thc ?? (cfg?.showCannabinoidPct !== false ? 22 : 0),
|
||||
cbd: last?.cbd ?? (cfg?.showCannabinoidPct !== false ? 0.4 : 0),
|
||||
totalCannabinoids: last?.totalCannabinoids ?? (cfg?.showCannabinoidPct !== false ? 26 : 0),
|
||||
purchaseDate: TODAY_STR,
|
||||
});
|
||||
const [newShopName, setNewShopName] = useState("");
|
||||
@@ -572,7 +572,7 @@ function InstanceDetailsStep({
|
||||
}}
|
||||
>
|
||||
{isDiscrete ? (
|
||||
<Field label="Unit weight (g)" span={2} hint="Weight of one unit — for grams stats">
|
||||
<Field label={`Unit weight (${cfg?.weightUnit ?? "g"})`} span={2} hint="Weight of one unit — for grams stats">
|
||||
<Input
|
||||
type="number"
|
||||
step="0.1"
|
||||
@@ -616,38 +616,42 @@ function InstanceDetailsStep({
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div
|
||||
className="smallcaps"
|
||||
style={{ color: "var(--ink-3)", margin: "28px 0 16px" }}
|
||||
>
|
||||
Cannabinoid profile
|
||||
</div>
|
||||
<div style={{ display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: 16 }}>
|
||||
<Field label="THC %">
|
||||
<Input
|
||||
type="number"
|
||||
step="0.1"
|
||||
value={form.thc}
|
||||
onChange={(e) => update("thc", +e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="CBD %">
|
||||
<Input
|
||||
type="number"
|
||||
step="0.1"
|
||||
value={form.cbd}
|
||||
onChange={(e) => update("cbd", +e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Total cannabinoids %">
|
||||
<Input
|
||||
type="number"
|
||||
step="0.1"
|
||||
value={form.totalCannabinoids}
|
||||
onChange={(e) => update("totalCannabinoids", +e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
</div>
|
||||
{cfg?.showCannabinoidPct !== false && (
|
||||
<>
|
||||
<div
|
||||
className="smallcaps"
|
||||
style={{ color: "var(--ink-3)", margin: "28px 0 16px" }}
|
||||
>
|
||||
Cannabinoid profile
|
||||
</div>
|
||||
<div style={{ display: "grid", gridTemplateColumns: "repeat(3, 1fr)", gap: 16 }}>
|
||||
<Field label="THC %">
|
||||
<Input
|
||||
type="number"
|
||||
step="0.1"
|
||||
value={form.thc}
|
||||
onChange={(e) => update("thc", +e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="CBD %">
|
||||
<Input
|
||||
type="number"
|
||||
step="0.1"
|
||||
value={form.cbd}
|
||||
onChange={(e) => update("cbd", +e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Total cannabinoids %">
|
||||
<Input
|
||||
type="number"
|
||||
step="0.1"
|
||||
value={form.totalCannabinoids}
|
||||
onChange={(e) => update("totalCannabinoids", +e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
{error && (
|
||||
<div style={{ marginTop: 14, fontSize: 12, color: "var(--terracotta)" }}>{error}</div>
|
||||
|
||||
Reference in New Issue
Block a user