mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-24 19:16:18 +01:00
The directory has existed on disk with 58 untracked files, four of them over the 250-line cap. An untracked file is invisible to every pre-commit hook, so those violations could not be fixed or gated while it stayed that way -- and its CI workflow was untracked too, so nothing ran against it. Landed with its already-written evidence artifact and a contract, since this crosses the 4-file threshold. Verified before staging: 58 plain text source/config files, no binaries, no node_modules, no build output. npm run check passes -- typecheck, eslint --max-warnings 0, and 220 tests at 100% statements/branches/functions/lines. Splitting its four oversized files is deliberately a separate commit. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011w2Pj4Ek3ZNMQVYcFHgXDY
51 lines
1.5 KiB
TypeScript
51 lines
1.5 KiB
TypeScript
import { useState } from 'react'
|
|
import type { ChangeEvent, ReactElement, SubmitEvent } from 'react'
|
|
import type { SettledDebt } from '../stakes/types'
|
|
import { taskLabel } from './taskLabel'
|
|
|
|
interface OutstandingDebtRowProps {
|
|
debt: SettledDebt
|
|
onLogDebtProgress: (debtId: string, units: number) => void
|
|
}
|
|
|
|
/**
|
|
* Shared by `BuyInScreen` (the hard gate) and `DebtHistoryPanel` (the ledger) so the two can never
|
|
* drift apart — the plan's "log N units done" control is the only way `paidUnits` advances, and
|
|
* there is deliberately no mark-paid checkbox to short-circuit it.
|
|
*/
|
|
export const OutstandingDebtRow = ({ debt, onLogDebtProgress }: OutstandingDebtRowProps): ReactElement => {
|
|
const [units, setUnits] = useState('')
|
|
|
|
const submit = (event: SubmitEvent<HTMLFormElement>): void => {
|
|
event.preventDefault()
|
|
const parsed = Number(units)
|
|
if (!Number.isInteger(parsed) || parsed <= 0) {
|
|
return
|
|
}
|
|
onLogDebtProgress(debt.id, parsed)
|
|
setUnits('')
|
|
}
|
|
|
|
return (
|
|
<li>
|
|
<span>
|
|
{taskLabel(debt.taskTypeId)}: {debt.paidUnits} / {debt.owedUnits} done
|
|
</span>
|
|
<form className="log-progress" onSubmit={submit}>
|
|
<input
|
|
type="number"
|
|
min={1}
|
|
value={units}
|
|
onChange={(event: ChangeEvent<HTMLInputElement>) => {
|
|
setUnits(event.target.value)
|
|
}}
|
|
aria-label={`Log units done for ${taskLabel(debt.taskTypeId)}`}
|
|
/>
|
|
<button type="submit" className="button">
|
|
Log progress
|
|
</button>
|
|
</form>
|
|
</li>
|
|
)
|
|
}
|