From 488b65af312499e573413fcf6a26bf00825dfe70 Mon Sep 17 00:00:00 2001 From: ypshim Date: Thu, 22 Oct 2026 12:13:03 +0900 Subject: [PATCH] =?UTF-8?q?fix(view):=20alert=20[=EB=B3=B4=EA=B8=B0]=20hig?= =?UTF-8?q?hlights=20the=20bar=20it=20is=20about=20(=EC=8B=9C=EC=95=88=20?= =?UTF-8?q?=E2=91=A2,=20spec=20=C2=A76.1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [보기] only switched the member tab. The alert now names its bar (RB-F08 → B2), and [보기] switches to the member, highlights that row, and scrolls to it. Co-Authored-By: Claude Haiku 5.5 --- src/core/rebar/summary.ts | 4 +++- src/main.ts | 7 +++++++ tests/rebar-summary.test.ts | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/core/rebar/summary.ts b/src/core/rebar/summary.ts index 963f61b..85a8f75 100644 --- a/src/core/rebar/summary.ts +++ b/src/core/rebar/summary.ts @@ -31,6 +31,8 @@ export interface RebarWarning { message: string; /** Where the alert points: a member tab, or the 공통 설정 (for I02). */ target: RebarRow['member'] | 'common'; + /** The bar the alert is about, so that [보기] can highlight its row. */ + bar?: string; } /** Table metadata per bar (코핑철근.md, 확대기초철근 (1).md, 기둥철근 (1).md, 받침블럭철근.md). */ @@ -154,7 +156,7 @@ export function rebarSummary(model: PierModel, m: Material = DEFAULT_MATERIAL): const split = splitPieces(b.length, 25.4, m.fyS, m.fck, STANDARD_BAR); if (split) { rows.push({ member: 'footing', name: b.name, size: b.size, count: b.count, length: split.pieceLength, note: `${note}, 2조각 이음 (추천안, 겹침 ${Math.round(split.lap)})` }); - warnings.push({ code: 'RB-F08', message: `${b.name} 길이 ${Math.round(b.length)} mm > 정척 ${STANDARD_BAR} mm: 2조각 이음을 추천안으로 적용 (Q-B6).`, target: 'footing' }); + warnings.push({ code: 'RB-F08', message: `${b.name} 길이 ${Math.round(b.length)} mm > 정척 ${STANDARD_BAR} mm: 2조각 이음을 추천안으로 적용 (Q-B6).`, target: 'footing', bar: b.name }); } else { rows.push({ member: 'footing', name: b.name, size: b.size, count: b.count, length: b.length, note }); } diff --git a/src/main.ts b/src/main.ts index 73cd6e1..187e1e4 100644 --- a/src/main.ts +++ b/src/main.ts @@ -74,6 +74,8 @@ const state = { stage: 'shape' as 'shape' | 'plan' | 'rebar', /** ③ 공통 설정 (fck · fy). */ material: { ...DEFAULT_MATERIAL } as Material, + /** Bar highlighted on ③ after [보기] (시안 ③ 알림). */ + rebarFocus: null as string | null, /** Member tab on ③ (철근표). */ rebarMember: 'coping' as RebarRow['member'], /** Member card selected on ② (시안 ② 부재 목록). */ @@ -737,6 +739,7 @@ function renderRebar(): void { nameCell.classList.add('bar-no'); // Clicking a 번호 highlights that row (시안: 번호를 누르면 그 철근만 강조). nameCell.addEventListener('click', () => tr.classList.toggle('hl')); + if (r.name === state.rebarFocus) tr.classList.add('hl'); tr.append( el('td', ROLE[r.name] ?? '—'), nameCell, @@ -766,7 +769,9 @@ function renderRebar(): void { $('mat-fck').focus(); $('mat-fck').scrollIntoView({ block: 'center' }); } else { + // [보기]: go to the member and highlight the bar the alert is about. state.rebarMember = w.target; + state.rebarFocus = w.bar ?? null; renderAll(); } }); @@ -783,6 +788,8 @@ function renderRebar(): void { } $('step3-status').textContent = `계산됨 · 경고 ${warnings.length}`; renderMaterial(); + const focused = box.querySelector('tr.hl'); + if (focused && state.rebarFocus) focused.scrollIntoView({ block: 'center' }); } /** 구분 (role) of each bar, as in the 시안 ③ table. */ diff --git a/tests/rebar-summary.test.ts b/tests/rebar-summary.test.ts index 52115fd..ead6746 100644 --- a/tests/rebar-summary.test.ts +++ b/tests/rebar-summary.test.ts @@ -46,6 +46,7 @@ describe('③ 철근표 요약 (P1)', () => { it('B9: 320 bars; warnings: B2 needs a splice (13646 > 12000)', () => { expect(count('B9')).toBe(320); expect(warnings.map((w) => w.code)).toEqual(['I02', 'RB-F08']); // defaults are assumed values (I02) + expect(warnings.find((w) => w.code === 'RB-F08')!.bar).toBe('B2'); // B2 is split into two pieces (추천안): each piece is about half the 13646 bar plus half the lap. expect(rows.find((r) => r.name === 'B2')!.length!).toBeCloseTo(7776, 0); });