Merge branch 'main' into cloudflare

This commit is contained in:
hamster1963 2024-10-12 22:24:09 +08:00
commit 4c746cf597
3 changed files with 14 additions and 7 deletions

View File

@ -246,12 +246,12 @@ export function NetworkChart({
tickFormatter={(value) => `${value}ms`} tickFormatter={(value) => `${value}ms`}
/> />
<ChartTooltip <ChartTooltip
cursor={false}
defaultIndex={1}
content={ content={
<ChartTooltipContent <ChartTooltipContent
indicator={"dot"} indicator={"line"}
className="gap-2"
labelKey="created_at" labelKey="created_at"
labelClassName="text-muted-foreground"
labelFormatter={(_, payload) => { labelFormatter={(_, payload) => {
return formatTime(payload[0].payload.created_at); return formatTime(payload[0].payload.created_at);
}} }}

View File

@ -178,7 +178,7 @@ const ChartTooltipContent = React.forwardRef<
<div <div
ref={ref} ref={ref}
className={cn( className={cn(
"grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl", "grid min-w-[8rem] items-start gap-1.5 rounded-sm border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",
className, className,
)} )}
> >
@ -238,8 +238,15 @@ const ChartTooltipContent = React.forwardRef<
</span> </span>
</div> </div>
{item.value && ( {item.value && (
<span className="ml-2 font-mono font-medium tabular-nums text-foreground"> <span
{item.value.toLocaleString()} className={cn(
"ml-2 font-mono font-medium tabular-nums text-foreground",
payload.length === 1 && "-ml-9",
)}
>
{typeof item.value === "number"
? item.value.toFixed(3).toLocaleString()
: item.value}
</span> </span>
)} )}
</div> </div>

View File

@ -103,7 +103,7 @@ export function formatTime(timestamp: number): string {
const year = date.getFullYear(); const year = date.getFullYear();
const month = date.getMonth() + 1; const month = date.getMonth() + 1;
const day = date.getDate(); const day = date.getDate();
const hours = date.getHours(); const hours = date.getHours().toString().padStart(2, "0");
const minutes = date.getMinutes().toString().padStart(2, "0"); const minutes = date.getMinutes().toString().padStart(2, "0");
const seconds = date.getSeconds().toString().padStart(2, "0"); const seconds = date.getSeconds().toString().padStart(2, "0");
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;