diff --git a/src/app/admin/master-classes/page.tsx b/src/app/admin/master-classes/page.tsx index 7cd369a..83bca01 100644 --- a/src/app/admin/master-classes/page.tsx +++ b/src/app/admin/master-classes/page.tsx @@ -7,6 +7,30 @@ import { ArrayEditor } from "../_components/ArrayEditor"; import { Plus, X, Upload, Loader2, ImageIcon, AlertCircle, Check, ChevronDown, ChevronUp, Instagram, Send, Trash2, Pencil } from "lucide-react"; import type { MasterClassItem, MasterClassSlot } from "@/types/content"; +function PriceField({ label, value, onChange, placeholder }: { label: string; value: string; onChange: (v: string) => void; placeholder?: string }) { + const raw = value.replace(/\s*BYN\s*$/i, "").trim(); + return ( +
+ +
+ { + const v = e.target.value; + onChange(v ? `${v} BYN` : ""); + }} + placeholder={placeholder ?? "0"} + className="flex-1 bg-transparent px-4 py-2.5 text-white placeholder-neutral-500 outline-none min-w-0" + /> + + BYN + +
+
+ ); +} + interface MasterClassesData { title: string; successMessage?: string; @@ -888,11 +912,11 @@ export default function MasterClassesEditorPage() { /> - updateItem({ ...item, cost: v })} - placeholder="40 BYN" + placeholder="40" /> {locations.length > 0 && ( diff --git a/src/app/admin/pricing/page.tsx b/src/app/admin/pricing/page.tsx index 01b08b4..1ba68d9 100644 --- a/src/app/admin/pricing/page.tsx +++ b/src/app/admin/pricing/page.tsx @@ -63,45 +63,28 @@ export default function PricingEditorPage() { onChange={(v) => update({ ...data, subtitle: v })} /> - {/* Popular & Featured selectors */} + {/* Featured selector */} {(() => { const itemOptions = data.items .map((it, idx) => ({ value: String(idx), label: it.name })) .filter((o) => o.label.trim() !== ""); const noneOption = { value: "", label: "— Нет —" }; - - const popularIdx = data.items.findIndex((it) => it.popular); const featuredIdx = data.items.findIndex((it) => it.featured); return ( -
- = 0 ? String(popularIdx) : ""} - onChange={(v) => { - const items = data.items.map((it, idx) => ({ - ...it, - popular: v ? idx === Number(v) : false, - })); - update({ ...data, items }); - }} - options={[noneOption, ...itemOptions]} - placeholder="Выберите..." - /> - = 0 ? String(featuredIdx) : ""} - onChange={(v) => { - const items = data.items.map((it, idx) => ({ - ...it, - featured: v ? idx === Number(v) : false, - })); - update({ ...data, items }); - }} - options={[noneOption, ...itemOptions]} - placeholder="Выберите..." - /> -
+ = 0 ? String(featuredIdx) : ""} + onChange={(v) => { + const items = data.items.map((it, idx) => ({ + ...it, + featured: v ? idx === Number(v) : false, + })); + update({ ...data, items }); + }} + options={[noneOption, ...itemOptions]} + placeholder="Выберите..." + /> ); })()} @@ -110,22 +93,42 @@ export default function PricingEditorPage() { items={data.items} onChange={(items) => update({ ...data, items })} renderItem={(item, _i, updateItem) => ( -
- updateItem({ ...item, name: v })} - /> - updateItem({ ...item, price: v })} - /> - updateItem({ ...item, note: v })} - /> +
+
+ updateItem({ ...item, name: v })} + /> + updateItem({ ...item, price: v })} + /> + updateItem({ ...item, note: v })} + /> +
+
)} createItem={() => ({ name: "", price: "", note: "" })}