feat: admin panel with SQLite, auth, and calendar-style schedule editor
Complete admin panel for content management: - SQLite database with better-sqlite3, seed script from content.ts - Simple password auth with HMAC-signed cookies (Edge + Node compatible) - 9 section editors: meta, hero, about, team, classes, schedule, pricing, FAQ, contact - Team CRUD with image upload and drag reorder - Schedule editor with Google Calendar-style visual timeline (colored blocks, overlap detection, click-to-add) - All public components refactored to accept data props from DB (with fallback to static content) - Middleware protecting /admin/* and /api/admin/* routes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
"use client";
|
||||
|
||||
import { SectionEditor } from "../_components/SectionEditor";
|
||||
import { InputField, TextareaField } from "../_components/FormField";
|
||||
import { ArrayEditor } from "../_components/ArrayEditor";
|
||||
import type { ContactInfo } from "@/types/content";
|
||||
|
||||
export default function ContactEditorPage() {
|
||||
return (
|
||||
<SectionEditor<ContactInfo> sectionKey="contact" title="Контакты">
|
||||
{(data, update) => (
|
||||
<>
|
||||
<InputField
|
||||
label="Заголовок секции"
|
||||
value={data.title}
|
||||
onChange={(v) => update({ ...data, title: v })}
|
||||
/>
|
||||
<InputField
|
||||
label="Телефон"
|
||||
value={data.phone}
|
||||
onChange={(v) => update({ ...data, phone: v })}
|
||||
type="tel"
|
||||
/>
|
||||
<InputField
|
||||
label="Instagram"
|
||||
value={data.instagram}
|
||||
onChange={(v) => update({ ...data, instagram: v })}
|
||||
type="url"
|
||||
/>
|
||||
<InputField
|
||||
label="Часы работы"
|
||||
value={data.workingHours}
|
||||
onChange={(v) => update({ ...data, workingHours: v })}
|
||||
/>
|
||||
<ArrayEditor
|
||||
label="Адреса"
|
||||
items={data.addresses}
|
||||
onChange={(addresses) => update({ ...data, addresses })}
|
||||
renderItem={(addr, _i, updateItem) => (
|
||||
<InputField label="Адрес" value={addr} onChange={updateItem} />
|
||||
)}
|
||||
createItem={() => ""}
|
||||
addLabel="Добавить адрес"
|
||||
/>
|
||||
<TextareaField
|
||||
label="URL карты (Yandex Maps iframe)"
|
||||
value={data.mapEmbedUrl}
|
||||
onChange={(v) => update({ ...data, mapEmbedUrl: v })}
|
||||
rows={2}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</SectionEditor>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user