feat(web): wire TickerStrip + status bar role into DashboardLayout (TEC-3047)

- Import TickerStrip vào dashboard layout, truyền vào DashboardLayout.ticker
- Thêm placeholder top-8 quận với TODO comment chờ /analytics/districts API
- Thêm role="status" aria-live="polite" vào status bar div trong DashboardLayout
- 8 Vitest unit tests cho DashboardLayout: role=banner, role=status, ticker,
  sidebar collapse/expand width, main content (tất cả pass)

Note: listings.spec.tsx failure là pre-existing trên HEAD, không liên quan TEC-3047.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Ho Ngoc Hai
2026-04-21 01:47:25 +07:00
parent d07f39b864
commit d6d7584677
3 changed files with 132 additions and 1 deletions

View File

@@ -27,6 +27,8 @@ import { useTranslations } from 'next-intl';
import { useEffect, useState } from 'react';
import { DashboardLayout } from '@/components/design-system/dashboard-layout';
import { CompactHeader } from '@/components/design-system/compact-header';
import { TickerStrip } from '@/components/design-system/ticker-strip';
import type { TickerItem } from '@/components/design-system/ticker-strip';
import { NotificationBell } from '@/components/notifications/notification-bell';
import { useTheme } from '@/components/providers/theme-provider';
import { Button } from '@/components/ui/button';
@@ -296,6 +298,20 @@ export default function AppDashboardLayout({ children }: { children: React.React
/>
);
// ── Ticker strip (top 8 quận, placeholder → TODO: /analytics/districts) ───
// TODO: thay thế bằng dữ liệu thực từ /analytics/districts khi API sẵn sàng (TEC-3047)
const tickerItems: TickerItem[] = [
{ id: 'q1', label: 'Quận 1', changePercent: 2.4, direction: 'up' },
{ id: 'q2', label: 'Quận 2', changePercent: -0.8, direction: 'down' },
{ id: 'q3', label: 'Quận 3', changePercent: 1.1, direction: 'up' },
{ id: 'q7', label: 'Quận 7', changePercent: 3.2, direction: 'up' },
{ id: 'binhthanh', label: 'Bình Thạnh', changePercent: 0.0, direction: 'neutral' },
{ id: 'thuduc', label: 'Thủ Đức', changePercent: 1.7, direction: 'up' },
{ id: 'tanbinh', label: 'Tân Bình', changePercent: -1.3, direction: 'down' },
{ id: 'phuninh', label: 'Phú Nhuận', changePercent: 0.5, direction: 'up' },
];
const ticker = <TickerStrip items={tickerItems} />;
// ── Status bar ───────────────────────────────────────────────────────────
const statusBar = (
<>
@@ -315,6 +331,7 @@ export default function AppDashboardLayout({ children }: { children: React.React
<DashboardLayout
sidebar={sidebar}
header={header}
ticker={ticker}
statusBar={statusBar}
sidebarCollapsed
>