feat/fix: implement chatbot session persistence, resolve auth redirect loops, and polish UI
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom';
|
||||
import { AuthProvider, useAuth } from './context/AuthContext';
|
||||
import { ThemeProvider } from './context/ThemeContext';
|
||||
import { ToastProvider } from './context/ToastContext';
|
||||
|
||||
// Layouts
|
||||
@@ -133,13 +132,11 @@ function AppRoutes() {
|
||||
function App() {
|
||||
return (
|
||||
<BrowserRouter>
|
||||
<ThemeProvider>
|
||||
<ToastProvider>
|
||||
<AuthProvider>
|
||||
<AppRoutes />
|
||||
</AuthProvider>
|
||||
</ToastProvider>
|
||||
</ThemeProvider>
|
||||
<ToastProvider>
|
||||
<AuthProvider>
|
||||
<AppRoutes />
|
||||
</AuthProvider>
|
||||
</ToastProvider>
|
||||
</BrowserRouter>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,8 +2,7 @@ import { useState, useRef, useEffect, useCallback } from 'react';
|
||||
import { useAuth } from '../context/AuthContext';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
|
||||
const STORAGE_KEY = 'admin_chat_history';
|
||||
const MAX_HISTORY = 40; // messages to persist
|
||||
const STORAGE_KEY = 'admin_chat_session_id';
|
||||
|
||||
const FAQ_DATA = {
|
||||
"Document Review": [
|
||||
@@ -43,26 +42,41 @@ export default function AdminChatbot() {
|
||||
const [pendingBulk, setPendingBulk] = useState(null); // bulk action awaiting confirmation
|
||||
const chatEndRef = useRef(null);
|
||||
|
||||
// ── Conversation memory via localStorage ──────────────────────────────────
|
||||
const [messages, setMessages] = useState(() => {
|
||||
try {
|
||||
const saved = localStorage.getItem(STORAGE_KEY);
|
||||
return saved ? JSON.parse(saved) : [];
|
||||
} catch { return []; }
|
||||
});
|
||||
const [messages, setMessages] = useState([]);
|
||||
const [sessionId, setSessionId] = useState(null);
|
||||
|
||||
// Persist messages to localStorage whenever they change
|
||||
useEffect(() => {
|
||||
try {
|
||||
localStorage.setItem(STORAGE_KEY, JSON.stringify(messages.slice(-MAX_HISTORY)));
|
||||
} catch { /* storage full — ignore */ }
|
||||
}, [messages]);
|
||||
if (!user) return;
|
||||
async function loadHistory() {
|
||||
const savedSession = localStorage.getItem(STORAGE_KEY);
|
||||
const url = savedSession ? `/api/chatbot/history?session_id=${savedSession}` : '/api/chatbot/history';
|
||||
try {
|
||||
const res = await authFetch(url);
|
||||
if (res.ok) {
|
||||
const data = await res.json();
|
||||
setSessionId(data.session_id);
|
||||
localStorage.setItem(STORAGE_KEY, data.session_id);
|
||||
const loaded = data.messages.map(m => ({
|
||||
type: m.role === 'user' ? 'user' : 'bot',
|
||||
role: m.role,
|
||||
text: m.content || '',
|
||||
...m
|
||||
})).filter(m => m.role === 'user' || m.role === 'assistant');
|
||||
setMessages(loaded);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Failed to load admin chat history", e);
|
||||
}
|
||||
}
|
||||
loadHistory();
|
||||
}, [authFetch, user]);
|
||||
|
||||
useEffect(() => { setIsOpen(false); }, [location.pathname]);
|
||||
useEffect(() => { chatEndRef.current?.scrollIntoView({ behavior: 'smooth' }); }, [messages, view]);
|
||||
|
||||
const clearHistory = () => {
|
||||
setMessages([]);
|
||||
setSessionId(null);
|
||||
localStorage.removeItem(STORAGE_KEY);
|
||||
};
|
||||
|
||||
@@ -121,11 +135,8 @@ export default function AdminChatbot() {
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
stream: false,
|
||||
messages: allMessages.map(m => ({
|
||||
role: m.role || (m.type === 'bot' ? 'assistant' : 'user'),
|
||||
content: m.text,
|
||||
reasoning_details: null,
|
||||
})),
|
||||
session_id: sessionId,
|
||||
message: text,
|
||||
}),
|
||||
});
|
||||
|
||||
|
||||
@@ -2,8 +2,7 @@ import { useState, useRef, useEffect, useCallback } from 'react';
|
||||
import { useAuth } from '../context/AuthContext';
|
||||
import { useLocation, useNavigate } from 'react-router-dom';
|
||||
|
||||
const STORAGE_KEY = 'user_chat_history';
|
||||
const MAX_HISTORY = 30;
|
||||
const STORAGE_KEY = 'user_chat_session_id';
|
||||
|
||||
const FAQ_DATA = {
|
||||
"Account": [
|
||||
@@ -48,23 +47,39 @@ export default function Chatbot() {
|
||||
const [isTyping, setIsTyping] = useState(false);
|
||||
const chatEndRef = useRef(null);
|
||||
|
||||
// ── Conversation memory via localStorage ──────────────────────────────────
|
||||
const [messages, setMessages] = useState(() => {
|
||||
try {
|
||||
const saved = localStorage.getItem(STORAGE_KEY);
|
||||
return saved ? JSON.parse(saved) : [];
|
||||
} catch { return []; }
|
||||
});
|
||||
const [messages, setMessages] = useState([]);
|
||||
const [sessionId, setSessionId] = useState(null);
|
||||
|
||||
useEffect(() => {
|
||||
try { localStorage.setItem(STORAGE_KEY, JSON.stringify(messages.slice(-MAX_HISTORY))); }
|
||||
catch { /* storage full */ }
|
||||
}, [messages]);
|
||||
if (!user) return;
|
||||
async function loadHistory() {
|
||||
const savedSession = localStorage.getItem(STORAGE_KEY);
|
||||
const url = savedSession ? `/api/chatbot/history?session_id=${savedSession}` : '/api/chatbot/history';
|
||||
try {
|
||||
const res = await authFetch(url);
|
||||
if (res.ok) {
|
||||
const data = await res.json();
|
||||
setSessionId(data.session_id);
|
||||
localStorage.setItem(STORAGE_KEY, data.session_id);
|
||||
const loaded = data.messages.map(m => ({
|
||||
type: m.role === 'user' ? 'user' : 'bot',
|
||||
role: m.role,
|
||||
text: m.content || '',
|
||||
...m
|
||||
})).filter(m => m.role === 'user' || m.role === 'assistant');
|
||||
setMessages(loaded);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Failed to load chat history", e);
|
||||
}
|
||||
}
|
||||
loadHistory();
|
||||
}, [authFetch, user]);
|
||||
|
||||
useEffect(() => { setIsOpen(false); }, [location.pathname]);
|
||||
useEffect(() => { chatEndRef.current?.scrollIntoView({ behavior: 'smooth' }); }, [messages, view]);
|
||||
|
||||
const clearHistory = () => { setMessages([]); localStorage.removeItem(STORAGE_KEY); };
|
||||
const clearHistory = () => { setMessages([]); setSessionId(null); localStorage.removeItem(STORAGE_KEY); };
|
||||
|
||||
// ── Document status quick-check ────────────────────────────────────────────
|
||||
const handleDocStatusCheck = async () => {
|
||||
@@ -127,11 +142,8 @@ export default function Chatbot() {
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
stream: false,
|
||||
messages: allMessages.map(m => ({
|
||||
role: m.role || (m.type === 'bot' ? 'assistant' : 'user'),
|
||||
content: m.text,
|
||||
reasoning_details: null,
|
||||
})),
|
||||
session_id: sessionId,
|
||||
message: text,
|
||||
}),
|
||||
});
|
||||
if (res.ok) {
|
||||
|
||||
@@ -8,14 +8,18 @@ const CONFIDENCE_STYLES = {
|
||||
unknown: { icon: '⚪', color: 'var(--muted)', bg: 'var(--paper)' },
|
||||
};
|
||||
|
||||
export default function ExpandableSummaryBlock({ extractedData }) {
|
||||
export default function ExpandableSummaryBlock({ extractedData, onSave }) {
|
||||
const [expanded, setExpanded] = useState(false);
|
||||
const [isEditing, setIsEditing] = useState(false);
|
||||
const [editValue, setEditValue] = useState("");
|
||||
const [saveError, setSaveError] = useState("");
|
||||
const [isSaving, setIsSaving] = useState(false);
|
||||
|
||||
// Separate _meta from the actual data fields
|
||||
const { _meta, ...dataFields } = extractedData || {};
|
||||
const entries = Object.entries(dataFields);
|
||||
|
||||
if (entries.length === 0) {
|
||||
if (entries.length === 0 && !isEditing) {
|
||||
return (
|
||||
<div style={{ fontSize: '12px', color: 'var(--muted)', fontStyle: 'italic' }}>
|
||||
Blank form / No user data found.
|
||||
@@ -23,36 +27,147 @@ export default function ExpandableSummaryBlock({ extractedData }) {
|
||||
);
|
||||
}
|
||||
|
||||
const handleEditClick = () => {
|
||||
setEditValue(JSON.stringify(extractedData || {}, null, 2));
|
||||
setSaveError("");
|
||||
setIsEditing(true);
|
||||
};
|
||||
|
||||
const handleCancelEdit = () => {
|
||||
setIsEditing(false);
|
||||
setSaveError("");
|
||||
};
|
||||
|
||||
const handleSave = async () => {
|
||||
setSaveError("");
|
||||
let parsed = null;
|
||||
try {
|
||||
parsed = JSON.parse(editValue);
|
||||
} catch (err) { console.error(err);
|
||||
setSaveError("Invalid JSON format");
|
||||
return;
|
||||
}
|
||||
|
||||
if (onSave) {
|
||||
setIsSaving(true);
|
||||
try {
|
||||
await onSave(parsed);
|
||||
setIsEditing(false);
|
||||
} catch (err) { console.error(err);
|
||||
setSaveError("Failed to save changes");
|
||||
} finally {
|
||||
setIsSaving(false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const handleExport = () => {
|
||||
// Convert extracted data into a 2-column CSV (Field, Value)
|
||||
const { _meta, ...dataFields } = extractedData || {};
|
||||
|
||||
const escapeCsv = (str) => {
|
||||
const s = String(str);
|
||||
if (s.includes(',') || s.includes('"') || s.includes('\n')) {
|
||||
return `"${s.replace(/"/g, '""')}"`;
|
||||
}
|
||||
return s;
|
||||
};
|
||||
|
||||
const csvRows = ['Field,Value'];
|
||||
Object.entries(dataFields).forEach(([key, val]) => {
|
||||
let valStr = val;
|
||||
if (Array.isArray(val)) {
|
||||
valStr = val.join('; ');
|
||||
} else if (typeof val === 'object' && val !== null) {
|
||||
valStr = JSON.stringify(val);
|
||||
}
|
||||
csvRows.push(`${escapeCsv(key)},${escapeCsv(valStr)}`);
|
||||
});
|
||||
|
||||
const csvContent = csvRows.join('\n');
|
||||
const blob = new Blob([csvContent], { type: "text/csv;charset=utf-8;" });
|
||||
const url = URL.createObjectURL(blob);
|
||||
const a = document.createElement("a");
|
||||
a.href = url;
|
||||
a.download = `extracted_data.csv`;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
URL.revokeObjectURL(url);
|
||||
};
|
||||
|
||||
const showToggle = entries.length > 3;
|
||||
const entriesToShow = expanded ? entries : entries.slice(0, 3);
|
||||
const confidenceStyle = CONFIDENCE_STYLES[_meta?.tier] || CONFIDENCE_STYLES.unknown;
|
||||
|
||||
if (isEditing) {
|
||||
return (
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: '10px' }}>
|
||||
<div style={{ fontSize: '12px', fontWeight: 600, color: 'var(--navy)' }}>Edit Extracted Data (JSON)</div>
|
||||
<textarea
|
||||
value={editValue}
|
||||
onChange={(e) => setEditValue(e.target.value)}
|
||||
style={{
|
||||
width: '100%',
|
||||
height: '200px',
|
||||
fontFamily: 'var(--font-mono)',
|
||||
fontSize: '12px',
|
||||
padding: '10px',
|
||||
borderRadius: 'var(--radius-sm)',
|
||||
border: '1px solid var(--border)',
|
||||
background: '#fff',
|
||||
resize: 'vertical'
|
||||
}}
|
||||
/>
|
||||
{saveError && <div style={{ fontSize: '12px', color: 'var(--error)' }}>{saveError}</div>}
|
||||
<div style={{ display: 'flex', gap: '8px' }}>
|
||||
<button onClick={handleSave} disabled={isSaving} className="btn btn-primary btn-sm" style={{borderRadius: 'var(--radius-sm)'}}>
|
||||
{isSaving ? "Saving..." : "Save Changes"}
|
||||
</button>
|
||||
<button onClick={handleCancelEdit} disabled={isSaving} className="btn btn-secondary btn-sm" style={{borderRadius: 'var(--radius-sm)'}}>
|
||||
Cancel
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: '10px' }}>
|
||||
|
||||
{/* Confidence tier badge */}
|
||||
{_meta && (
|
||||
<div
|
||||
title={_meta.description}
|
||||
style={{
|
||||
display: 'inline-flex',
|
||||
alignItems: 'center',
|
||||
gap: '5px',
|
||||
fontSize: '10px',
|
||||
fontWeight: 700,
|
||||
fontFamily: 'var(--font-mono)',
|
||||
color: confidenceStyle.color,
|
||||
background: confidenceStyle.bg,
|
||||
padding: '2px 8px',
|
||||
borderRadius: 'var(--radius-xs)',
|
||||
alignSelf: 'flex-start',
|
||||
cursor: 'help',
|
||||
letterSpacing: '0.3px',
|
||||
}}
|
||||
>
|
||||
{confidenceStyle.icon} {_meta.label}
|
||||
{/* Top action bar: Confidence tier + Edit/Export */}
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'flex-start' }}>
|
||||
{_meta ? (
|
||||
<div
|
||||
title={_meta.description}
|
||||
style={{
|
||||
display: 'inline-flex',
|
||||
alignItems: 'center',
|
||||
gap: '5px',
|
||||
fontSize: '10px',
|
||||
fontWeight: 700,
|
||||
fontFamily: 'var(--font-mono)',
|
||||
color: confidenceStyle.color,
|
||||
background: confidenceStyle.bg,
|
||||
padding: '2px 8px',
|
||||
borderRadius: 'var(--radius-xs)',
|
||||
cursor: 'help',
|
||||
letterSpacing: '0.3px',
|
||||
}}
|
||||
>
|
||||
{confidenceStyle.icon} {_meta.label}
|
||||
</div>
|
||||
) : <div />}
|
||||
|
||||
<div style={{ display: 'flex', gap: '6px' }}>
|
||||
<button onClick={handleExport} style={{ border: 'none', background: 'transparent', cursor: 'pointer', fontSize: '11px', color: 'var(--muted)', display: 'flex', alignItems: 'center', gap: '4px', padding: '2px' }} title="Export CSV">
|
||||
<span className="material-symbols-outlined" style={{ fontSize: '14px' }}>download</span> Export CSV
|
||||
</button>
|
||||
<button onClick={handleEditClick} style={{ border: 'none', background: 'transparent', cursor: 'pointer', fontSize: '11px', color: 'var(--emerald)', display: 'flex', alignItems: 'center', gap: '4px', padding: '2px', fontWeight: 600 }} title="Edit Summary">
|
||||
<span className="material-symbols-outlined" style={{ fontSize: '14px' }}>edit</span> Edit
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Field rows */}
|
||||
{entriesToShow.map(([key, value]) => (
|
||||
|
||||
@@ -5,12 +5,12 @@ export default function Footer() {
|
||||
<footer className="footer">
|
||||
<div className="footer-top">
|
||||
<div className="footer-left">
|
||||
<img src="/images/bookkeeppro-logo.webp" className="footer-logo" alt="BookKeepPro" />
|
||||
<img src="/images/bookkeeppro-logo.webp" className="footer-logo" alt="BookKeepPro" width="190" height="64" />
|
||||
<p>Bookkeeping, payroll and tax preparation for growing businesses — kept precise, kept compliant.</p>
|
||||
</div>
|
||||
|
||||
<div className="footer-links">
|
||||
<h4>Navigate</h4>
|
||||
<h3>Navigate</h3>
|
||||
<Link to="/">Home</Link>
|
||||
<Link to="/about-us">About Us</Link>
|
||||
<Link to="/services">Services</Link>
|
||||
@@ -18,7 +18,7 @@ export default function Footer() {
|
||||
</div>
|
||||
|
||||
<div className="footer-contact">
|
||||
<h4>Reach us</h4>
|
||||
<h3>Reach us</h3>
|
||||
<p>USA · 2520 Indigo Dr, McKinney, TX 75072</p>
|
||||
<p>India · 508 White Square, Hinjewadi Road, Pune 411057</p>
|
||||
<p>atharvg.aiindia@gmail.com</p>
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
import { Link, useNavigate } from 'react-router-dom';
|
||||
import { useState } from 'react';
|
||||
import { useTheme } from '../context/ThemeContext';
|
||||
|
||||
export default function Navbar({ solid = false }) {
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
const navigate = useNavigate();
|
||||
const { theme, toggleTheme } = useTheme();
|
||||
|
||||
return (
|
||||
<div className={`navbar ${solid ? 'navbar-solid' : ''}`}>
|
||||
<div className="nav-container">
|
||||
<Link to="/">
|
||||
<img id="logos" src="/images/bookkeeppro-logo.webp" alt="BookKeepPro" />
|
||||
<img id="logos" src="/images/bookkeeppro-logo.webp" alt="BookKeepPro" width="190" height="64" />
|
||||
</Link>
|
||||
|
||||
<nav id="navMenu" className={`nav-menu ${isOpen ? 'active' : ''}`}>
|
||||
@@ -20,17 +18,6 @@ export default function Navbar({ solid = false }) {
|
||||
<Link to="/services" onClick={() => setIsOpen(false)}>Services</Link>
|
||||
<Link to="/contact" onClick={() => setIsOpen(false)}>Contact Us</Link>
|
||||
|
||||
<button
|
||||
className="theme-toggle"
|
||||
onClick={toggleTheme}
|
||||
style={{ background: 'none', border: 'none', cursor: 'pointer', display: 'flex', alignItems: 'center', justifyContent: 'center', padding: '8px' }}
|
||||
aria-label="Toggle Theme"
|
||||
>
|
||||
<span className="material-symbols-outlined" style={{ fontSize: '22px' }}>
|
||||
{theme === 'dark' ? 'light_mode' : 'dark_mode'}
|
||||
</span>
|
||||
</button>
|
||||
|
||||
<button className="login-btn desktop-login" onClick={() => navigate('/login')}>
|
||||
Sign in
|
||||
</button>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable react-refresh/only-export-components */
|
||||
import { createContext, useContext, useState, useEffect, useCallback } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
import { createContext, useContext, useState, useEffect } from 'react';
|
||||
|
||||
const ThemeContext = createContext();
|
||||
|
||||
export function ThemeProvider({ children }) {
|
||||
const [theme, setTheme] = useState(() => {
|
||||
return localStorage.getItem('theme') || 'light';
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (theme === 'dark') {
|
||||
document.documentElement.classList.add('dark-theme');
|
||||
document.body.classList.add('dark-theme');
|
||||
localStorage.setItem('theme', 'dark');
|
||||
} else {
|
||||
document.documentElement.classList.remove('dark-theme');
|
||||
document.body.classList.remove('dark-theme');
|
||||
localStorage.setItem('theme', 'light');
|
||||
}
|
||||
}, [theme]);
|
||||
|
||||
const toggleTheme = () => {
|
||||
setTheme(prev => prev === 'dark' ? 'light' : 'dark');
|
||||
};
|
||||
|
||||
return (
|
||||
<ThemeContext.Provider value={{ theme, toggleTheme }}>
|
||||
{children}
|
||||
</ThemeContext.Provider>
|
||||
);
|
||||
}
|
||||
|
||||
export const useTheme = () => useContext(ThemeContext);
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable react-refresh/only-export-components */
|
||||
import { createContext, useContext, useState, useCallback } from 'react';
|
||||
|
||||
const ToastContext = createContext();
|
||||
|
||||
+1
-17
@@ -50,23 +50,7 @@
|
||||
--green: #10b981;
|
||||
}
|
||||
|
||||
.dark-theme, body.dark-theme {
|
||||
--color-brand-ink: #F2EFE4;
|
||||
--color-brand-ink-soft: #D5D1C3;
|
||||
|
||||
--color-brand-paper: #10160F;
|
||||
--color-brand-card: #1A2119;
|
||||
|
||||
--color-brand-muted: #A6AC9F;
|
||||
--color-brand-border: #2B3529;
|
||||
|
||||
--color-brand-emerald-light: rgba(90, 168, 138, 0.16);
|
||||
--color-brand-brass-light: rgba(196, 150, 82, 0.16);
|
||||
|
||||
--color-status-success-bg: rgba(90, 168, 138, 0.14);
|
||||
--color-status-error-bg: rgba(214, 110, 110, 0.14);
|
||||
--color-status-warn-bg: rgba(196, 150, 82, 0.16);
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------- */
|
||||
/* Global and Base Elements */
|
||||
|
||||
@@ -1,30 +1,17 @@
|
||||
import { Outlet, Link, useNavigate } from 'react-router-dom';
|
||||
import { useAuth } from '../context/AuthContext';
|
||||
import { useTheme } from '../context/ThemeContext';
|
||||
|
||||
export default function DashboardLayout() {
|
||||
const { user, logout } = useAuth();
|
||||
const navigate = useNavigate();
|
||||
const { theme, toggleTheme } = useTheme();
|
||||
|
||||
return (
|
||||
<div className="app-body">
|
||||
<header className="app-header">
|
||||
<Link to={(user?.role === 'admin' || user?.role === 'super_admin') ? '/admin-dashboard' : '/dashboard'}>
|
||||
<img className="logo" src="/images/bookkeeppro-logo.webp" alt="BookKeepPro" />
|
||||
<img className="logo" src="/images/bookkeeppro-logo.webp" alt="BookKeepPro" width="190" height="64" />
|
||||
</Link>
|
||||
<div className="header-actions">
|
||||
<button
|
||||
className="theme-toggle"
|
||||
onClick={toggleTheme}
|
||||
style={{background:'none', border:'none', color:'inherit', cursor:'pointer', display:'flex', alignItems:'center', justifyContent:'center', padding:'8px'}}
|
||||
aria-label="Toggle Theme"
|
||||
>
|
||||
<span className="material-symbols-outlined theme-toggle-icon" style={{fontSize: '24px'}}>
|
||||
{theme === 'dark' ? 'light_mode' : 'dark_mode'}
|
||||
</span>
|
||||
</button>
|
||||
|
||||
<button className="btn btn-secondary btn-sm" onClick={() => navigate('/profile')}>
|
||||
My Profile
|
||||
</button>
|
||||
|
||||
@@ -6,7 +6,9 @@ export default function MarketingLayout() {
|
||||
return (
|
||||
<>
|
||||
<Navbar />
|
||||
<Outlet />
|
||||
<main>
|
||||
<Outlet />
|
||||
</main>
|
||||
<Footer />
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -50,7 +50,7 @@ export default function AboutUs() {
|
||||
operations support.
|
||||
</p>
|
||||
</div>
|
||||
<img className="about-img" src="/images/young-business-people-using-computer-in-office.jpg" alt="About BookKeepPro" />
|
||||
<img className="about-img" src="/images/young-business-people-using-computer-in-office.webp" alt="About BookKeepPro" width="800" height="533" loading="lazy" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -198,7 +198,7 @@ export default function AdminDashboard() {
|
||||
<div className="stat-value">{stats.total_users}</div>
|
||||
<div className="stat-label">Total Users</div>
|
||||
</div>
|
||||
<div className="stat-card">
|
||||
<div className="stat-card accent-green">
|
||||
<div className="stat-icon"><span className="material-symbols-outlined">security</span></div>
|
||||
<div className="stat-value">{stats.admins}</div>
|
||||
<div className="stat-label">Admin Accounts</div>
|
||||
|
||||
@@ -108,7 +108,7 @@ export default function AdminUserDetail() {
|
||||
} else {
|
||||
alert("Failed to delete user");
|
||||
}
|
||||
} catch (err) {
|
||||
} catch (err) { console.error(err);
|
||||
console.error("Error deleting user", err);
|
||||
}
|
||||
};
|
||||
@@ -128,7 +128,7 @@ export default function AdminUserDetail() {
|
||||
const data = await res.json();
|
||||
showToast(data.detail || "Failed to change role", "error");
|
||||
}
|
||||
} catch (err) {
|
||||
} catch (err) { console.error(err);
|
||||
showToast("Network error", "error");
|
||||
}
|
||||
};
|
||||
@@ -147,7 +147,7 @@ export default function AdminUserDetail() {
|
||||
} else {
|
||||
showToast("Failed to save review status", "error");
|
||||
}
|
||||
} catch (err) {
|
||||
} catch (err) { console.error(err);
|
||||
console.error("Approval error", err);
|
||||
showToast("Approval error", "error");
|
||||
}
|
||||
@@ -185,7 +185,7 @@ export default function AdminUserDetail() {
|
||||
} else {
|
||||
showToast("Failed to upload admin document", "error");
|
||||
}
|
||||
} catch(err) {
|
||||
} catch (err) { console.error(err);
|
||||
showToast("Upload failed", "error");
|
||||
}
|
||||
};
|
||||
@@ -199,11 +199,32 @@ export default function AdminUserDetail() {
|
||||
} else {
|
||||
showToast("Could not generate view link", "error");
|
||||
}
|
||||
} catch (err) {
|
||||
} catch (err) { console.error(err);
|
||||
showToast("Could not generate view link", "error");
|
||||
}
|
||||
};
|
||||
|
||||
const handleUpdateExtractedData = async (docId, type, newData) => {
|
||||
try {
|
||||
const res = await authFetch(`/api/upload/${type}-documents/${docId}/extracted-data`, {
|
||||
method: "PATCH",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ extracted_data: newData })
|
||||
});
|
||||
if (res.ok) {
|
||||
showToast("AI Summary updated successfully", "success");
|
||||
fetchUserDetails();
|
||||
} else {
|
||||
showToast("Failed to update AI Summary", "error");
|
||||
throw new Error("Failed to update");
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
showToast("Network error while updating", "error");
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
const sendEmail = async (type) => {
|
||||
const docsToReview = documents.filter(d => d.type === type);
|
||||
const approved = docsToReview.filter(d => d.review_status === "approved").map(d => d.doc_type);
|
||||
@@ -232,7 +253,7 @@ export default function AdminUserDetail() {
|
||||
} else {
|
||||
showToast("Failed to send email", "error");
|
||||
}
|
||||
} catch(err) {
|
||||
} catch (err) { console.error(err);
|
||||
showToast("Error sending email", "error");
|
||||
}
|
||||
};
|
||||
@@ -250,7 +271,7 @@ export default function AdminUserDetail() {
|
||||
} else {
|
||||
showToast("Failed to submit", "error");
|
||||
}
|
||||
} catch (err) {
|
||||
} catch (err) { console.error(err);
|
||||
showToast("Error submitting documents", "error");
|
||||
}
|
||||
};
|
||||
@@ -390,7 +411,10 @@ export default function AdminUserDetail() {
|
||||
<span className="material-symbols-outlined" style={{ fontSize: '14px', verticalAlign: 'middle', marginRight: '4px' }}>auto_awesome</span>
|
||||
AI Summary
|
||||
</div>
|
||||
<ExpandableSummaryBlock extractedData={doc.extracted_data} />
|
||||
<ExpandableSummaryBlock
|
||||
extractedData={doc.extracted_data}
|
||||
onSave={(newData) => handleUpdateExtractedData(doc.id, doc.type, newData)}
|
||||
/>
|
||||
</div>
|
||||
) : doc.extracted_data === null ? (
|
||||
<div className="ai-summary-block" style={{ opacity: 0.6 }}>
|
||||
@@ -465,7 +489,10 @@ export default function AdminUserDetail() {
|
||||
<span className="material-symbols-outlined" style={{ fontSize: '14px', verticalAlign: 'middle', marginRight: '4px' }}>auto_awesome</span>
|
||||
AI Summary
|
||||
</div>
|
||||
<ExpandableSummaryBlock extractedData={doc.extracted_data} />
|
||||
<ExpandableSummaryBlock
|
||||
extractedData={doc.extracted_data}
|
||||
onSave={(newData) => handleUpdateExtractedData(doc.id, doc.type, newData)}
|
||||
/>
|
||||
</div>
|
||||
) : doc.extracted_data === null ? (
|
||||
<div className="ai-summary-block" style={{ opacity: 0.6 }}>
|
||||
|
||||
@@ -29,7 +29,7 @@ export default function Contact() {
|
||||
phone: '',
|
||||
message: ''
|
||||
});
|
||||
} catch (err) {
|
||||
} catch (err) { console.error(err);
|
||||
alert("Failed to send message");
|
||||
} finally {
|
||||
setLoading(false);
|
||||
@@ -42,7 +42,7 @@ export default function Contact() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="page-hero" style={{ '--hero-img': 'url("/images/home-background.jpg")' }}>
|
||||
<div className="page-hero" style={{ '--hero-img': 'url("/images/home-background.webp")' }}>
|
||||
<div className="page-hero-inner">
|
||||
<span className="eyebrow">Get in touch</span>
|
||||
<h1>Let's talk about your books</h1>
|
||||
|
||||
@@ -4,17 +4,17 @@ const SERVICES = [
|
||||
{
|
||||
label: 'Bookkeeping',
|
||||
title: 'Monthly books, closed clean and on time',
|
||||
img: '/images/services-1.jpg',
|
||||
img: '/images/services-1.webp',
|
||||
},
|
||||
{
|
||||
label: 'Payroll',
|
||||
title: 'Payroll runs your team can set a clock by',
|
||||
img: '/images/services-2.jpg',
|
||||
img: '/images/services-2.webp',
|
||||
},
|
||||
{
|
||||
label: 'Tax',
|
||||
title: 'Tax planning and prep built around your entity',
|
||||
img: '/images/services-3.jpg',
|
||||
img: '/images/services-3.webp',
|
||||
},
|
||||
];
|
||||
|
||||
@@ -71,7 +71,7 @@ export default function Home() {
|
||||
<p className="note">— Our people are passionate about what we do</p>
|
||||
</div>
|
||||
<div className="about-media">
|
||||
<img src="/images/home-about.jpg" alt="BookKeepPro team at work" />
|
||||
<img src="/images/home-about.webp" alt="BookKeepPro team at work" width="800" height="533" loading="lazy" />
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -85,7 +85,7 @@ export default function Home() {
|
||||
{SERVICES.map((s) => (
|
||||
<div className="service-card fade-up" key={s.label}>
|
||||
<div className="service-media">
|
||||
<img src={s.img} alt={s.title} />
|
||||
<img src={s.img} alt={s.title} width="600" height="400" loading="lazy" />
|
||||
</div>
|
||||
<div className="service-body">
|
||||
<span className="service-label">{s.label}</span>
|
||||
|
||||
@@ -29,7 +29,17 @@ export default function Login() {
|
||||
setError("EMAIL_NOT_VERIFIED");
|
||||
return;
|
||||
}
|
||||
throw new Error(errData.detail || "Invalid credentials");
|
||||
let errorMsg = "Invalid credentials";
|
||||
if (errData.detail) {
|
||||
if (typeof errData.detail === 'string') {
|
||||
errorMsg = errData.detail;
|
||||
} else if (Array.isArray(errData.detail)) {
|
||||
errorMsg = errData.detail.map(err => err.msg).join(", ");
|
||||
} else {
|
||||
errorMsg = JSON.stringify(errData.detail);
|
||||
}
|
||||
}
|
||||
throw new Error(errorMsg);
|
||||
}
|
||||
|
||||
const data = await res.json();
|
||||
|
||||
@@ -37,7 +37,17 @@ export default function Profile() {
|
||||
|
||||
if (!res.ok) {
|
||||
const data = await res.json();
|
||||
throw new Error(data.detail || "Failed to update profile");
|
||||
let errorMsg = "Failed to update profile";
|
||||
if (data.detail) {
|
||||
if (typeof data.detail === 'string') {
|
||||
errorMsg = data.detail;
|
||||
} else if (Array.isArray(data.detail)) {
|
||||
errorMsg = data.detail.map(err => err.msg).join(", ");
|
||||
} else {
|
||||
errorMsg = JSON.stringify(data.detail);
|
||||
}
|
||||
}
|
||||
throw new Error(errorMsg);
|
||||
}
|
||||
|
||||
alert("Profile updated successfully. Please log in again if you changed your password.");
|
||||
|
||||
@@ -33,7 +33,17 @@ export default function ResetPassword() {
|
||||
const data = await res.json();
|
||||
|
||||
if (!res.ok) {
|
||||
throw new Error(data.detail || "Password reset failed");
|
||||
let errorMsg = "Password reset failed";
|
||||
if (data.detail) {
|
||||
if (typeof data.detail === 'string') {
|
||||
errorMsg = data.detail;
|
||||
} else if (Array.isArray(data.detail)) {
|
||||
errorMsg = data.detail.map(err => err.msg).join(", ");
|
||||
} else {
|
||||
errorMsg = JSON.stringify(data.detail);
|
||||
}
|
||||
}
|
||||
throw new Error(errorMsg);
|
||||
}
|
||||
|
||||
setMessage("Password reset! Redirecting to sign in...");
|
||||
|
||||
@@ -25,7 +25,7 @@ export default function Services() {
|
||||
benefits to global accounting firms and businesses.
|
||||
</p>
|
||||
</div>
|
||||
<img className="service-img" src="/images/services-3.jpg" alt="Accounting Outsourcing" />
|
||||
<img className="service-img" src="/images/services-3.webp" alt="Accounting Outsourcing" width="600" height="400" loading="lazy" />
|
||||
</div>
|
||||
|
||||
<div className="service-block reverse reveal">
|
||||
@@ -43,7 +43,7 @@ export default function Services() {
|
||||
background so yours doesn't have to.
|
||||
</p>
|
||||
</div>
|
||||
<img className="service-img-bl-3" src="/images/services-2.jpg" alt="Outsourced Accounting Team" />
|
||||
<img className="service-img-bl-3" src="/images/services-2.webp" alt="Outsourced Accounting Team" width="600" height="400" loading="lazy" />
|
||||
</div>
|
||||
|
||||
<div className="service-block reveal">
|
||||
@@ -68,7 +68,7 @@ export default function Services() {
|
||||
cash flow — the foundation of a proactive, confident tax plan.
|
||||
</p>
|
||||
</div>
|
||||
<img className="service-img" src="/images/services-1.jpg" alt="Tax Services" />
|
||||
<img className="service-img" src="/images/services-1.webp" alt="Tax Services" width="600" height="400" loading="lazy" />
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
|
||||
@@ -22,7 +22,17 @@ export default function Signup() {
|
||||
|
||||
if (!res.ok) {
|
||||
const data = await res.json();
|
||||
throw new Error(data.detail || "Signup failed");
|
||||
let errorMsg = "Signup failed";
|
||||
if (data.detail) {
|
||||
if (typeof data.detail === 'string') {
|
||||
errorMsg = data.detail;
|
||||
} else if (Array.isArray(data.detail)) {
|
||||
errorMsg = data.detail.map(err => err.msg).join(", ");
|
||||
} else {
|
||||
errorMsg = JSON.stringify(data.detail);
|
||||
}
|
||||
}
|
||||
throw new Error(errorMsg);
|
||||
}
|
||||
|
||||
// Success, route to login with message
|
||||
|
||||
@@ -57,7 +57,7 @@ export default function UploadBusiness() {
|
||||
const data = await res.json().catch(() => ({}));
|
||||
showToast(data.detail || "Upload failed", "error");
|
||||
}
|
||||
} catch (err) {
|
||||
} catch (err) { console.error(err);
|
||||
showToast("Upload failed due to network error", "error");
|
||||
}
|
||||
};
|
||||
@@ -72,7 +72,7 @@ export default function UploadBusiness() {
|
||||
} else {
|
||||
showToast("Delete failed", "error");
|
||||
}
|
||||
} catch (err) {
|
||||
} catch (err) { console.error(err);
|
||||
showToast("Delete failed", "error");
|
||||
}
|
||||
};
|
||||
@@ -86,7 +86,7 @@ export default function UploadBusiness() {
|
||||
} else {
|
||||
showToast("Could not generate view link", "error");
|
||||
}
|
||||
} catch (err) {
|
||||
} catch (err) { console.error(err);
|
||||
showToast("Could not generate view link", "error");
|
||||
}
|
||||
};
|
||||
@@ -123,7 +123,7 @@ export default function UploadBusiness() {
|
||||
} else {
|
||||
showToast("Failed to notify admin", "error");
|
||||
}
|
||||
} catch (err) {
|
||||
} catch (err) { console.error(err);
|
||||
showToast("Error notifying admin", "error");
|
||||
}
|
||||
};
|
||||
@@ -169,6 +169,8 @@ export default function UploadBusiness() {
|
||||
<div className="doc-slot-status">
|
||||
{uploaded.length ? (
|
||||
<span className="pill-pending"><span className="material-symbols-outlined">pending</span> Pending Review</span>
|
||||
) : dt.download ? (
|
||||
<a href={dt.download} target="_blank" rel="noopener noreferrer" className="btn-link" style={{ fontSize: '14px', color: 'var(--brand)', textDecoration: 'underline' }}>View Template</a>
|
||||
) : (
|
||||
"Missing"
|
||||
)}
|
||||
|
||||
@@ -59,7 +59,7 @@ export default function UploadPersonal() {
|
||||
const data = await res.json().catch(() => ({}));
|
||||
showToast(data.detail || "Upload failed", "error");
|
||||
}
|
||||
} catch (err) {
|
||||
} catch (err) { console.error(err);
|
||||
showToast("Upload failed due to network error", "error");
|
||||
}
|
||||
};
|
||||
@@ -74,7 +74,7 @@ export default function UploadPersonal() {
|
||||
} else {
|
||||
showToast("Delete failed", "error");
|
||||
}
|
||||
} catch (err) {
|
||||
} catch (err) { console.error(err);
|
||||
showToast("Delete failed", "error");
|
||||
}
|
||||
};
|
||||
@@ -88,7 +88,7 @@ export default function UploadPersonal() {
|
||||
} else {
|
||||
showToast("Could not generate view link", "error");
|
||||
}
|
||||
} catch (err) {
|
||||
} catch (err) { console.error(err);
|
||||
showToast("Could not generate view link", "error");
|
||||
}
|
||||
};
|
||||
@@ -125,7 +125,7 @@ export default function UploadPersonal() {
|
||||
} else {
|
||||
showToast("Failed to notify admin", "error");
|
||||
}
|
||||
} catch (err) {
|
||||
} catch (err) { console.error(err);
|
||||
showToast("Error notifying admin", "error");
|
||||
}
|
||||
};
|
||||
@@ -171,6 +171,8 @@ export default function UploadPersonal() {
|
||||
<div className="doc-slot-status">
|
||||
{uploaded.length ? (
|
||||
<span className="pill-pending"><span className="material-symbols-outlined">pending</span> Pending Review</span>
|
||||
) : dt.download ? (
|
||||
<a href={dt.download} target="_blank" rel="noopener noreferrer" className="btn-link" style={{ fontSize: '14px', color: 'var(--brand)', textDecoration: 'underline' }}>View Template</a>
|
||||
) : (
|
||||
"Missing"
|
||||
)}
|
||||
|
||||
@@ -12,6 +12,8 @@ export default function UserDashboard() {
|
||||
const [adminDocs, setAdminDocs] = useState([]);
|
||||
const [loadingDocs, setLoadingDocs] = useState(false);
|
||||
const [docLoading, setDocLoading] = useState(false);
|
||||
// Track which doc rows have the AI summary panel open
|
||||
const [expandedSummary, setExpandedSummary] = useState({});
|
||||
|
||||
// ── declare callbacks BEFORE the effects that reference them ──
|
||||
|
||||
@@ -49,6 +51,14 @@ export default function UserDashboard() {
|
||||
loadAdminDocs();
|
||||
}, [checkEngagement, loadAdminDocs]);
|
||||
|
||||
// Poll every 15s while any doc still has ai_summary === null (backend still processing)
|
||||
useEffect(() => {
|
||||
const hasPending = adminDocs.some(d => d.ai_summary === null);
|
||||
if (!hasPending) return;
|
||||
const timer = setInterval(loadAdminDocs, 15000);
|
||||
return () => clearInterval(timer);
|
||||
}, [adminDocs, loadAdminDocs]);
|
||||
|
||||
const handleEngagementChange = async (e) => {
|
||||
const isChecked = e.target.checked;
|
||||
if (!isChecked) {
|
||||
@@ -64,7 +74,7 @@ export default function UserDashboard() {
|
||||
} else {
|
||||
setEngagementChecked(false);
|
||||
}
|
||||
} catch (err) {
|
||||
} catch (err) { console.error(err);
|
||||
setEngagementChecked(false);
|
||||
}
|
||||
};
|
||||
@@ -78,7 +88,7 @@ export default function UserDashboard() {
|
||||
} else {
|
||||
showToast("Could not generate view link", "error");
|
||||
}
|
||||
} catch (err) {
|
||||
} catch (err) { console.error(err);
|
||||
showToast("Could not generate view link", "error");
|
||||
}
|
||||
};
|
||||
@@ -102,13 +112,17 @@ export default function UserDashboard() {
|
||||
} else {
|
||||
showToast("Failed to submit response", "error");
|
||||
}
|
||||
} catch (err) {
|
||||
} catch (err) { console.error(err);
|
||||
showToast("Network error", "error");
|
||||
} finally {
|
||||
setDocLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const toggleSummary = (docId) => {
|
||||
setExpandedSummary(prev => ({ ...prev, [docId]: !prev[docId] }));
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="page-heading">
|
||||
@@ -192,20 +206,139 @@ export default function UserDashboard() {
|
||||
</thead>
|
||||
<tbody>
|
||||
{adminDocs.map(doc => (
|
||||
<tr key={doc.id}>
|
||||
<td>
|
||||
<div style={{fontWeight: 500, color: 'var(--navy)'}}>{doc.doc_label}</div>
|
||||
<div className="text-sm text-muted">{doc.filename}</div>
|
||||
</td>
|
||||
<td>{new Date(doc.created_at).toLocaleDateString()}</td>
|
||||
<td>
|
||||
<div style={{display:'flex', gap:'8px'}}>
|
||||
<button className="btn btn-secondary btn-sm" onClick={() => viewDoc(doc.storage_key)}>View</button>
|
||||
<button className="btn btn-primary btn-sm" onClick={() => respondDoc(doc.id, true)} disabled={docLoading}>Approve</button>
|
||||
<button className="btn btn-danger btn-sm" onClick={() => respondDoc(doc.id, false)} disabled={docLoading}>Reject</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<>
|
||||
<tr key={doc.id}>
|
||||
<td>
|
||||
<div style={{fontWeight: 500, color: 'var(--navy)'}}>{doc.doc_label}</div>
|
||||
<div className="text-sm text-muted">{doc.filename}</div>
|
||||
</td>
|
||||
<td>{new Date(doc.created_at).toLocaleDateString()}</td>
|
||||
<td>
|
||||
<div style={{display:'flex', gap:'8px', flexWrap:'wrap', alignItems:'center'}}>
|
||||
<button className="btn btn-secondary btn-sm" onClick={() => viewDoc(doc.storage_key)}>View</button>
|
||||
<button className="btn btn-primary btn-sm" onClick={() => respondDoc(doc.id, true)} disabled={docLoading}>Approve</button>
|
||||
<button className="btn btn-danger btn-sm" onClick={() => respondDoc(doc.id, false)} disabled={docLoading}>Reject</button>
|
||||
|
||||
{/* AI Summary badge / button */}
|
||||
{doc.ai_summary === null ? (
|
||||
<span style={{
|
||||
display: 'inline-flex', alignItems: 'center', gap: '6px',
|
||||
fontSize: '11.5px', fontWeight: 500,
|
||||
color: 'var(--brass-dark)',
|
||||
padding: '5px 12px', borderRadius: 'var(--radius-pill)',
|
||||
background: 'var(--brass-light)',
|
||||
border: '1px solid rgba(176,128,61,0.25)',
|
||||
letterSpacing: '0.01em',
|
||||
}}>
|
||||
<span style={{display:'inline-block', animation:'spin 1.5s linear infinite', fontSize:'13px'}}>✦</span>
|
||||
Analyzing…
|
||||
</span>
|
||||
) : doc.ai_summary ? (
|
||||
<button
|
||||
onClick={() => toggleSummary(doc.id)}
|
||||
style={{
|
||||
display: 'inline-flex', alignItems: 'center', gap: '6px',
|
||||
fontSize: '11.5px', fontWeight: 600,
|
||||
padding: '5px 14px', borderRadius: 'var(--radius-pill)',
|
||||
border: expandedSummary[doc.id]
|
||||
? '1px solid var(--accent)'
|
||||
: '1px solid rgba(44,122,91,0.35)',
|
||||
cursor: 'pointer',
|
||||
background: expandedSummary[doc.id]
|
||||
? 'var(--accent)'
|
||||
: 'linear-gradient(135deg, rgba(44,122,91,0.10) 0%, rgba(31,93,70,0.06) 100%)',
|
||||
color: expandedSummary[doc.id] ? '#fff' : 'var(--accent)',
|
||||
boxShadow: expandedSummary[doc.id] ? 'var(--shadow-sm)' : 'none',
|
||||
transition: 'all 0.22s ease',
|
||||
letterSpacing: '0.01em',
|
||||
}}
|
||||
>
|
||||
<span style={{fontSize:'13px'}}>✨</span>
|
||||
{expandedSummary[doc.id] ? 'Hide Summary' : 'AI Summary'}
|
||||
</button>
|
||||
) : null}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{/* Expanded AI Summary panel — spans full row width */}
|
||||
{expandedSummary[doc.id] && doc.ai_summary && (
|
||||
<tr key={`${doc.id}-summary`}>
|
||||
<td colSpan={3} style={{padding: '0 0 14px'}}>
|
||||
<div style={{
|
||||
display: 'flex',
|
||||
borderRadius: 'var(--radius-md)',
|
||||
overflow: 'hidden',
|
||||
border: '1px solid rgba(44,122,91,0.20)',
|
||||
boxShadow: '0 4px 20px -6px rgba(44,122,91,0.18)',
|
||||
background: 'linear-gradient(135deg, rgba(44,122,91,0.07) 0%, rgba(31,93,70,0.03) 100%)',
|
||||
backdropFilter: 'blur(8px)',
|
||||
animation: 'fadeUp 0.2s ease',
|
||||
}}>
|
||||
{/* Left accent strip */}
|
||||
<div style={{
|
||||
width: '4px', flexShrink: 0,
|
||||
background: 'linear-gradient(180deg, var(--accent) 0%, var(--brass) 100%)',
|
||||
}} />
|
||||
|
||||
<div style={{padding: '16px 20px', flex: 1}}>
|
||||
{/* Header row */}
|
||||
<div style={{
|
||||
display: 'flex', alignItems: 'center', gap: '8px',
|
||||
marginBottom: '10px'
|
||||
}}>
|
||||
<div style={{
|
||||
width: '28px', height: '28px', borderRadius: 'var(--radius-xs)',
|
||||
background: 'linear-gradient(135deg, var(--accent) 0%, var(--emerald-dark) 100%)',
|
||||
display: 'flex', alignItems: 'center', justifyContent: 'center',
|
||||
fontSize: '14px', flexShrink: 0,
|
||||
boxShadow: '0 2px 8px rgba(44,122,91,0.30)',
|
||||
}}>
|
||||
✨
|
||||
</div>
|
||||
<div>
|
||||
<div style={{
|
||||
fontSize: '10px', fontWeight: 700,
|
||||
letterSpacing: '0.08em', textTransform: 'uppercase',
|
||||
color: 'var(--accent)',
|
||||
}}>AI Document Summary</div>
|
||||
<div style={{
|
||||
fontSize: '11px', color: 'var(--muted)', marginTop: '1px'
|
||||
}}>Generated by BookKeepPro AI</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Summary text */}
|
||||
<p style={{
|
||||
fontSize: '13.5px', lineHeight: '1.7',
|
||||
color: 'var(--ink)',
|
||||
margin: 0,
|
||||
fontFamily: 'var(--font-body)',
|
||||
}}>
|
||||
{doc.ai_summary}
|
||||
</p>
|
||||
|
||||
{/* Footer disclaimer */}
|
||||
<div style={{
|
||||
display: 'flex', alignItems: 'center', gap: '6px',
|
||||
marginTop: '12px',
|
||||
paddingTop: '10px',
|
||||
borderTop: '1px solid rgba(44,122,91,0.12)',
|
||||
}}>
|
||||
<span style={{fontSize:'11px', color:'var(--muted)'}}>⚠</span>
|
||||
<span style={{
|
||||
fontSize: '11px', color: 'var(--muted)',
|
||||
fontStyle: 'italic',
|
||||
}}>
|
||||
AI-generated summary — always review the original document for authoritative information.
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
)}
|
||||
</>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -26,7 +26,7 @@ export default function VerifyEmail() {
|
||||
setStatus('failed');
|
||||
setMessage(data.detail || "This link is invalid or has expired.");
|
||||
}
|
||||
} catch (err) {
|
||||
} catch (err) { console.error(err);
|
||||
setStatus('failed');
|
||||
setMessage("Could not connect to the server. Please try again later.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user