Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 0 additions & 53 deletions dashboard/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

173 changes: 82 additions & 91 deletions dashboard/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState } from 'react';
import { useState, useRef, useEffect } from 'react';
import { EventExplorerPage } from './pages/EventExplorerPage';
import { NotificationTimelineView } from './components/NotificationTimelineView';
import { ActivityFeed } from './components/ActivityFeed';
Expand All @@ -22,105 +22,96 @@ type Tab =
| 'preferences'
| 'templates';

const TAB_ITEMS: { id: Tab; label: string }[] = [
{ id: 'explorer', label: 'Event Explorer' },
{ id: 'timeline', label: 'Delivery Timeline' },
{ id: 'activity', label: 'Activity Feed' },
{ id: 'webhooks', label: 'Webhook Performance' },
{ id: 'export-history', label: 'Export History' },
{ id: 'search', label: 'Notification Search' },
{ id: 'preferences', label: 'Preferences' },
{ id: 'templates', label: 'Templates' },
];

export function App() {
const [tab, setTab] = useState<Tab>('explorer');
const [menuOpen, setMenuOpen] = useState(false);
const { theme, toggleTheme } = useTheme();
const events = useEventStore((state) => state.events);
const menuRef = useRef<HTMLDivElement>(null);

return (
<div className="app">
<div className="app__theme-bar">
<ThemeToggle theme={theme} onToggle={toggleTheme} />
</div>
| 'preferences';
useEffect(() => {
function handleClickOutside(event: MouseEvent) {
if (menuRef.current && !menuRef.current.contains(event.target as Node)) {
setMenuOpen(false);
}
}

export function App() {
const [tab, setTab] = useState<Tab>('explorer');
function handleEscape(event: KeyboardEvent) {
if (event.key === 'Escape') {
setMenuOpen(false);
}
}

if (menuOpen) {
document.addEventListener('mousedown', handleClickOutside);
document.addEventListener('keydown', handleEscape);
}

return () => {
document.removeEventListener('mousedown', handleClickOutside);
document.removeEventListener('keydown', handleEscape);
};
}, [menuOpen]);

const handleTabChange = (newTab: Tab) => {
setTab(newTab);
setMenuOpen(false);
};

return (
<div className="app">
<nav className="app-tabs" role="tablist" aria-label="Main navigation">
<button
type="button"
role="tab"
type="button"
aria-selected={tab === 'explorer'}
className={`app-tabs__btn${tab === 'explorer' ? ' app-tabs__btn--active' : ''}`}
onClick={() => setTab('explorer')}
>
Event Explorer
</button>
<button
type="button"
role="tab"
type="button"
aria-selected={tab === 'timeline'}
className={`app-tabs__btn${tab === 'timeline' ? ' app-tabs__btn--active' : ''}`}
onClick={() => setTab('timeline')}
>
Delivery Timeline
</button>
<button
type="button"
role="tab"
type="button"
aria-selected={tab === 'activity'}
className={`app-tabs__btn${tab === 'activity' ? ' app-tabs__btn--active' : ''}`}
onClick={() => setTab('activity')}
>
Activity Feed
</button>
<button
type="button"
role="tab"
type="button"
aria-selected={tab === 'webhooks'}
className={`app-tabs__btn${tab === 'webhooks' ? ' app-tabs__btn--active' : ''}`}
onClick={() => setTab('webhooks')}
>
Webhook Performance
</button>
<button
type="button"
role="tab"
type="button"
aria-selected={tab === 'export-history'}
className={`app-tabs__btn${tab === 'export-history' ? ' app-tabs__btn--active' : ''}`}
onClick={() => setTab('export-history')}
>
Export History
</button>
<button
type="button"
role="tab"
type="button"
aria-selected={tab === 'search'}
className={`app-tabs__btn${tab === 'search' ? ' app-tabs__btn--active' : ''}`}
onClick={() => setTab('search')}
>
Notification Search
</button>
<button
role="tab"
type="button"
type="button"
role="tab"
aria-selected={tab === 'preferences'}
className={`app-tabs__btn${tab === 'preferences' ? ' app-tabs__btn--active' : ''}`}
onClick={() => setTab('preferences')}
>
Preferences
</button>
<button
role="tab"
type="button"
aria-selected={tab === 'templates'}
className={`app-tabs__btn${tab === 'templates' ? ' app-tabs__btn--active' : ''}`}
onClick={() => setTab('templates')}
>
Templates
</button>
</nav>
<div className="app__topbar">
<div className="app__brand">
<h1 className="app__brand-name">NotifyChain</h1>
<p className="app__brand-eyebrow">Dashboard</p>
</div>
<div className="app__topbar-actions">
<ThemeToggle theme={theme} onToggle={toggleTheme} />
<div className="app__nav-wrapper" ref={menuRef}>
<button
type="button"
className="app-nav__toggle"
onClick={() => setMenuOpen((prev) => !prev)}
aria-expanded={menuOpen}
aria-controls="app-nav-menu"
aria-label="Toggle navigation menu"
>
<span className="app-nav__toggle-icon">{menuOpen ? '✕' : '☰'}</span>
<span className="app-nav__toggle-label">{menuOpen ? 'Close' : 'Menu'}</span>
</button>
<nav
id="app-nav-menu"
className={`app-nav${menuOpen ? ' app-nav--open' : ''}`}
role="tablist"
aria-label="Main navigation"
>
{TAB_ITEMS.map((item) => (
<button
key={item.id}
type="button"
role="tab"
aria-selected={tab === item.id}
className={`app-nav__button${tab === item.id ? ' app-nav__button--active' : ''}`}
onClick={() => handleTabChange(item.id)}
>
{item.label}
</button>
))}
</nav>
</div>
</div>
</div>

{tab === 'explorer' && (
<>
Expand Down
65 changes: 65 additions & 0 deletions dashboard/src/components/ExportHistorySkeleton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
cliinterface ExportHistorySkeletonProps {
rows?: number;
}

function SkeletonCell({ width }: { width: string }) {
return (
<span
className="skeleton-block skeleton-block--inline"
style={{ width, height: '14px' }}
aria-hidden="true"
/>
);
}

export function ExportHistorySkeleton({ rows = 5 }: ExportHistorySkeletonProps) {
return (
<div className="export-table-container" aria-busy="true" aria-label="Loading export history">
<table className="export-table">
<thead>
<tr>
<th scope="col">ID</th>
<th scope="col">Name</th>
<th scope="col">Format</th>
<th scope="col">Created At</th>
<th scope="col" style={{ textAlign: 'right' }}>Records</th>
<th scope="col" style={{ textAlign: 'right' }}>Size</th>
<th scope="col">Status</th>
<th scope="col" style={{ textAlign: 'center' }}>Actions</th>
</tr>
</thead>
<tbody>
{Array.from({ length: rows }).map((_, rowIndex) => (
<tr key={rowIndex} className="export-table__row export-table__row--skeleton">
<td className="export-table__cell-id" data-label="ID">
<SkeletonCell width="60px" />
</td>
<td className="export-table__cell-name" data-label="Name">
<SkeletonCell width="120px" />
</td>
<td data-label="Format">
<SkeletonCell width="50px" />
</td>
<td className="export-table__cell-date" data-label="Created At">
<SkeletonCell width="110px" />
</td>
<td className="export-table__cell-numeric" data-label="Records">
<SkeletonCell width="50px" />
</td>
<td className="export-table__cell-numeric" data-label="Size">
<SkeletonCell width="60px" />
</td>
<td data-label="Status">
<SkeletonCell width="70px" />
</td>
<td className="export-table__cell-action" data-label="Actions">
<SkeletonCell width="80px" />
</td>
</tr>
))}
</tbody>
</table>
</div>
);
}

Loading