chnages
chnages
This commit is contained in:
1 parent
3e22355510
commit
e22a8dc248
71 files changed
+24775
-1
No files matched your search
+57
@@ -0,0 +1,57 @@
|
||||
// App — top-level routing.
|
||||
// Public site (cream theme, navbar/footer/chatbot) under PublicLayout.
|
||||
// Admin area (dark back-office) under /admin, guarded by RequireAuth,
|
||||
// using the existing login + OTP backend flow.
|
||||
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom';
|
||||
|
||||
import PublicLayout from './components/PublicLayout';
|
||||
import RequireAuth from './components/RequireAuth';
|
||||
|
||||
import Home from './pages/Home';
|
||||
import Services from './pages/Services';
|
||||
import PastSolutions from './pages/PastSolutions';
|
||||
import Feedback from './pages/Feedback';
|
||||
import Articles from './pages/Articles';
|
||||
import ArticleDetail from './pages/ArticleDetail';
|
||||
import Gallery from './pages/Gallery';
|
||||
import Events from './pages/Events';
|
||||
import Contact from './pages/Contact';
|
||||
import NotFound from './pages/NotFound';
|
||||
|
||||
import AdminLogin from './pages/admin/AdminLogin';
|
||||
import AdminLayout from './pages/admin/AdminLayout';
|
||||
import AdminDashboard from './pages/admin/AdminDashboard';
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<BrowserRouter>
|
||||
<Routes>
|
||||
{/* Public website */}
|
||||
<Route element={<PublicLayout />}>
|
||||
<Route path="/" element={<Home />} />
|
||||
<Route path="/services" element={<Services />} />
|
||||
<Route path="/past-solutions" element={<PastSolutions />} />
|
||||
<Route path="/feedback" element={<Feedback />} />
|
||||
<Route path="/articles" element={<Articles />} />
|
||||
<Route path="/articles/:slug" element={<ArticleDetail />} />
|
||||
<Route path="/gallery" element={<Gallery />} />
|
||||
<Route path="/events" element={<Events />} />
|
||||
<Route path="/contact" element={<Contact />} />
|
||||
<Route path="*" element={<NotFound />} />
|
||||
</Route>
|
||||
|
||||
{/* Admin area */}
|
||||
<Route path="/admin/login" element={<AdminLogin />} />
|
||||
<Route
|
||||
path="/admin"
|
||||
element={<RequireAuth><AdminLayout /></RequireAuth>}
|
||||
>
|
||||
<Route index element={<AdminDashboard />} />
|
||||
</Route>
|
||||
<Route path="/admin/*" element={<Navigate to="/admin" replace />} />
|
||||
</Routes>
|
||||
</BrowserRouter>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
||||
@@ -0,0 +1,9 @@
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import App from './App';
|
||||
|
||||
// Smoke test: the public site shell renders with the AI-Solutions brand.
|
||||
test('renders the AI-Solutions brand in the navbar', () => {
|
||||
render(<App />);
|
||||
const brand = screen.getAllByText(/solutions/i)[0];
|
||||
expect(brand).toBeInTheDocument();
|
||||
});
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
// Shared fetch wrapper that handles CSRF tokens and auto-refreshes expired sessions
|
||||
const API_BASE = process.env.REACT_APP_API_URL || 'http://localhost:5000';
|
||||
|
||||
function getCookie(name) {
|
||||
const match = document.cookie.match(new RegExp('(^| )' + name + '=([^;]+)'));
|
||||
return match ? match[2] : null;
|
||||
}
|
||||
|
||||
async function ensureCsrfToken() {
|
||||
if (!getCookie('csrfToken')) {
|
||||
await fetch(`${API_BASE}/`, { credentials: 'include' });
|
||||
}
|
||||
return getCookie('csrfToken');
|
||||
}
|
||||
|
||||
async function apiFetch(path, options = {}) {
|
||||
const url = path.startsWith('http') ? path : `${API_BASE}${path}`;
|
||||
|
||||
const csrfToken = await ensureCsrfToken();
|
||||
|
||||
const headers = {
|
||||
...options.headers,
|
||||
};
|
||||
|
||||
const method = (options.method || 'GET').toUpperCase();
|
||||
if (!['GET', 'HEAD', 'OPTIONS'].includes(method) && csrfToken) {
|
||||
headers['X-CSRF-Token'] = csrfToken;
|
||||
}
|
||||
|
||||
if (options.body && !headers['Content-Type']) {
|
||||
headers['Content-Type'] = 'application/json';
|
||||
}
|
||||
|
||||
const res = await fetch(url, {
|
||||
...options,
|
||||
headers,
|
||||
credentials: 'include',
|
||||
});
|
||||
|
||||
if (res.status === 401 && !path.includes('/refresh-token')) {
|
||||
const refreshed = await tryRefreshToken();
|
||||
if (refreshed) {
|
||||
const retryCsrf = getCookie('csrfToken');
|
||||
if (!['GET', 'HEAD', 'OPTIONS'].includes(method) && retryCsrf) {
|
||||
headers['X-CSRF-Token'] = retryCsrf;
|
||||
}
|
||||
return fetch(url, {
|
||||
...options,
|
||||
headers,
|
||||
credentials: 'include',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
async function tryRefreshToken() {
|
||||
try {
|
||||
const csrfToken = getCookie('csrfToken');
|
||||
const headers = {};
|
||||
if (csrfToken) headers['X-CSRF-Token'] = csrfToken;
|
||||
|
||||
const res = await fetch(`${API_BASE}/api/auth/refresh-token`, {
|
||||
method: 'POST',
|
||||
credentials: 'include',
|
||||
headers,
|
||||
});
|
||||
return res.ok;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Convenience JSON helpers ------------------------------
|
||||
// Resolve with parsed JSON on success; throw an Error whose
|
||||
// message is the backend's message on failure, so callers can
|
||||
// show clean error states.
|
||||
async function getJSON(path) {
|
||||
const res = await apiFetch(path);
|
||||
const data = await res.json().catch(() => ({}));
|
||||
if (!res.ok) throw new Error(data.message || 'Something went wrong.');
|
||||
return data;
|
||||
}
|
||||
|
||||
async function postJSON(path, body, method = 'POST') {
|
||||
const res = await apiFetch(path, { method, body: JSON.stringify(body || {}) });
|
||||
const data = await res.json().catch(() => ({}));
|
||||
if (!res.ok) {
|
||||
const err = new Error(data.message || 'Something went wrong.');
|
||||
err.status = res.status;
|
||||
err.data = data;
|
||||
throw err;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
export { apiFetch, API_BASE, getJSON, postJSON };
|
||||
@@ -0,0 +1,21 @@
|
||||
// Brand mark — mono wordmark + dark rounded "AI" square (DESIGN.md §Brand).
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
function Brand({ to = '/', onDark = false }) {
|
||||
const inner = (
|
||||
<span className="brand">
|
||||
<span className="brand__mark">AI</span>
|
||||
<span className="brand__word" style={onDark ? { color: 'var(--dark-fg)' } : undefined}>
|
||||
ai-<b>solutions</b>
|
||||
</span>
|
||||
</span>
|
||||
);
|
||||
if (!to) return inner;
|
||||
return (
|
||||
<Link to={to} aria-label="AI-Solutions home" style={{ textDecoration: 'none' }}>
|
||||
{inner}
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
|
||||
export default Brand;
|
||||
@@ -0,0 +1,135 @@
|
||||
// Floating AI assistant widget ("Ava"). Present on every page via
|
||||
// PublicLayout. Talks ONLY to our backend Gemini proxy (/api/chat) —
|
||||
// the API key never reaches the browser. Surfaces a graceful
|
||||
// "escalate to a human" prompt when the backend flags it.
|
||||
import { useState, useRef, useEffect } from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { postJSON } from '../api';
|
||||
import Icon from './Icon';
|
||||
|
||||
const GREETING = {
|
||||
role: 'assistant',
|
||||
text: "Hi, I'm Ava — the AI-Solutions virtual assistant. Ask me about our services, past projects or events, and I'll point you in the right direction.",
|
||||
};
|
||||
|
||||
function Chatbot() {
|
||||
const [open, setOpen] = useState(false);
|
||||
const [messages, setMessages] = useState([GREETING]);
|
||||
const [input, setInput] = useState('');
|
||||
const [sending, setSending] = useState(false);
|
||||
const [escalated, setEscalated] = useState(false);
|
||||
const bodyRef = useRef(null);
|
||||
const inputRef = useRef(null);
|
||||
|
||||
// Auto-scroll to the latest message.
|
||||
useEffect(() => {
|
||||
if (bodyRef.current) bodyRef.current.scrollTop = bodyRef.current.scrollHeight;
|
||||
}, [messages, sending]);
|
||||
|
||||
// Focus the input when the panel opens.
|
||||
useEffect(() => { if (open) inputRef.current?.focus(); }, [open]);
|
||||
|
||||
const send = async (e) => {
|
||||
e.preventDefault();
|
||||
const text = input.trim();
|
||||
if (!text || sending) return;
|
||||
|
||||
const history = messages.map((m) => ({ role: m.role, text: m.text }));
|
||||
setMessages((m) => [...m, { role: 'user', text }]);
|
||||
setInput('');
|
||||
setSending(true);
|
||||
|
||||
try {
|
||||
const data = await postJSON('/api/chat', { message: text, history });
|
||||
setMessages((m) => [...m, { role: 'assistant', text: data.reply, escalate: data.escalate }]);
|
||||
if (data.escalate) setEscalated(true);
|
||||
} catch {
|
||||
setMessages((m) => [
|
||||
...m,
|
||||
{
|
||||
role: 'assistant',
|
||||
escalate: true,
|
||||
text: "I couldn't reach my AI service just now. Our team can help directly — please use the Contact Us page.",
|
||||
},
|
||||
]);
|
||||
setEscalated(true);
|
||||
} finally {
|
||||
setSending(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
{!open && (
|
||||
<button
|
||||
type="button"
|
||||
className="chat-fab"
|
||||
onClick={() => setOpen(true)}
|
||||
aria-label="Open AI assistant chat"
|
||||
>
|
||||
<Icon name="chat" size={24} />
|
||||
</button>
|
||||
)}
|
||||
|
||||
{open && (
|
||||
<section className="chat-panel" role="dialog" aria-label="AI assistant" aria-modal="false">
|
||||
<header className="chat-head">
|
||||
<div className="chat-head__title">
|
||||
<span className="chat-head__dot" aria-hidden="true" />
|
||||
<span>
|
||||
<b>Ava</b><br />
|
||||
<small>AI VIRTUAL ASSISTANT</small>
|
||||
</span>
|
||||
</div>
|
||||
<button type="button" className="modal__close" onClick={() => setOpen(false)} aria-label="Close chat">
|
||||
<Icon name="close" size={16} />
|
||||
</button>
|
||||
</header>
|
||||
|
||||
<div className="chat-body" ref={bodyRef}>
|
||||
{messages.map((m, i) => (
|
||||
<div
|
||||
key={i}
|
||||
className={`msg msg--${m.role === 'user' ? 'user' : 'bot'}${m.escalate ? ' msg--escalate' : ''}`}
|
||||
>
|
||||
{m.text}
|
||||
{m.escalate && (
|
||||
<div className="mt-8">
|
||||
<Link to="/contact" className="btn btn--primary" onClick={() => setOpen(false)}>
|
||||
Talk to a human <Icon name="arrow" size={13} />
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
|
||||
{sending && (
|
||||
<div className="msg msg--bot" aria-live="polite" aria-label="Ava is typing">
|
||||
<span className="chat-typing"><span /><span /><span /></span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<form className="chat-foot" onSubmit={send}>
|
||||
<label className="sr-only" htmlFor="chat-input">Message</label>
|
||||
<input
|
||||
id="chat-input"
|
||||
ref={inputRef}
|
||||
className="input"
|
||||
placeholder={escalated ? 'Ask another question…' : 'Type your message…'}
|
||||
value={input}
|
||||
onChange={(e) => setInput(e.target.value)}
|
||||
maxLength={1000}
|
||||
autoComplete="off"
|
||||
/>
|
||||
<button type="submit" className="btn btn--primary" disabled={sending || !input.trim()} aria-label="Send message">
|
||||
<Icon name="send" size={16} />
|
||||
</button>
|
||||
</form>
|
||||
</section>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default Chatbot;
|
||||
@@ -0,0 +1,97 @@
|
||||
// Accessible form field wrappers: label + control + error/hint, all
|
||||
// wired with htmlFor/id and aria-invalid/aria-describedby.
|
||||
import { useId, useState } from 'react';
|
||||
import Icon from './Icon';
|
||||
|
||||
export function TextField({
|
||||
label, name, value, onChange, error, hint, required, type = 'text',
|
||||
autoComplete, placeholder, icon,
|
||||
}) {
|
||||
const id = useId();
|
||||
const errId = `${id}-err`;
|
||||
return (
|
||||
<div className="field">
|
||||
<label className="field__label" htmlFor={id}>
|
||||
{label}{required && <span className="field__req" aria-hidden="true"> *</span>}
|
||||
</label>
|
||||
<input
|
||||
id={id}
|
||||
name={name}
|
||||
type={type}
|
||||
className={`input${error ? ' input--error' : ''}`}
|
||||
value={value}
|
||||
onChange={(e) => onChange(e.target.value)}
|
||||
required={required}
|
||||
autoComplete={autoComplete}
|
||||
placeholder={placeholder}
|
||||
aria-invalid={!!error}
|
||||
aria-describedby={error ? errId : undefined}
|
||||
/>
|
||||
{error && <span className="field__error" id={errId}>{error}</span>}
|
||||
{!error && hint && <span className="field__hint">{hint}</span>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function TextArea({ label, name, value, onChange, error, hint, required, rows = 5, placeholder }) {
|
||||
const id = useId();
|
||||
const errId = `${id}-err`;
|
||||
return (
|
||||
<div className="field">
|
||||
<label className="field__label" htmlFor={id}>
|
||||
{label}{required && <span className="field__req" aria-hidden="true"> *</span>}
|
||||
</label>
|
||||
<textarea
|
||||
id={id}
|
||||
name={name}
|
||||
rows={rows}
|
||||
className={`textarea${error ? ' textarea--error' : ''}`}
|
||||
value={value}
|
||||
onChange={(e) => onChange(e.target.value)}
|
||||
required={required}
|
||||
placeholder={placeholder}
|
||||
aria-invalid={!!error}
|
||||
aria-describedby={error ? errId : undefined}
|
||||
/>
|
||||
{error && <span className="field__error" id={errId}>{error}</span>}
|
||||
{!error && hint && <span className="field__hint">{hint}</span>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function PasswordField({ label, value, onChange, error, required, autoComplete = 'current-password', placeholder }) {
|
||||
const id = useId();
|
||||
const errId = `${id}-err`;
|
||||
const [show, setShow] = useState(false);
|
||||
return (
|
||||
<div className="field">
|
||||
<label className="field__label" htmlFor={id}>
|
||||
{label}{required && <span className="field__req" aria-hidden="true"> *</span>}
|
||||
</label>
|
||||
<div className="password-wrap">
|
||||
<input
|
||||
id={id}
|
||||
type={show ? 'text' : 'password'}
|
||||
className={`input${error ? ' input--error' : ''}`}
|
||||
value={value}
|
||||
onChange={(e) => onChange(e.target.value)}
|
||||
required={required}
|
||||
autoComplete={autoComplete}
|
||||
placeholder={placeholder}
|
||||
aria-invalid={!!error}
|
||||
aria-describedby={error ? errId : undefined}
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
className="password-toggle"
|
||||
onClick={() => setShow((s) => !s)}
|
||||
aria-label={show ? 'Hide password' : 'Show password'}
|
||||
tabIndex={-1}
|
||||
>
|
||||
<Icon name={show ? 'eyeOff' : 'eye'} size={16} />
|
||||
</button>
|
||||
</div>
|
||||
{error && <span className="field__error" id={errId}>{error}</span>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
// Public site footer (dark).
|
||||
import { Link } from 'react-router-dom';
|
||||
import Brand from './Brand';
|
||||
|
||||
function Footer() {
|
||||
const year = new Date().getFullYear();
|
||||
return (
|
||||
<footer className="footer">
|
||||
<div className="container footer__inner">
|
||||
<div className="footer__col">
|
||||
<Brand to="/" onDark />
|
||||
<p style={{ color: 'var(--dark-dim)', marginTop: 16, fontSize: 15, maxWidth: 320 }}>
|
||||
Innovating, promoting and delivering the future of the digital employee
|
||||
experience — with a strong focus on supporting people at work.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="footer__col">
|
||||
<h4>Explore</h4>
|
||||
<Link to="/services">Services</Link>
|
||||
<Link to="/past-solutions">Past Solutions</Link>
|
||||
<Link to="/feedback">Customer Feedback</Link>
|
||||
<Link to="/articles">Articles</Link>
|
||||
</div>
|
||||
|
||||
<div className="footer__col">
|
||||
<h4>Company</h4>
|
||||
<Link to="/gallery">Photo Gallery</Link>
|
||||
<Link to="/events">Upcoming Events</Link>
|
||||
<Link to="/contact">Contact Us</Link>
|
||||
<Link to="/admin">Admin Portal</Link>
|
||||
</div>
|
||||
|
||||
<div className="footer__col">
|
||||
<h4>Get in touch</h4>
|
||||
<a href="mailto:hello@ai-solutions.com">hello@ai-solutions.com</a>
|
||||
<span style={{ color: 'var(--dark-dim)', fontSize: 15, display: 'block', padding: '5px 0' }}>Sunderland, United Kingdom</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="footer__bottom">
|
||||
© {year} AI-Solutions Ltd · Built for CET333 Product Development
|
||||
</div>
|
||||
</footer>
|
||||
);
|
||||
}
|
||||
|
||||
export default Footer;
|
||||
@@ -0,0 +1,124 @@
|
||||
// Inline SVG icon set. Per DESIGN.md: utility SVG only (1.75 stroke,
|
||||
// currentColor, ~13-15px), no decorative illustration, no emoji.
|
||||
// Usage: <Icon name="bolt" size={16} />
|
||||
|
||||
const PATHS = {
|
||||
robot: (
|
||||
<>
|
||||
<rect x="4" y="8" width="16" height="11" rx="2" />
|
||||
<path d="M12 8V4M9 4h6" />
|
||||
<circle cx="9" cy="13" r="1" />
|
||||
<circle cx="15" cy="13" r="1" />
|
||||
<path d="M2 13v2M22 13v2" />
|
||||
</>
|
||||
),
|
||||
bolt: <path d="M13 2 4 14h6l-1 8 9-12h-6l1-8Z" />,
|
||||
code: <path d="m9 18-6-6 6-6M15 6l6 6-6 6" />,
|
||||
chart: (
|
||||
<>
|
||||
<path d="M3 3v18h18" />
|
||||
<rect x="7" y="12" width="3" height="6" />
|
||||
<rect x="12" y="8" width="3" height="10" />
|
||||
<rect x="17" y="5" width="3" height="13" />
|
||||
</>
|
||||
),
|
||||
spark: <path d="M12 3v6M12 15v6M3 12h6M15 12h6M5.6 5.6l4.2 4.2M14.2 14.2l4.2 4.2M18.4 5.6l-4.2 4.2M9.8 14.2l-4.2 4.2" />,
|
||||
shield: <path d="M12 3 5 6v5c0 4 3 7 7 9 4-2 7-5 7-9V6l-7-3Z" />,
|
||||
star: <path d="M12 3.5l2.6 5.3 5.9.9-4.2 4.1 1 5.8L12 17l-5.3 2.6 1-5.8L3.5 9.7l5.9-.9L12 3.5Z" />,
|
||||
mail: (
|
||||
<>
|
||||
<rect x="3" y="5" width="18" height="14" rx="2" />
|
||||
<path d="m3 7 9 6 9-6" />
|
||||
</>
|
||||
),
|
||||
phone: <path d="M5 4h4l2 5-3 2a14 14 0 0 0 5 5l2-3 5 2v4a2 2 0 0 1-2 2A16 16 0 0 1 3 6a2 2 0 0 1 2-2Z" />,
|
||||
building: (
|
||||
<>
|
||||
<rect x="5" y="3" width="14" height="18" rx="1" />
|
||||
<path d="M9 7h2M13 7h2M9 11h2M13 11h2M9 15h2M13 15h2" />
|
||||
</>
|
||||
),
|
||||
globe: (
|
||||
<>
|
||||
<circle cx="12" cy="12" r="9" />
|
||||
<path d="M3 12h18M12 3c2.5 2.5 2.5 15 0 18M12 3c-2.5 2.5-2.5 15 0 18" />
|
||||
</>
|
||||
),
|
||||
briefcase: (
|
||||
<>
|
||||
<rect x="3" y="7" width="18" height="13" rx="2" />
|
||||
<path d="M8 7V5a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" />
|
||||
</>
|
||||
),
|
||||
user: (
|
||||
<>
|
||||
<circle cx="12" cy="8" r="4" />
|
||||
<path d="M4 20c0-4 4-6 8-6s8 2 8 6" />
|
||||
</>
|
||||
),
|
||||
calendar: (
|
||||
<>
|
||||
<rect x="3" y="5" width="18" height="16" rx="2" />
|
||||
<path d="M3 9h18M8 3v4M16 3v4" />
|
||||
</>
|
||||
),
|
||||
pin: (
|
||||
<>
|
||||
<path d="M12 21s7-5.5 7-11a7 7 0 1 0-14 0c0 5.5 7 11 7 11Z" />
|
||||
<circle cx="12" cy="10" r="2.5" />
|
||||
</>
|
||||
),
|
||||
inbox: (
|
||||
<>
|
||||
<path d="M3 12h5l2 3h4l2-3h5" />
|
||||
<path d="M5 5h14l2 7v7H3v-7l2-7Z" />
|
||||
</>
|
||||
),
|
||||
chat: <path d="M21 12a8 8 0 0 1-8 8H7l-4 3v-4a8 8 0 1 1 18-7Z" />,
|
||||
send: <path d="M4 12 20 4l-6 16-2-7-8-1Z" />,
|
||||
close: <path d="M6 6l12 12M18 6 6 18" />,
|
||||
menu: <path d="M4 7h16M4 12h16M4 17h16" />,
|
||||
arrow: <path d="M5 12h14M13 6l6 6-6 6" />,
|
||||
eye: (
|
||||
<>
|
||||
<path d="M2 12s4-7 10-7 10 7 10 7-4 7-10 7-10-7-10-7Z" />
|
||||
<circle cx="12" cy="12" r="3" />
|
||||
</>
|
||||
),
|
||||
eyeOff: <path d="M3 3l18 18M10.6 10.6a3 3 0 0 0 4.2 4.2M9.9 5.2A9.5 9.5 0 0 1 12 5c6 0 10 7 10 7a17 17 0 0 1-3.2 3.8M6.2 6.2A17 17 0 0 0 2 12s4 7 10 7a9.4 9.4 0 0 0 3-.5" />,
|
||||
logout: <path d="M14 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2v-2M9 12h12M18 9l3 3-3 3" />,
|
||||
search: (
|
||||
<>
|
||||
<circle cx="11" cy="11" r="7" />
|
||||
<path d="m20 20-3.5-3.5" />
|
||||
</>
|
||||
),
|
||||
trash: <path d="M4 7h16M9 7V5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2M6 7l1 13h10l1-13" />,
|
||||
check: <path d="m5 12 5 5 9-11" />,
|
||||
refresh: <path d="M21 12a9 9 0 1 1-3-6.7L21 8M21 4v4h-4" />,
|
||||
};
|
||||
|
||||
function Icon({ name, size = 16, strokeWidth = 1.75, className = '', ...rest }) {
|
||||
const content = PATHS[name];
|
||||
if (!content) return null;
|
||||
return (
|
||||
<svg
|
||||
width={size}
|
||||
height={size}
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth={strokeWidth}
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
className={className}
|
||||
aria-hidden="true"
|
||||
focusable="false"
|
||||
{...rest}
|
||||
>
|
||||
{content}
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
export default Icon;
|
||||
@@ -0,0 +1,43 @@
|
||||
// Accessible modal dialog: focus trap-lite, Esc to close, backdrop
|
||||
// click to close, scroll lock. Used for the admin enquiry detail.
|
||||
import { useEffect, useRef } from 'react';
|
||||
import Icon from './Icon';
|
||||
|
||||
function Modal({ title, onClose, children, labelledById = 'modal-title' }) {
|
||||
const ref = useRef(null);
|
||||
|
||||
useEffect(() => {
|
||||
const onKey = (e) => { if (e.key === 'Escape') onClose(); };
|
||||
document.addEventListener('keydown', onKey);
|
||||
document.body.style.overflow = 'hidden';
|
||||
// Move focus into the dialog for screen-reader + keyboard users.
|
||||
ref.current?.focus();
|
||||
return () => {
|
||||
document.removeEventListener('keydown', onKey);
|
||||
document.body.style.overflow = '';
|
||||
};
|
||||
}, [onClose]);
|
||||
|
||||
return (
|
||||
<div className="modal-overlay" onMouseDown={(e) => { if (e.target === e.currentTarget) onClose(); }}>
|
||||
<div
|
||||
className="modal"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-labelledby={labelledById}
|
||||
tabIndex={-1}
|
||||
ref={ref}
|
||||
>
|
||||
<div className="modal__head">
|
||||
<h2 className="modal__title" id={labelledById}>{title}</h2>
|
||||
<button type="button" className="modal__close" onClick={onClose} aria-label="Close dialog">
|
||||
<Icon name="close" size={16} />
|
||||
</button>
|
||||
</div>
|
||||
<div className="modal__body">{children}</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Modal;
|
||||
@@ -0,0 +1,62 @@
|
||||
// Public site navigation. Sticky, responsive (collapses < 760px),
|
||||
// keyboard accessible, marks the active route.
|
||||
import { useState } from 'react';
|
||||
import { NavLink } from 'react-router-dom';
|
||||
import Brand from './Brand';
|
||||
import Icon from './Icon';
|
||||
|
||||
const LINKS = [
|
||||
{ to: '/', label: 'Home', end: true },
|
||||
{ to: '/services', label: 'Services' },
|
||||
{ to: '/past-solutions', label: 'Past Solutions' },
|
||||
{ to: '/feedback', label: 'Feedback' },
|
||||
{ to: '/articles', label: 'Articles' },
|
||||
{ to: '/gallery', label: 'Gallery' },
|
||||
{ to: '/events', label: 'Events' },
|
||||
];
|
||||
|
||||
function Navbar() {
|
||||
const [open, setOpen] = useState(false);
|
||||
const close = () => setOpen(false);
|
||||
|
||||
return (
|
||||
<header className="nav">
|
||||
<div className="container nav__inner">
|
||||
<Brand />
|
||||
|
||||
<nav className={`nav__links${open ? ' is-open' : ''}`} aria-label="Primary">
|
||||
{LINKS.map((l) => (
|
||||
<NavLink
|
||||
key={l.to}
|
||||
to={l.to}
|
||||
end={l.end}
|
||||
className={({ isActive }) => `nav__link${isActive ? ' is-active' : ''}`}
|
||||
onClick={close}
|
||||
>
|
||||
{l.label}
|
||||
</NavLink>
|
||||
))}
|
||||
{/* Shown only inside the collapsed mobile menu */}
|
||||
<NavLink to="/contact" className="nav__link nav__link--mobile" onClick={close}>Contact</NavLink>
|
||||
<NavLink to="/admin" className="nav__link nav__link--mobile" onClick={close}>Admin</NavLink>
|
||||
</nav>
|
||||
|
||||
<div className="nav__actions">
|
||||
<NavLink to="/admin" className="nav__admin">Admin</NavLink>
|
||||
<NavLink to="/contact" className="btn btn--primary">Contact Us</NavLink>
|
||||
<button
|
||||
type="button"
|
||||
className="nav__toggle"
|
||||
aria-expanded={open}
|
||||
aria-label="Toggle menu"
|
||||
onClick={() => setOpen((o) => !o)}
|
||||
>
|
||||
<Icon name={open ? 'close' : 'menu'} size={22} />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
}
|
||||
|
||||
export default Navbar;
|
||||
@@ -0,0 +1,26 @@
|
||||
// Public site shell: skip-link, navbar, routed page, footer, and the
|
||||
// always-available AI chatbot. Scrolls to top on route change.
|
||||
import { useEffect } from 'react';
|
||||
import { Outlet, useLocation } from 'react-router-dom';
|
||||
import Navbar from './Navbar';
|
||||
import Footer from './Footer';
|
||||
import Chatbot from './Chatbot';
|
||||
|
||||
function PublicLayout() {
|
||||
const { pathname } = useLocation();
|
||||
useEffect(() => { window.scrollTo(0, 0); }, [pathname]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<a className="skip-link" href="#main">Skip to content</a>
|
||||
<Navbar />
|
||||
<main id="main">
|
||||
<Outlet />
|
||||
</main>
|
||||
<Footer />
|
||||
<Chatbot />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default PublicLayout;
|
||||
@@ -0,0 +1,31 @@
|
||||
// Route guard for the admin area. Verifies the session against the
|
||||
// existing backend (GET /api/auth/me) — it never inspects tokens
|
||||
// itself, so the server stays the single source of truth. Redirects
|
||||
// to the admin login when unauthenticated.
|
||||
import { useEffect, useState } from 'react';
|
||||
import { Navigate, useLocation } from 'react-router-dom';
|
||||
import { getJSON } from '../api';
|
||||
import { Loading } from './States';
|
||||
|
||||
function RequireAuth({ children }) {
|
||||
const [status, setStatus] = useState('checking'); // checking | ok | denied
|
||||
const location = useLocation();
|
||||
|
||||
useEffect(() => {
|
||||
let active = true;
|
||||
getJSON('/api/auth/me')
|
||||
.then(() => active && setStatus('ok'))
|
||||
.catch(() => active && setStatus('denied'));
|
||||
return () => { active = false; };
|
||||
}, []);
|
||||
|
||||
if (status === 'checking') {
|
||||
return <div className="auth-screen"><Loading label="Checking your session…" /></div>;
|
||||
}
|
||||
if (status === 'denied') {
|
||||
return <Navigate to="/admin/login" state={{ from: location.pathname }} replace />;
|
||||
}
|
||||
return children;
|
||||
}
|
||||
|
||||
export default RequireAuth;
|
||||
@@ -0,0 +1,35 @@
|
||||
// Image with a graceful branded fallback. If the remote image fails
|
||||
// to load, we render a tinted placeholder with an icon instead of a
|
||||
// broken-image glyph — keeping every card looking intentional.
|
||||
import { useState } from 'react';
|
||||
import Icon from './Icon';
|
||||
|
||||
function SmartImage({ src, alt, icon = 'spark', className = '', style }) {
|
||||
const [failed, setFailed] = useState(false);
|
||||
|
||||
if (failed || !src) {
|
||||
return (
|
||||
<div
|
||||
className={className}
|
||||
style={{ ...style, display: 'grid', placeItems: 'center', background: 'var(--accent-soft)', color: 'var(--accent)' }}
|
||||
role="img"
|
||||
aria-label={alt}
|
||||
>
|
||||
<Icon name={icon} size={40} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<img
|
||||
src={src}
|
||||
alt={alt}
|
||||
className={className}
|
||||
style={style}
|
||||
loading="lazy"
|
||||
onError={() => setFailed(true)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export default SmartImage;
|
||||
@@ -0,0 +1,21 @@
|
||||
// Accessible star rating (read-only). Renders 5 stars, fills `value`.
|
||||
import Icon from './Icon';
|
||||
|
||||
function StarRating({ value = 0, max = 5 }) {
|
||||
const rounded = Math.round(value);
|
||||
return (
|
||||
<span className="stars" role="img" aria-label={`${value} out of ${max} stars`}>
|
||||
{Array.from({ length: max }).map((_, i) => (
|
||||
<Icon
|
||||
key={i}
|
||||
name="star"
|
||||
size={16}
|
||||
className={i < rounded ? '' : 'star--empty'}
|
||||
style={{ fill: i < rounded ? 'currentColor' : 'none' }}
|
||||
/>
|
||||
))}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
export default StarRating;
|
||||
@@ -0,0 +1,38 @@
|
||||
// Shared async UI states: Loading, Empty, Error.
|
||||
// Every asynchronous view uses these for consistent UX.
|
||||
import Icon from './Icon';
|
||||
|
||||
export function Loading({ label = 'Loading…' }) {
|
||||
return (
|
||||
<div className="state" role="status" aria-live="polite">
|
||||
<div className="spinner" />
|
||||
<p className="mt-16 muted">{label}</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function EmptyState({ title = 'Nothing here yet', message = '', icon = 'inbox', children }) {
|
||||
return (
|
||||
<div className="state">
|
||||
<Icon name={icon} size={28} />
|
||||
<p className="state__title">{title}</p>
|
||||
{message && <p className="muted">{message}</p>}
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function ErrorState({ message = 'Something went wrong.', onRetry }) {
|
||||
return (
|
||||
<div className="state" role="alert">
|
||||
<Icon name="refresh" size={28} />
|
||||
<p className="state__title">We hit a problem</p>
|
||||
<p className="muted">{message}</p>
|
||||
{onRetry && (
|
||||
<button type="button" className="btn mt-16" onClick={onRetry}>
|
||||
<Icon name="refresh" size={14} /> Try again
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
// Reusable Cloudflare Turnstile widget. Loads the CF script on demand,
|
||||
// renders the widget, and reports the token up via onToken. Exposes a
|
||||
// reset() through a ref so forms can re-challenge after a failure.
|
||||
import { useEffect, useRef, forwardRef, useImperativeHandle } from 'react';
|
||||
|
||||
const SITE_KEY = process.env.REACT_APP_TURNSTILE_SITE_KEY;
|
||||
const SCRIPT_SRC = 'https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit';
|
||||
|
||||
let scriptPromise = null;
|
||||
function loadTurnstileScript() {
|
||||
if (window.turnstile) return Promise.resolve();
|
||||
if (scriptPromise) return scriptPromise;
|
||||
scriptPromise = new Promise((resolve, reject) => {
|
||||
const s = document.createElement('script');
|
||||
s.src = SCRIPT_SRC;
|
||||
s.async = true;
|
||||
s.defer = true;
|
||||
s.onload = () => resolve();
|
||||
s.onerror = () => reject(new Error('Failed to load CAPTCHA.'));
|
||||
document.head.appendChild(s);
|
||||
});
|
||||
return scriptPromise;
|
||||
}
|
||||
|
||||
const Turnstile = forwardRef(function Turnstile({ onToken }, ref) {
|
||||
const containerRef = useRef(null);
|
||||
const widgetId = useRef(null);
|
||||
|
||||
useImperativeHandle(ref, () => ({
|
||||
reset() {
|
||||
if (widgetId.current !== null && window.turnstile) {
|
||||
window.turnstile.reset(widgetId.current);
|
||||
onToken?.('');
|
||||
}
|
||||
},
|
||||
}));
|
||||
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
loadTurnstileScript()
|
||||
.then(() => {
|
||||
if (cancelled || !containerRef.current || widgetId.current !== null) return;
|
||||
widgetId.current = window.turnstile.render(containerRef.current, {
|
||||
sitekey: SITE_KEY,
|
||||
callback: (token) => onToken?.(token),
|
||||
'expired-callback': () => onToken?.(''),
|
||||
'error-callback': () => onToken?.(''),
|
||||
});
|
||||
})
|
||||
.catch(() => {/* surfaced via missing token on submit */});
|
||||
return () => {
|
||||
cancelled = true;
|
||||
if (widgetId.current !== null && window.turnstile) {
|
||||
window.turnstile.remove(widgetId.current);
|
||||
widgetId.current = null;
|
||||
}
|
||||
};
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
return <div ref={containerRef} className="mt-8" />;
|
||||
});
|
||||
|
||||
export default Turnstile;
|
||||
+437
@@ -0,0 +1,437 @@
|
||||
/* ============================================================
|
||||
AI-Solutions — Design System (v2, modern professional)
|
||||
Warm cream surfaces + a single orange accent. Clean, spacious,
|
||||
image-led marketing look. Inter throughout, mono for small
|
||||
technical accents only.
|
||||
============================================================ */
|
||||
|
||||
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;600&display=swap');
|
||||
|
||||
:root {
|
||||
/* Surfaces (warm) */
|
||||
--bg: #f7f3ee;
|
||||
--bg-soft: #efe8df;
|
||||
--card: #ffffff;
|
||||
--border: #e7ddd0;
|
||||
--border-soft: #f0e8dd;
|
||||
--ink: #211a13;
|
||||
--ink-dim: #6c6052;
|
||||
|
||||
/* Accent (single warm orange hue) */
|
||||
--accent: #e8590c;
|
||||
--accent-hover: #cf4e06;
|
||||
--accent-soft: #fdeadb;
|
||||
--accent-2: #f59e0b; /* amber — used only in gradients */
|
||||
|
||||
/* Dark surface */
|
||||
--dark: #1c1610;
|
||||
--dark-2: #241d15;
|
||||
--dark-panel: #2c2319;
|
||||
--dark-border: #463829;
|
||||
--dark-accent: #ff9e57;
|
||||
--dark-fg: #f4ede4;
|
||||
--dark-dim: #b9a892;
|
||||
|
||||
/* Status */
|
||||
--danger: #c94a4a;
|
||||
--danger-soft: #fbeaea;
|
||||
--success: #2f8f5b;
|
||||
--success-soft: #e6f4ec;
|
||||
--warn: #b8761f;
|
||||
|
||||
/* Radii — larger, modern */
|
||||
--r-chip: 999px;
|
||||
--r-sm: 10px;
|
||||
--r-card: 18px;
|
||||
--r-panel: 26px;
|
||||
|
||||
--font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
|
||||
--font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', monospace;
|
||||
|
||||
--t: 0.18s cubic-bezier(.4,0,.2,1);
|
||||
|
||||
--shadow-xs: 0 1px 2px rgba(33, 26, 19, 0.06);
|
||||
--shadow-sm: 0 2px 8px rgba(33, 26, 19, 0.06);
|
||||
--shadow-md: 0 12px 28px rgba(33, 26, 19, 0.08);
|
||||
--shadow-lg: 0 24px 60px rgba(33, 26, 19, 0.12);
|
||||
--shadow-accent: 0 12px 30px rgba(232, 89, 12, 0.28);
|
||||
|
||||
--grad-accent: linear-gradient(120deg, #f97a2b 0%, #e8590c 55%, #d24a05 100%);
|
||||
--grad-warm: radial-gradient(900px 500px at 85% -5%, rgba(245,158,11,.18), transparent 60%),
|
||||
radial-gradient(700px 500px at 5% 0%, rgba(232,89,12,.10), transparent 55%);
|
||||
}
|
||||
|
||||
/* ---- Reset & base ---- */
|
||||
*, *::before, *::after { box-sizing: border-box; }
|
||||
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
|
||||
body {
|
||||
margin: 0;
|
||||
background: var(--bg);
|
||||
color: var(--ink);
|
||||
font-family: var(--font-sans);
|
||||
font-size: 16px;
|
||||
line-height: 1.6;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
h1, h2, h3, h4, p { margin: 0; }
|
||||
h1, h2, h3, h4 { line-height: 1.15; letter-spacing: -0.02em; font-weight: 800; }
|
||||
a { color: var(--accent); text-decoration: none; }
|
||||
a:hover { color: var(--accent-hover); }
|
||||
img { max-width: 100%; display: block; }
|
||||
button { font-family: inherit; }
|
||||
|
||||
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
|
||||
|
||||
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
|
||||
.skip-link { position: absolute; left: 16px; top: -52px; z-index: 200; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; transition: top var(--t); }
|
||||
.skip-link:focus { top: 16px; }
|
||||
|
||||
::-webkit-scrollbar { width: 10px; height: 10px; }
|
||||
::-webkit-scrollbar-thumb { background: #d9ccba; border-radius: 6px; border: 2px solid var(--bg); }
|
||||
::-webkit-scrollbar-thumb:hover { background: #c3b29a; }
|
||||
|
||||
/* ---- Layout ---- */
|
||||
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 40px; }
|
||||
.section { padding: 80px 0; }
|
||||
.section--tight { padding: 56px 0; }
|
||||
.section--tint { background: var(--bg-soft); }
|
||||
.section--last { padding-bottom: 96px; }
|
||||
|
||||
.section-head { max-width: 760px; margin: 0 auto 48px; text-align: center; }
|
||||
.section-head--left { margin-left: 0; text-align: left; }
|
||||
.section-head h2 { font-size: clamp(28px, 3.4vw, 40px); }
|
||||
.section-head p { color: var(--ink-dim); margin-top: 16px; font-size: 18px; }
|
||||
|
||||
.eyebrow {
|
||||
display: inline-flex; align-items: center; gap: 8px;
|
||||
font-size: 13px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
|
||||
color: var(--accent); margin-bottom: 16px;
|
||||
}
|
||||
.eyebrow::before { content: ''; width: 22px; height: 2px; background: var(--accent); border-radius: 2px; }
|
||||
.section-head:not(.section-head--left) .eyebrow { justify-content: center; }
|
||||
.eyebrow--on-dark { color: var(--dark-accent); }
|
||||
.eyebrow--on-dark::before { background: var(--dark-accent); }
|
||||
|
||||
.grid { display: grid; gap: 24px; }
|
||||
.grid--2 { grid-template-columns: repeat(2, 1fr); }
|
||||
.grid--3 { grid-template-columns: repeat(3, 1fr); }
|
||||
.grid--4 { grid-template-columns: repeat(4, 1fr); }
|
||||
|
||||
/* ---- Brand ---- */
|
||||
.brand { display: inline-flex; align-items: center; gap: 11px; flex: none; }
|
||||
.brand__mark {
|
||||
width: 34px; height: 34px; border-radius: 11px; background: var(--grad-accent);
|
||||
color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 14px;
|
||||
letter-spacing: -0.5px; flex: none; box-shadow: var(--shadow-accent);
|
||||
}
|
||||
.brand__word { font-weight: 800; font-size: 18px; letter-spacing: -0.02em; color: var(--ink); white-space: nowrap; }
|
||||
.brand__word b { color: var(--accent); }
|
||||
.tag { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); padding: 3px 9px; border-radius: 999px; }
|
||||
|
||||
/* ---- Navbar ---- */
|
||||
.nav { position: sticky; top: 0; z-index: 100; background: rgba(247,243,238,.8); backdrop-filter: saturate(160%) blur(12px); border-bottom: 1px solid var(--border); }
|
||||
.nav__inner { display: flex; align-items: center; justify-content: space-between; height: 72px; gap: 18px; }
|
||||
.nav__links { display: flex; align-items: center; gap: 2px; }
|
||||
.nav__link { font-size: 14.5px; font-weight: 600; color: var(--ink-dim); padding: 8px 11px; border-radius: 10px; white-space: nowrap; transition: color var(--t), background var(--t); }
|
||||
.nav__link:hover { color: var(--ink); background: var(--bg-soft); }
|
||||
.nav__link.is-active { color: var(--accent); background: var(--accent-soft); }
|
||||
.nav__link--mobile { display: none; }
|
||||
.nav__actions { display: flex; align-items: center; gap: 8px; flex: none; }
|
||||
.nav__admin { font-size: 14.5px; font-weight: 600; color: var(--ink-dim); padding: 9px 12px; border-radius: 10px; white-space: nowrap; }
|
||||
.nav__admin:hover { color: var(--ink); background: var(--bg-soft); }
|
||||
.nav__toggle { display: none; background: none; border: 1px solid var(--border); border-radius: 12px; width: 44px; height: 44px; cursor: pointer; color: var(--ink); align-items: center; justify-content: center; }
|
||||
|
||||
/* ---- Buttons ---- */
|
||||
.btn {
|
||||
font-size: 15px; font-weight: 700; letter-spacing: -0.01em;
|
||||
display: inline-flex; align-items: center; justify-content: center; gap: 8px;
|
||||
padding: 12px 20px; border-radius: 12px; cursor: pointer; white-space: nowrap;
|
||||
background: var(--card); color: var(--ink); border: 1px solid var(--border);
|
||||
transition: transform var(--t), box-shadow var(--t), background var(--t), border-color var(--t), color var(--t);
|
||||
box-shadow: var(--shadow-xs);
|
||||
}
|
||||
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); color: var(--ink); }
|
||||
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
|
||||
.btn--primary { background: var(--grad-accent); color: #fff; border-color: transparent; box-shadow: var(--shadow-accent); }
|
||||
.btn--primary:hover { color: #fff; box-shadow: 0 16px 36px rgba(232,89,12,.36); }
|
||||
.btn--ghost { background: transparent; box-shadow: none; border-color: transparent; }
|
||||
.btn--ghost:hover { background: var(--bg-soft); box-shadow: none; }
|
||||
.btn--dark { background: rgba(255,255,255,.08); color: var(--dark-fg); border-color: var(--dark-border); box-shadow: none; }
|
||||
.btn--dark:hover { color: #fff; background: rgba(255,255,255,.16); border-color: var(--dark-accent); }
|
||||
.btn--white { background: #fff; color: var(--accent); border-color: transparent; }
|
||||
.btn--big { padding: 15px 26px; font-size: 16px; border-radius: 14px; }
|
||||
.btn--block { width: 100%; }
|
||||
|
||||
/* ---- Cards ---- */
|
||||
.card { position: relative; background: var(--card); border: 1px solid var(--border); border-radius: var(--r-card); padding: 28px; transition: transform var(--t), box-shadow var(--t), border-color var(--t); box-shadow: var(--shadow-xs); }
|
||||
.card--hover:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: #ecd9c5; }
|
||||
.card--rule::before { content: ''; position: absolute; left: 0; top: 22px; bottom: 22px; width: 4px; border-radius: 4px; background: var(--grad-accent); }
|
||||
.card--rule { padding-left: 32px; }
|
||||
|
||||
.icon-badge, .card__icon { width: 52px; height: 52px; border-radius: 15px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin-bottom: 18px; }
|
||||
.card__title { font-size: 20px; font-weight: 700; margin-bottom: 9px; letter-spacing: -0.02em; }
|
||||
.card__text { color: var(--ink-dim); font-size: 15.5px; }
|
||||
|
||||
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
|
||||
.chip { font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--accent); background: var(--accent-soft); padding: 5px 11px; border-radius: 999px; }
|
||||
.chip--muted { color: var(--ink-dim); background: var(--bg-soft); }
|
||||
|
||||
/* ---- Hero ---- */
|
||||
.hero { position: relative; padding: 64px 0 24px; background: var(--grad-warm); }
|
||||
.hero__grid { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 48px; align-items: center; }
|
||||
.hero__pill { display: inline-flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--border); padding: 7px 14px 7px 8px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--ink-dim); box-shadow: var(--shadow-xs); margin-bottom: 22px; }
|
||||
.hero__pill b { background: var(--accent-soft); color: var(--accent); padding: 3px 9px; border-radius: 999px; font-size: 12px; }
|
||||
.hero h1 { font-size: clamp(38px, 5.2vw, 60px); letter-spacing: -0.03em; }
|
||||
.hero h1 .accent { background: var(--grad-accent); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
|
||||
.hero__lead { font-size: 19px; color: var(--ink-dim); max-width: 56ch; margin: 22px 0 28px; }
|
||||
.hero__actions { display: flex; flex-wrap: wrap; gap: 14px; }
|
||||
.hero__proof { display: flex; align-items: center; gap: 14px; margin-top: 30px; color: var(--ink-dim); font-size: 14px; }
|
||||
.hero__avatars { display: flex; }
|
||||
.hero__avatars span { width: 34px; height: 34px; border-radius: 999px; border: 2px solid var(--bg); background: var(--grad-accent); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; margin-left: -10px; }
|
||||
.hero__avatars span:first-child { margin-left: 0; }
|
||||
|
||||
.hero__media { position: relative; }
|
||||
.hero__media img { width: 100%; border-radius: var(--r-panel); box-shadow: var(--shadow-lg); aspect-ratio: 5/5.4; object-fit: cover; }
|
||||
.hero__float { position: absolute; background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow-md); display: flex; align-items: center; gap: 12px; }
|
||||
.hero__float--tl { top: 22px; left: -22px; }
|
||||
.hero__float--br { bottom: 22px; right: -22px; }
|
||||
.hero__float .icon-badge { width: 40px; height: 40px; margin: 0; border-radius: 12px; }
|
||||
.hero__float b { display: block; font-size: 15px; }
|
||||
.hero__float small { color: var(--ink-dim); font-size: 12.5px; }
|
||||
|
||||
/* logo / trust strip */
|
||||
.logo-strip { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 14px 36px; padding: 28px 0; }
|
||||
.logo-strip__label { width: 100%; text-align: center; font-size: 13px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-dim); margin-bottom: 4px; }
|
||||
.logo-strip__item { font-size: 18px; font-weight: 800; letter-spacing: -.02em; color: #b6a892; transition: color var(--t); }
|
||||
.logo-strip__item:hover { color: var(--ink); }
|
||||
|
||||
/* ---- Stats band ---- */
|
||||
.stats-band { background: var(--dark); background-image: var(--grad-warm); border-radius: var(--r-panel); padding: 44px; color: var(--dark-fg); display: grid; grid-template-columns: repeat(4,1fr); gap: 24px; box-shadow: var(--shadow-lg); }
|
||||
.stats-band__item { text-align: center; }
|
||||
.stats-band__num { font-size: clamp(30px, 4vw, 44px); font-weight: 800; letter-spacing: -.03em; background: linear-gradient(120deg,#ffb774,#ff7a2b); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
|
||||
.stats-band__label { color: var(--dark-dim); font-size: 14px; margin-top: 6px; }
|
||||
|
||||
.stat { display: flex; flex-direction: column; gap: 2px; }
|
||||
.stat__num { font-size: 30px; font-weight: 800; color: var(--accent); letter-spacing: -.02em; }
|
||||
.stat__label { font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-dim); }
|
||||
|
||||
/* ---- Feature / showcase rows ---- */
|
||||
.showcase { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: center; }
|
||||
.showcase--reverse .showcase__media { order: 2; }
|
||||
.showcase__media img, .showcase__media > div { width: 100%; border-radius: var(--r-panel); box-shadow: var(--shadow-lg); aspect-ratio: 4/3; object-fit: cover; }
|
||||
.showcase__list { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 14px; }
|
||||
.showcase__list li { display: flex; gap: 12px; align-items: flex-start; color: var(--ink); font-size: 16px; }
|
||||
.showcase__list li .tick { flex: none; width: 24px; height: 24px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin-top: 1px; }
|
||||
|
||||
/* ---- Testimonials ---- */
|
||||
.testimonial { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-card); padding: 28px; box-shadow: var(--shadow-xs); height: 100%; }
|
||||
.testimonial__quote { font-size: 16.5px; color: var(--ink); margin: 16px 0 20px; }
|
||||
.testimonial__who { display: flex; align-items: center; gap: 12px; }
|
||||
.avatar { width: 44px; height: 44px; border-radius: 999px; background: var(--grad-accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 15px; flex: none; }
|
||||
.testimonial__name { font-weight: 700; font-size: 15px; }
|
||||
.testimonial__role { color: var(--ink-dim); font-size: 13px; }
|
||||
|
||||
/* ---- CTA band ---- */
|
||||
.cta-band { position: relative; overflow: hidden; background: var(--grad-accent); border-radius: var(--r-panel); padding: 56px; color: #fff; text-align: center; box-shadow: var(--shadow-accent); }
|
||||
.cta-band::after { content: ''; position: absolute; inset: 0; background: radial-gradient(600px 300px at 80% -20%, rgba(255,255,255,.25), transparent 60%); pointer-events: none; }
|
||||
.cta-band h2 { font-size: clamp(26px, 3.4vw, 38px); color: #fff; position: relative; }
|
||||
.cta-band p { color: rgba(255,255,255,.92); font-size: 18px; margin: 14px 0 26px; position: relative; }
|
||||
.cta-band .btn { position: relative; }
|
||||
|
||||
/* ---- Page header ---- */
|
||||
.page-head { padding: 64px 0 8px; background: var(--grad-warm); text-align: center; }
|
||||
.page-head .container { max-width: 820px; }
|
||||
.page-head h1 { font-size: clamp(34px, 4.6vw, 52px); letter-spacing: -.03em; }
|
||||
.page-head p { color: var(--ink-dim); font-size: 19px; margin: 18px auto 0; }
|
||||
|
||||
/* media object (case studies / events / articles) */
|
||||
.media-card { overflow: hidden; padding: 0; }
|
||||
.media-card__img { aspect-ratio: 16/10; object-fit: cover; width: 100%; }
|
||||
.media-card__body { padding: 24px 26px 28px; }
|
||||
|
||||
/* ---- Forms ---- */
|
||||
.field { margin-bottom: 20px; }
|
||||
.field__label { display: block; font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 8px; }
|
||||
.field__req { color: var(--accent); }
|
||||
.input, .textarea, .select {
|
||||
width: 100%; font-family: inherit; font-size: 16px; color: var(--ink);
|
||||
background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 13px 15px;
|
||||
transition: border-color var(--t), box-shadow var(--t);
|
||||
}
|
||||
.input::placeholder, .textarea::placeholder { color: #b3a795; }
|
||||
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
|
||||
.input--error, .textarea--error { border-color: var(--danger); }
|
||||
.textarea { resize: vertical; min-height: 130px; line-height: 1.55; }
|
||||
.field__error { display: block; color: var(--danger); font-size: 13px; margin-top: 7px; }
|
||||
.field__hint { display: block; color: var(--ink-dim); font-size: 13px; margin-top: 7px; }
|
||||
.password-wrap { position: relative; }
|
||||
.password-wrap .input { padding-right: 48px; }
|
||||
.password-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: var(--ink-dim); width: 36px; height: 36px; display: grid; place-items: center; border-radius: 8px; }
|
||||
.password-toggle:hover { color: var(--accent); }
|
||||
|
||||
.notice { border-radius: 12px; padding: 13px 16px; font-size: 14.5px; margin-bottom: 18px; border: 1px solid transparent; }
|
||||
.notice--error { background: var(--danger-soft); color: #8f2f2f; border-color: #eccdcd; }
|
||||
.notice--success { background: var(--success-soft); color: #1f6b43; border-color: #c7e6d4; }
|
||||
.notice--info { background: var(--accent-soft); color: #9a3d06; border-color: #f6cba3; }
|
||||
|
||||
/* ---- Footer ---- */
|
||||
.footer { margin-top: 0; background: var(--dark); color: var(--dark-dim); }
|
||||
.footer__inner { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 40px; padding: 64px 0 40px; }
|
||||
.footer__col h4 { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--dark-fg); margin-bottom: 16px; }
|
||||
.footer__col a { display: block; color: var(--dark-dim); font-size: 15px; padding: 5px 0; }
|
||||
.footer__col a:hover { color: var(--dark-accent); }
|
||||
.footer .brand__word { color: var(--dark-fg); }
|
||||
.footer__bottom { border-top: 1px solid var(--dark-border); padding: 20px 0; text-align: center; font-size: 14px; color: var(--dark-dim); }
|
||||
|
||||
/* ---- Modal ---- */
|
||||
.modal-overlay { position: fixed; inset: 0; z-index: 300; background: rgba(28,22,16,.6); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 20px; animation: fadeIn .2s ease; }
|
||||
.modal { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-panel); width: 100%; max-width: 660px; max-height: 86vh; overflow: auto; box-shadow: var(--shadow-lg); animation: slideUp .24s ease; }
|
||||
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: 22px 26px; border-bottom: 1px solid var(--border-soft); position: sticky; top: 0; background: var(--card); }
|
||||
.modal__title { font-size: 20px; font-weight: 700; }
|
||||
.modal__close { background: none; border: 1px solid var(--border); border-radius: 10px; width: 38px; height: 38px; cursor: pointer; color: var(--ink-dim); display: grid; place-items: center; }
|
||||
.modal__close:hover { color: var(--accent); border-color: var(--accent); }
|
||||
.modal__body { padding: 26px; }
|
||||
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
|
||||
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
|
||||
|
||||
/* ---- Stars ---- */
|
||||
.stars { display: inline-flex; gap: 2px; color: var(--accent); }
|
||||
.stars svg { width: 18px; height: 18px; }
|
||||
.stars .star--empty { color: #e0d4c4; }
|
||||
|
||||
/* ---- States ---- */
|
||||
.state { text-align: center; padding: 72px 24px; color: var(--ink-dim); }
|
||||
.state__title { font-size: 18px; font-weight: 700; color: var(--ink); margin: 14px 0 6px; }
|
||||
.spinner { width: 30px; height: 30px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; margin: 0 auto; }
|
||||
.spinner--sm { width: 17px; height: 17px; border-width: 2px; margin: 0; }
|
||||
@keyframes spin { to { transform: rotate(360deg); } }
|
||||
.skeleton { background: linear-gradient(90deg, var(--bg-soft) 25%, #f4ece1 37%, var(--bg-soft) 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: 14px; }
|
||||
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
|
||||
|
||||
/* ---- Gallery ---- */
|
||||
.gallery { columns: 3; column-gap: 20px; }
|
||||
.gallery__item { break-inside: avoid; margin-bottom: 20px; border-radius: var(--r-card); overflow: hidden; border: 1px solid var(--border); background: var(--card); box-shadow: var(--shadow-xs); transition: box-shadow var(--t), transform var(--t); }
|
||||
.gallery__item:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }
|
||||
.gallery__item img { width: 100%; transition: transform .4s ease; }
|
||||
.gallery__item:hover img { transform: scale(1.05); }
|
||||
.gallery__cap { padding: 12px 14px; font-size: 13.5px; color: var(--ink-dim); }
|
||||
|
||||
/* ---- Chatbot ---- */
|
||||
.chat-fab { position: fixed; right: 24px; bottom: 24px; z-index: 250; width: 60px; height: 60px; border-radius: 999px; cursor: pointer; background: var(--grad-accent); color: #fff; border: none; display: grid; place-items: center; box-shadow: var(--shadow-accent); transition: transform var(--t); }
|
||||
.chat-fab:hover { transform: scale(1.08) translateY(-2px); }
|
||||
.chat-panel { position: fixed; right: 24px; bottom: 24px; z-index: 251; width: 372px; max-width: calc(100vw - 32px); height: 540px; max-height: calc(100vh - 48px); background: var(--card); border: 1px solid var(--border); border-radius: var(--r-panel); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden; animation: slideUp .2s ease; }
|
||||
.chat-head { background: var(--dark); background-image: var(--grad-warm); color: var(--dark-fg); padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
|
||||
.chat-head__title { display: flex; align-items: center; gap: 11px; }
|
||||
.chat-head__title b { font-size: 15px; }
|
||||
.chat-head__title small { color: var(--dark-dim); font-size: 11px; letter-spacing: .06em; }
|
||||
.chat-head__avatar { width: 36px; height: 36px; border-radius: 999px; background: var(--grad-accent); display: grid; place-items: center; color: #fff; }
|
||||
.chat-head .modal__close { color: var(--dark-dim); border-color: var(--dark-border); }
|
||||
.chat-head .modal__close:hover { color: #fff; }
|
||||
.chat-body { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; background: var(--bg); }
|
||||
.msg { max-width: 84%; padding: 11px 14px; border-radius: 16px; font-size: 14.5px; line-height: 1.5; white-space: pre-wrap; }
|
||||
.msg--bot { background: var(--card); border: 1px solid var(--border); border-bottom-left-radius: 5px; align-self: flex-start; }
|
||||
.msg--user { background: var(--grad-accent); color: #fff; border-bottom-right-radius: 5px; align-self: flex-end; }
|
||||
.msg--escalate { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
|
||||
.chat-typing { display: inline-flex; gap: 4px; align-items: center; }
|
||||
.chat-typing span { width: 7px; height: 7px; border-radius: 999px; background: var(--ink-dim); animation: blink 1s infinite; }
|
||||
.chat-typing span:nth-child(2) { animation-delay: .2s; } .chat-typing span:nth-child(3) { animation-delay: .4s; }
|
||||
@keyframes blink { 0%,80%,100% { opacity: .3; } 40% { opacity: 1; } }
|
||||
.chat-foot { border-top: 1px solid var(--border); padding: 12px; display: flex; gap: 8px; background: var(--card); }
|
||||
.chat-foot .input { padding: 10px 13px; border-radius: 12px; }
|
||||
|
||||
/* ---- Admin back-office ---- */
|
||||
.admin { min-height: 100vh; display: grid; grid-template-columns: 256px 1fr; background: var(--bg); }
|
||||
.admin__side { background: var(--dark); color: var(--dark-fg); padding: 24px 18px; display: flex; flex-direction: column; }
|
||||
.admin__brand { display: flex; align-items: center; gap: 11px; margin-bottom: 30px; }
|
||||
.admin__brand .brand__word { color: var(--dark-fg); }
|
||||
.admin__navlink { display: flex; align-items: center; gap: 11px; padding: 11px 13px; border-radius: 12px; color: var(--dark-dim); font-size: 14px; font-weight: 600; cursor: pointer; border: none; background: none; width: 100%; text-align: left; transition: background var(--t), color var(--t); }
|
||||
.admin__navlink:hover { background: var(--dark-panel); color: var(--dark-fg); }
|
||||
.admin__navlink.is-active { background: var(--grad-accent); color: #fff; }
|
||||
.admin__spacer { flex: 1; }
|
||||
.admin__main { padding: 32px 36px; overflow-x: auto; }
|
||||
.admin__topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
|
||||
.admin__title h1 { font-size: 26px; }
|
||||
.admin__title p { color: var(--ink-dim); font-size: 15px; margin-top: 4px; }
|
||||
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-card); padding: 22px; box-shadow: var(--shadow-xs); }
|
||||
.stat-card .stat__num { font-size: 36px; }
|
||||
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 18px; }
|
||||
.toolbar .input, .toolbar .select { width: auto; min-width: 190px; }
|
||||
.toolbar__grow { flex: 1; }
|
||||
|
||||
.table-wrap { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-card); overflow: hidden; box-shadow: var(--shadow-xs); }
|
||||
table.data { width: 100%; border-collapse: collapse; font-size: 15px; }
|
||||
table.data th { text-align: left; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-dim); padding: 16px 18px; border-bottom: 1px solid var(--border); background: var(--bg-soft); }
|
||||
table.data td { padding: 16px 18px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
|
||||
table.data tr:last-child td { border-bottom: none; }
|
||||
table.data tbody tr { cursor: pointer; transition: background var(--t); }
|
||||
table.data tbody tr:hover { background: var(--bg-soft); }
|
||||
.row-unread td:first-child { box-shadow: inset 4px 0 0 var(--accent); }
|
||||
.badge { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 4px 9px; border-radius: 999px; }
|
||||
.badge--new { background: var(--accent-soft); color: var(--accent); }
|
||||
.badge--read { background: var(--bg-soft); color: var(--ink-dim); }
|
||||
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
|
||||
.pagination__info { font-size: 13.5px; color: var(--ink-dim); }
|
||||
.dl { display: grid; grid-template-columns: 160px 1fr; gap: 0; }
|
||||
.dl dt { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-dim); padding: 13px 0; border-bottom: 1px solid var(--border-soft); }
|
||||
.dl dd { padding: 13px 0; margin: 0; border-bottom: 1px solid var(--border-soft); word-break: break-word; }
|
||||
|
||||
/* ---- Auth card ---- */
|
||||
.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); background-image: var(--grad-warm); }
|
||||
.auth-card { width: 100%; max-width: 440px; background: var(--card); border: 1px solid var(--border); border-radius: var(--r-panel); padding: 38px; box-shadow: var(--shadow-lg); }
|
||||
.auth-card__head { text-align: center; margin-bottom: 26px; }
|
||||
.auth-card__head .brand { justify-content: center; margin-bottom: 18px; }
|
||||
.auth-card__head h1 { font-size: 24px; }
|
||||
.auth-card__head p { color: var(--ink-dim); font-size: 15px; margin-top: 8px; }
|
||||
.auth-card__foot { text-align: center; margin-top: 20px; font-size: 14px; color: var(--ink-dim); }
|
||||
|
||||
/* ---- utilities ---- */
|
||||
.text-center { text-align: center; }
|
||||
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; }
|
||||
.muted { color: var(--ink-dim); }
|
||||
.mono { font-family: var(--font-mono); }
|
||||
.flex { display: flex; } .between { justify-content: space-between; } .items-center { align-items: center; }
|
||||
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .wrap { flex-wrap: wrap; }
|
||||
|
||||
/* ---- Responsive ---- */
|
||||
@media (max-width: 1000px) {
|
||||
.grid--4 { grid-template-columns: repeat(2,1fr); }
|
||||
.grid--3 { grid-template-columns: repeat(2,1fr); }
|
||||
.hero__grid { grid-template-columns: 1fr; gap: 36px; }
|
||||
.hero__media { max-width: 460px; }
|
||||
.hero__float--tl { left: 0; } .hero__float--br { right: 0; }
|
||||
.showcase { grid-template-columns: 1fr; gap: 32px; }
|
||||
.showcase--reverse .showcase__media { order: 0; }
|
||||
.stats-band { grid-template-columns: repeat(2,1fr); padding: 32px; }
|
||||
.footer__inner { grid-template-columns: 1fr 1fr; }
|
||||
.gallery { columns: 2; }
|
||||
.admin { grid-template-columns: 1fr; }
|
||||
.admin__side { flex-direction: row; align-items: center; gap: 6px; overflow-x: auto; padding: 12px 16px; }
|
||||
.admin__brand { margin-bottom: 0; margin-right: 8px; } .admin__navlink { width: auto; white-space: nowrap; } .admin__spacer { display: none; }
|
||||
}
|
||||
/* Collapse the nav into a menu on laptops/tablets so links never overflow */
|
||||
@media (max-width: 900px) {
|
||||
.nav__links { display: none; }
|
||||
.nav__links.is-open {
|
||||
display: flex; flex-direction: column; align-items: stretch;
|
||||
position: absolute; top: 72px; left: 0; right: 0; background: var(--bg);
|
||||
border-bottom: 1px solid var(--border); padding: 14px 20px; gap: 4px; box-shadow: var(--shadow-md);
|
||||
}
|
||||
.nav__link { font-size: 15.5px; padding: 11px 12px; }
|
||||
.nav__link--mobile { display: block; }
|
||||
.nav__admin { display: none; }
|
||||
.nav__toggle { display: inline-flex; }
|
||||
}
|
||||
|
||||
@media (max-width: 680px) {
|
||||
.container { padding: 0 20px; }
|
||||
.section { padding: 56px 0; }
|
||||
.grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
|
||||
.stats-band { grid-template-columns: 1fr 1fr; }
|
||||
.footer__inner { grid-template-columns: 1fr 1fr; }
|
||||
.dl { grid-template-columns: 1fr; } .dl dt { padding-bottom: 0; border-bottom: none; } .dl dd { padding-top: 4px; }
|
||||
.gallery { columns: 1; }
|
||||
.cta-band, .stats-band { padding: 32px 24px; }
|
||||
.hero__float { display: none; }
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; } }
|
||||
@@ -0,0 +1,17 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom/client';
|
||||
import './index.css';
|
||||
import App from './App';
|
||||
import reportWebVitals from './reportWebVitals';
|
||||
|
||||
const root = ReactDOM.createRoot(document.getElementById('root'));
|
||||
root.render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>
|
||||
);
|
||||
|
||||
// If you want to start measuring performance in your app, pass a function
|
||||
// to log results (for example: reportWebVitals(console.log))
|
||||
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
||||
reportWebVitals();
|
||||
@@ -0,0 +1,23 @@
|
||||
// Curated imagery for the marketing pages. Uses the Unsplash CDN
|
||||
// (stable photo IDs). Every <SmartImage> falls back to a branded
|
||||
// placeholder if a URL fails, so the layout never breaks.
|
||||
const U = (id, w = 900) => `https://images.unsplash.com/photo-${id}?auto=format&fit=crop&w=${w}&q=80`;
|
||||
|
||||
export const IMAGES = {
|
||||
heroTeam: U('1522071820081-009f0129c71c', 1100), // team collaborating
|
||||
showcaseAssistant: U('1485827404703-89b55fcc595e', 1000), // AI / robot
|
||||
showcasePrototype: U('1542744173-8e7e53415bb0', 1000), // planning / whiteboard
|
||||
};
|
||||
|
||||
// Map a solution's `icon` key to a themed image.
|
||||
const SERVICE_IMAGES = {
|
||||
robot: U('1485827404703-89b55fcc595e'), // AI / robot
|
||||
bolt: U('1517180102446-f3ece451e9d8'), // fast / tech
|
||||
code: U('1461749280684-dccba630e2f6'), // code on screen
|
||||
chart: U('1551288049-bebda4e38f71'), // analytics dashboard
|
||||
};
|
||||
const SERVICE_FALLBACK = U('1498050108023-c5249f4df085'); // workspace / code
|
||||
|
||||
export function serviceImage(icon) {
|
||||
return SERVICE_IMAGES[icon] || SERVICE_FALLBACK;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// Tiny data-fetching hook → { data, loading, error, reload }.
|
||||
// Wraps the shared getJSON helper so every page gets consistent
|
||||
// loading / error / empty handling.
|
||||
import { useState, useEffect, useCallback } from 'react';
|
||||
import { getJSON } from '../api';
|
||||
|
||||
export default function useFetch(path) {
|
||||
const [data, setData] = useState(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState('');
|
||||
|
||||
const load = useCallback(() => {
|
||||
let active = true;
|
||||
setLoading(true);
|
||||
setError('');
|
||||
getJSON(path)
|
||||
.then((d) => { if (active) setData(d); })
|
||||
.catch((e) => { if (active) setError(e.message || 'Failed to load.'); })
|
||||
.finally(() => { if (active) setLoading(false); });
|
||||
return () => { active = false; };
|
||||
}, [path]);
|
||||
|
||||
useEffect(() => load(), [load]);
|
||||
|
||||
return { data, loading, error, reload: load };
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
// ArticleDetail — a single promotional article.
|
||||
import { Link, useParams } from 'react-router-dom';
|
||||
import useFetch from '../lib/useFetch';
|
||||
import Icon from '../components/Icon';
|
||||
import SmartImage from '../components/SmartImage';
|
||||
import { Loading, ErrorState } from '../components/States';
|
||||
|
||||
function formatDate(d) {
|
||||
return d ? new Date(d).toLocaleDateString('en-GB', { day: 'numeric', month: 'long', year: 'numeric' }) : '';
|
||||
}
|
||||
|
||||
function ArticleDetail() {
|
||||
const { slug } = useParams();
|
||||
const { data, loading, error, reload } = useFetch(`/api/content/articles/${slug}`);
|
||||
const a = data?.article;
|
||||
|
||||
return (
|
||||
<article className="section section--last">
|
||||
<div className="container" style={{ maxWidth: 820 }}>
|
||||
<Link to="/articles" className="btn btn--ghost" style={{ marginBottom: 24 }}>
|
||||
<Icon name="arrow" size={15} style={{ transform: 'rotate(180deg)' }} /> All articles
|
||||
</Link>
|
||||
|
||||
{loading && <Loading label="Loading article…" />}
|
||||
{error && <ErrorState message={error} onRetry={reload} />}
|
||||
|
||||
{a && (
|
||||
<>
|
||||
<p className="eyebrow">{formatDate(a.published_at)}{a.author ? ` · ${a.author}` : ''}</p>
|
||||
<h1 style={{ fontSize: 'clamp(30px,4.4vw,46px)', letterSpacing: '-.03em' }}>{a.title}</h1>
|
||||
{a.excerpt && <p className="muted mt-16" style={{ fontSize: 19 }}>{a.excerpt}</p>}
|
||||
{a.cover_image && (
|
||||
<SmartImage src={a.cover_image} alt={a.title} icon="chat"
|
||||
style={{ width: '100%', borderRadius: 'var(--r-panel)', margin: '28px 0', boxShadow: 'var(--shadow-md)', aspectRatio: '16/8', objectFit: 'cover' }} />
|
||||
)}
|
||||
<div style={{ fontSize: 17.5, lineHeight: 1.75, color: 'var(--ink)' }}>
|
||||
{a.body.split('\n').filter(Boolean).map((para, i) => (
|
||||
<p key={i} style={{ marginBottom: 20 }}>{para}</p>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="cta-band mt-32" style={{ padding: 36 }}>
|
||||
<h2 style={{ fontSize: 26 }}>Want to know more?</h2>
|
||||
<p>Our team is happy to talk through how this applies to your organisation.</p>
|
||||
<Link to="/contact" className="btn btn--white">Contact us <Icon name="arrow" size={15} /></Link>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</article>
|
||||
);
|
||||
}
|
||||
|
||||
export default ArticleDetail;
|
||||
@@ -0,0 +1,59 @@
|
||||
// Articles — promotional articles / news about the company (CSE requirement).
|
||||
import { Link } from 'react-router-dom';
|
||||
import useFetch from '../lib/useFetch';
|
||||
import Icon from '../components/Icon';
|
||||
import SmartImage from '../components/SmartImage';
|
||||
import { Loading, ErrorState, EmptyState } from '../components/States';
|
||||
|
||||
function formatDate(d) {
|
||||
return d ? new Date(d).toLocaleDateString('en-GB', { day: 'numeric', month: 'long', year: 'numeric' }) : '';
|
||||
}
|
||||
|
||||
function Articles() {
|
||||
const { data, loading, error, reload } = useFetch('/api/content/articles');
|
||||
const articles = data?.articles || [];
|
||||
|
||||
return (
|
||||
<>
|
||||
<section className="page-head">
|
||||
<div className="container">
|
||||
<span className="eyebrow">Articles</span>
|
||||
<h1>News & insights from AI-Solutions</h1>
|
||||
<p>Ideas on AI, the digital employee experience and how we help teams innovate faster.</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="section section--last">
|
||||
<div className="container">
|
||||
{loading && <Loading label="Loading articles…" />}
|
||||
{error && <ErrorState message={error} onRetry={reload} />}
|
||||
{!loading && !error && articles.length === 0 && (
|
||||
<EmptyState title="No articles yet" message="Our latest articles will appear here." icon="chat" />
|
||||
)}
|
||||
|
||||
{!loading && !error && articles.length > 0 && (
|
||||
<div className="grid grid--3">
|
||||
{articles.map((a) => (
|
||||
<Link to={`/articles/${a.slug}`} className="card media-card card--hover" key={a.id} style={{ color: 'inherit' }}>
|
||||
<SmartImage src={a.cover_image} alt={a.title} icon="chat" className="media-card__img" />
|
||||
<div className="media-card__body">
|
||||
<p className="muted" style={{ fontSize: 13, marginBottom: 8 }}>
|
||||
{formatDate(a.published_at)}{a.author ? ` · ${a.author}` : ''}
|
||||
</p>
|
||||
<h2 className="card__title">{a.title}</h2>
|
||||
<p className="card__text">{a.excerpt}</p>
|
||||
<span className="mt-16" style={{ display: 'inline-flex', alignItems: 'center', gap: 6, color: 'var(--accent)', fontWeight: 700, fontSize: 14 }}>
|
||||
Read article <Icon name="arrow" size={14} />
|
||||
</span>
|
||||
</div>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default Articles;
|
||||
@@ -0,0 +1,144 @@
|
||||
// Contact Us — the 7-field enquiry form. No customer account required.
|
||||
// Client-side validation mirrors the server rules; submission is
|
||||
// protected by Cloudflare Turnstile and posts to /api/contact.
|
||||
import { useState, useRef } from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { postJSON } from '../api';
|
||||
import { TextField, TextArea } from '../components/Field';
|
||||
import Turnstile from '../components/Turnstile';
|
||||
import Icon from '../components/Icon';
|
||||
|
||||
const EMPTY = {
|
||||
full_name: '', email: '', phone: '', company: '',
|
||||
country: '', job_title: '', job_details: '',
|
||||
};
|
||||
|
||||
function validate(values) {
|
||||
const e = {};
|
||||
if (!values.full_name.trim()) e.full_name = 'Please enter your full name.';
|
||||
if (!values.email.trim()) e.email = 'Please enter your email address.';
|
||||
else if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(values.email.trim())) e.email = 'Please enter a valid email address.';
|
||||
if (values.phone && values.phone.length > 40) e.phone = 'Phone number is too long.';
|
||||
if (!values.job_details.trim()) e.job_details = 'Please tell us about your requirements.';
|
||||
else if (values.job_details.trim().length < 5) e.job_details = 'Please add a little more detail (5+ characters).';
|
||||
return e;
|
||||
}
|
||||
|
||||
function Contact() {
|
||||
const [values, setValues] = useState(EMPTY);
|
||||
const [errors, setErrors] = useState({});
|
||||
const [token, setToken] = useState('');
|
||||
const [status, setStatus] = useState('idle'); // idle | submitting | success
|
||||
const [serverError, setServerError] = useState('');
|
||||
const turnstileRef = useRef(null);
|
||||
|
||||
const set = (key) => (val) => {
|
||||
setValues((v) => ({ ...v, [key]: val }));
|
||||
if (errors[key]) setErrors((e) => ({ ...e, [key]: undefined }));
|
||||
};
|
||||
|
||||
const handleSubmit = async (e) => {
|
||||
e.preventDefault();
|
||||
setServerError('');
|
||||
const v = validate(values);
|
||||
setErrors(v);
|
||||
if (Object.keys(v).length > 0) return;
|
||||
|
||||
if (!token) {
|
||||
setServerError('Please complete the CAPTCHA challenge below.');
|
||||
return;
|
||||
}
|
||||
|
||||
setStatus('submitting');
|
||||
try {
|
||||
await postJSON('/api/contact', { ...values, turnstileToken: token });
|
||||
setStatus('success');
|
||||
} catch (err) {
|
||||
setStatus('idle');
|
||||
setServerError(err.message || 'Could not send your message. Please try again.');
|
||||
turnstileRef.current?.reset();
|
||||
setToken('');
|
||||
}
|
||||
};
|
||||
|
||||
if (status === 'success') {
|
||||
return (
|
||||
<section className="page-head">
|
||||
<div className="container" style={{ maxWidth: 640 }}>
|
||||
<div className="card card--rule" role="status">
|
||||
<div className="card__icon"><Icon name="check" size={20} /></div>
|
||||
<h1 style={{ fontSize: 26 }}>Thank you — your enquiry is in.</h1>
|
||||
<p className="muted mt-8">
|
||||
Our team will review your requirements and get back to you shortly. We have not created
|
||||
an account for you — there is nothing else you need to do.
|
||||
</p>
|
||||
<div className="flex gap-12 mt-24 wrap">
|
||||
<Link to="/" className="btn btn--primary">Back to home</Link>
|
||||
<button type="button" className="btn" onClick={() => { setValues(EMPTY); setToken(''); setStatus('idle'); }}>
|
||||
Send another enquiry
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<section className="page-head">
|
||||
<div className="container">
|
||||
<span className="eyebrow">Contact Us</span>
|
||||
<h1>Tell us about your project</h1>
|
||||
<p>
|
||||
Share your requirements and our team will be in touch. No account or password needed —
|
||||
just the details below.
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="section section--last">
|
||||
<div className="container" style={{ maxWidth: 720 }}>
|
||||
<form className="card" onSubmit={handleSubmit} noValidate>
|
||||
{serverError && <div className="notice notice--error" role="alert">{serverError}</div>}
|
||||
|
||||
<div className="grid grid--2" style={{ gap: '0 20px' }}>
|
||||
<TextField label="Full Name" required value={values.full_name} onChange={set('full_name')}
|
||||
error={errors.full_name} autoComplete="name" />
|
||||
<TextField label="Email Address" required type="email" value={values.email} onChange={set('email')}
|
||||
error={errors.email} autoComplete="email" />
|
||||
<TextField label="Phone Number" type="tel" value={values.phone} onChange={set('phone')}
|
||||
error={errors.phone} autoComplete="tel" />
|
||||
<TextField label="Company Name" value={values.company} onChange={set('company')}
|
||||
autoComplete="organization" />
|
||||
<TextField label="Country" value={values.country} onChange={set('country')}
|
||||
autoComplete="country-name" />
|
||||
<TextField label="Job Title" value={values.job_title} onChange={set('job_title')}
|
||||
autoComplete="organization-title" />
|
||||
</div>
|
||||
|
||||
<TextArea label="Job Details" required rows={6} value={values.job_details} onChange={set('job_details')}
|
||||
error={errors.job_details}
|
||||
placeholder="Describe what you would like help with — your goals, timescales and anything else we should know." />
|
||||
|
||||
<div className="field">
|
||||
<span className="field__label">Verification</span>
|
||||
<Turnstile ref={turnstileRef} onToken={setToken} />
|
||||
</div>
|
||||
|
||||
<button type="submit" className="btn btn--primary btn--big btn--block" disabled={status === 'submitting'}>
|
||||
{status === 'submitting'
|
||||
? (<><span className="spinner spinner--sm" /> Sending…</>)
|
||||
: (<>Send enquiry <Icon name="send" size={15} /></>)}
|
||||
</button>
|
||||
<p className="field__hint text-center mt-16">
|
||||
By submitting you agree we may contact you about your enquiry.
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default Contact;
|
||||
@@ -0,0 +1,96 @@
|
||||
// Upcoming Events — plus a section for past events for context.
|
||||
import { useState } from 'react';
|
||||
import useFetch from '../lib/useFetch';
|
||||
import Icon from '../components/Icon';
|
||||
import SmartImage from '../components/SmartImage';
|
||||
import { Loading, ErrorState, EmptyState } from '../components/States';
|
||||
|
||||
function formatDate(d) {
|
||||
if (!d) return 'Date to be confirmed';
|
||||
return new Date(d).toLocaleDateString('en-GB', { day: 'numeric', month: 'long', year: 'numeric' });
|
||||
}
|
||||
|
||||
function EventCard({ e, upcoming }) {
|
||||
// Demo-only registration: no backend call, just visual confirmation.
|
||||
const [registered, setRegistered] = useState(false);
|
||||
|
||||
return (
|
||||
<article className="card media-card card--hover" style={{ display: 'flex', flexDirection: 'column' }}>
|
||||
{e.cover_image && (
|
||||
<SmartImage src={e.cover_image} alt={e.title} icon="calendar" className="media-card__img" />
|
||||
)}
|
||||
<div className="media-card__body" style={{ display: 'flex', flexDirection: 'column', flex: 1 }}>
|
||||
<div className="chips">
|
||||
<span className={`chip${upcoming ? '' : ' chip--muted'}`}>{upcoming ? 'Upcoming' : 'Past event'}</span>
|
||||
</div>
|
||||
<h2 className="card__title">{e.title}</h2>
|
||||
<p className="mono" style={{ fontSize: 12.5, color: 'var(--ink-dim)', display: 'flex', gap: 14, flexWrap: 'wrap', margin: '4px 0 12px' }}>
|
||||
<span className="flex items-center gap-8"><Icon name="calendar" size={13} /> {formatDate(e.event_date)}</span>
|
||||
{e.location && <span className="flex items-center gap-8"><Icon name="pin" size={13} /> {e.location}</span>}
|
||||
</p>
|
||||
{e.description && <p className="card__text">{e.description}</p>}
|
||||
|
||||
{upcoming && (
|
||||
<div style={{ marginTop: 'auto', paddingTop: 18 }}>
|
||||
{registered ? (
|
||||
<button type="button" className="btn btn--block" disabled style={{ color: 'var(--success)', borderColor: 'var(--success)' }}>
|
||||
<Icon name="check" size={16} /> You're registered
|
||||
</button>
|
||||
) : (
|
||||
<button type="button" className="btn btn--primary btn--block" onClick={() => setRegistered(true)}>
|
||||
Register for this event <Icon name="arrow" size={15} />
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</article>
|
||||
);
|
||||
}
|
||||
|
||||
function Events() {
|
||||
const { data, loading, error, reload } = useFetch('/api/content/events');
|
||||
const upcoming = data?.upcoming || [];
|
||||
const past = data?.past || [];
|
||||
|
||||
return (
|
||||
<>
|
||||
<section className="page-head">
|
||||
<div className="container">
|
||||
<span className="eyebrow">Events</span>
|
||||
<h1>Where to find AI-Solutions</h1>
|
||||
<p>Join us at upcoming demos and workshops, register your interest, or see where we have been.</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="section">
|
||||
<div className="container">
|
||||
<div className="section-head section-head--left"><span className="eyebrow">Upcoming</span><h2>Upcoming events</h2></div>
|
||||
{loading && <Loading label="Loading events…" />}
|
||||
{error && <ErrorState message={error} onRetry={reload} />}
|
||||
{!loading && !error && upcoming.length === 0 && (
|
||||
<EmptyState title="No upcoming events" message="Check back soon for new dates." icon="calendar" />
|
||||
)}
|
||||
{!loading && !error && upcoming.length > 0 && (
|
||||
<div className="grid grid--3">
|
||||
{upcoming.map((e) => <EventCard key={e.id} e={e} upcoming />)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{!loading && !error && past.length > 0 && (
|
||||
<section className="section section--last">
|
||||
<div className="container">
|
||||
<div className="section-head section-head--left"><span className="eyebrow">Archive</span><h2>Past events</h2></div>
|
||||
<div className="grid grid--3">
|
||||
{past.map((e) => <EventCard key={e.id} e={e} upcoming={false} />)}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default Events;
|
||||
@@ -0,0 +1,63 @@
|
||||
// Customer Feedback — testimonials with star ratings.
|
||||
import useFetch from '../lib/useFetch';
|
||||
import StarRating from '../components/StarRating';
|
||||
import { Loading, ErrorState, EmptyState } from '../components/States';
|
||||
|
||||
function Feedback() {
|
||||
const { data, loading, error, reload } = useFetch('/api/content/feedback');
|
||||
const items = data?.feedback || [];
|
||||
|
||||
return (
|
||||
<>
|
||||
<section className="page-head">
|
||||
<div className="container">
|
||||
<span className="eyebrow">Customer Feedback</span>
|
||||
<h1>What our clients think</h1>
|
||||
<p>Honest feedback and ratings from the organisations we have worked with.</p>
|
||||
|
||||
{!loading && !error && items.length > 0 && (
|
||||
<div className="flex gap-12 items-center mt-16" style={{ flexWrap: 'wrap', justifyContent: 'center' }}>
|
||||
<div className="stat">
|
||||
<span className="stat__num">{data.averageRating?.toFixed(1)}</span>
|
||||
<span className="stat__label">Average rating</span>
|
||||
</div>
|
||||
<StarRating value={data.averageRating} />
|
||||
<span className="muted">· based on {data.count} review{data.count === 1 ? '' : 's'}</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="section section--last">
|
||||
<div className="container">
|
||||
{loading && <Loading label="Loading feedback…" />}
|
||||
{error && <ErrorState message={error} onRetry={reload} />}
|
||||
{!loading && !error && items.length === 0 && (
|
||||
<EmptyState title="No feedback yet" message="Reviews from our clients will appear here." icon="star" />
|
||||
)}
|
||||
|
||||
{!loading && !error && items.length > 0 && (
|
||||
<div className="grid grid--2">
|
||||
{items.map((f) => (
|
||||
<article className="card card--rule" key={f.id}>
|
||||
<div className="flex between items-center">
|
||||
<StarRating value={f.rating} />
|
||||
<span className="mono" style={{ fontSize: 11, color: 'var(--ink-dim)' }}>
|
||||
{new Date(f.created_at).toLocaleDateString('en-GB', { month: 'short', year: 'numeric' })}
|
||||
</span>
|
||||
</div>
|
||||
<p className="card__text mt-16" style={{ fontSize: 16, color: 'var(--ink)' }}>“{f.comment}”</p>
|
||||
<p className="mono mt-16" style={{ fontSize: 12, color: 'var(--ink-dim)' }}>
|
||||
{f.customer_name}{f.company ? ` · ${f.company}` : ''}
|
||||
</p>
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default Feedback;
|
||||
@@ -0,0 +1,65 @@
|
||||
// Photo Gallery — images from past & upcoming promotional events,
|
||||
// with an accessible lightbox.
|
||||
import { useState } from 'react';
|
||||
import useFetch from '../lib/useFetch';
|
||||
import Modal from '../components/Modal';
|
||||
import { Loading, ErrorState, EmptyState } from '../components/States';
|
||||
|
||||
function Gallery() {
|
||||
const { data, loading, error, reload } = useFetch('/api/content/gallery');
|
||||
const images = data?.gallery || [];
|
||||
const [active, setActive] = useState(null);
|
||||
|
||||
return (
|
||||
<>
|
||||
<section className="page-head">
|
||||
<div className="container">
|
||||
<span className="eyebrow">Photo Gallery</span>
|
||||
<h1>Moments from our events</h1>
|
||||
<p>A look back at our promotional events, demos and the people behind AI-Solutions.</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="section section--last">
|
||||
<div className="container">
|
||||
{loading && <Loading label="Loading gallery…" />}
|
||||
{error && <ErrorState message={error} onRetry={reload} />}
|
||||
{!loading && !error && images.length === 0 && (
|
||||
<EmptyState title="No photos yet" message="Event photos will appear here." icon="globe" />
|
||||
)}
|
||||
|
||||
{!loading && !error && images.length > 0 && (
|
||||
<div className="gallery">
|
||||
{images.map((img) => (
|
||||
<button
|
||||
type="button"
|
||||
className="gallery__item"
|
||||
key={img.id}
|
||||
onClick={() => setActive(img)}
|
||||
style={{ display: 'block', width: '100%', textAlign: 'left', padding: 0, border: '1px solid var(--border)', cursor: 'zoom-in', background: 'var(--card)' }}
|
||||
aria-label={`View photo: ${img.caption || 'event photo'}`}
|
||||
>
|
||||
<img src={img.image_url} alt={img.caption || 'Event photo'} loading="lazy" />
|
||||
{(img.caption || img.event_title) && (
|
||||
<span className="gallery__cap" style={{ display: 'block' }}>
|
||||
{img.caption}{img.event_title ? ` · ${img.event_title}` : ''}
|
||||
</span>
|
||||
)}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{active && (
|
||||
<Modal title={active.caption || 'Event photo'} onClose={() => setActive(null)}>
|
||||
<img src={active.image_url} alt={active.caption || 'Event photo'} style={{ borderRadius: 8, width: '100%' }} />
|
||||
{active.event_title && <p className="muted mt-16 mono" style={{ fontSize: 12 }}>{active.event_title}</p>}
|
||||
</Modal>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default Gallery;
|
||||
@@ -0,0 +1,212 @@
|
||||
// Home — company mission, core services and value proposition.
|
||||
import { Link } from 'react-router-dom';
|
||||
import useFetch from '../lib/useFetch';
|
||||
import { IMAGES, serviceImage } from '../lib/images';
|
||||
import Icon from '../components/Icon';
|
||||
import StarRating from '../components/StarRating';
|
||||
import SmartImage from '../components/SmartImage';
|
||||
|
||||
const VALUES = [
|
||||
{ icon: 'spark', title: 'AI-first by design',
|
||||
text: 'An AI-powered virtual assistant sits at the core of everything we build, answering inquiries and accelerating work.' },
|
||||
{ icon: 'bolt', title: 'Affordable & fast',
|
||||
text: 'Rapid, low-cost prototyping turns ideas into testable solutions in days — validate before you invest.' },
|
||||
{ icon: 'globe', title: 'Built to scale globally',
|
||||
text: 'From a Sunderland start-up to worldwide impact: solutions engineered to grow across teams and industries.' },
|
||||
];
|
||||
|
||||
const STATS = [
|
||||
{ num: '24/7', label: 'AI assistant availability' },
|
||||
{ num: '62%', label: 'Avg. faster resolution' },
|
||||
{ num: 'Days', label: 'From idea to prototype' },
|
||||
{ num: '4.8/5', label: 'Average client rating' },
|
||||
];
|
||||
|
||||
const ASSISTANT_POINTS = [
|
||||
'Understands natural language and resolves routine requests automatically',
|
||||
'Knows when to hand a conversation to a human — gracefully',
|
||||
'Plugs into your existing tools to cut response times',
|
||||
];
|
||||
|
||||
function Home() {
|
||||
const { data } = useFetch('/api/content/solutions');
|
||||
const { data: fb } = useFetch('/api/content/feedback');
|
||||
const solutions = (data?.solutions || []).slice(0, 3);
|
||||
const featured = (fb?.feedback || []).slice(0, 3);
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* Hero */}
|
||||
<section className="hero">
|
||||
<div className="container hero__grid">
|
||||
<div>
|
||||
<span className="hero__pill"><b>New</b> AI virtual assistant for industry teams</span>
|
||||
<h1>The future of the <span className="accent">digital employee experience</span></h1>
|
||||
<p className="hero__lead">
|
||||
AI-Solutions helps industry teams work better. We build AI-powered virtual assistants
|
||||
and affordable prototypes that speed up design, engineering and innovation — with a
|
||||
strong focus on supporting people at work.
|
||||
</p>
|
||||
<div className="hero__actions">
|
||||
<Link to="/contact" className="btn btn--primary btn--big">Get in touch <Icon name="arrow" size={16} /></Link>
|
||||
<Link to="/services" className="btn btn--big">Explore services</Link>
|
||||
</div>
|
||||
<div className="hero__proof">
|
||||
<div className="hero__avatars" aria-hidden="true">
|
||||
<span>NL</span><span>TM</span><span>WC</span><span>BR</span>
|
||||
</div>
|
||||
<span>Trusted by teams in logistics, manufacturing, healthcare & more</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="hero__media">
|
||||
<SmartImage src={IMAGES.heroTeam} alt="The AI-Solutions team collaborating" icon="robot" />
|
||||
<div className="hero__float hero__float--tl">
|
||||
<span className="icon-badge"><Icon name="spark" size={18} /></span>
|
||||
<span><b>AI Assistant</b><small>Always on, always learning</small></span>
|
||||
</div>
|
||||
<div className="hero__float hero__float--br">
|
||||
<span className="icon-badge"><Icon name="bolt" size={18} /></span>
|
||||
<span><b>Rapid prototypes</b><small>Idea → demo in days</small></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="container">
|
||||
<div className="logo-strip">
|
||||
<span className="logo-strip__label">Supporting people at work across industries</span>
|
||||
{['Logistics', 'Manufacturing', 'Healthcare', 'Retail', 'Insurance'].map((s) => (
|
||||
<span className="logo-strip__item" key={s}>{s}</span>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Mission / values */}
|
||||
<section className="section">
|
||||
<div className="container">
|
||||
<div className="section-head">
|
||||
<span className="eyebrow">Our mission</span>
|
||||
<h2>Innovate, promote & deliver — for people at work</h2>
|
||||
<p>We leverage AI to rapidly and proactively address the issues that impact the digital
|
||||
employee experience, so organisations can design, engineer and innovate faster.</p>
|
||||
</div>
|
||||
<div className="grid grid--3">
|
||||
{VALUES.map((v) => (
|
||||
<article className="card card--hover" key={v.title}>
|
||||
<div className="icon-badge"><Icon name={v.icon} size={22} /></div>
|
||||
<h3 className="card__title">{v.title}</h3>
|
||||
<p className="card__text">{v.text}</p>
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Stats band */}
|
||||
<section className="section--tight">
|
||||
<div className="container">
|
||||
<div className="stats-band">
|
||||
{STATS.map((s) => (
|
||||
<div className="stats-band__item" key={s.label}>
|
||||
<div className="stats-band__num">{s.num}</div>
|
||||
<div className="stats-band__label">{s.label}</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Showcase: AI assistant */}
|
||||
<section className="section">
|
||||
<div className="container">
|
||||
<div className="showcase">
|
||||
<div className="showcase__media">
|
||||
<SmartImage src={IMAGES.showcaseAssistant} alt="AI-powered virtual assistant" icon="robot" />
|
||||
</div>
|
||||
<div>
|
||||
<span className="eyebrow">Our core product</span>
|
||||
<h2 style={{ fontSize: 'clamp(26px,3.2vw,36px)' }}>An AI virtual assistant that actually helps</h2>
|
||||
<p className="muted mt-16" style={{ fontSize: 17 }}>
|
||||
Our flagship assistant responds to inquiries instantly and provides affordable,
|
||||
AI-based prototyping — the unique selling point that sets AI-Solutions apart.
|
||||
</p>
|
||||
<ul className="showcase__list">
|
||||
{ASSISTANT_POINTS.map((p) => (
|
||||
<li key={p}><span className="tick"><Icon name="check" size={14} /></span> <span>{p}</span></li>
|
||||
))}
|
||||
</ul>
|
||||
<div className="mt-32"><Link to="/services" className="btn btn--primary">See how it works <Icon name="arrow" size={15} /></Link></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Featured services */}
|
||||
<section className="section section--tint">
|
||||
<div className="container">
|
||||
<div className="section-head">
|
||||
<span className="eyebrow">What we do</span>
|
||||
<h2>Software solutions, built around you</h2>
|
||||
<p>From AI assistants to bespoke engineering — services grounded in what your team actually needs.</p>
|
||||
</div>
|
||||
<div className="grid grid--3">
|
||||
{solutions.length === 0
|
||||
? Array.from({ length: 3 }).map((_, i) => <div className="card skeleton" key={i} style={{ height: 320 }} />)
|
||||
: solutions.map((s) => (
|
||||
<article className="card media-card card--hover" key={s.id}>
|
||||
<SmartImage src={serviceImage(s.icon)} alt={s.title} icon={s.icon || 'robot'} className="media-card__img" />
|
||||
<div className="media-card__body">
|
||||
<h3 className="card__title">{s.title}</h3>
|
||||
<p className="card__text">{s.summary}</p>
|
||||
</div>
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
<div className="text-center mt-32"><Link to="/services" className="btn">View all services <Icon name="arrow" size={15} /></Link></div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Testimonials */}
|
||||
{featured.length > 0 && (
|
||||
<section className="section">
|
||||
<div className="container">
|
||||
<div className="section-head">
|
||||
<span className="eyebrow">Customer feedback</span>
|
||||
<h2>Trusted by the teams we work with</h2>
|
||||
</div>
|
||||
<div className="grid grid--3">
|
||||
{featured.map((f) => (
|
||||
<article className="testimonial" key={f.id}>
|
||||
<StarRating value={f.rating} />
|
||||
<p className="testimonial__quote">“{f.comment}”</p>
|
||||
<div className="testimonial__who">
|
||||
<span className="avatar">{f.customer_name.split(' ').map(w => w[0]).slice(0, 2).join('')}</span>
|
||||
<span>
|
||||
<span className="testimonial__name" style={{ display: 'block' }}>{f.customer_name}</span>
|
||||
<span className="testimonial__role">{f.company}</span>
|
||||
</span>
|
||||
</div>
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
<div className="text-center mt-32"><Link to="/feedback" className="btn">Read all feedback <Icon name="arrow" size={15} /></Link></div>
|
||||
</div>
|
||||
</section>
|
||||
)}
|
||||
|
||||
{/* CTA */}
|
||||
<section className="section section--last">
|
||||
<div className="container">
|
||||
<div className="cta-band">
|
||||
<h2>Ready to support your people with AI?</h2>
|
||||
<p>Tell us about your project and our team will be in touch — no account needed.</p>
|
||||
<Link to="/contact" className="btn btn--white btn--big">Contact us <Icon name="arrow" size={16} /></Link>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default Home;
|
||||
@@ -0,0 +1,19 @@
|
||||
// 404 — unknown public route.
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
function NotFound() {
|
||||
return (
|
||||
<section className="page-head section--last">
|
||||
<div className="container text-center">
|
||||
<span className="eyebrow">Error 404</span>
|
||||
<h1>Page not found</h1>
|
||||
<p className="muted" style={{ margin: '0 auto' }}>
|
||||
The page you are looking for doesn’t exist or has moved.
|
||||
</p>
|
||||
<div className="mt-24"><Link to="/" className="btn btn--primary">Back to home</Link></div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
export default NotFound;
|
||||
@@ -0,0 +1,57 @@
|
||||
// Past Solutions — case studies of completed industry projects.
|
||||
import useFetch from '../lib/useFetch';
|
||||
import { Loading, ErrorState, EmptyState } from '../components/States';
|
||||
|
||||
function PastSolutions() {
|
||||
const { data, loading, error, reload } = useFetch('/api/content/case-studies');
|
||||
const items = data?.caseStudies || [];
|
||||
|
||||
return (
|
||||
<>
|
||||
<section className="page-head">
|
||||
<div className="container">
|
||||
<span className="eyebrow">Past Solutions</span>
|
||||
<h1>Real results, delivered for industry</h1>
|
||||
<p>Highlights of past solutions we have provided — and the measurable outcomes they produced.</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="section section--last">
|
||||
<div className="container">
|
||||
{loading && <Loading label="Loading case studies…" />}
|
||||
{error && <ErrorState message={error} onRetry={reload} />}
|
||||
{!loading && !error && items.length === 0 && (
|
||||
<EmptyState title="No case studies yet" message="Our completed projects will appear here." icon="briefcase" />
|
||||
)}
|
||||
|
||||
{!loading && !error && items.length > 0 && (
|
||||
<div className="grid grid--3">
|
||||
{items.map((c) => (
|
||||
<article className="card media-card card--hover" key={c.id}>
|
||||
{c.image_url && (
|
||||
<img className="media-card__img" src={c.image_url} alt={`${c.client || c.title} project`} loading="lazy" />
|
||||
)}
|
||||
<div className="media-card__body">
|
||||
<div className="chips">
|
||||
{c.industry && <span className="chip">{c.industry}</span>}
|
||||
{c.client && <span className="chip chip--muted">{c.client}</span>}
|
||||
</div>
|
||||
<h2 className="card__title">{c.title}</h2>
|
||||
<p className="card__text" style={{ marginBottom: 10 }}>{c.summary}</p>
|
||||
{c.outcome && (
|
||||
<p className="card__text" style={{ color: 'var(--ink)' }}>
|
||||
<strong>Outcome:</strong> {c.outcome}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default PastSolutions;
|
||||
@@ -0,0 +1,105 @@
|
||||
// Services — the software solutions AI-Solutions offers.
|
||||
import { Link } from 'react-router-dom';
|
||||
import useFetch from '../lib/useFetch';
|
||||
import { IMAGES, serviceImage } from '../lib/images';
|
||||
import Icon from '../components/Icon';
|
||||
import SmartImage from '../components/SmartImage';
|
||||
import { Loading, ErrorState, EmptyState } from '../components/States';
|
||||
|
||||
const STEPS = [
|
||||
{ n: '01', title: 'Listen', text: 'We start with your needs — your workflows, your people, your goals.' },
|
||||
{ n: '02', title: 'Prototype', text: 'We build an affordable, working prototype so you can test ideas fast.' },
|
||||
{ n: '03', title: 'Deliver & scale', text: 'We refine, deploy and support the solution as it grows with you.' },
|
||||
];
|
||||
|
||||
function Services() {
|
||||
const { data, loading, error, reload } = useFetch('/api/content/solutions');
|
||||
const solutions = data?.solutions || [];
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* Header with image */}
|
||||
<section className="hero">
|
||||
<div className="container">
|
||||
<div className="showcase">
|
||||
<div>
|
||||
<span className="eyebrow">Services</span>
|
||||
<h1 style={{ fontSize: 36, letterSpacing: '-0.6px', lineHeight: 1.12 }}>
|
||||
Software solutions that support people at work
|
||||
</h1>
|
||||
<p className="muted mt-16" style={{ fontSize: 17 }}>
|
||||
Each engagement is grounded in what you actually need. From AI virtual assistants to
|
||||
bespoke engineering, here is how we help teams design, build and innovate faster.
|
||||
</p>
|
||||
<div className="hero__actions mt-24">
|
||||
<Link to="/contact" className="btn btn--primary btn--big">Get a free consultation <Icon name="arrow" size={14} /></Link>
|
||||
</div>
|
||||
</div>
|
||||
<div className="showcase__media">
|
||||
<SmartImage src={IMAGES.showcasePrototype} alt="Planning a software solution" icon="code" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Service cards */}
|
||||
<section className="section">
|
||||
<div className="container">
|
||||
{loading && <Loading label="Loading services…" />}
|
||||
{error && <ErrorState message={error} onRetry={reload} />}
|
||||
{!loading && !error && solutions.length === 0 && (
|
||||
<EmptyState title="No services published yet" message="Please check back soon." icon="briefcase" />
|
||||
)}
|
||||
|
||||
{!loading && !error && solutions.length > 0 && (
|
||||
<div className="grid grid--2">
|
||||
{solutions.map((s) => (
|
||||
<article className="card media-card card--hover" key={s.id}>
|
||||
<SmartImage src={serviceImage(s.icon)} alt={s.title} icon={s.icon || 'robot'} className="media-card__img" />
|
||||
<div className="media-card__body">
|
||||
<div className="card__icon" style={{ marginBottom: 12 }}><Icon name={s.icon || 'robot'} size={20} /></div>
|
||||
<h2 className="card__title">{s.title}</h2>
|
||||
<p className="card__text" style={{ marginBottom: 12 }}>{s.summary}</p>
|
||||
{s.description && <p className="card__text">{s.description}</p>}
|
||||
</div>
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* How we work */}
|
||||
<section className="section">
|
||||
<div className="container">
|
||||
<div className="section-head">
|
||||
<span className="eyebrow">How we work</span>
|
||||
<h2>A simple path from idea to impact</h2>
|
||||
</div>
|
||||
<div className="grid grid--3">
|
||||
{STEPS.map((st) => (
|
||||
<article className="card card--rule" key={st.n}>
|
||||
<span className="mono" style={{ fontSize: 28, fontWeight: 700, color: 'var(--accent)' }}>{st.n}</span>
|
||||
<h3 className="card__title mt-8">{st.title}</h3>
|
||||
<p className="card__text">{st.text}</p>
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* CTA */}
|
||||
<section className="section section--last">
|
||||
<div className="container">
|
||||
<div className="cta-band">
|
||||
<h2>Not sure which solution fits?</h2>
|
||||
<p>Tell us your goals and we will recommend the right approach — no obligation.</p>
|
||||
<Link to="/contact" className="btn btn--white btn--big">Get in touch <Icon name="arrow" size={16} /></Link>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default Services;
|
||||
@@ -0,0 +1,267 @@
|
||||
// Admin dashboard — the sole back-office job: review Contact Us
|
||||
// enquiries. Headline stats + a searchable, filterable, paginated
|
||||
// table, with a full-detail modal per enquiry.
|
||||
import { useEffect, useState, useCallback } from 'react';
|
||||
import { getJSON, postJSON, apiFetch } from '../../api';
|
||||
import Modal from '../../components/Modal';
|
||||
import Icon from '../../components/Icon';
|
||||
import { Loading, ErrorState, EmptyState } from '../../components/States';
|
||||
|
||||
function StatCard({ num, label }) {
|
||||
return (
|
||||
<div className="stat-card">
|
||||
<div className="stat">
|
||||
<span className="stat__num">{num}</span>
|
||||
<span className="stat__label">{label}</span>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function fmtDateTime(d) {
|
||||
return new Date(d).toLocaleString('en-GB', { day: '2-digit', month: 'short', year: 'numeric', hour: '2-digit', minute: '2-digit' });
|
||||
}
|
||||
|
||||
function AdminDashboard() {
|
||||
const [stats, setStats] = useState(null);
|
||||
const [search, setSearch] = useState('');
|
||||
const [debounced, setDebounced] = useState('');
|
||||
const [country, setCountry] = useState('');
|
||||
const [status, setStatus] = useState('');
|
||||
const [page, setPage] = useState(1);
|
||||
|
||||
const [list, setList] = useState(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState('');
|
||||
|
||||
const [active, setActive] = useState(null); // open enquiry detail
|
||||
const [detailLoading, setDetailLoading] = useState(false);
|
||||
|
||||
const limit = 10;
|
||||
|
||||
// Debounce the free-text search.
|
||||
useEffect(() => {
|
||||
const t = setTimeout(() => { setDebounced(search); setPage(1); }, 350);
|
||||
return () => clearTimeout(t);
|
||||
}, [search]);
|
||||
|
||||
const loadStats = useCallback(() => {
|
||||
getJSON('/api/admin/stats').then(setStats).catch(() => {});
|
||||
}, []);
|
||||
|
||||
const loadList = useCallback(() => {
|
||||
setLoading(true);
|
||||
setError('');
|
||||
const params = new URLSearchParams({ page: String(page), limit: String(limit) });
|
||||
if (debounced) params.set('search', debounced);
|
||||
if (country) params.set('country', country);
|
||||
if (status) params.set('status', status);
|
||||
getJSON(`/api/admin/inquiries?${params.toString()}`)
|
||||
.then(setList)
|
||||
.catch((e) => setError(e.message))
|
||||
.finally(() => setLoading(false));
|
||||
}, [page, debounced, country, status]);
|
||||
|
||||
useEffect(() => { loadStats(); }, [loadStats]);
|
||||
useEffect(() => { loadList(); }, [loadList]);
|
||||
|
||||
const openDetail = async (id) => {
|
||||
setDetailLoading(true);
|
||||
try {
|
||||
const data = await getJSON(`/api/admin/inquiries/${id}`);
|
||||
setActive(data.inquiry);
|
||||
loadStats(); // unread count may change (viewing marks read)
|
||||
loadList();
|
||||
} catch (e) {
|
||||
setError(e.message);
|
||||
} finally {
|
||||
setDetailLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const removeInquiry = async (id) => {
|
||||
if (!window.confirm('Delete this enquiry? This cannot be undone.')) return;
|
||||
try {
|
||||
await apiFetch(`/api/admin/inquiries/${id}`, { method: 'DELETE' });
|
||||
setActive(null);
|
||||
loadStats();
|
||||
loadList();
|
||||
} catch (e) {
|
||||
setError(e.message);
|
||||
}
|
||||
};
|
||||
|
||||
const toggleRead = async (inq) => {
|
||||
try {
|
||||
await postJSON(`/api/admin/inquiries/${inq.id}/read`, { is_read: !inq.is_read }, 'PATCH');
|
||||
loadStats();
|
||||
loadList();
|
||||
setActive((a) => (a && a.id === inq.id ? { ...a, is_read: !inq.is_read } : a));
|
||||
} catch (e) {
|
||||
setError(e.message);
|
||||
}
|
||||
};
|
||||
|
||||
const inquiries = list?.inquiries || [];
|
||||
const pg = list?.pagination;
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="admin__topbar">
|
||||
<div className="admin__title">
|
||||
<h1>Customer Enquiries</h1>
|
||||
<p>Every submission from the public Contact Us form.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Stats */}
|
||||
<div className="grid grid--4" style={{ marginBottom: 28 }}>
|
||||
<StatCard num={stats ? stats.totalInquiries : '—'} label="Total enquiries" />
|
||||
<StatCard num={stats ? stats.unreadInquiries : '—'} label="Unread" />
|
||||
<StatCard num={stats ? stats.last7Days : '—'} label="Last 7 days" />
|
||||
<StatCard num={stats ? stats.today : '—'} label="Today" />
|
||||
</div>
|
||||
|
||||
{/* Toolbar */}
|
||||
<div className="toolbar">
|
||||
<div className="toolbar__grow" style={{ position: 'relative', minWidth: 220 }}>
|
||||
<span style={{ position: 'absolute', left: 12, top: '50%', transform: 'translateY(-50%)', color: 'var(--ink-dim)' }}>
|
||||
<Icon name="search" size={16} />
|
||||
</span>
|
||||
<input
|
||||
className="input"
|
||||
style={{ paddingLeft: 38, width: '100%' }}
|
||||
placeholder="Search name, email, company, details…"
|
||||
value={search}
|
||||
onChange={(e) => setSearch(e.target.value)}
|
||||
aria-label="Search enquiries"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<label className="sr-only" htmlFor="f-country">Filter by country</label>
|
||||
<select id="f-country" className="select" value={country} onChange={(e) => { setCountry(e.target.value); setPage(1); }}>
|
||||
<option value="">All countries</option>
|
||||
{(stats?.countries || []).map((c) => <option key={c} value={c}>{c}</option>)}
|
||||
</select>
|
||||
|
||||
<label className="sr-only" htmlFor="f-status">Filter by status</label>
|
||||
<select id="f-status" className="select" value={status} onChange={(e) => { setStatus(e.target.value); setPage(1); }}>
|
||||
<option value="">All statuses</option>
|
||||
<option value="unread">Unread</option>
|
||||
<option value="read">Read</option>
|
||||
</select>
|
||||
|
||||
{(search || country || status) && (
|
||||
<button type="button" className="btn btn--ghost" onClick={() => { setSearch(''); setCountry(''); setStatus(''); setPage(1); }}>
|
||||
Clear
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Table */}
|
||||
{loading && <Loading label="Loading enquiries…" />}
|
||||
{error && !loading && <ErrorState message={error} onRetry={loadList} />}
|
||||
{!loading && !error && inquiries.length === 0 && (
|
||||
<EmptyState
|
||||
title="No enquiries found"
|
||||
message={search || country || status ? 'Try clearing your filters.' : 'New Contact Us submissions will appear here.'}
|
||||
/>
|
||||
)}
|
||||
|
||||
{!loading && !error && inquiries.length > 0 && (
|
||||
<>
|
||||
<div className="table-wrap">
|
||||
<table className="data">
|
||||
<caption className="sr-only">Customer enquiries</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Status</th>
|
||||
<th scope="col">Name</th>
|
||||
<th scope="col">Company</th>
|
||||
<th scope="col">Country</th>
|
||||
<th scope="col">Received</th>
|
||||
<th scope="col"><span className="sr-only">Actions</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{inquiries.map((inq) => (
|
||||
<tr
|
||||
key={inq.id}
|
||||
className={inq.is_read ? '' : 'row-unread'}
|
||||
onClick={() => openDetail(inq.id)}
|
||||
tabIndex={0}
|
||||
onKeyDown={(e) => { if (e.key === 'Enter') openDetail(inq.id); }}
|
||||
>
|
||||
<td><span className={`badge ${inq.is_read ? 'badge--read' : 'badge--new'}`}>{inq.is_read ? 'Read' : 'New'}</span></td>
|
||||
<td>
|
||||
<div style={{ fontWeight: 600 }}>{inq.full_name}</div>
|
||||
<div className="muted" style={{ fontSize: 12.5 }}>{inq.email}</div>
|
||||
</td>
|
||||
<td>{inq.company || <span className="muted">—</span>}</td>
|
||||
<td>{inq.country || <span className="muted">—</span>}</td>
|
||||
<td className="mono" style={{ fontSize: 12, color: 'var(--ink-dim)' }}>{fmtDateTime(inq.created_at)}</td>
|
||||
<td onClick={(e) => e.stopPropagation()}>
|
||||
<button type="button" className="btn btn--ghost" onClick={() => openDetail(inq.id)} aria-label={`View enquiry from ${inq.full_name}`}>
|
||||
View
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{pg && (
|
||||
<div className="pagination">
|
||||
<span className="pagination__info">
|
||||
Page {pg.page} of {pg.totalPages} · {pg.totalCount} enquir{pg.totalCount === 1 ? 'y' : 'ies'}
|
||||
</span>
|
||||
<div className="flex gap-8">
|
||||
<button type="button" className="btn" disabled={page <= 1} onClick={() => setPage((p) => p - 1)}>Previous</button>
|
||||
<button type="button" className="btn" disabled={page >= pg.totalPages} onClick={() => setPage((p) => p + 1)}>Next</button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* Detail modal */}
|
||||
{(active || detailLoading) && (
|
||||
<Modal title={active ? `Enquiry from ${active.full_name}` : 'Loading…'} onClose={() => setActive(null)}>
|
||||
{!active ? (
|
||||
<Loading label="Loading enquiry…" />
|
||||
) : (
|
||||
<>
|
||||
<dl className="dl">
|
||||
<dt>Full name</dt><dd>{active.full_name}</dd>
|
||||
<dt>Email</dt><dd><a href={`mailto:${active.email}`}>{active.email}</a></dd>
|
||||
<dt>Phone</dt><dd>{active.phone || <span className="muted">Not provided</span>}</dd>
|
||||
<dt>Company</dt><dd>{active.company || <span className="muted">Not provided</span>}</dd>
|
||||
<dt>Country</dt><dd>{active.country || <span className="muted">Not provided</span>}</dd>
|
||||
<dt>Job title</dt><dd>{active.job_title || <span className="muted">Not provided</span>}</dd>
|
||||
<dt>Received</dt><dd>{fmtDateTime(active.created_at)}</dd>
|
||||
<dt>Job details</dt><dd style={{ whiteSpace: 'pre-wrap' }}>{active.job_details}</dd>
|
||||
</dl>
|
||||
|
||||
<div className="flex between wrap gap-12 mt-24">
|
||||
<div className="flex gap-8 wrap">
|
||||
<a className="btn btn--primary" href={`mailto:${active.email}?subject=Re: your enquiry to AI-Solutions`}>
|
||||
<Icon name="mail" size={15} /> Reply by email
|
||||
</a>
|
||||
<button type="button" className="btn" onClick={() => toggleRead(active)}>
|
||||
Mark as {active.is_read ? 'unread' : 'read'}
|
||||
</button>
|
||||
</div>
|
||||
<button type="button" className="btn btn--ghost" onClick={() => removeInquiry(active.id)} style={{ color: 'var(--danger)' }}>
|
||||
<Icon name="trash" size={15} /> Delete
|
||||
</button>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</Modal>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default AdminDashboard;
|
||||
@@ -0,0 +1,58 @@
|
||||
// Admin back-office shell: dark sidebar (visually distinct from the
|
||||
// public cream site) + routed content. Loads the current admin via
|
||||
// the existing /api/auth/me and logs out via /api/auth/logout.
|
||||
import { useEffect, useState } from 'react';
|
||||
import { Outlet, useNavigate, Link } from 'react-router-dom';
|
||||
import { getJSON, postJSON } from '../../api';
|
||||
import Brand from '../../components/Brand';
|
||||
import Icon from '../../components/Icon';
|
||||
|
||||
function AdminLayout() {
|
||||
const [me, setMe] = useState(null);
|
||||
const navigate = useNavigate();
|
||||
|
||||
useEffect(() => {
|
||||
getJSON('/api/auth/me').then((d) => setMe(d.user)).catch(() => {});
|
||||
}, []);
|
||||
|
||||
const logout = async () => {
|
||||
try { await postJSON('/api/auth/logout', {}); } catch {/* ignore */}
|
||||
navigate('/admin/login', { replace: true });
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="admin">
|
||||
<aside className="admin__side">
|
||||
<div className="admin__brand"><Brand to={null} onDark /></div>
|
||||
|
||||
<nav aria-label="Admin">
|
||||
<Link to="/admin" className="admin__navlink is-active">
|
||||
<Icon name="inbox" size={16} /> Enquiries
|
||||
</Link>
|
||||
<Link to="/" className="admin__navlink">
|
||||
<Icon name="globe" size={16} /> View website
|
||||
</Link>
|
||||
</nav>
|
||||
|
||||
<div className="admin__spacer" />
|
||||
|
||||
<div style={{ borderTop: '1px solid var(--dark-border)', paddingTop: 14 }}>
|
||||
{me && (
|
||||
<p className="mono" style={{ fontSize: 11, color: 'var(--dark-dim)', marginBottom: 10, wordBreak: 'break-all' }}>
|
||||
{me.username}
|
||||
</p>
|
||||
)}
|
||||
<button type="button" className="admin__navlink" onClick={logout}>
|
||||
<Icon name="logout" size={16} /> Sign out
|
||||
</button>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<div className="admin__main">
|
||||
<Outlet />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default AdminLayout;
|
||||
@@ -0,0 +1,118 @@
|
||||
// Admin login — integrates with the EXISTING secure backend:
|
||||
// 1) POST /api/auth/login (email + password + Turnstile) → sends OTP
|
||||
// 2) POST /api/auth/verify-otp (userId + 6-digit OTP) → sets session
|
||||
// No auth/security logic is reimplemented here; this is just the UI.
|
||||
import { useState, useRef } from 'react';
|
||||
import { useNavigate, useLocation, Link } from 'react-router-dom';
|
||||
import { postJSON } from '../../api';
|
||||
import { TextField, PasswordField } from '../../components/Field';
|
||||
import Turnstile from '../../components/Turnstile';
|
||||
import Brand from '../../components/Brand';
|
||||
import Icon from '../../components/Icon';
|
||||
|
||||
function AdminLogin() {
|
||||
const [step, setStep] = useState('credentials'); // credentials | otp
|
||||
const [email, setEmail] = useState('');
|
||||
const [password, setPassword] = useState('');
|
||||
const [otp, setOtp] = useState('');
|
||||
const [userId, setUserId] = useState(null);
|
||||
const [token, setToken] = useState('');
|
||||
const [error, setError] = useState('');
|
||||
const [info, setInfo] = useState('');
|
||||
const [busy, setBusy] = useState(false);
|
||||
const turnstileRef = useRef(null);
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
const dest = location.state?.from || '/admin';
|
||||
|
||||
const resetCaptcha = () => { turnstileRef.current?.reset(); setToken(''); };
|
||||
|
||||
const submitCredentials = async (e) => {
|
||||
e.preventDefault();
|
||||
setError('');
|
||||
if (!token) { setError('Please complete the CAPTCHA challenge.'); return; }
|
||||
setBusy(true);
|
||||
try {
|
||||
const data = await postJSON('/api/auth/login', { email, password, turnstileToken: token });
|
||||
if (data.requireOTP) {
|
||||
setUserId(data.userId);
|
||||
setStep('otp');
|
||||
setInfo(data.message || 'We sent a 6-digit code to your email.');
|
||||
}
|
||||
} catch (err) {
|
||||
setError(err.message || 'Login failed.');
|
||||
resetCaptcha();
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
};
|
||||
|
||||
const submitOtp = async (e) => {
|
||||
e.preventDefault();
|
||||
setError('');
|
||||
setBusy(true);
|
||||
try {
|
||||
await postJSON('/api/auth/verify-otp', { userId, otp });
|
||||
navigate(dest, { replace: true });
|
||||
} catch (err) {
|
||||
setError(err.message || 'Invalid code.');
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
};
|
||||
|
||||
const resendOtp = async () => {
|
||||
setError(''); setInfo('');
|
||||
try {
|
||||
const data = await postJSON('/api/auth/request-otp', { userId });
|
||||
setInfo(data.message || 'A new code has been sent.');
|
||||
} catch (err) {
|
||||
setError(err.message || 'Could not resend the code.');
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="auth-screen">
|
||||
<div className="auth-card">
|
||||
<div className="auth-card__head">
|
||||
<Brand to={null} />
|
||||
<h1 className="mt-16">Admin Portal</h1>
|
||||
<p>{step === 'credentials' ? 'Sign in to review customer enquiries.' : 'Enter the verification code we emailed you.'}</p>
|
||||
</div>
|
||||
|
||||
{error && <div className="notice notice--error" role="alert">{error}</div>}
|
||||
{info && step === 'otp' && <div className="notice notice--info">{info}</div>}
|
||||
|
||||
{step === 'credentials' ? (
|
||||
<form onSubmit={submitCredentials} noValidate>
|
||||
<TextField label="Email" required type="email" value={email} onChange={setEmail} autoComplete="username" />
|
||||
<PasswordField label="Password" required value={password} onChange={setPassword} />
|
||||
<div className="field">
|
||||
<span className="field__label">Verification</span>
|
||||
<Turnstile ref={turnstileRef} onToken={setToken} />
|
||||
</div>
|
||||
<button type="submit" className="btn btn--primary btn--big btn--block" disabled={busy}>
|
||||
{busy ? (<><span className="spinner spinner--sm" /> Signing in…</>) : (<>Continue <Icon name="arrow" size={14} /></>)}
|
||||
</button>
|
||||
</form>
|
||||
) : (
|
||||
<form onSubmit={submitOtp} noValidate>
|
||||
<TextField label="6-digit code" required value={otp} onChange={(v) => setOtp(v.replace(/\D/g, '').slice(0, 6))}
|
||||
placeholder="••••••" autoComplete="one-time-code" />
|
||||
<button type="submit" className="btn btn--primary btn--big btn--block" disabled={busy || otp.length !== 6}>
|
||||
{busy ? (<><span className="spinner spinner--sm" /> Verifying…</>) : 'Verify & sign in'}
|
||||
</button>
|
||||
<div className="flex between mt-16">
|
||||
<button type="button" className="btn btn--ghost" onClick={() => { setStep('credentials'); setOtp(''); resetCaptcha(); }}>Back</button>
|
||||
<button type="button" className="btn btn--ghost" onClick={resendOtp}>Resend code</button>
|
||||
</div>
|
||||
</form>
|
||||
)}
|
||||
|
||||
<p className="auth-card__foot"><Link to="/">← Back to website</Link></p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default AdminLogin;
|
||||
@@ -0,0 +1,13 @@
|
||||
const reportWebVitals = onPerfEntry => {
|
||||
if (onPerfEntry && onPerfEntry instanceof Function) {
|
||||
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
|
||||
getCLS(onPerfEntry);
|
||||
getFID(onPerfEntry);
|
||||
getFCP(onPerfEntry);
|
||||
getLCP(onPerfEntry);
|
||||
getTTFB(onPerfEntry);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export default reportWebVitals;
|
||||
@@ -0,0 +1,5 @@
|
||||
// jest-dom adds custom jest matchers for asserting on DOM nodes.
|
||||
// allows you to do things like:
|
||||
// expect(element).toHaveTextContent(/react/i)
|
||||
// learn more: https://github.com/testing-library/jest-dom
|
||||
import '@testing-library/jest-dom';
|
||||
Reference in new issue
Block a user