mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-09-06 17:46:23 +00:00
Remove hard-coded and capped border radius overrides so shared controls and feature actions consistently follow the active theme radius. - Replace fixed radius utilities with semantic theme-aware radius tokens - Remove redundant `rounded-full` and pixel-based overrides from header, toolbar, Playground, and utility actions - Drop unused `StatusBadge` rounded prop usage - Keep existing component behavior intact while improving global theme consistency
66 lines
1.6 KiB
TypeScript
Vendored
66 lines
1.6 KiB
TypeScript
Vendored
import type { ReactNode } from 'react'
|
|
import type { UseQueryResult } from '@tanstack/react-query'
|
|
import { AutoSkeleton } from 'auto-skeleton-react'
|
|
import { useThemeRadiusPx } from '@/lib/theme-radius'
|
|
import { ErrorState } from '@/components/error-state'
|
|
|
|
interface ContentSkeletonProps {
|
|
loading: boolean
|
|
children: ReactNode
|
|
borderRadius?: number
|
|
minTextHeight?: number
|
|
maxDepth?: number
|
|
className?: string
|
|
}
|
|
|
|
export function ContentSkeleton(props: ContentSkeletonProps) {
|
|
const themeRadius = useThemeRadiusPx()
|
|
|
|
return (
|
|
<div className={props.className}>
|
|
<AutoSkeleton
|
|
loading={props.loading}
|
|
config={{
|
|
animation: 'none',
|
|
baseColor: 'var(--skeleton-base)',
|
|
highlightColor: 'var(--skeleton-highlight)',
|
|
borderRadius: props.borderRadius ?? themeRadius,
|
|
minTextHeight: props.minTextHeight ?? 14,
|
|
maxDepth: props.maxDepth ?? 10,
|
|
}}
|
|
>
|
|
{props.children}
|
|
</AutoSkeleton>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
interface QuerySkeletonProps {
|
|
query: UseQueryResult<unknown, unknown>
|
|
children: ReactNode
|
|
className?: string
|
|
errorTitle?: string
|
|
errorDescription?: string
|
|
}
|
|
|
|
export function QuerySkeleton(props: QuerySkeletonProps) {
|
|
if (props.query.isError) {
|
|
return (
|
|
<ErrorState
|
|
title={props.errorTitle}
|
|
description={props.errorDescription}
|
|
onRetry={() => props.query.refetch()}
|
|
/>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<ContentSkeleton
|
|
loading={props.query.isLoading}
|
|
className={props.className}
|
|
>
|
|
{props.children}
|
|
</ContentSkeleton>
|
|
)
|
|
}
|