Brijesh619 commented on code in PR #728:
URL: https://github.com/apache/atlas/pull/728#discussion_r3967023581


##########
dashboard/src/views/DashboardOverview/LatestEntitiesList.scss:
##########
@@ -0,0 +1,113 @@
+/*
+ * 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.
+ */
+
+.latest-entities-paper {
+  padding: 16px;
+  border-radius: 8px;
+  min-height: 340px;
+  min-width: 0;
+  width: 100%;
+  flex: 1;
+  box-sizing: border-box;
+  transition: box-shadow 0.3s ease;
+
+  &:hover {
+    box-shadow: 0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 
0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12);
+  }
+}
+
+.latest-entities-header {
+  padding-bottom: 16px;
+  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
+}
+
+.latest-entities-title {
+  font-size: 1rem;
+  font-weight: 600;
+  color: rgba(0, 0, 0, 0.87);
+}
+
+.latest-entities-view-all {
+  font-size: 0.875rem;
+  cursor: pointer;
+  text-decoration: none;
+}
+
+.latest-entities-empty {
+  padding-top: 16px;
+}
+
+.latest-entities-list {
+  padding-top: 16px;
+}
+
+.latest-entities-list-item {
+  padding-top: 8px;
+  padding-bottom: 8px;
+  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
+
+  &:last-child {
+    border-bottom: none;
+  }
+}
+
+.latest-entities-entity-name {
+  font-size: 0.875rem;
+}
+
+.latest-entities-entity-name-link {

Review Comment:
   I have completely removed the inline truncation properties (overflow, 
textOverflow, whiteSpace) from OverflowTooltip's sx prop in muiComponents.tsx.
   
   Instead, I've moved those rules directly into LatestEntitiesList.scss, 
applying them to .latest-entities-entity-name (for visual consistency) as well 
as to .latest-entities-name-wrapper and .latest-entities-type-wrapper.
   
   This consolidates all truncation CSS entirely into the SCSS file as 
requested! I've also updated the tests and confirmed they pass properly with 
these changes.



##########
dashboard/src/views/DashboardOverview/LatestEntitiesList.scss:
##########
@@ -0,0 +1,113 @@
+/*
+ * 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.
+ */
+
+.latest-entities-paper {
+  padding: 16px;
+  border-radius: 8px;
+  min-height: 340px;
+  min-width: 0;
+  width: 100%;
+  flex: 1;
+  box-sizing: border-box;
+  transition: box-shadow 0.3s ease;
+
+  &:hover {
+    box-shadow: 0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 
0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12);
+  }
+}
+
+.latest-entities-header {
+  padding-bottom: 16px;
+  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
+}
+
+.latest-entities-title {
+  font-size: 1rem;
+  font-weight: 600;
+  color: rgba(0, 0, 0, 0.87);
+}
+
+.latest-entities-view-all {
+  font-size: 0.875rem;
+  cursor: pointer;
+  text-decoration: none;
+}
+
+.latest-entities-empty {
+  padding-top: 16px;
+}
+
+.latest-entities-list {
+  padding-top: 16px;
+}
+
+.latest-entities-list-item {
+  padding-top: 8px;
+  padding-bottom: 8px;
+  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
+
+  &:last-child {
+    border-bottom: none;
+  }
+}
+
+.latest-entities-entity-name {
+  font-size: 0.875rem;
+}
+
+.latest-entities-entity-name-link {
+  cursor: pointer;
+}
+
+.latest-entities-entity-name-fallback {
+  font-weight: 500;
+  color: rgba(0, 0, 0, 0.87);
+}
+
+.latest-entities-type-name {
+  font-size: 0.875rem;
+  color: rgba(0, 0, 0, 0.6);
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+  min-width: 0;
+}
+
+.latest-entities-timestamp {
+  font-size: 0.8125rem;
+  color: rgba(0, 0, 0, 0.6);
+  flex-shrink: 0;
+  margin-left: 8px;
+  white-space: nowrap;
+}
+
+.latest-entities-name-wrapper {
+  display: block;
+  /* Allow this column to grow and shrink; min-width: 0 enables text 
truncation inside flex */
+  flex: 1 1 auto;
+  min-width: 0;
+  width: auto;
+}
+
+.latest-entities-type-wrapper {
+  display: block;
+  flex: 0 1 auto;
+  flex-shrink: 0;

Review Comment:
   I've simplified the flex rules for .latest-entities-type-wrapper in 
LatestEntitiesList.scss. By replacing flex: 0 1 auto; flex-shrink: 0; with just 
flex: 0 0 auto;, it now clearly communicates the single intent of neither 
growing nor shrinking the element by default, while still being constrained by 
the max-width limit.
   
   Let me know if there's anything else you'd like me to look at!



##########
dashboard/src/components/muiComponents.tsx:
##########
@@ -68,58 +71,97 @@ const LightTooltip = styled(({ className, ...props }: any) 
=> (
   }
 }));
 
-interface ButtonProps {
-  children?: any;
-  variant?: string;
-  color: string;
-  onClick: any;
-  sx?: any;
-  size?: string;
-  endIcon?: any;
-  startIcon?: any;
-  className?: string;
-  disabled?: boolean;
+
+interface OverflowTooltipProps extends Omit<TooltipProps, "children"> {
+  children: React.ReactElement;
+  wrapperSx?: SxProps<Theme>;
+  wrapperClassName?: string;
 }
 
+const OverflowTooltip = ({ title, children, wrapperSx, wrapperClassName, 
...props }: OverflowTooltipProps) => {
+  const textElementRef = React.useRef<HTMLElement>(null);
+  const [isOverflowed, setIsOverflowed] = React.useState(false);
+
+  const checkOverflow = React.useCallback(() => {
+    if (textElementRef.current) {
+      const el = textElementRef.current;
+      setIsOverflowed(
+        el.scrollWidth > el.clientWidth || 
+        el.scrollWidth > el.getBoundingClientRect().width

Review Comment:
   I've added a short comment explaining that clientWidth is an integer that 
can miss subpixel overflow, whereas getBoundingClientRect().width is fractional 
and catches those cases. It's a helpful clarification for why both conditions 
are kept around!
   
   As for the scope creep on the CustomButton / LightTooltip refactors touching 
unrelated files—understood! Let me know if you want me to split that refactor 
out, revert it, or keep it as is.



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