1616 * specific language governing permissions and limitations
1717 * under the License.
1818 */
19- import { Box , Text , Button , useDisclosure , Skeleton } from "@chakra-ui/react" ;
19+ import { Box , Button , useDisclosure , Skeleton } from "@chakra-ui/react" ;
2020import { useTranslation } from "react-i18next" ;
21- import { FiChevronRight } from "react-icons/fi" ;
2221import { LuPlug } from "react-icons/lu" ;
2322
2423import { usePluginServiceImportErrors } from "openapi/queries" ;
2524import { ErrorAlert , type ExpandedApiError } from "src/components/ErrorAlert" ;
2625import { StateBadge } from "src/components/StateBadge" ;
26+ import { StatsCard } from "src/components/StatsCard" ;
2727
2828import { PluginImportErrorsModal } from "./PluginImportErrorsModal" ;
2929
3030export const PluginImportErrors = ( { iconOnly = false } : { readonly iconOnly ?: boolean } ) => {
3131 const { onClose, onOpen, open } = useDisclosure ( ) ;
32- const { t : translate } = useTranslation ( "admin" ) ;
32+ const { i18n , t : translate } = useTranslation ( "admin" ) ;
3333 const { data, error, isLoading } = usePluginServiceImportErrors ( ) ;
3434
35+ const isRTL = i18n . dir ( ) === "rtl" ;
36+
3537 const importErrorsCount = data ?. total_entries ?? 0 ;
3638 const importErrors = data ?. import_errors ?? [ ] ;
3739
@@ -48,7 +50,7 @@ export const PluginImportErrors = ({ iconOnly = false }: { readonly iconOnly?: b
4850 }
4951
5052 return (
51- < Box alignItems = "center" display = "flex" maxH = "10px" >
53+ < Box alignItems = "center" display = "flex" >
5254 < ErrorAlert error = { error } />
5355 { iconOnly ? (
5456 < StateBadge
@@ -62,23 +64,15 @@ export const PluginImportErrors = ({ iconOnly = false }: { readonly iconOnly?: b
6264 { importErrorsCount }
6365 </ StateBadge >
6466 ) : (
65- < Button
66- alignItems = "center"
67- borderRadius = "md"
68- display = "flex"
69- gap = { 2 }
67+ < StatsCard
68+ colorScheme = "failed"
69+ count = { importErrorsCount }
70+ icon = { < LuPlug /> }
71+ isLoading = { isLoading }
72+ isRTL = { isRTL }
73+ label = { translate ( "plugins.importError" , { count : importErrorsCount } ) }
7074 onClick = { onOpen }
71- variant = "outline"
72- >
73- < StateBadge colorPalette = "failed" >
74- < LuPlug />
75- { importErrorsCount }
76- </ StateBadge >
77- < Box alignItems = "center" display = "flex" gap = { 1 } >
78- < Text fontWeight = "bold" > { translate ( "plugins.importError" , { count : importErrorsCount } ) } </ Text >
79- < FiChevronRight />
80- </ Box >
81- </ Button >
75+ />
8276 ) }
8377 < PluginImportErrorsModal importErrors = { importErrors } onClose = { onClose } open = { open } />
8478 </ Box >
0 commit comments