codeburn/app/renderer/components/TruncTip.tsx
Resham Joshi ec24de6e65
fix(pr): charge pushed branches to their PR and show every PR's details (#1737)
* fix(pr): push evidence beats the carried pr-link, show every PR fact

Claude Code's pr-link tags a session with its latest PR and CodeBurn carried
that tag to every later turn and subagent run. A run or turn that pushes the
head branch of a PR opened in the same data (paired gh pr create --head) now
goes to that PR, same repo only; spend left only on the tag is carriedUSD.
Rows also get runList (why each run counts), a locally evidenced state and
follow-up round times, and a call opening several PRs pairs its pr-link with
the last create. The PR card states every unknown and the expanded view shows
timeline, runs, cost by phase and work as compact tables.

* fix(app): full text on hover for cropped PR cells, plainer wording for same-session spend

Truncated PR labels, run descriptions, table labels and summary figures now show their full text in the shared tooltip surface while cut off. The carried-from-session-tag wording becomes 'from other work in the same session' in all six locales.

* fix(pr): explain carried spend without the pr-link jargon
2026-10-10 23:47:23 +02:00

23 lines
1.1 KiB
TypeScript

import { createElement, useId, useRef, useState, type ReactNode } from 'react'
import { AnchoredSurface } from './AnchoredSurface'
import { useEscape } from '../hooks/useEscape'
/** An element that shows its full text in the shared tooltip surface, on hover
* or focus, only while its text is cut off by an ellipsis. */
export function TruncTip({ as = 'span', text, children, ...rest }: { as?: string; text: string; children?: ReactNode } & Record<string, unknown>) {
const ref = useRef<HTMLElement>(null)
const surfaceRef = useRef<HTMLDivElement>(null)
const [open, setOpen] = useState(false)
const id = useId()
useEscape(open, () => setOpen(false))
const show = () => {
const el = ref.current
if (el && el.scrollWidth > el.clientWidth) setOpen(true)
}
return (
<>
{createElement(as, { ...rest, ref, 'aria-describedby': open ? id : undefined, onMouseEnter: show, onMouseLeave: () => setOpen(false), onFocus: show, onBlur: () => setOpen(false) }, children ?? text)}
{open && <AnchoredSurface anchor={ref} surfaceRef={surfaceRef} id={id} className="pop-menu usd-pop trunc-pop" role="tooltip">{text}</AnchoredSurface>}
</>
)
}