Improve dashboard responsive layout, collapsible risk section, and breakeven badge.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-29 22:50:48 +08:00
parent 8b4b1a875c
commit d1ad0f9253
5 changed files with 543 additions and 14 deletions
+185
View File
@@ -80,6 +80,7 @@
align-items: baseline;
flex-wrap: wrap;
gap: 0.35rem;
width: 100%;
}
.dash-risk-doc-ref {
@@ -262,3 +263,187 @@
padding: 0.35rem 0.4rem;
}
}
/* ---- 风控折叠 / 平板两行 ---- */
.dash-section-toggle {
cursor: pointer;
user-select: none;
}
.dash-section-toggle-label {
margin-right: 0.15rem;
}
.dash-toggle-icon {
margin-left: auto;
font-size: 0.68rem;
color: var(--text-muted);
transition: transform 0.2s ease;
}
.dashboard-risk-card.is-expanded .dash-toggle-icon {
transform: rotate(180deg);
}
html:is([data-layout="phone"], [data-layout="tablet"], .layout-phone, .layout-tablet)
.dashboard-risk-card:not(.is-expanded) .dash-risk-body {
display: none;
}
html[data-layout="tablet"] .dashboard-risk-grid,
html.layout-tablet .dashboard-risk-grid {
display: grid;
grid-template-columns: repeat(7, minmax(0, 1fr));
overflow-x: visible;
}
html[data-layout="tablet"] .dashboard-risk-item,
html.layout-tablet .dashboard-risk-item {
flex: none;
min-width: 0;
border-right: 1px solid var(--table-border);
border-bottom: 1px solid var(--table-border);
}
html[data-layout="tablet"] .dashboard-risk-item:nth-child(7n),
html.layout-tablet .dashboard-risk-item:nth-child(7n) {
border-right: none;
}
html[data-layout="tablet"] .dashboard-risk-item:nth-last-child(-n+6),
html.layout-tablet .dashboard-risk-item:nth-last-child(-n+6) {
border-bottom: none;
}
html:is([data-layout="phone"], .layout-phone) .dashboard-risk-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
overflow-x: visible;
}
html:is([data-layout="phone"], .layout-phone) .dashboard-risk-item {
flex: none;
min-width: 0;
border-right: 1px solid var(--table-border);
border-bottom: 1px solid var(--table-border);
}
html:is([data-layout="phone"], .layout-phone) .dashboard-risk-item:nth-child(2n) {
border-right: none;
}
html:is([data-layout="phone"], .layout-phone) .dashboard-risk-item:nth-last-child(-n+1) {
border-bottom: none;
}
/* ---- 持仓 / 关键位:桌面平板最多 3 行后滚动 ---- */
html:not([data-layout="phone"]):not(.layout-phone) .dash-pos-table-wrap,
html:not([data-layout="phone"]):not(.layout-phone) .dash-keys-table-wrap {
max-height: 12rem;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
}
html:not([data-layout="phone"]):not(.layout-phone) .dash-pos-table-wrap thead th,
html:not([data-layout="phone"]):not(.layout-phone) .dash-keys-table-wrap thead th {
position: sticky;
top: 0;
z-index: 1;
background: var(--card-inner);
}
/* ---- 手机简要列表 ---- */
.dash-mobile-list {
display: none;
}
html:is([data-layout="phone"], .layout-phone) .dash-mobile-list {
display: block;
}
html:is([data-layout="phone"], .layout-phone) .dash-pos-table-wrap,
html:is([data-layout="phone"], .layout-phone) .dash-keys-table-wrap {
display: none;
}
.dash-mobile-item {
display: block;
width: 100%;
text-align: left;
border: 1px solid var(--table-border);
border-radius: 10px;
background: var(--card-inner);
padding: 0.65rem 0.75rem;
margin-bottom: 0.5rem;
cursor: pointer;
color: inherit;
font: inherit;
transition: border-color 0.2s, box-shadow 0.2s;
}
.dash-mobile-item:hover,
.dash-mobile-item:focus-visible {
border-color: var(--accent);
outline: none;
box-shadow: 0 0 0 1px rgba(76, 194, 255, 0.15);
}
.dash-mobile-item-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 0.45rem;
margin-bottom: 0.3rem;
}
.dash-mobile-item-title {
min-width: 0;
flex: 1;
}
.dash-mobile-item-meta {
font-size: 0.74rem;
color: var(--text-muted);
line-height: 1.45;
}
.dash-mobile-item-foot {
display: flex;
align-items: center;
justify-content: space-between;
gap: 0.5rem;
margin-top: 0.35rem;
font-size: 0.78rem;
}
.dash-mobile-chevron {
font-size: 0.72rem;
color: var(--accent);
white-space: nowrap;
}
.dash-mobile-empty {
padding: 0.85rem 0.35rem;
text-align: center;
color: var(--text-muted);
font-size: 0.82rem;
}
.dash-be-badge {
font-size: 0.66rem;
vertical-align: middle;
}
.dash-detail-modal {
max-width: 520px;
width: 100%;
}
.dash-detail-modal .modal-grid .item.wide {
grid-column: 1 / -1;
}
.dash-detail-modal .modal-actions {
margin-top: 1rem;
text-align: right;
}