diff --git a/web/components/PriceTargets.tsx b/web/components/PriceTargets.tsx index 1b65863..985051b 100644 --- a/web/components/PriceTargets.tsx +++ b/web/components/PriceTargets.tsx @@ -7,6 +7,7 @@ import { useEffect, useMemo, useState } from "react"; import { readTargets, writeTargets, type Targets } from "../lib/targets"; +import { Collapsible } from "./Collapsible"; type Props = { code: string; @@ -69,12 +70,24 @@ export function PriceTargets({ code, current, onChange }: Props) { const pctCls = (p: number | null): string => p == null ? "text-zinc-500" : p >= 0 ? "text-rose-400" : "text-sky-400"; + // 접힌 상태에서도 유저가 어떤 값을 저장해뒀는지 한눈에 — 둘 다 없으면 InvestmentNote 와 + // 같은 톤의 "비공개 · 브라우저 저장" 안내. 저장값(savedN)이 아닌 dirty 입력값을 보여주면 + // 토글 사이클 사이에 안내가 깜빡여 혼란. saved 기준만 표시. + const fmtNum = (n: number): string => + n.toLocaleString(undefined, { maximumFractionDigits: 0 }); + const subtitle = + saved.target != null && saved.stop != null + ? `목표 ${fmtNum(saved.target)} · 손절 ${fmtNum(saved.stop)}` + : saved.target != null + ? `목표 ${fmtNum(saved.target)}` + : saved.stop != null + ? `손절 ${fmtNum(saved.stop)}` + : "비공개 · 브라우저 저장"; + return ( -