MCPcopy Create free account
hub / github.com/CodebuffAI/codebuff / handleThresholdChange

Function handleThresholdChange

web/src/hooks/use-auto-topup.ts:266–287  ·  view source on GitHub ↗
(rawValue: number)

Source from the content-addressed store, hash-verified

264 )
265
266 const handleThresholdChange = (rawValue: number) => {
267 // Allow any value for UI display
268 setThreshold(rawValue)
269
270 if (isEnabled) {
271 // Make sure we send a valid value to the server
272 const validValue = clamp(
273 rawValue,
274 MIN_THRESHOLD_CREDITS,
275 MAX_THRESHOLD_CREDITS,
276 )
277 pendingSettings.current = { threshold: validValue, topUpAmountDollars }
278
279 // Only save if the value is valid
280 if (
281 rawValue >= MIN_THRESHOLD_CREDITS &&
282 rawValue <= MAX_THRESHOLD_CREDITS
283 ) {
284 debouncedSaveSettings()
285 }
286 }
287 }
288
289 const handleTopUpAmountChange = (rawValue: number) => {
290 // Allow any value for UI display

Callers 1

enableMinimumAutoTopupFunction · 0.50

Calls 1

clampFunction · 0.90

Tested by

no test coverage detected