feat: wrap App with ToastProvider for global notifications
This commit is contained in:
@@ -2,6 +2,7 @@ import React, { useState } from 'react';
|
|||||||
import ViolationForm from './components/ViolationForm';
|
import ViolationForm from './components/ViolationForm';
|
||||||
import Dashboard from './components/Dashboard';
|
import Dashboard from './components/Dashboard';
|
||||||
import ReadmeModal from './components/ReadmeModal';
|
import ReadmeModal from './components/ReadmeModal';
|
||||||
|
import ToastProvider from './components/ToastProvider';
|
||||||
|
|
||||||
const tabs = [
|
const tabs = [
|
||||||
{ id: 'dashboard', label: '📊 Dashboard' },
|
{ id: 'dashboard', label: '📊 Dashboard' },
|
||||||
@@ -45,29 +46,31 @@ export default function App() {
|
|||||||
const [showReadme, setShowReadme] = useState(false);
|
const [showReadme, setShowReadme] = useState(false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={s.app}>
|
<ToastProvider>
|
||||||
<nav style={s.nav}>
|
<div style={s.app}>
|
||||||
<div style={s.logoWrap}>
|
<nav style={s.nav}>
|
||||||
<img src="/static/mpm-logo.png" alt="MPM" style={s.logoImg} />
|
<div style={s.logoWrap}>
|
||||||
<div style={s.logoText}>CPAS Tracker</div>
|
<img src="/static/mpm-logo.png" alt="MPM" style={s.logoImg} />
|
||||||
|
<div style={s.logoText}>CPAS Tracker</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{tabs.map(t => (
|
||||||
|
<button key={t.id} style={s.tab(tab === t.id)} onClick={() => setTab(t.id)}>
|
||||||
|
{t.label}
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
|
||||||
|
<button style={s.docsBtn} onClick={() => setShowReadme(true)} title="Open admin documentation">
|
||||||
|
<span>?</span> Docs
|
||||||
|
</button>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div style={s.card}>
|
||||||
|
{tab === 'dashboard' ? <Dashboard /> : <ViolationForm />}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{tabs.map(t => (
|
{showReadme && <ReadmeModal onClose={() => setShowReadme(false)} />}
|
||||||
<button key={t.id} style={s.tab(tab === t.id)} onClick={() => setTab(t.id)}>
|
|
||||||
{t.label}
|
|
||||||
</button>
|
|
||||||
))}
|
|
||||||
|
|
||||||
<button style={s.docsBtn} onClick={() => setShowReadme(true)} title="Open admin documentation">
|
|
||||||
<span>?</span> Docs
|
|
||||||
</button>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<div style={s.card}>
|
|
||||||
{tab === 'dashboard' ? <Dashboard /> : <ViolationForm />}
|
|
||||||
</div>
|
</div>
|
||||||
|
</ToastProvider>
|
||||||
{showReadme && <ReadmeModal onClose={() => setShowReadme(false)} />}
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user