Files
smartmenu-collina/src/components/admin/AdminLogin.tsx
T
Collina SystemsandClaude Opus 4.8 58a71d0bef Apply full frontend redesign (Montserrat, red accent, glass + dock UI)
Fonts switched to Montserrat (UI) + Merriweather (landing wordmark). Macro
protein standard color updated to #dc2626; primary actions hardcoded red.
New globals.css primitives: ai-smoke gradient buttons, seg-btn, sticky
cat-bar, editor dock-*, macro shimmer, delivery-timer pulses, liquid-btn,
aurora, editable-num.

- Public: landing (video bg + red CTA), PublicMenu (segmented toggle +
  "Preguntar a Claude" + sticky category bar w/ scroll-spy + Order/Waiter/
  Split FABs), DishCard flip, MacrosBack shimmer, BrandHeader, SplitPanel,
  AiConsultant.
- Editor: bottom dock navigation, EditorLogin video background, BrandTab,
  CatalogTab (+SectionTitleEditor), VersionHistory, OrdersTab, ProductEditor.
- Admin: AdminLogin, AdminPanel.
- Add landing/editor background videos under public/videos.
- ES/EN i18n keys added; FRONTEND.md updated; design mockups included.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-23 14:03:06 -06:00

58 lines
1.8 KiB
TypeScript

'use client';
import { useState } from 'react';
import { useRouter } from 'next/navigation';
import { useTranslations } from 'next-intl';
export default function AdminLogin() {
const router = useRouter();
const tAdmin = useTranslations('admin');
const tAuth = useTranslations('auth');
const [user, setUser] = useState('');
const [password, setPassword] = useState('');
const [error, setError] = useState(false);
const [loading, setLoading] = useState(false);
async function submit(e: React.FormEvent) {
e.preventDefault();
setLoading(true);
setError(false);
const res = await fetch('/api/admin/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ user, password }),
});
setLoading(false);
if (res.ok) router.refresh();
else setError(true);
}
return (
<main className="flex min-h-screen items-center justify-center p-4">
<form onSubmit={submit} className="glass flex w-full max-w-sm flex-col gap-3 rounded-3xl p-6">
<h1 className="display text-2xl font-semibold">{tAdmin('title')}</h1>
<input
value={user}
onChange={(e) => setUser(e.target.value)}
placeholder={tAuth('username')}
className="glass-soft rounded-2xl px-4 py-3 outline-none"
/>
<input
type="password"
value={password}
onChange={(e) => setPassword(e.target.value)}
placeholder={tAuth('password')}
className="glass-soft rounded-2xl px-4 py-3 outline-none"
/>
{error && <p className="text-sm text-red-600">{tAuth('invalid')}</p>}
<button
disabled={loading}
className="rounded-2xl bg-[#dc2626] py-3 font-medium text-white disabled:opacity-50"
>
{tAuth('login')}
</button>
</form>
</main>
);
}