bbovenzi commented on code in PR #49519:
URL: https://github.com/apache/airflow/pull/49519#discussion_r2054274824


##########
airflow-core/src/airflow/ui/src/pages/Dashboard/Stats/Stats.tsx:
##########
@@ -16,33 +16,82 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-import { Box, Flex, Heading, HStack } from "@chakra-ui/react";
-import { FiClipboard, FiZap } from "react-icons/fi";
+import { Box, Flex, Heading, SimpleGrid } from "@chakra-ui/react";
+import { FiClipboard } from "react-icons/fi";
 
-import { StateIcon } from "src/components/StateIcon";
+import { useDagServiceGetDags } from "openapi/queries";
 
 import { DAGImportErrors } from "./DAGImportErrors";
-import { DagFilterButton } from "./DagFilterButton";
-
-export const Stats = () => (
-  <Box>
-    <Flex color="fg.muted" my={2}>
-      <FiClipboard />
-      <Heading ml={1} size="xs">
-        Links
-      </Heading>
-    </Flex>
-    <HStack>
-      <DagFilterButton colorPalette="failed" filter="failed" 
link="dags?last_dag_run_state=failed">
-        <StateIcon state="failed" />
-      </DagFilterButton>
-      <DAGImportErrors />
-      <DagFilterButton colorPalette="running" filter="running" 
link="dags?last_dag_run_state=running">
-        <StateIcon state="running" />
-      </DagFilterButton>
-      <DagFilterButton colorPalette="blue" filter="active" 
link="dags?paused=false">
-        <FiZap />
-      </DagFilterButton>
-    </HStack>
-  </Box>
-);
+import { StatsCard } from "./StatsCard";
+
+export const Stats = () => {
+  const { data: activeDagsData, isLoading: isActiveDagsLoading } = 
useDagServiceGetDags({
+    paused: false,
+  });
+
+  const { data: failedDagsData, isLoading: isFailedDagsLoading } = 
useDagServiceGetDags({
+    lastDagRunState: "failed",
+  });
+
+  const { data: stalledDagsData, isLoading: isStalledDagsLoading } = 
useDagServiceGetDags({
+    lastDagRunState: "queued",
+  });
+
+  const { data: runningDagsData, isLoading: isRunningDagsLoading } = 
useDagServiceGetDags({
+    lastDagRunState: "running",
+  });
+
+  const activeDagsCount = activeDagsData?.total_entries ?? 0;
+  const failedDagsCount = failedDagsData?.total_entries ?? 0;
+  const stalledDagsCount = stalledDagsData?.total_entries ?? 0;
+  const runningDagsCount = runningDagsData?.total_entries ?? 0;
+
+  return (
+    <Box>
+      <Flex alignItems="center" color="fg.muted" my={2}>
+        <FiClipboard />
+        <Heading ml={1} size="xs">
+          Stats
+        </Heading>
+      </Flex>
+
+      <SimpleGrid columns={{ base: 1, lg: 5, md: 3 }} gap={4}>
+        <StatsCard
+          colorScheme="red"
+          count={failedDagsCount}
+          isLoading={isFailedDagsLoading}
+          label="Failed DAGs"
+          link="dags?last_dag_run_state=failed"
+        />
+
+        {failedDagsCount > 0 && <DAGImportErrors />}
+
+        {stalledDagsCount > 0 && (
+          <StatsCard
+            colorScheme="orange"
+            count={stalledDagsCount}
+            isLoading={isStalledDagsLoading}
+            label="Stalled DAGs"

Review Comment:
   I know we had "Stalled" in the mockups. But I think we should stay 
consistent and use "Queued" here



##########
airflow-core/src/airflow/ui/src/pages/Dashboard/Stats/Stats.tsx:
##########
@@ -16,33 +16,82 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-import { Box, Flex, Heading, HStack } from "@chakra-ui/react";
-import { FiClipboard, FiZap } from "react-icons/fi";
+import { Box, Flex, Heading, SimpleGrid } from "@chakra-ui/react";
+import { FiClipboard } from "react-icons/fi";
 
-import { StateIcon } from "src/components/StateIcon";
+import { useDagServiceGetDags } from "openapi/queries";
 
 import { DAGImportErrors } from "./DAGImportErrors";
-import { DagFilterButton } from "./DagFilterButton";
-
-export const Stats = () => (
-  <Box>
-    <Flex color="fg.muted" my={2}>
-      <FiClipboard />
-      <Heading ml={1} size="xs">
-        Links
-      </Heading>
-    </Flex>
-    <HStack>
-      <DagFilterButton colorPalette="failed" filter="failed" 
link="dags?last_dag_run_state=failed">
-        <StateIcon state="failed" />
-      </DagFilterButton>
-      <DAGImportErrors />
-      <DagFilterButton colorPalette="running" filter="running" 
link="dags?last_dag_run_state=running">
-        <StateIcon state="running" />
-      </DagFilterButton>
-      <DagFilterButton colorPalette="blue" filter="active" 
link="dags?paused=false">
-        <FiZap />
-      </DagFilterButton>
-    </HStack>
-  </Box>
-);
+import { StatsCard } from "./StatsCard";
+
+export const Stats = () => {
+  const { data: activeDagsData, isLoading: isActiveDagsLoading } = 
useDagServiceGetDags({
+    paused: false,
+  });
+
+  const { data: failedDagsData, isLoading: isFailedDagsLoading } = 
useDagServiceGetDags({
+    lastDagRunState: "failed",
+  });
+
+  const { data: stalledDagsData, isLoading: isStalledDagsLoading } = 
useDagServiceGetDags({
+    lastDagRunState: "queued",
+  });
+
+  const { data: runningDagsData, isLoading: isRunningDagsLoading } = 
useDagServiceGetDags({
+    lastDagRunState: "running",
+  });
+
+  const activeDagsCount = activeDagsData?.total_entries ?? 0;
+  const failedDagsCount = failedDagsData?.total_entries ?? 0;
+  const stalledDagsCount = stalledDagsData?.total_entries ?? 0;
+  const runningDagsCount = runningDagsData?.total_entries ?? 0;
+
+  return (
+    <Box>
+      <Flex alignItems="center" color="fg.muted" my={2}>
+        <FiClipboard />
+        <Heading ml={1} size="xs">
+          Stats
+        </Heading>
+      </Flex>
+
+      <SimpleGrid columns={{ base: 1, lg: 5, md: 3 }} gap={4}>
+        <StatsCard
+          colorScheme="red"
+          count={failedDagsCount}
+          isLoading={isFailedDagsLoading}
+          label="Failed DAGs"
+          link="dags?last_dag_run_state=failed"
+        />
+
+        {failedDagsCount > 0 && <DAGImportErrors />}
+
+        {stalledDagsCount > 0 && (
+          <StatsCard
+            colorScheme="orange"

Review Comment:
   ```suggestion
               colorScheme="queued"
   ```



##########
airflow-core/src/airflow/ui/src/pages/Dashboard/Stats/Stats.tsx:
##########
@@ -16,33 +16,82 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-import { Box, Flex, Heading, HStack } from "@chakra-ui/react";
-import { FiClipboard, FiZap } from "react-icons/fi";
+import { Box, Flex, Heading, SimpleGrid } from "@chakra-ui/react";
+import { FiClipboard } from "react-icons/fi";
 
-import { StateIcon } from "src/components/StateIcon";
+import { useDagServiceGetDags } from "openapi/queries";
 
 import { DAGImportErrors } from "./DAGImportErrors";
-import { DagFilterButton } from "./DagFilterButton";
-
-export const Stats = () => (
-  <Box>
-    <Flex color="fg.muted" my={2}>
-      <FiClipboard />
-      <Heading ml={1} size="xs">
-        Links
-      </Heading>
-    </Flex>
-    <HStack>
-      <DagFilterButton colorPalette="failed" filter="failed" 
link="dags?last_dag_run_state=failed">
-        <StateIcon state="failed" />
-      </DagFilterButton>
-      <DAGImportErrors />
-      <DagFilterButton colorPalette="running" filter="running" 
link="dags?last_dag_run_state=running">
-        <StateIcon state="running" />
-      </DagFilterButton>
-      <DagFilterButton colorPalette="blue" filter="active" 
link="dags?paused=false">
-        <FiZap />
-      </DagFilterButton>
-    </HStack>
-  </Box>
-);
+import { StatsCard } from "./StatsCard";
+
+export const Stats = () => {
+  const { data: activeDagsData, isLoading: isActiveDagsLoading } = 
useDagServiceGetDags({
+    paused: false,
+  });
+
+  const { data: failedDagsData, isLoading: isFailedDagsLoading } = 
useDagServiceGetDags({
+    lastDagRunState: "failed",
+  });
+
+  const { data: stalledDagsData, isLoading: isStalledDagsLoading } = 
useDagServiceGetDags({
+    lastDagRunState: "queued",
+  });
+
+  const { data: runningDagsData, isLoading: isRunningDagsLoading } = 
useDagServiceGetDags({
+    lastDagRunState: "running",
+  });
+
+  const activeDagsCount = activeDagsData?.total_entries ?? 0;
+  const failedDagsCount = failedDagsData?.total_entries ?? 0;
+  const stalledDagsCount = stalledDagsData?.total_entries ?? 0;
+  const runningDagsCount = runningDagsData?.total_entries ?? 0;
+
+  return (
+    <Box>
+      <Flex alignItems="center" color="fg.muted" my={2}>
+        <FiClipboard />
+        <Heading ml={1} size="xs">
+          Stats
+        </Heading>
+      </Flex>
+
+      <SimpleGrid columns={{ base: 1, lg: 5, md: 3 }} gap={4}>
+        <StatsCard
+          colorScheme="red"

Review Comment:
   ```suggestion
             colorScheme="failed"
   ```



##########
airflow-core/src/airflow/ui/src/pages/Dashboard/Stats/StatsCard.tsx:
##########
@@ -0,0 +1,118 @@
+/*!
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { Box, Flex, HStack, Skeleton, Text } from "@chakra-ui/react";
+import { FiChevronRight } from "react-icons/fi";
+import { Link as RouterLink } from "react-router-dom";
+
+import { capitalize } from "src/utils";
+
+export const StatsCard = ({
+  colorScheme,
+  count,
+  isLoading = false,
+  label,
+  link,
+  onClick,
+}: {
+  readonly colorScheme: string;
+  readonly count: number;
+  readonly isLoading?: boolean;
+  readonly label: string;
+  readonly link?: string;
+  readonly onClick?: () => void;
+}) => {
+  const content = (
+    <Box as="button" textAlign="left" width="100%">
+      {isLoading ? (
+        <Skeleton>
+          <Flex
+            alignItems="center"
+            bg="bg.surface"
+            borderColor={`${colorScheme}.100`}
+            borderRadius="lg"
+            borderWidth={1}
+            height="60px"
+            overflow="hidden"
+            p={3}

Review Comment:
   Nit: I feel like these stats take up too much vertical space. Could we pass 
a smaller `py={1}`?



##########
airflow-core/src/airflow/ui/src/pages/Dashboard/Stats/StatsCard.tsx:
##########
@@ -0,0 +1,118 @@
+/*!
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { Box, Flex, HStack, Skeleton, Text } from "@chakra-ui/react";
+import { FiChevronRight } from "react-icons/fi";
+import { Link as RouterLink } from "react-router-dom";
+
+import { capitalize } from "src/utils";
+
+export const StatsCard = ({
+  colorScheme,
+  count,
+  isLoading = false,
+  label,
+  link,
+  onClick,
+}: {
+  readonly colorScheme: string;
+  readonly count: number;
+  readonly isLoading?: boolean;
+  readonly label: string;
+  readonly link?: string;
+  readonly onClick?: () => void;
+}) => {
+  const content = (
+    <Box as="button" textAlign="left" width="100%">
+      {isLoading ? (
+        <Skeleton>
+          <Flex
+            alignItems="center"
+            bg="bg.surface"
+            borderColor={`${colorScheme}.100`}

Review Comment:
   I don't know if hard coding all these color numbers will work across all 
states in light and dark mode. It might be be better to use the semantic tokens 
like`${colorScheme}.border`



##########
airflow-core/src/airflow/ui/src/pages/Dashboard/Stats/StatsCard.tsx:
##########
@@ -0,0 +1,118 @@
+/*!
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { Box, Flex, HStack, Skeleton, Text } from "@chakra-ui/react";
+import { FiChevronRight } from "react-icons/fi";
+import { Link as RouterLink } from "react-router-dom";
+
+import { capitalize } from "src/utils";
+
+export const StatsCard = ({
+  colorScheme,
+  count,
+  isLoading = false,
+  label,
+  link,
+  onClick,
+}: {
+  readonly colorScheme: string;
+  readonly count: number;
+  readonly isLoading?: boolean;
+  readonly label: string;
+  readonly link?: string;
+  readonly onClick?: () => void;
+}) => {
+  const content = (
+    <Box as="button" textAlign="left" width="100%">
+      {isLoading ? (
+        <Skeleton>
+          <Flex
+            alignItems="center"
+            bg="bg.surface"
+            borderColor={`${colorScheme}.100`}
+            borderRadius="lg"
+            borderWidth={1}
+            height="60px"
+            overflow="hidden"
+            p={3}
+            pl={4}
+          />
+        </Skeleton>
+      ) : (
+        <Flex
+          _hover={{
+            borderColor: `${colorScheme}.500`,
+            boxShadow: "sm",
+            transform: "translateY(-0.5px)",
+            transition: "all 0.1s",
+          }}
+          alignItems="center"
+          bg="bg.surface"
+          borderColor={`${colorScheme}.100`}
+          borderRadius="lg"
+          borderWidth={1}
+          cursor="pointer"
+          height="60px"
+          overflow="hidden"
+          p={3}
+          pl={4}
+          width="100%"
+        >
+          <Flex
+            alignItems="center"
+            bg={`${colorScheme}.500`}
+            borderRadius="full"
+            boxSize={8}
+            color="white"
+            fontWeight="bold"
+            justifyContent="center"
+            minWidth={8}
+            mr={3}
+          >
+            <Text fontSize="sm" fontWeight="bold">
+              {count}
+            </Text>
+          </Flex>
+          <Box flex={1}>
+            <HStack alignItems="center" gap={2}>
+              <Text
+                fontSize="sm"
+                fontWeight="bold"
+                maxWidth="100%"
+                overflow="hidden"
+                textOverflow="ellipsis"
+                whiteSpace="nowrap"
+              >
+                {capitalize(label)}
+              </Text>
+            </HStack>
+          </Box>
+          <Box color="gray.400" pr={1}>

Review Comment:
   ```suggestion
             <Box color="gray.emphasized" pr={1}>
   ```
   
   Let's try to use semantic colors that can adapt to dakr/light mode: 



##########
airflow-core/src/airflow/ui/src/pages/Dashboard/Stats/Stats.tsx:
##########
@@ -16,33 +16,82 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-import { Box, Flex, Heading, HStack } from "@chakra-ui/react";
-import { FiClipboard, FiZap } from "react-icons/fi";
+import { Box, Flex, Heading, SimpleGrid } from "@chakra-ui/react";
+import { FiClipboard } from "react-icons/fi";
 
-import { StateIcon } from "src/components/StateIcon";
+import { useDagServiceGetDags } from "openapi/queries";
 
 import { DAGImportErrors } from "./DAGImportErrors";
-import { DagFilterButton } from "./DagFilterButton";
-
-export const Stats = () => (
-  <Box>
-    <Flex color="fg.muted" my={2}>
-      <FiClipboard />
-      <Heading ml={1} size="xs">
-        Links
-      </Heading>
-    </Flex>
-    <HStack>
-      <DagFilterButton colorPalette="failed" filter="failed" 
link="dags?last_dag_run_state=failed">
-        <StateIcon state="failed" />
-      </DagFilterButton>
-      <DAGImportErrors />
-      <DagFilterButton colorPalette="running" filter="running" 
link="dags?last_dag_run_state=running">
-        <StateIcon state="running" />
-      </DagFilterButton>
-      <DagFilterButton colorPalette="blue" filter="active" 
link="dags?paused=false">
-        <FiZap />
-      </DagFilterButton>
-    </HStack>
-  </Box>
-);
+import { StatsCard } from "./StatsCard";
+
+export const Stats = () => {
+  const { data: activeDagsData, isLoading: isActiveDagsLoading } = 
useDagServiceGetDags({
+    paused: false,
+  });
+
+  const { data: failedDagsData, isLoading: isFailedDagsLoading } = 
useDagServiceGetDags({
+    lastDagRunState: "failed",
+  });
+
+  const { data: stalledDagsData, isLoading: isStalledDagsLoading } = 
useDagServiceGetDags({
+    lastDagRunState: "queued",
+  });
+
+  const { data: runningDagsData, isLoading: isRunningDagsLoading } = 
useDagServiceGetDags({
+    lastDagRunState: "running",
+  });

Review Comment:
   Later on, we should make a custom endpoint to get the counts of all of these 
without having to load all the dags.



##########
airflow-core/src/airflow/ui/src/pages/Dashboard/Stats/Stats.tsx:
##########
@@ -16,33 +16,82 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-import { Box, Flex, Heading, HStack } from "@chakra-ui/react";
-import { FiClipboard, FiZap } from "react-icons/fi";
+import { Box, Flex, Heading, SimpleGrid } from "@chakra-ui/react";
+import { FiClipboard } from "react-icons/fi";
 
-import { StateIcon } from "src/components/StateIcon";
+import { useDagServiceGetDags } from "openapi/queries";
 
 import { DAGImportErrors } from "./DAGImportErrors";
-import { DagFilterButton } from "./DagFilterButton";
-
-export const Stats = () => (
-  <Box>
-    <Flex color="fg.muted" my={2}>
-      <FiClipboard />
-      <Heading ml={1} size="xs">
-        Links
-      </Heading>
-    </Flex>
-    <HStack>
-      <DagFilterButton colorPalette="failed" filter="failed" 
link="dags?last_dag_run_state=failed">
-        <StateIcon state="failed" />
-      </DagFilterButton>
-      <DAGImportErrors />
-      <DagFilterButton colorPalette="running" filter="running" 
link="dags?last_dag_run_state=running">
-        <StateIcon state="running" />
-      </DagFilterButton>
-      <DagFilterButton colorPalette="blue" filter="active" 
link="dags?paused=false">
-        <FiZap />
-      </DagFilterButton>
-    </HStack>
-  </Box>
-);
+import { StatsCard } from "./StatsCard";
+
+export const Stats = () => {
+  const { data: activeDagsData, isLoading: isActiveDagsLoading } = 
useDagServiceGetDags({
+    paused: false,
+  });
+
+  const { data: failedDagsData, isLoading: isFailedDagsLoading } = 
useDagServiceGetDags({
+    lastDagRunState: "failed",
+  });
+
+  const { data: stalledDagsData, isLoading: isStalledDagsLoading } = 
useDagServiceGetDags({
+    lastDagRunState: "queued",
+  });
+
+  const { data: runningDagsData, isLoading: isRunningDagsLoading } = 
useDagServiceGetDags({
+    lastDagRunState: "running",
+  });
+
+  const activeDagsCount = activeDagsData?.total_entries ?? 0;
+  const failedDagsCount = failedDagsData?.total_entries ?? 0;
+  const stalledDagsCount = stalledDagsData?.total_entries ?? 0;
+  const runningDagsCount = runningDagsData?.total_entries ?? 0;
+
+  return (
+    <Box>
+      <Flex alignItems="center" color="fg.muted" my={2}>
+        <FiClipboard />
+        <Heading ml={1} size="xs">
+          Stats
+        </Heading>
+      </Flex>
+
+      <SimpleGrid columns={{ base: 1, lg: 5, md: 3 }} gap={4}>
+        <StatsCard
+          colorScheme="red"
+          count={failedDagsCount}
+          isLoading={isFailedDagsLoading}
+          label="Failed DAGs"
+          link="dags?last_dag_run_state=failed"
+        />
+
+        {failedDagsCount > 0 && <DAGImportErrors />}
+
+        {stalledDagsCount > 0 && (
+          <StatsCard
+            colorScheme="orange"
+            count={stalledDagsCount}
+            isLoading={isStalledDagsLoading}
+            label="Stalled DAGs"
+            link="dags?last_dag_run_state=queued"
+          />
+        )}
+
+        <StatsCard
+          colorScheme="teal"

Review Comment:
   ```suggestion
             colorScheme="running"
   ```
   
   We made semantic tokens for all our run states



##########
airflow-core/src/airflow/ui/src/pages/Dashboard/Stats/StatsCard.tsx:
##########
@@ -0,0 +1,118 @@
+/*!
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { Box, Flex, HStack, Skeleton, Text } from "@chakra-ui/react";
+import { FiChevronRight } from "react-icons/fi";
+import { Link as RouterLink } from "react-router-dom";
+
+import { capitalize } from "src/utils";
+
+export const StatsCard = ({
+  colorScheme,
+  count,
+  isLoading = false,
+  label,
+  link,
+  onClick,
+}: {
+  readonly colorScheme: string;
+  readonly count: number;
+  readonly isLoading?: boolean;
+  readonly label: string;
+  readonly link?: string;
+  readonly onClick?: () => void;
+}) => {
+  const content = (
+    <Box as="button" textAlign="left" width="100%">

Review Comment:
   What are we using `as="button"` here? If this is a link, then we are 
incorrectly nesting a `<button>` inside of a `<a>`



##########
airflow-core/src/airflow/ui/src/pages/Dashboard/Stats/StatsCard.tsx:
##########
@@ -0,0 +1,118 @@
+/*!
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { Box, Flex, HStack, Skeleton, Text } from "@chakra-ui/react";
+import { FiChevronRight } from "react-icons/fi";
+import { Link as RouterLink } from "react-router-dom";
+
+import { capitalize } from "src/utils";
+
+export const StatsCard = ({
+  colorScheme,
+  count,
+  isLoading = false,
+  label,
+  link,
+  onClick,
+}: {
+  readonly colorScheme: string;
+  readonly count: number;
+  readonly isLoading?: boolean;
+  readonly label: string;
+  readonly link?: string;
+  readonly onClick?: () => void;
+}) => {
+  const content = (
+    <Box as="button" textAlign="left" width="100%">
+      {isLoading ? (
+        <Skeleton>
+          <Flex
+            alignItems="center"
+            bg="bg.surface"
+            borderColor={`${colorScheme}.100`}
+            borderRadius="lg"
+            borderWidth={1}
+            height="60px"
+            overflow="hidden"
+            p={3}
+            pl={4}
+          />
+        </Skeleton>
+      ) : (
+        <Flex
+          _hover={{
+            borderColor: `${colorScheme}.500`,
+            boxShadow: "sm",
+            transform: "translateY(-0.5px)",
+            transition: "all 0.1s",
+          }}
+          alignItems="center"
+          bg="bg.surface"
+          borderColor={`${colorScheme}.100`}
+          borderRadius="lg"
+          borderWidth={1}
+          cursor="pointer"
+          height="60px"
+          overflow="hidden"
+          p={3}
+          pl={4}
+          width="100%"
+        >
+          <Flex
+            alignItems="center"
+            bg={`${colorScheme}.500`}
+            borderRadius="full"
+            boxSize={8}
+            color="white"
+            fontWeight="bold"
+            justifyContent="center"
+            minWidth={8}
+            mr={3}
+          >
+            <Text fontSize="sm" fontWeight="bold">
+              {count}
+            </Text>
+          </Flex>

Review Comment:
   We should use the badge component we use in the HistoricalMetrics which 
includes the appropriate icons for each stat.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to