create-nextblock 0.12.11 → 0.12.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -8,8 +8,6 @@ import {
|
|
|
8
8
|
DialogHeader,
|
|
9
9
|
DialogTitle,
|
|
10
10
|
DialogTrigger,
|
|
11
|
-
DialogFooter,
|
|
12
|
-
DialogClose,
|
|
13
11
|
Button,
|
|
14
12
|
Input,
|
|
15
13
|
Separator,
|
|
@@ -246,13 +244,6 @@ export default function MediaPickerDialog({
|
|
|
246
244
|
</div>
|
|
247
245
|
)}
|
|
248
246
|
</div>
|
|
249
|
-
<DialogFooter className="mt-auto pt-4">
|
|
250
|
-
<DialogClose asChild>
|
|
251
|
-
<Button type="button" variant="outline">
|
|
252
|
-
Close
|
|
253
|
-
</Button>
|
|
254
|
-
</DialogClose>
|
|
255
|
-
</DialogFooter>
|
|
256
247
|
</DialogContent>
|
|
257
248
|
</Dialog>
|
|
258
249
|
);
|
|
@@ -157,9 +157,21 @@ export default async function EditProductPage({
|
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
+
// Product drafts persist prices in major units (dollars, the ProductForm
|
|
161
|
+
// value shape), but ProductForm re-divides the top-level price/sale_price by
|
|
162
|
+
// 100 because it expects a raw product row (minor units/cents). Convert the
|
|
163
|
+
// draft's dollars back to cents so the form shows the saved amount instead of
|
|
164
|
+
// 1/100th of it (e.g. an imported $29.50 draft otherwise renders as $0.30).
|
|
165
|
+
// The prices maps and variant prices are already in the dollar shape the form
|
|
166
|
+
// consumes directly, so only these two scalars need converting.
|
|
167
|
+
const draftDollarsToStoredCents = (value: unknown) =>
|
|
168
|
+
typeof value === 'number' && Number.isFinite(value) ? Math.round(value * 100) : value;
|
|
169
|
+
|
|
160
170
|
normalizedInitialData = {
|
|
161
171
|
...meta,
|
|
162
172
|
id: product.id,
|
|
173
|
+
price: draftDollarsToStoredCents(meta.price),
|
|
174
|
+
sale_price: draftDollarsToStoredCents(meta.sale_price),
|
|
163
175
|
product_media: hydratedProductMedia,
|
|
164
176
|
category_ids: meta.category_ids ?? assignedCategories.map((c: any) => c.id),
|
|
165
177
|
};
|