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


##########
airflow-core/src/airflow/ui/src/components/LimitedItemsList.tsx:
##########
@@ -16,67 +16,178 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-import { Box, Text, HStack, StackSeparator } from "@chakra-ui/react";
+import { Box, Text, HStack, useDisclosure, Heading, Stack } from 
"@chakra-ui/react";
 import React, { type ReactNode } from "react";
 import { useTranslation } from "react-i18next";
 
-import { Tooltip } from "./ui";
+import { Tooltip, Dialog, Button } from "./ui";
 
 type ListProps = {
   readonly icon?: ReactNode;
   readonly interactive?: boolean;
   readonly items: Array<ReactNode | string>;
   readonly maxItems?: number;
+  readonly modalTitle?: string;
   readonly separator?: string;
+  readonly showModal?: boolean;
 };
 
 export const LimitedItemsList = ({
   icon,
   interactive = false,
   items,
   maxItems,
+  modalTitle = "All Items",
   separator = ", ",
+  showModal = false,
 }: ListProps) => {
   const { t: translate } = useTranslation("components");
+  const { onClose, onOpen, open } = useDisclosure();
   const shouldTruncate = maxItems !== undefined && items.length > maxItems;
   const displayItems = shouldTruncate ? items.slice(0, maxItems) : items;
   const remainingItems = shouldTruncate ? items.slice(maxItems) : [];
   const remainingItemsList = interactive ? (
-    <HStack separator={<StackSeparator />}>{remainingItems}</HStack>
+    <Box maxH="200px" overflowY="auto" p={2}>
+      <Text fontSize="sm" fontWeight="bold" mb={2}>
+        {translate("limitedList.allItems", { count: items.length })}
+      </Text>
+      <Stack gap={1}>
+        {items.map((item, index) => (
+          // eslint-disable-next-line react/no-array-index-key
+          <Box fontSize="sm" key={index}>
+            {item}
+          </Box>
+        ))}
+      </Stack>
+      <Text color="gray.500" fontSize="xs" mt={2}>
+        {translate("limitedList.clickToOpenFull", { count: 
remainingItems.length })}
+      </Text>
+    </Box>
   ) : (
-    `More items: ${remainingItems.map((item) => (typeof item === "string" ? 
item : "item")).join(", ")}`
+    <Box maxH="200px" overflowY="auto" p={2}>
+      <Text fontSize="sm" fontWeight="bold" mb={2}>
+        {translate("limitedList.allItems", { count: items.length })}
+      </Text>
+      <Stack gap={1}>
+        {items.map((item, index) => (
+          // eslint-disable-next-line react/no-array-index-key
+          <Text fontSize="sm" key={index}>
+            {typeof item === "string" ? item : "item"}
+          </Text>
+        ))}
+      </Stack>
+      {showModal ? (
+        <Text color="gray.500" fontSize="xs" mt={2}>
+          {translate("limitedList.clickToOpenFull", { count: 
remainingItems.length })}
+        </Text>
+      ) : undefined}
+    </Box>
   );
 
   if (!items.length) {
     return undefined;
   }
 
   return (
-    <HStack align="center" gap={1}>
-      {icon}
-      <Box fontSize="sm">
-        {displayItems.map((item, index) => (
-          // eslint-disable-next-line react/no-array-index-key
-          <React.Fragment key={index}>
-            <Text as="span">{item}</Text>
-            {index < displayItems.length - 1 ||
-            (shouldTruncate && remainingItems.length >= 1 && index === 
displayItems.length - 1) ? (
-              <Text as="span">{separator}</Text>
-            ) : undefined}
-          </React.Fragment>
-        ))}
-        {shouldTruncate ? (
-          remainingItems.length === 1 ? (
-            <Text as="span">{remainingItems[0]}</Text>
-          ) : (
-            <Tooltip content={remainingItemsList} interactive={interactive}>
-              <Text as="span" cursor="help">
-                {translate("limitedList", { count: remainingItems.length })}
-              </Text>
-            </Tooltip>
-          )
-        ) : undefined}
-      </Box>
-    </HStack>
+    <>
+      <HStack align="center" gap={1}>
+        {icon}
+        <Box fontSize="sm">
+          {displayItems.map((item, index) => (
+            // eslint-disable-next-line react/no-array-index-key
+            <React.Fragment key={index}>
+              <Text as="span">{item}</Text>
+              {index < displayItems.length - 1 ||
+              (shouldTruncate && remainingItems.length >= 1 && index === 
displayItems.length - 1) ? (
+                <Text as="span">{separator}</Text>
+              ) : undefined}
+            </React.Fragment>
+          ))}
+          {shouldTruncate ? (
+            remainingItems.length === 1 ? (
+              <Text as="span">{remainingItems[0]}</Text>
+            ) : showModal ? (
+              <Tooltip content={remainingItemsList} interactive={interactive}>
+                <Button
+                  _hover={{ color: "blue.600", textDecoration: "underline" }}
+                  color="blue.500"
+                  cursor="pointer"
+                  fontSize="sm"
+                  minH="auto"
+                  onClick={onOpen}
+                  px={1}
+                  py={0}
+                  size="xs"
+                  variant="ghost"
+                >
+                  {translate("limitedList", { count: remainingItems.length })}
+                </Button>
+              </Tooltip>
+            ) : (
+              <Tooltip content={remainingItemsList} interactive={interactive}>
+                <Text as="span" cursor="help">
+                  {translate("limitedList", { count: remainingItems.length })}
+                </Text>
+              </Tooltip>
+            )
+          ) : undefined}
+        </Box>
+      </HStack>
+
+      {/* Modal for showing all items */}
+      {showModal ? (
+        <Dialog.Root onOpenChange={onClose} open={open} size="xl">
+          <Dialog.Content backdrop>
+            <Dialog.Header>
+              <Heading size="lg">{modalTitle}</Heading>
+            </Dialog.Header>
+
+            <Dialog.CloseTrigger />
+
+            <Dialog.Body>
+              <Box>
+                <Text color="gray.600" fontSize="sm" mb={3}>
+                  {translate("limitedList.showingItems", { count: items.length 
})}
+                </Text>
+
+                <Box
+                  bg="gray.50"

Review Comment:
   Because of light/dark mode and to support future custom theme files. We 
shoudl try to use semantic tokens whenever possible: ie: `bg.subtle`



-- 
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