feat(notes): per-code private investment note panel

- New lib/notes.ts: localStorage key `notes:<code>` storing { text, updatedAt },
  2000-char cap, blank/whitespace removes the key.
- New InvestmentNote sidebar panel: textarea + character counter, save button
  enabled only when dirty, "방금 전 / N분 전 / 오늘 HH:MM / YYYY-MM-DD"
  relative timestamp on the last save, short save-confirmation toast.
- Mounted in [code]/page.tsx sidebar after AlertsPanel.

Also tightens writeTargets() to require strictly positive finite values,
matching the UI's parseNum() guard so the lib is safe under direct external
calls (reviewer's non-blocking note on a4a4a7f).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
claude-owner
2026-05-29 00:05:33 +09:00
parent a4a4a7f98c
commit 442cc38c32
4 changed files with 165 additions and 2 deletions

View File

@@ -5,6 +5,7 @@ import { useEffect, useMemo, useState } from "react";
import { AlertsPanel } from "../../components/AlertsPanel";
import { CompositeScoreCard } from "../../components/CompositeScoreCard";
import { DisclosuresPanel } from "../../components/DisclosuresPanel";
import { InvestmentNote } from "../../components/InvestmentNote";
import { InvestorCumulative } from "../../components/InvestorCumulative";
import { MetricsPanel } from "../../components/MetricsPanel";
import { PeerComparePanel } from "../../components/PeerComparePanel";
@@ -198,6 +199,7 @@ export default function CodePage({ params }: { params: { code: string } }) {
<OrderbookPanel code={code} />
<PriceTargets code={code} current={current} onChange={setTargets} />
<AlertsPanel code={code} name={chart?.name} current={current} />
<InvestmentNote code={code} />
<RelatedStocks code={code} />
</div>
</div>