fix(web): prevent usage summary shift for unpriced records (#13991)
This commit is contained in:
1 parent
94f92a7a38
commit
d15210cd3d
1 file changed
+27
-7
@@ -10,6 +10,7 @@ import {
|
||||
CircleAlertIcon,
|
||||
ChevronDownIcon,
|
||||
CircleDashedIcon,
|
||||
InfoIcon,
|
||||
SlidersHorizontalIcon,
|
||||
} from "lucide-react";
|
||||
import { useEffect, useEffectEvent, useMemo, useRef, useState } from "react";
|
||||
@@ -64,6 +65,7 @@ import { SidebarInset } from "../ui/sidebar";
|
||||
import { Skeleton } from "../ui/skeleton";
|
||||
import { Toggle, ToggleGroup } from "../ui/toggle-group";
|
||||
import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
|
||||
import { Popover, PopoverPopup, PopoverTrigger } from "../ui/popover";
|
||||
import {
|
||||
WorkspaceBreadcrumb,
|
||||
WorkspaceBreadcrumbItem,
|
||||
@@ -486,13 +488,31 @@ export function UsagePage() {
|
||||
: formatTokens(merged.totalTokens)}
|
||||
</span>
|
||||
<span className="text-xs text-muted-foreground">
|
||||
{metric !== "cost"
|
||||
? `${formatCount(merged.sessions)} sessions`
|
||||
: merged.costQuality.unpricedShare > 0
|
||||
? `${formatCount(merged.sessions)} sessions · API estimate excludes ${formatPercent(
|
||||
merged.costQuality.unpricedShare,
|
||||
)} unpriced records`
|
||||
: `${formatCount(merged.sessions)} sessions · API estimate`}
|
||||
{formatCount(merged.sessions)} sessions
|
||||
{metric === "cost" && (
|
||||
<>
|
||||
{" · API estimate"}
|
||||
{merged.costQuality.unpricedShare > 0 && (
|
||||
<>
|
||||
{" "}
|
||||
<Popover>
|
||||
<PopoverTrigger
|
||||
openOnHover
|
||||
render={<InlineButton tone="muted" />}
|
||||
aria-label="Unpriced usage details"
|
||||
>
|
||||
<InfoIcon className="size-3" aria-hidden />
|
||||
</PopoverTrigger>
|
||||
<PopoverPopup side="top" tooltipStyle>
|
||||
API estimate excludes{" "}
|
||||
{formatPercent(merged.costQuality.unpricedShare)} unpriced
|
||||
records.
|
||||
</PopoverPopup>
|
||||
</Popover>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in new issue
Block a user