// HIFA OIL Loyalty — screens: Login, Home, Card
const { useState } = React;
// ── shared primitives ─────────────────────────────────────────
function Field({ label, value, onChange, type = 'text', icon, trailing }) {
const [focus, setFocus] = useState(false);
return (
);
}
function Button({ children, onClick, variant = 'primary', full, icon, size = 'md' }) {
const base = { display: 'inline-flex', alignItems: 'center', justifyContent: 'center', gap: 8,
height: size === 'lg' ? 54 : 48, padding: '0 22px', borderRadius: 'var(--r-button)',
fontFamily: 'var(--font-display)', fontWeight: 700, fontSize: size === 'lg' ? 16 : 15,
width: full ? '100%' : undefined, border: 'none' };
const styles = {
primary: { ...base, background: 'var(--hifa-gold-grad)', color: 'var(--on-gold)', boxShadow: 'var(--shadow-gold)' },
dark: { ...base, background: 'var(--surface-2)', color: 'var(--text)', border: '1px solid var(--border)' },
ghost: { ...base, background: 'transparent', color: 'var(--hifa-gold)' },
danger: { ...base, background: 'transparent', color: 'var(--danger)', border: '1px solid color-mix(in srgb, var(--danger) 40%, transparent)' },
};
return (
{icon && }
{children}
);
}
function SectionTitle({ children, action, onAction }) {
return (
{children}
{action &&
{action}}
);
}
// ── Login ─────────────────────────────────────────────────────
function LoginScreen({ onLogin }) {
const [email, setEmail] = useState('amar.hodzic@example.com');
const [pw, setPw] = useState('isomax2026');
return (
LOYALTY CLUB
Loyal is Royal
} />
Zaboravili ste lozinku?
Nemate račun?
Registrujte se
);
}
// ── Home (Početna) ────────────────────────────────────────────
function HomeScreen({ onTab, onNews, onTx }) {
const u = HIFA.user;
return (
{/* hero */}
LOYALTY CLUB
Uživaj u pogodnostima i vrijednim nagradama ISOMAX Loyalty cluba.
{/* greeting + fuel */}
Raspoloživo
{u.available} KM
{/* news */}
Najnovije vijesti
{HIFA.news.map((n, i) => (
{n.tag}
{n.date}
{n.title}
))}
{/* transactions */}
Transakcije
{HIFA.transactions.slice(0, 3).map((t, i) => (
{t.type === 'earn' ? '+' : '−'}{fmtL(t.litres)} L
))}
);
}
// ── Card (Kartica) ────────────────────────────────────────────
function CardScreen() {
const u = HIFA.user;
return (
Digitalna kartica
Vaša ISOMAX kartica
{/* membership card */}
ISOMAX LOYALTY
{u.card}
Član
{u.firstName} {u.lastName}
{/* QR + barcode */}
Skeniraj QR code
{u.email}
Broj ISOMAX Loyalty kartice
{/* faux barcode */}
{Array.from({ length: 52 }).map((_, i) => (
1 ? 1 : 0.0 }} />
))}
{u.cardId}
Pokažite QR kod ili barkod na kasi prilikom točenja goriva ili kupovine.
);
}
Object.assign(window, { Field, Button, SectionTitle, LoginScreen, HomeScreen, CardScreen });