feat(hub): add data dashboard and AI chat with session history
Add /dashboard with daily PnL overview and loss alerts. Extend AI coach chat with history sidebar, delete/switch sessions, message copy, and trading vs general bot modes. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,434 @@
|
||||
/* 数据看板 — 科技感展示 */
|
||||
body.hub-page-dashboard {
|
||||
--dash-cyan: #3ee7ff;
|
||||
--dash-mag: #c45bff;
|
||||
--dash-warn: #ff5c7a;
|
||||
--dash-ok: #3dffb0;
|
||||
--dash-panel: rgba(10, 16, 32, 0.82);
|
||||
--dash-border: rgba(62, 231, 255, 0.22);
|
||||
}
|
||||
|
||||
body.hub-page-dashboard .page#page-dashboard {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.dash-bg-grid {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
pointer-events: none;
|
||||
background-image:
|
||||
linear-gradient(rgba(62, 231, 255, 0.04) 1px, transparent 1px),
|
||||
linear-gradient(90deg, rgba(62, 231, 255, 0.04) 1px, transparent 1px);
|
||||
background-size: 48px 48px;
|
||||
mask-image: radial-gradient(ellipse 80% 70% at 50% 20%, #000 20%, transparent 75%);
|
||||
}
|
||||
|
||||
.dash-bg-glow {
|
||||
position: absolute;
|
||||
width: 520px;
|
||||
height: 520px;
|
||||
border-radius: 50%;
|
||||
filter: blur(90px);
|
||||
opacity: 0.35;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.dash-bg-glow-a {
|
||||
top: -120px;
|
||||
left: -80px;
|
||||
background: var(--dash-cyan);
|
||||
}
|
||||
|
||||
.dash-bg-glow-b {
|
||||
top: 40%;
|
||||
right: -160px;
|
||||
background: var(--dash-mag);
|
||||
}
|
||||
|
||||
.dash-wrap {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 18px;
|
||||
min-height: calc(100vh - 120px);
|
||||
}
|
||||
|
||||
.dash-head {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.dash-head h1 {
|
||||
font-family: Orbitron, var(--font-sans, system-ui), sans-serif;
|
||||
font-size: clamp(1.35rem, 2.5vw, 1.85rem);
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.06em;
|
||||
margin: 0;
|
||||
background: linear-gradient(90deg, var(--dash-cyan), #8fc8ff 45%, var(--dash-mag));
|
||||
-webkit-background-clip: text;
|
||||
background-clip: text;
|
||||
color: transparent;
|
||||
}
|
||||
|
||||
.dash-head-tag {
|
||||
display: inline-block;
|
||||
font-family: JetBrains Mono, monospace;
|
||||
font-size: 0.65rem;
|
||||
color: var(--dash-cyan);
|
||||
border: 1px solid var(--dash-border);
|
||||
padding: 2px 8px;
|
||||
border-radius: 4px;
|
||||
margin-right: 10px;
|
||||
vertical-align: middle;
|
||||
letter-spacing: 0.12em;
|
||||
}
|
||||
|
||||
.dash-head-meta {
|
||||
font-family: JetBrains Mono, monospace;
|
||||
font-size: 0.78rem;
|
||||
color: var(--muted);
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.dash-head-meta strong {
|
||||
color: var(--dash-cyan);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.dash-pulse-dot {
|
||||
display: inline-block;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
background: var(--dash-ok);
|
||||
margin-right: 6px;
|
||||
box-shadow: 0 0 10px var(--dash-ok);
|
||||
animation: dash-pulse 2s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@keyframes dash-pulse {
|
||||
0%,
|
||||
100% {
|
||||
opacity: 1;
|
||||
transform: scale(1);
|
||||
}
|
||||
50% {
|
||||
opacity: 0.55;
|
||||
transform: scale(0.85);
|
||||
}
|
||||
}
|
||||
|
||||
.dash-kpi-row {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.dash-kpi {
|
||||
position: relative;
|
||||
padding: 16px 18px;
|
||||
border-radius: 12px;
|
||||
background: var(--dash-panel);
|
||||
border: 1px solid var(--dash-border);
|
||||
backdrop-filter: blur(12px);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.dash-kpi::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 2px;
|
||||
background: linear-gradient(90deg, transparent, var(--dash-cyan), transparent);
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.dash-kpi-label {
|
||||
font-size: 0.72rem;
|
||||
color: var(--muted);
|
||||
letter-spacing: 0.08em;
|
||||
text-transform: uppercase;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.dash-kpi-value {
|
||||
font-family: JetBrains Mono, monospace;
|
||||
font-size: clamp(1.25rem, 2.2vw, 1.65rem);
|
||||
font-weight: 600;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.dash-kpi-value.pos {
|
||||
color: var(--dash-ok);
|
||||
text-shadow: 0 0 18px rgba(61, 255, 176, 0.35);
|
||||
}
|
||||
|
||||
.dash-kpi-value.neg {
|
||||
color: var(--dash-warn);
|
||||
text-shadow: 0 0 18px rgba(255, 92, 122, 0.35);
|
||||
}
|
||||
|
||||
.dash-kpi-sub {
|
||||
margin-top: 6px;
|
||||
font-size: 0.72rem;
|
||||
color: #8892b0;
|
||||
}
|
||||
|
||||
.dash-alert-banner {
|
||||
display: none;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 12px 16px;
|
||||
border-radius: 10px;
|
||||
border: 1px solid rgba(255, 92, 122, 0.45);
|
||||
background: linear-gradient(90deg, rgba(255, 92, 122, 0.12), rgba(196, 91, 255, 0.08));
|
||||
font-size: 0.85rem;
|
||||
animation: dash-alert-glow 2.5s ease-in-out infinite;
|
||||
}
|
||||
|
||||
.dash-alert-banner.is-on {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
@keyframes dash-alert-glow {
|
||||
0%,
|
||||
100% {
|
||||
box-shadow: 0 0 0 rgba(255, 92, 122, 0);
|
||||
}
|
||||
50% {
|
||||
box-shadow: 0 0 22px rgba(255, 92, 122, 0.25);
|
||||
}
|
||||
}
|
||||
|
||||
.dash-alert-banner strong {
|
||||
color: var(--dash-warn);
|
||||
font-family: Orbitron, sans-serif;
|
||||
letter-spacing: 0.04em;
|
||||
}
|
||||
|
||||
.dash-section {
|
||||
border-radius: 14px;
|
||||
border: 1px solid var(--dash-border);
|
||||
background: var(--dash-panel);
|
||||
backdrop-filter: blur(10px);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.dash-section-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 12px 16px;
|
||||
border-bottom: 1px solid rgba(62, 231, 255, 0.12);
|
||||
font-family: Orbitron, sans-serif;
|
||||
font-size: 0.82rem;
|
||||
letter-spacing: 0.1em;
|
||||
color: var(--dash-cyan);
|
||||
}
|
||||
|
||||
.dash-section-body {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.dash-ac-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
|
||||
gap: 12px;
|
||||
padding: 14px;
|
||||
}
|
||||
|
||||
.dash-ac-card {
|
||||
position: relative;
|
||||
padding: 14px 16px;
|
||||
border-radius: 10px;
|
||||
border: 1px solid rgba(136, 146, 176, 0.2);
|
||||
background: rgba(8, 12, 24, 0.65);
|
||||
transition: border-color 0.2s, box-shadow 0.2s;
|
||||
}
|
||||
|
||||
.dash-ac-card.is-alert {
|
||||
border-color: rgba(255, 92, 122, 0.65);
|
||||
box-shadow:
|
||||
0 0 0 1px rgba(255, 92, 122, 0.2),
|
||||
0 0 28px rgba(255, 92, 122, 0.15);
|
||||
animation: dash-card-alert 3s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@keyframes dash-card-alert {
|
||||
0%,
|
||||
100% {
|
||||
box-shadow:
|
||||
0 0 0 1px rgba(255, 92, 122, 0.2),
|
||||
0 0 20px rgba(255, 92, 122, 0.1);
|
||||
}
|
||||
50% {
|
||||
box-shadow:
|
||||
0 0 0 1px rgba(255, 92, 122, 0.45),
|
||||
0 0 36px rgba(255, 92, 122, 0.22);
|
||||
}
|
||||
}
|
||||
|
||||
.dash-ac-card.is-unmon {
|
||||
opacity: 0.55;
|
||||
}
|
||||
|
||||
.dash-ac-top {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.dash-ac-name {
|
||||
font-weight: 600;
|
||||
font-size: 0.92rem;
|
||||
color: #e8eeff;
|
||||
}
|
||||
|
||||
.dash-ac-badge {
|
||||
font-size: 0.65rem;
|
||||
font-weight: 700;
|
||||
padding: 3px 8px;
|
||||
border-radius: 4px;
|
||||
letter-spacing: 0.06em;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.dash-ac-badge.alert {
|
||||
color: #fff;
|
||||
background: linear-gradient(135deg, #ff5c7a, #c45bff);
|
||||
}
|
||||
|
||||
.dash-ac-badge.ok {
|
||||
color: var(--dash-cyan);
|
||||
border: 1px solid var(--dash-border);
|
||||
}
|
||||
|
||||
.dash-ac-metrics {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 8px 12px;
|
||||
font-family: JetBrains Mono, monospace;
|
||||
font-size: 0.76rem;
|
||||
}
|
||||
|
||||
.dash-ac-metric span {
|
||||
display: block;
|
||||
color: #8892b0;
|
||||
font-size: 0.65rem;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
.dash-ac-metric strong.pos {
|
||||
color: var(--dash-ok);
|
||||
}
|
||||
|
||||
.dash-ac-metric strong.neg {
|
||||
color: var(--dash-warn);
|
||||
}
|
||||
|
||||
.dash-loss-bar {
|
||||
margin-top: 10px;
|
||||
height: 4px;
|
||||
border-radius: 2px;
|
||||
background: rgba(255, 255, 255, 0.08);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.dash-loss-bar i {
|
||||
display: block;
|
||||
height: 100%;
|
||||
border-radius: 2px;
|
||||
background: linear-gradient(90deg, var(--dash-warn), var(--dash-mag));
|
||||
transition: width 0.6s ease;
|
||||
}
|
||||
|
||||
.dash-ac-remark {
|
||||
margin-top: 10px;
|
||||
font-size: 0.7rem;
|
||||
color: #8892b0;
|
||||
line-height: 1.4;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.dash-table-wrap {
|
||||
overflow: auto;
|
||||
max-height: min(52vh, 480px);
|
||||
}
|
||||
|
||||
.dash-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
font-family: JetBrains Mono, monospace;
|
||||
font-size: 0.74rem;
|
||||
}
|
||||
|
||||
.dash-table th {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 1;
|
||||
text-align: left;
|
||||
padding: 10px 12px;
|
||||
background: rgba(12, 18, 36, 0.95);
|
||||
color: var(--dash-cyan);
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.06em;
|
||||
border-bottom: 1px solid var(--dash-border);
|
||||
}
|
||||
|
||||
.dash-table td {
|
||||
padding: 9px 12px;
|
||||
border-bottom: 1px solid rgba(42, 52, 72, 0.5);
|
||||
color: #c5cde0;
|
||||
}
|
||||
|
||||
.dash-table tr:hover td {
|
||||
background: rgba(62, 231, 255, 0.04);
|
||||
}
|
||||
|
||||
.dash-table tr.is-alert-row td {
|
||||
background: rgba(255, 92, 122, 0.08);
|
||||
}
|
||||
|
||||
.dash-table .pos {
|
||||
color: var(--dash-ok);
|
||||
}
|
||||
|
||||
.dash-table .neg {
|
||||
color: var(--dash-warn);
|
||||
}
|
||||
|
||||
.dash-empty {
|
||||
padding: 32px;
|
||||
text-align: center;
|
||||
color: var(--muted);
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.dash-status {
|
||||
font-family: JetBrains Mono, monospace;
|
||||
font-size: 0.75rem;
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.dash-status.err {
|
||||
color: var(--dash-warn);
|
||||
}
|
||||
|
||||
@media (max-width: 720px) {
|
||||
.dash-ac-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.dash-head-meta {
|
||||
text-align: left;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user