feat(hub): enlarge archive quotes panel and show full text on expand

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-11 20:33:51 +08:00
parent a9c40097b3
commit e7e3a49151
3 changed files with 66 additions and 10 deletions
+34 -6
View File
@@ -5493,7 +5493,7 @@ body.funds-fullscreen-open {
flex-direction: column; flex-direction: column;
gap: 10px; gap: 10px;
padding: 12px; padding: 12px;
min-height: 100%; min-height: calc(100vh - 200px);
overflow: hidden; overflow: hidden;
} }
.archive-panel-head { .archive-panel-head {
@@ -5527,9 +5527,12 @@ body.funds-fullscreen-open {
font-size: 0.82rem; font-size: 0.82rem;
resize: vertical; resize: vertical;
} }
.archive-quote-form textarea {
min-height: 110px;
}
.archive-quotes-list { .archive-quotes-list {
flex: 1 1 auto; flex: 1 1 auto;
min-height: 0; min-height: 420px;
overflow: auto; overflow: auto;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -5543,13 +5546,21 @@ body.funds-fullscreen-open {
} }
.archive-quote-summary { .archive-quote-summary {
display: grid; display: grid;
grid-template-columns: auto 1fr; grid-template-columns: auto 1fr auto;
gap: 8px; gap: 8px;
align-items: center; align-items: center;
padding: 8px 10px; padding: 8px 10px;
cursor: pointer; cursor: pointer;
list-style: none; list-style: none;
} }
.archive-quote-open-hint {
font-size: 0.7rem;
color: var(--accent);
white-space: nowrap;
}
.archive-quote-card[open] .archive-quote-open-hint {
color: var(--muted);
}
.archive-quote-summary::-webkit-details-marker { .archive-quote-summary::-webkit-details-marker {
display: none; display: none;
} }
@@ -5572,9 +5583,21 @@ body.funds-fullscreen-open {
flex-direction: column; flex-direction: column;
gap: 8px; gap: 8px;
} }
.archive-quote-full {
padding: 10px 12px;
border-radius: 8px;
border: 1px solid var(--border-soft);
background: var(--panel);
color: var(--text);
font-size: 0.82rem;
line-height: 1.55;
white-space: pre-wrap;
word-break: break-word;
max-height: none;
}
.archive-quote-edit { .archive-quote-edit {
width: 100%; width: 100%;
min-height: 72px; min-height: 160px;
padding: 8px 10px; padding: 8px 10px;
border-radius: 8px; border-radius: 8px;
border: 1px solid var(--border-soft); border: 1px solid var(--border-soft);
@@ -5583,6 +5606,8 @@ body.funds-fullscreen-open {
font-family: var(--font); font-family: var(--font);
font-size: 0.8rem; font-size: 0.8rem;
resize: vertical; resize: vertical;
line-height: 1.55;
white-space: pre-wrap;
} }
.archive-quote-actions { .archive-quote-actions {
display: flex; display: flex;
@@ -5914,8 +5939,11 @@ body.funds-fullscreen-open {
min-height: 0; min-height: 0;
} }
.archive-quotes-panel { .archive-quotes-panel {
min-height: 280px; min-height: 360px;
max-height: 320px; max-height: none;
}
.archive-quotes-list {
min-height: 220px;
} }
} }
+29 -1
View File
@@ -480,6 +480,22 @@
return s.length > 36 ? s.slice(0, 36) + "…" : s; return s.length > 36 ? s.slice(0, 36) + "…" : s;
} }
function quoteEditRows(text) {
const t = String(text || "");
const lines = t.split(/\n/).length;
const wrapLines = Math.ceil(t.length / 26);
return Math.min(32, Math.max(8, lines, wrapLines));
}
function resizeQuoteTextarea(ta) {
if (!ta) return;
ta.style.height = "auto";
const lines = String(ta.value || "").split("\n").length;
const wrapLines = Math.ceil(String(ta.value || "").length / 26);
ta.rows = Math.min(32, Math.max(8, lines, wrapLines));
ta.style.height = Math.max(ta.scrollHeight, 160) + "px";
}
function renderQuotes() { function renderQuotes() {
if (!elQuotesList) return; if (!elQuotesList) return;
if (elQuotesCount) { if (elQuotesCount) {
@@ -500,11 +516,17 @@
'<span class="archive-quote-preview">' + '<span class="archive-quote-preview">' +
esc(quotePreview(q.content)) + esc(quotePreview(q.content)) +
"</span>" + "</span>" +
'<span class="archive-quote-open-hint">查看</span>' +
"</summary>" + "</summary>" +
'<div class="archive-quote-body">' + '<div class="archive-quote-body">' +
'<div class="archive-quote-full">' +
esc(q.content || "(空)") +
"</div>" +
'<textarea class="archive-quote-edit" data-id="' + '<textarea class="archive-quote-edit" data-id="' +
q.id + q.id +
'" rows="4">' + '" rows="' +
quoteEditRows(q.content) +
'">' +
esc(q.content) + esc(q.content) +
"</textarea>" + "</textarea>" +
'<div class="archive-quote-actions">' + '<div class="archive-quote-actions">' +
@@ -519,6 +541,12 @@
}) })
.join(""); .join("");
elQuotesList.querySelectorAll(".archive-quote-card").forEach(function (card) {
card.addEventListener("toggle", function () {
if (!card.open) return;
resizeQuoteTextarea(card.querySelector(".archive-quote-edit"));
});
});
elQuotesList.querySelectorAll(".archive-quote-save").forEach(function (btn) { elQuotesList.querySelectorAll(".archive-quote-save").forEach(function (btn) {
btn.addEventListener("click", function () { btn.addEventListener("click", function () {
const id = btn.getAttribute("data-id"); const id = btn.getAttribute("data-id");
+3 -3
View File
@@ -15,7 +15,7 @@
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&family=Orbitron:wght@500;600;700&display=swap" rel="stylesheet" media="print" onload="this.media='all'" /> <link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&family=Orbitron:wght@500;600;700&display=swap" rel="stylesheet" media="print" onload="this.media='all'" />
<noscript><link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&family=Orbitron:wght@500;600;700&display=swap" rel="stylesheet" /></noscript> <noscript><link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&family=Orbitron:wght@500;600;700&display=swap" rel="stylesheet" /></noscript>
<link rel="stylesheet" href="/assets/app.css?v=20260612-time-close-table" /> <link rel="stylesheet" href="/assets/app.css?v=20260612-archive-quotes" />
<link rel="stylesheet" href="/assets/dashboard.css?v=20260612-dash-monitor-count" /> <link rel="stylesheet" href="/assets/dashboard.css?v=20260612-dash-monitor-count" />
</head> </head>
<body> <body>
@@ -302,7 +302,7 @@
</div> </div>
<form id="archive-quote-form" class="archive-quote-form"> <form id="archive-quote-form" class="archive-quote-form">
<input id="archive-quote-date" type="date" required /> <input id="archive-quote-date" type="date" required />
<textarea id="archive-quote-content" rows="3" placeholder="今日复盘心得…" required></textarea> <textarea id="archive-quote-content" rows="5" placeholder="今日复盘心得…" required></textarea>
<button type="submit" class="primary">添加语录</button> <button type="submit" class="primary">添加语录</button>
</form> </form>
<div id="archive-quotes-list" class="archive-quotes-list"></div> <div id="archive-quotes-list" class="archive-quotes-list"></div>
@@ -584,7 +584,7 @@
<script src="https://unpkg.com/lightweight-charts@4.2.0/dist/lightweight-charts.standalone.production.js"></script> <script src="https://unpkg.com/lightweight-charts@4.2.0/dist/lightweight-charts.standalone.production.js"></script>
<script src="/assets/chart_draw.js?v=20260609-market-day-split"></script> <script src="/assets/chart_draw.js?v=20260609-market-day-split"></script>
<script src="/assets/chart.js?v=20260609-market-day-split"></script> <script src="/assets/chart.js?v=20260609-market-day-split"></script>
<script src="/assets/archive.js?v=20260612-trade-row-click"></script> <script src="/assets/archive.js?v=20260612-archive-quotes"></script>
<script src="/assets/funds.js?v=20260609-hub-funds-fold"></script> <script src="/assets/funds.js?v=20260609-hub-funds-fold"></script>
<script src="/assets/dashboard.js?v=20260612-dash-monitor-count"></script> <script src="/assets/dashboard.js?v=20260612-dash-monitor-count"></script>
<script src="/assets/ai_review_render.js?v=3"></script> <script src="/assets/ai_review_render.js?v=3"></script>