File size: 1,920 Bytes
f22b512
375d687
 
 
 
f22b512
375d687
 
 
165a274
a38a802
 
 
375d687
 
 
 
 
 
 
 
 
 
 
c412fbd
375d687
 
 
 
 
c412fbd
 
375d687
 
 
 
 
 
 
165a274
 
 
 
 
 
 
 
 
375d687
c412fbd
 
 
 
 
a38a802
375d687
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { IconAsk, IconEval, IconLogout, IconOverview, IconShield, IconSpark } from "../lib/icons";

const NAV = [
  { id: "overview", label: "Overview", Icon: IconOverview },
  { id: "ask", label: "Ask", Icon: IconAsk },
  { id: "audit", label: "Audit", Icon: IconShield },
  { id: "evaluation", label: "Evaluation", Icon: IconEval },
];

export default function Sidebar({ view, setView, online, llmAvailable, userEmail, onLogout }) {
  const status = online
    ? `API online · ${llmAvailable ? "Thinking ready" : "Fast mode"}`
    : "API offline";
  return (
    <aside className="sidebar">
      <div className="brand">
        <span className="brand-mark">
          <IconSpark size={17} />
        </span>
        <span className="brand-name brand-sub-hide">
          FinanceFlow <span>AI</span>
        </span>
      </div>

      <nav className="nav" aria-label="Primary">
        {NAV.map(({ id, label, Icon }) => (
          <button
            key={id}
            className={`nav-item ${view === id ? "active" : ""}`}
            onClick={() => setView(id)}
            aria-label={label}
            aria-current={view === id ? "page" : undefined}
          >
            <Icon />
            <span className="label">{label}</span>
          </button>
        ))}
      </nav>

      {userEmail && (
        <div className="sidebar-account brand-sub-hide">
          <span className="acct-email" title={userEmail}>{userEmail}</span>
          <button className="acct-logout" onClick={onLogout} aria-label="Log out" title="Log out">
            <IconLogout size={15} />
          </button>
        </div>
      )}

      <div className="sidebar-foot">
        <span
          className={`status-dot ${online ? "" : "off"}`}
          role="img"
          aria-label={online ? "API online" : "API offline"}
        />
        <span className="brand-sub-hide">{status}</span>
      </div>
    </aside>
  );
}