+3
-6
@@ -33,14 +33,11 @@ function resetTiming(resetsAt: number, now: number) {
|
||||
return `${minutes}m`;
|
||||
}
|
||||
|
||||
export function formatQuotaWindow(
|
||||
window: QuotaWindow & { remaining: number; sessionConsumed: number },
|
||||
now = Date.now(),
|
||||
) {
|
||||
export function formatQuotaWindow(window: QuotaWindow & { remaining: number }, now = Date.now()) {
|
||||
const label = window.label
|
||||
? `${window.label} ${duration(window.seconds)}`
|
||||
: duration(window.seconds);
|
||||
return `${label}: ${percent(window.remaining)}% · ~${percent(window.sessionConsumed)}pp · ${resetTiming(window.resetsAt, now)}`;
|
||||
return `${label}: ${percent(window.remaining)}% · ${resetTiming(window.resetsAt, now)}`;
|
||||
}
|
||||
|
||||
export async function loadQuotaStatus(load: () => Promise<QuotaStatus | null>) {
|
||||
@@ -66,7 +63,7 @@ export default Plugin.define({
|
||||
const Slot = (props: { sessionID: string }) => {
|
||||
const [status] = createResource(
|
||||
() => `${props.sessionID}:${revision()}`,
|
||||
() => loadQuotaStatus(() => quota.status({ sessionID: props.sessionID })),
|
||||
() => loadQuotaStatus(() => quota.status({})),
|
||||
);
|
||||
return (
|
||||
<Show when={status()}>
|
||||
|
||||
Reference in New Issue
Block a user