Navigation & layout - Replace per-page hardcoded nav/footer with shared nav.js (client-side injection) - Add nginx reverse proxy back to docker-compose for clean localhost routing - Rename /color-picker/ to /color/ across nav, directory, and references eStore admin - Add variation hiding controls (mirrors existing modifier hiding) - Add delivery rate editor (base fee + per-mile per tier, persisted to data/) - Fix all missing BASE prefix on fetch calls (admin PATCH/DELETE, availability, slots, colors) - Mount estore/data/ as a Docker volume so admin config survives rebuilds Booking & calendar - Set pickup calendar events to TRANSPARENT (free) so they don't block delivery slots - Skip CANCELLED events in busy-time calculation - Re-check slot availability at checkout before charging (409 on conflict) Phone & email validation - Auto-format phone as (XXX) XXX-XXXX as user types - Require exactly 10 digits; tighten email regex Confirmation emails (store alert + customer) - Full item detail per line: name, price, add-ons, colors, note - Charges breakdown: subtotal, delivery fee, tax, total - Delivery window: simplified M/D/YY h:mm – h:mm AM/PM format - .ics calendar attachment on customer confirmation Delivery rates - Extract configurable rates to delivery-rates.ts (server-only, no fs in client bundle) - calcDelivery() accepts optional rates param; delivery-quote route passes configured rates Content - Change all "40+ latex colors" references to "70+" Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
60 lines
1.7 KiB
TypeScript
60 lines
1.7 KiB
TypeScript
'use client'
|
|
import { BASE } from '@/lib/basepath'
|
|
|
|
import { useState } from 'react'
|
|
import { useRouter } from 'next/navigation'
|
|
import type { Metadata } from 'next'
|
|
|
|
export default function AdminLoginPage() {
|
|
const router = useRouter()
|
|
const [password, setPassword] = useState('')
|
|
const [error, setError] = useState('')
|
|
const [loading, setLoading] = useState(false)
|
|
|
|
async function handleSubmit(e: React.FormEvent) {
|
|
e.preventDefault()
|
|
setLoading(true)
|
|
setError('')
|
|
const res = await fetch(BASE + '/api/admin/login', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ password }),
|
|
})
|
|
if (res.ok) {
|
|
router.push('/admin')
|
|
} else {
|
|
setError('Invalid password')
|
|
setLoading(false)
|
|
}
|
|
}
|
|
|
|
return (
|
|
<section className="section">
|
|
<div className="container" style={{ maxWidth: 400 }}>
|
|
<h1 className="title is-4" style={{ marginBottom: '1.5rem' }}>Admin Login</h1>
|
|
<form onSubmit={handleSubmit}>
|
|
<div className="field">
|
|
<div className="control">
|
|
<input
|
|
className="input"
|
|
type="password"
|
|
placeholder="Password"
|
|
value={password}
|
|
onChange={(e) => setPassword(e.target.value)}
|
|
autoFocus
|
|
required
|
|
/>
|
|
</div>
|
|
</div>
|
|
{error && <p className="help is-danger">{error}</p>}
|
|
<div className="field" style={{ marginTop: '1rem' }}>
|
|
<button className={`button is-dark is-fullwidth${loading ? ' is-loading' : ''}`} type="submit">
|
|
Sign in
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</section>
|
|
)
|
|
}
|