mirror of
https://github.com/anomalyco/opencode.git
synced 2026-08-27 04:52:15 +00:00
chore: generate
This commit is contained in:
parent
afd6f3b064
commit
322e2b9dd5
2 changed files with 11 additions and 13 deletions
|
|
@ -17,11 +17,7 @@ export type LiteUsageBreakdownItem = {
|
|||
estimated: boolean
|
||||
}
|
||||
|
||||
export function buildLiteUsageBreakdown(input: {
|
||||
usage: number
|
||||
limit: number
|
||||
sources: LiteUsageBreakdownSource[]
|
||||
}) {
|
||||
export function buildLiteUsageBreakdown(input: { usage: number; limit: number; sources: LiteUsageBreakdownSource[] }) {
|
||||
const rows: LiteUsageBreakdownItem[] = input.sources
|
||||
.filter((item) => item.cost !== 0 || item.quotaCost !== 0)
|
||||
.sort((a, b) => b.quotaCost - a.quotaCost)
|
||||
|
|
|
|||
|
|
@ -140,7 +140,9 @@ export const queryLiteUsageDetails = query(async (workspaceID: string, window: L
|
|||
const now = new Date()
|
||||
const detail = (() => {
|
||||
if (window === "rolling") {
|
||||
const active = !!row.timeRollingUpdated && row.timeRollingUpdated >= new Date(now.getTime() - limits.rollingWindow * 3600 * 1000)
|
||||
const active =
|
||||
!!row.timeRollingUpdated &&
|
||||
row.timeRollingUpdated >= new Date(now.getTime() - limits.rollingWindow * 3600 * 1000)
|
||||
return {
|
||||
start: active ? row.timeRollingUpdated! : now,
|
||||
usage: active ? (row.rollingUsage ?? 0) : 0,
|
||||
|
|
@ -356,7 +358,12 @@ function LiteUsageItem(props: {
|
|||
)
|
||||
}
|
||||
|
||||
function LiteUsageDetails(props: { id: LiteUsageWindow; label: string; quotaLabel: string; usage: LiteUsageDetailsData }) {
|
||||
function LiteUsageDetails(props: {
|
||||
id: LiteUsageWindow
|
||||
label: string
|
||||
quotaLabel: string
|
||||
usage: LiteUsageDetailsData
|
||||
}) {
|
||||
const i18n = useI18n()
|
||||
const language = useLanguage()
|
||||
const money = (amount: number) =>
|
||||
|
|
@ -480,12 +487,7 @@ function LiteUsageGroup(props: { lite: NonNullable<LiteSubscription> }) {
|
|||
}
|
||||
>
|
||||
{(usage) => (
|
||||
<LiteUsageDetails
|
||||
id={item().id}
|
||||
label={item().label}
|
||||
quotaLabel={item().quotaLabel}
|
||||
usage={usage()}
|
||||
/>
|
||||
<LiteUsageDetails id={item().id} label={item().label} quotaLabel={item().quotaLabel} usage={usage()} />
|
||||
)}
|
||||
</Show>
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue