Develop #21

Merged
sakibcc merged 5 commits from develop into main 2026-09-01 11:30:21 +08:00
4 changed files with 17 additions and 11 deletions
Showing only changes of commit c8b08add76 - Show all commits
@@ -90,6 +90,14 @@ export function getSignalJValue(details: SelectionSignal["details"]) {
return formatSignalDetailValue("j", details.j)
}
export function getStockJValue(stock: SelectionStockResult) {
const signal = stock.signals.find(
({ details }) =>
details.j !== null && details.j !== undefined && details.j !== "",
)
return getSignalJValue(signal?.details ?? {})
}
function formatSignalDetailValue(
key: string,
value: number | string | null | undefined,
@@ -8,7 +8,7 @@ import { PatternScoreDetails, PatternScoreSummary } from "./pattern-score"
import {
categoryToneClass,
getCategoryLabel,
getSignalJValue,
getStockJValue,
getStockKey,
} from "./selection-presentation"
import { SignalDetails } from "./signal-details"
@@ -77,9 +77,7 @@ export function SignalRecordList({
<span className="text-xs tabular-nums text-muted-foreground">
J&nbsp;
<strong className="font-semibold text-foreground">
{stock.signals
.map((signal) => getSignalJValue(signal.details))
.join(" / ")}
{getStockJValue(stock)}
</strong>
</span>
<Button
@@ -7,7 +7,7 @@ import { PatternScoreSummary } from "./pattern-score"
import {
categoryToneClass,
getCategoryLabel,
getSignalJValue,
getStockJValue,
getStockKey,
} from "./selection-presentation"
@@ -81,11 +81,7 @@ export function SignalTable({
<PatternScoreSummary score={stock.score} />
</td>
<td className="px-3 text-right align-middle font-semibold tabular-nums text-foreground">
{stock.signals.map((signal) => (
<span key={signal.category} className="block">
{getSignalJValue(signal.details)}
</span>
))}
{getStockJValue(stock)}
</td>
<td className="px-3 text-right align-middle font-medium tabular-nums text-foreground">
¥ {stock.close.toFixed(2)}
@@ -153,11 +153,15 @@ describe("SelectionResultsPage", () => {
expect(within(table).getByText("原始 B1")).toBeInTheDocument()
expect(within(table).getByText("回踩白线 B")).toBeInTheDocument()
expect(within(table).getByText("12")).toBeInTheDocument()
expect(within(table).getByText("13")).toBeInTheDocument()
expect(within(table).queryByText("13")).not.toBeInTheDocument()
expect(within(table).getByText("平安银行")).toBeInTheDocument()
expect(within(table).getByText("86.40 分")).toBeInTheDocument()
expect(within(table).getByText("华纳药厂")).toBeInTheDocument()
const mobileRecord = screen.getAllByRole("article")[0]
expect(within(mobileRecord).getByText("12")).toBeInTheDocument()
expect(within(mobileRecord).queryByText("13")).not.toBeInTheDocument()
const detailPanel = screen.getByRole("complementary", {
name: "当前股票详情",
})