Apply the repo's comments guideline to src/client/**: delete comments that
restate JSX, Tailwind utilities or standard React behaviour, narrate history,
duplicate docs/, or describe what the next line does; keep only container-query
and containment traps, portal requirements, reference-stability rules with a
real re-render consequence, CSS<->TS constant parities, harness seat and payload
contracts. Align the page's name with the shipped UI label ("Context Insights",
not "Context Dashboard"), unify drifted phrasings, drop the last non-English
fragments, and rewrap survivors onto fewer, fuller lines within the 140-col limit.
Comment lines 5,183 -> 1,822. No code change: comment-stripped content is
identical per file; the client bundle differs only by dead Tailwind utilities
that existed because deleted comments contained those words.
30 lines
761 B
TypeScript
30 lines
761 B
TypeScript
import type { ContextEventRecord } from '../shared/types'
|
|
import { fmt, fmtDuration, fmtShare, fmtTime } from './format'
|
|
import { makeEventText } from './components/events'
|
|
import type { Translate } from './i18n'
|
|
|
|
export interface ViewKit {
|
|
t: Translate
|
|
fmt: typeof fmt
|
|
fmtTime: typeof fmtTime
|
|
fmtDuration: typeof fmtDuration
|
|
fmtShare: typeof fmtShare
|
|
catLabel: (key: string) => string
|
|
eventLabel: (ev: ContextEventRecord) => string
|
|
eventAt: (ev: ContextEventRecord) => string | null
|
|
}
|
|
|
|
export function makeViewKit(t: Translate): ViewKit {
|
|
const { eventLabel, eventAt } = makeEventText(t)
|
|
return {
|
|
t,
|
|
fmt,
|
|
fmtTime,
|
|
fmtDuration,
|
|
fmtShare,
|
|
catLabel: (key: string) => t('cat.' + key),
|
|
eventLabel,
|
|
eventAt,
|
|
}
|
|
}
|