MCPcopy Create free account
hub / github.com/claude-code-best/claude-code / ExtraUsageSection

Function ExtraUsageSection

src/components/Settings/Usage.tsx:203–255  ·  view source on GitHub ↗
({ extraUsage, maxWidth }: ExtraUsageSectionProps)

Source from the content-addressed store, hash-verified

201const EXTRA_USAGE_SECTION_TITLE = 'Extra usage';
202
203function ExtraUsageSection({ extraUsage, maxWidth }: ExtraUsageSectionProps): React.ReactNode {
204 const subscriptionType = getSubscriptionType();
205 const isProOrMax = subscriptionType === 'pro' || subscriptionType === 'max';
206 if (!isProOrMax) {
207 // Only show to Pro and Max, consistent with claude.ai non-admin usage settings
208 return false;
209 }
210
211 if (!extraUsage.is_enabled) {
212 if (extraUsageCommand.isEnabled()) {
213 return (
214 <Box flexDirection="column">
215 <Text bold>{EXTRA_USAGE_SECTION_TITLE}</Text>
216 <Text dimColor>Extra usage not enabled · /extra-usage to enable</Text>
217 </Box>
218 );
219 }
220
221 return null;
222 }
223
224 if (extraUsage.monthly_limit === null) {
225 return (
226 <Box flexDirection="column">
227 <Text bold>{EXTRA_USAGE_SECTION_TITLE}</Text>
228 <Text dimColor>Unlimited</Text>
229 </Box>
230 );
231 }
232
233 if (typeof extraUsage.used_credits !== 'number' || typeof extraUsage.utilization !== 'number') {
234 return null;
235 }
236
237 const formattedUsedCredits = formatCost(extraUsage.used_credits / 100, 2);
238 const formattedMonthlyLimit = formatCost(extraUsage.monthly_limit / 100, 2);
239 const now = new Date();
240 const oneMonthReset = new Date(now.getFullYear(), now.getMonth() + 1, 1);
241
242 return (
243 <LimitBar
244 title={EXTRA_USAGE_SECTION_TITLE}
245 limit={{
246 utilization: extraUsage.utilization,
247 // Not applicable for enterprises, but for now we don't render this for them
248 resets_at: oneMonthReset.toISOString(),
249 }}
250 showTimeInReset={false}
251 extraSubtext={`${formattedUsedCredits} / ${formattedMonthlyLimit} spent`}
252 maxWidth={maxWidth}
253 />
254 );
255}

Callers

nothing calls this directly

Calls 3

getSubscriptionTypeFunction · 0.85
formatCostFunction · 0.85
isEnabledMethod · 0.65

Tested by

no test coverage detected