π File detail
components/EffortIndicator.ts
π§© .tsπ 43 linesπΎ 1,128 bytesπ text
β Back to All Filesπ― Use case
This file lives under βcomponents/β, which covers shared React UI pieces. On the API surface it exposes getEffortNotificationText and effortLevelToSymbol β mainly functions, hooks, or classes. It composes internal code from constants and utils (relative imports).
Generated from folder role, exports, dependency roots, and inline comments β not hand-reviewed for every path.
π§ Inline summary
import { EFFORT_HIGH, EFFORT_LOW, EFFORT_MAX, EFFORT_MEDIUM,
π€ Exports (heuristic)
getEffortNotificationTexteffortLevelToSymbol
π₯οΈ Source preview
import {
EFFORT_HIGH,
EFFORT_LOW,
EFFORT_MAX,
EFFORT_MEDIUM,
} from '../constants/figures.js'
import {
type EffortLevel,
type EffortValue,
getDisplayedEffortLevel,
modelSupportsEffort,
} from '../utils/effort.js'
/**
* Build the text for the effort-changed notification, e.g. "β medium Β· /effort".
* Returns undefined if the model doesn't support effort.
*/
export function getEffortNotificationText(
effortValue: EffortValue | undefined,
model: string,
): string | undefined {
if (!modelSupportsEffort(model)) return undefined
const level = getDisplayedEffortLevel(model, effortValue)
return `${effortLevelToSymbol(level)} ${level} Β· /effort`
}
export function effortLevelToSymbol(level: EffortLevel): string {
switch (level) {
case 'low':
return EFFORT_LOW
case 'medium':
return EFFORT_MEDIUM
case 'high':
return EFFORT_HIGH
case 'max':
return EFFORT_MAX
default:
// Defensive: level can originate from remote config. If an unknown
// value slips through, render the high symbol rather than undefined.
return EFFORT_HIGH
}
}