minyeamer commented on code in PR #71558:
URL: https://github.com/apache/airflow/pull/71558#discussion_r4191860534


##########
airflow-core/src/airflow/ui/src/pages/TimeSchedule/DayTimeline.tsx:
##########
@@ -0,0 +1,245 @@
+/*!
+ * 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 type { MouseEvent as ReactMouseEvent, ReactNode, RefObject } from 
"react";
+
+import { Box, Button, Text } from "@chakra-ui/react";
+import { useTranslation } from "react-i18next";
+import { FiArrowDown, FiArrowUp } from "react-icons/fi";
+
+import { RouterLink } from "src/system-components";
+
+import { TimelineBar } from "./TimelineBar";
+import { dayjs } from "./dateUtils";
+import { getPosition, getTimelineBarLeft, getVisualDurationWidth } from 
"./timelineUtils";
+import type { DayRowLayout, RowSortMode, TimeMarker, TimelineItem } from 
"./types";
+
+type DayTimelineProps = {
+  readonly chartBodyRef: RefObject<HTMLDivElement | null>;
+  readonly chartContentHeight: number;
+  readonly chartMinWidth?: string;
+  readonly chartRootRef: RefObject<HTMLDivElement | null>;
+  readonly chartViewportHeight: string;
+  readonly headerRowRef: RefObject<HTMLDivElement | null>;
+  readonly hourMarkers: Array<Pick<TimeMarker, "minute" | "position">>;
+  readonly layouts: Array<DayRowLayout>;
+  readonly onCycleSort: () => void;
+  readonly onMouseLeave: () => void;
+  readonly onMouseMove: (event: ReactMouseEvent<HTMLDivElement>) => void;
+  readonly renderTooltip: (item: TimelineItem) => ReactNode;
+  readonly rowSortMode: RowSortMode;
+  readonly scrollRegionRef: RefObject<HTMLDivElement | null>;
+  readonly selectedTimezone: string;
+  readonly timeLabelStep: number;
+  readonly timelineMinWidth?: string;
+  readonly timeMarkers: Array<TimeMarker>;
+};
+
+export const DayTimeline = ({
+  chartBodyRef,
+  chartContentHeight,
+  chartMinWidth,
+  chartRootRef,
+  chartViewportHeight,
+  headerRowRef,
+  hourMarkers,
+  layouts,
+  onCycleSort,
+  onMouseLeave,
+  onMouseMove,
+  renderTooltip,
+  rowSortMode,
+  scrollRegionRef,
+  selectedTimezone,
+  timeLabelStep,
+  timelineMinWidth,
+  timeMarkers,
+}: DayTimelineProps) => {
+  const { t: translate } = useTranslation();
+
+  return (
+    <Box
+      borderColor="border.subtle"
+      borderRadius="md"
+      borderWidth="1px"
+      data-testid="time-schedule-day-grid"
+      height={chartViewportHeight}
+      minHeight="420px"
+      overflow="hidden"
+    >
+      <Box position="sticky" top={0} zIndex={5}>
+        <Box display="grid" gridTemplateColumns="220px minmax(0, 1fr)">
+          <Box bg="bg.subtle" borderBottomColor="border.subtle" 
borderBottomWidth="1px" p={3}>
+            <Button
+              aria-label={`Sort Dag ID: ${rowSortMode}`}
+              color="fg.muted"
+              fontSize="sm"
+              fontWeight="normal"
+              gap={1}
+              onClick={onCycleSort}
+              p={0}
+              variant="plain"
+            >
+              {translate("dagId")}
+              {rowSortMode === "dagIdAscending" ? <FiArrowUp /> : null}
+              {rowSortMode === "dagIdDescending" ? <FiArrowDown /> : null}
+            </Button>
+          </Box>
+          <Box
+            bg="bg.panel"
+            borderBottomColor="border.subtle"
+            borderBottomWidth="1px"
+            data-testid="time-schedule-header-row"
+            minHeight="48px"
+            onMouseDown={() => chartRootRef.current?.focus({ preventScroll: 
true })}
+            onMouseLeave={onMouseLeave}
+            onMouseMove={onMouseMove}
+            overflowX="hidden"
+            py={3}
+            ref={headerRowRef}
+          >
+            <Box
+              height="24px"
+              minWidth={timelineMinWidth}
+              mx="20px"
+              position="relative"
+              width="calc(100% - 40px)"

Review Comment:
   ```typescript
   // airflow-core/src/airflow/ui/src/pages/TimeSchedule/constants.ts
   
   export const TIMELINE_HORIZONTAL_PADDING = 40;
   ```
   
   ```suggestion
                 width={`calc(100% - ${TIMELINE_HORIZONTAL_PADDING}px)`}
   ```
   
   ```typescript
               <Box
                 height="24px"
                 minWidth={timelineMinWidth}
                 mx={`${TIMELINE_HORIZONTAL_PADDING / 2}px`}
                 position="relative"
                 width={`calc(100% - ${TIMELINE_HORIZONTAL_PADDING}px)`}
               >
   ```



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