// Villa Mesochori — owners' area. Login-gated admin for site copy, pricing and booking email. // Prototype note: this is a client-side gate for the demo — production needs a real backend. const adNS = window.VillaMesochoriDesignSystem_9e1a21; const { Button: AdButton, Input: AdInput, Card: AdCard, Badge: AdBadge, Toast: AdToast, LucideIcon: AdIcon } = adNS; const ADMIN_SESSION_KEY = "vm-admin-session"; // unused in server mode function AdField({ label, k, draft, setDraft, hint, type, multiline }) { if (multiline) { return ( ); } return ( setDraft({ ...draft, [k]: type === "number" ? Number(e.target.value) : e.target.value })} hint={hint} /> ); } function AdminLogin({ onIn }) { const [email, setEmail] = React.useState(""); const [password, setPassword] = React.useState(""); const [err, setErr] = React.useState(false); const [busy, setBusy] = React.useState(false); const tryLogin = () => { setBusy(true); window.VMContent.login(email, password).then((ok) => { setBusy(false); if (ok) onIn(); else setErr(true); }); }; return (
Owners' area

Sign in

For Maria & the family — manage the site, prices and bookings.

{ setEmail(e.target.value); setErr(false); }} placeholder="you@example.com" /> { setPassword(e.target.value); setErr(false); }} onKeyDown={(e) => { if (e.key === "Enter") tryLogin(); }} /> {err && Check the email and password and try again.}
{busy ? "Signing in…" : "Sign in"}
); } function AdminPanel({ onHome }) { const [signedIn, setSignedIn] = React.useState(() => window.VMContent.isSignedIn()); const [draft, setDraft] = React.useState(() => window.VMContent.get()); const [saved, setSaved] = React.useState(false); const [saveErr, setSaveErr] = React.useState(false); const dirty = JSON.stringify(draft) !== JSON.stringify(window.VMContent.get()); if (!signedIn) return { setSignedIn(true); setDraft(window.VMContent.get()); }} />; const save = () => { setSaveErr(false); window.VMContent.set(draft).then(() => { setSaved(true); setTimeout(() => setSaved(false), 2500); }).catch(() => setSaveErr(true)); }; const reset = () => { window.VMContent.reset().then(() => setDraft(window.VMContent.get())).catch(() => setSaveErr(true)); }; const signOut = () => { window.VMContent.signOut(); setSignedIn(false); }; const sectionH = (eyebrow, title) => (
{eyebrow}

{title}

); return (
Owners' area

Manage the site

Changes go live on the site the moment you save. Booking requests arrive at the email below.

Sign out
{sectionH("Bookings", "Pricing & rules")}
{sectionH("Guests", "Guest book")}
{sectionH("Availability", "Google Calendar sync")}
{sectionH("Bookings", "Seasonal pricing")}
{sectionH("Photos", "Site photos")}
{sectionH("Photos", "More photos gallery")}
{sectionH("Payments", "Deposits — PayPal & Square")}

Guests pay the {draft.depositPct}% deposit right after sending their booking request. Set up either or both — PayPal shows its buttons, Square adds a card form.

{sectionH("Where requests go", "Booking email")}
{sectionH("Home page", "Copy")}
{sectionH("Getting here", "Directions to the house")}
{sectionH("Places to go", "Guide intro")}
Save changes View the site Reset to defaults {saved && Saved — live on the site} {saveErr && Couldn't save — check your connection and try again}

{window.VMContent.serverMode() ? "Connected to the server — saved changes appear for every visitor." : "Prototype note: no server connected, so changes are saved in this browser only. On the live site (with api.php uploaded) they appear for every visitor."}

); } window.VMAdmin = AdminPanel;