Skip to content

feat(new-webui): Add card to Ingestion page showing time range, file count, and message count.#830

Merged
davemarco merged 16 commits into
y-scope:mainfrom
davemarco:details
Apr 23, 2025
Merged

feat(new-webui): Add card to Ingestion page showing time range, file count, and message count.#830
davemarco merged 16 commits into
y-scope:mainfrom
davemarco:details

Conversation

@davemarco

@davemarco davemarco commented Apr 16, 2025

Copy link
Copy Markdown
Contributor

Description

Add card with time range, files, and messages to ingest page.

Goes back to native grid to due lack of features in antd grid.

Checklist

  • The PR satisfies the contribution guidelines.
  • This is a breaking change and that has been indicated in the PR title, OR this isn't a
    breaking change.
  • Necessary docs have been updated, OR no docs need to be updated.

Validation performed

Checked resizing grid.

Summary by CodeRabbit

  • New Features

    • Introduced new statistic cards for displaying files count, messages count, and time range in the details section.
    • Added a new details section to the ingest page, presenting key statistics in a grid layout.
    • Launched a reusable DashboardCard component for consistent card styling across the UI.
  • Refactor

    • Updated StatCard to use the new DashboardCard component and enhanced its styling options.
    • Improved the calculation and display of space savings statistics.
  • Style

    • Added and updated CSS modules for improved grid layouts and card appearance.
    • Removed obsolete StatCard CSS styles.

@davemarco davemarco requested a review from a team as a code owner April 16, 2025 20:49
@coderabbitai

coderabbitai Bot commented Apr 16, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

This update introduces several new React components for the IngestPage Details section, including Details, TimeRange, Messages, Files, and a reusable DetailsCard component. These components display various statistics with placeholder data and are styled using new CSS modules. The Details component aggregates these detail cards into a grid layout. Additionally, a new DashboardCard component replaces the previous styling approach in StatCard, which was refactored accordingly. Minor corrections and styling improvements were made in the SpaceSavings component, and the Details component was integrated into the main IngestPage. Some CSS modules were added or removed to support these changes.

Changes

Files Summary
components/log-viewer-webui/client/src/pages/IngestPage/Details/Files.tsx Added new Files React component rendering a DetailsCard with a hardcoded files count.
components/log-viewer-webui/client/src/pages/IngestPage/Details/Messages.tsx Added new Messages React component rendering a DetailsCard with a hardcoded messages count.
components/log-viewer-webui/client/src/pages/IngestPage/Details/TimeRange.tsx Added new TimeRange React component rendering a DetailsCard showing a hardcoded formatted date range.
components/log-viewer-webui/client/src/pages/IngestPage/Details/DetailsCard.tsx Added new DetailsCard React component wrapping StatCard with styling props for title and statistic display.
components/log-viewer-webui/client/src/pages/IngestPage/Details/index.tsx Added new Details React component composing TimeRange, Messages, and Files components in a grid layout.
components/log-viewer-webui/client/src/pages/IngestPage/Details/index.module.css Added CSS module defining .detailsGrid and .timeRange styles for layout of detail cards.
components/log-viewer-webui/client/src/pages/IngestPage/index.tsx Imported and integrated the new Details component alongside SpaceSavings in the IngestPage grid layout.
components/log-viewer-webui/client/src/pages/IngestPage/SpaceSavings/index.tsx Corrected space savings percentage calculation; updated StatCard props to use statColor, statSize, and titleColor.
components/log-viewer-webui/client/src/components/DashboardCard/index.tsx Added new reusable DashboardCard React component with customizable title, colors, background, and children.
components/log-viewer-webui/client/src/components/DashboardCard/index.module.css Added CSS module for DashboardCard styling including card container, content layout, and title text styles.
components/log-viewer-webui/client/src/components/StatCard/index.tsx Refactored StatCard to use DashboardCard; renamed and added props (titleColor, statColor, statSize); removed CSS class usage.
components/log-viewer-webui/client/src/components/StatCard/index.module.css Deleted CSS module for StatCard, removing previous styles.

Sequence Diagram(s)

Error: Could not generate a valid Mermaid diagram after multiple attempts.

Suggested reviewers

  • hoophalab
  • junhaoliao

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7d62a72 and 45dddf5.

📒 Files selected for processing (6)
  • components/log-viewer-webui/client/src/pages/IngestPage/Details/DetailsCard.tsx (1 hunks)
  • components/log-viewer-webui/client/src/pages/IngestPage/Details/Files.tsx (1 hunks)
  • components/log-viewer-webui/client/src/pages/IngestPage/Details/Messages.tsx (1 hunks)
  • components/log-viewer-webui/client/src/pages/IngestPage/Details/TimeRange.tsx (1 hunks)
  • components/log-viewer-webui/client/src/pages/IngestPage/Details/index.module.css (1 hunks)
  • components/log-viewer-webui/client/src/pages/IngestPage/Details/index.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • components/log-viewer-webui/client/src/pages/IngestPage/Details/DetailsCard.tsx
🚧 Files skipped from review as they are similar to previous changes (5)
  • components/log-viewer-webui/client/src/pages/IngestPage/Details/Messages.tsx
  • components/log-viewer-webui/client/src/pages/IngestPage/Details/Files.tsx
  • components/log-viewer-webui/client/src/pages/IngestPage/Details/index.module.css
  • components/log-viewer-webui/client/src/pages/IngestPage/Details/TimeRange.tsx
  • components/log-viewer-webui/client/src/pages/IngestPage/Details/index.tsx
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: lint-check (ubuntu-latest)
  • GitHub Check: lint-check (macos-latest)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@davemarco davemarco marked this pull request as draft April 16, 2025 20:49
@davemarco davemarco requested a review from junhaoliao April 16, 2025 20:51

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (13)
components/log-viewer-webui/client/src/pages/IngestPage/SpaceSavings/index.module.css (1)

1-5: Consider using CSS variables for colours.

While the implementation works well, consider using CSS variables or theme tokens for colours like #1888fa to make future theming changes (like dark mode) easier to implement.

components/log-viewer-webui/client/src/pages/IngestPage/Details/index.module.css (1)

19-23: Consider using theme colours instead of hardcoded values.

Use theme variables or CSS variables for the colour "grey" to maintain consistency with the design system and make future theming changes easier.

components/log-viewer-webui/client/src/pages/IngestPage/index.tsx (1)

6-10: Enhance JSDoc comment.

The JSDoc comment could be more detailed about the component's purpose and functionality. Consider expanding it to describe what compression statistics are shown and how they're structured on the page.

components/log-viewer-webui/client/src/pages/IngestPage/Details/Files.tsx (1)

22-30: Simplify conditional className pattern.

The pattern className={styles["card"] || ""} is used to handle potential undefined classes, but this is unnecessary with CSS modules as they handle undefined classes gracefully. Consider simplifying:

-        <Card className={styles["card"] || ""}>
+        <Card className={styles.card}>
             <div className={styles["cardContent"]}>
-                <Text className={styles["title"] || ""}>
+                <Text className={styles.title}>
                     Files
                 </Text>
-                <Text className={styles["statistic"] || ""}>
+                <Text className={styles.statistic}>
                     {DUMMY_FILES}
                 </Text>
             </div>

This pattern should be applied consistently across all components that use CSS modules.

components/log-viewer-webui/client/src/pages/IngestPage/Details/TimeRange.tsx (3)

19-23: Add a proper return type to the JSDoc

The JSDoc comment is missing a return type after the @return tag. Including a return type improves documentation clarity.

 /**
  * Renders the time range statistic.
  *
- * @return
+ * @return {JSX.Element} The rendered TimeRange component
  */

26-36: Remove redundant fallback for CSS class names

The || "" fallback for style classes is unnecessary when using TypeScript with CSS modules, as TypeScript should enforce that these properties exist in the styles object.

-        <Card className={styles["card"] || ""}>
+        <Card className={styles["card"]}>
             <div className={styles["cardContent"]}>
-                <Text className={styles["title"] || ""}>
+                <Text className={styles["title"]}>
                     Time Range
                 </Text>
-                <Text className={styles["statistic"] || ""}>
+                <Text className={styles["statistic"]}>
                     {`${dayjs(DUMMY_START_DATE).format(DATE_FORMAT)} - ${
                         dayjs(DUMMY_END_DATE).format(DATE_FORMAT)
                     }`}
                 </Text>

12-15: Consider adding type safety for date variables

While using dummy data for now, it would be beneficial to define types for these date variables to ensure they're used correctly when implementing the API integration.

 // eslint-disable-next-line no-warning-comments
 // TODO: Replace with values from database once api implemented.
-const DUMMY_START_DATE = "2021-12-14";
-const DUMMY_END_DATE = "2025-04-16";
+const DUMMY_START_DATE: string = "2021-12-14";
+const DUMMY_END_DATE: string = "2025-04-16";
components/log-viewer-webui/client/src/pages/IngestPage/Details/Messages.tsx (3)

15-19: Add a proper return type to the JSDoc

The JSDoc comment is missing a return type after the @return tag. Including a return type improves documentation clarity.

 /**
  * Renders the messages statistic.
  *
- * @return
+ * @return {JSX.Element} The rendered Messages component
  */

22-30: Remove redundant fallback for CSS class names

The || "" fallback for style classes is unnecessary when using TypeScript with CSS modules, as TypeScript should enforce that these properties exist in the styles object.

-        <Card className={styles["card"] || ""}>
+        <Card className={styles["card"]}>
             <div className={styles["cardContent"]}>
-                <Text className={styles["title"] || ""}>
+                <Text className={styles["title"]}>
                     Messages
                 </Text>
-                <Text className={styles["statistic"] || ""}>
+                <Text className={styles["statistic"]}>
                     {DUMMY_MESSAGES}
                 </Text>

27-29: Add number formatting for better readability

Large numbers like 1,235,844 should be formatted with commas or other locale-appropriate separators for improved readability.

                 <Text className={styles["statistic"] || ""}>
-                    {DUMMY_MESSAGES}
+                    {DUMMY_MESSAGES.toLocaleString()}
                 </Text>
components/log-viewer-webui/client/src/pages/IngestPage/Details/index.tsx (1)

7-11: Add a proper return type to the JSDoc and improve component description

The JSDoc comment is missing a return type after the @return tag, and the description could be more specific about what "details" are being presented.

 /**
- * Presents details from the given statistics.
+ * Presents a grid layout of statistics including time range, message count, and file count.
  *
- * @return
+ * @return {JSX.Element} The rendered Details component
  */
components/log-viewer-webui/client/src/pages/IngestPage/SpaceSavings/index.tsx (2)

16-20: Add a proper return type to the JSDoc

The JSDoc comment is missing a return type after the @return tag. Including a return type improves documentation clarity.

 /**
  * Presents space savings or compression ratio from the given statistics.
  *
- * @return
+ * @return {JSX.Element} The rendered SpaceSavings component
  */

31-44: Remove redundant fallback for CSS class names

The || "" fallback for style classes is unnecessary when using TypeScript with CSS modules, as TypeScript should enforce that these properties exist in the styles object.

         <Card
-            className={styles["card"] || ""}
+            className={styles["card"]}
             hoverable={true}
         >
             <div className={styles["cardContent"]}>
-                <Text className={styles["title"] || ""}>
+                <Text className={styles["title"]}>
                     Space Savings
                 </Text>
-                <Text className={styles["statistic"] || ""}>
+                <Text className={styles["statistic"]}>
                     {spaceSavingsPercent.toFixed(2)}
                     %
                 </Text>
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ffbd533 and 7a8ebfc.

📒 Files selected for processing (10)
  • components/log-viewer-webui/client/src/pages/IngestPage.tsx (0 hunks)
  • components/log-viewer-webui/client/src/pages/IngestPage/Details/Files.tsx (1 hunks)
  • components/log-viewer-webui/client/src/pages/IngestPage/Details/Messages.tsx (1 hunks)
  • components/log-viewer-webui/client/src/pages/IngestPage/Details/TimeRange.tsx (1 hunks)
  • components/log-viewer-webui/client/src/pages/IngestPage/Details/index.module.css (1 hunks)
  • components/log-viewer-webui/client/src/pages/IngestPage/Details/index.tsx (1 hunks)
  • components/log-viewer-webui/client/src/pages/IngestPage/SpaceSavings/index.module.css (1 hunks)
  • components/log-viewer-webui/client/src/pages/IngestPage/SpaceSavings/index.tsx (1 hunks)
  • components/log-viewer-webui/client/src/pages/IngestPage/index.module.css (1 hunks)
  • components/log-viewer-webui/client/src/pages/IngestPage/index.tsx (1 hunks)
💤 Files with no reviewable changes (1)
  • components/log-viewer-webui/client/src/pages/IngestPage.tsx
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}`: - Prefer `false == ` rather than `!`.

**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}: - Prefer false == <expression> rather than !<expression>.

  • components/log-viewer-webui/client/src/pages/IngestPage/Details/Files.tsx
  • components/log-viewer-webui/client/src/pages/IngestPage/index.tsx
  • components/log-viewer-webui/client/src/pages/IngestPage/Details/TimeRange.tsx
  • components/log-viewer-webui/client/src/pages/IngestPage/Details/index.tsx
  • components/log-viewer-webui/client/src/pages/IngestPage/Details/Messages.tsx
  • components/log-viewer-webui/client/src/pages/IngestPage/SpaceSavings/index.tsx
🧬 Code Graph Analysis (1)
components/log-viewer-webui/client/src/pages/IngestPage/SpaceSavings/index.tsx (2)
components/webui/imports/ui/IngestView/panels/SpaceSavings.jsx (1)
  • SpaceSavings (19-71)
components/webui/imports/ui/IngestView/panels/IngestionJobs/IngestionJobRow.jsx (2)
  • compressedSize (57-57)
  • uncompressedSize (52-52)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: lint-check (macos-latest)
  • GitHub Check: lint-check (ubuntu-latest)
🔇 Additional comments (6)
components/log-viewer-webui/client/src/pages/IngestPage/index.module.css (1)

1-6: Grid layout implementation looks good.

The CSS Grid implementation provides a responsive layout that adapts well to different screen sizes. The use of auto-fit with minmax creates a fluid layout that will reflow as needed. The padding and gap provide appropriate spacing between elements.

components/log-viewer-webui/client/src/pages/IngestPage/SpaceSavings/index.module.css (2)

7-9: Global selector usage is appropriate.

The use of the :global() selector to remove the border from Ant Design's card header is correct and follows best practices for CSS modules.


11-25: Typography styling looks good.

The styling for card content, title, and statistic are well-defined and maintain a consistent visual hierarchy. The large font size (100px) for the statistic will ensure it has visual prominence on the page.

components/log-viewer-webui/client/src/pages/IngestPage/Details/index.module.css (1)

25-34: Nested grid implementation is well structured.

The nested grid layout for details provides a clean way to organize the child components. The span configuration for timeRange ensures it takes the full width while other items share the available space.

components/log-viewer-webui/client/src/pages/IngestPage/Details/Files.tsx (1)

11-13: Dummy data and TODO comment are appropriate.

The explicit TODO comment and use of a constant for dummy data make it clear that this is placeholder content waiting for API implementation. The eslint-disable comment is also properly scoped to just the TODO line.

components/log-viewer-webui/client/src/pages/IngestPage/Details/index.tsx (1)

12-22: The grid layout implementation looks good

The implementation aligns with the PR objective of reverting to native grid layout instead of using Ant Design grid components. The structure is clean and will work well for responsive layouts.

Comment thread components/log-viewer-webui/client/src/pages/IngestPage/index.tsx Outdated
Comment on lines +25 to +28
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
const spaceSavingsPercent = 0 < compressedSize ?
100 * (1 - (compressedSize / uncompressedSize)) :
0;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add validation for uncompressedSize to prevent division by zero

There's a check for compressedSize > 0, but no check for uncompressedSize > 0. If uncompressedSize is 0, it will cause a division by zero error.

     // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
-    const spaceSavingsPercent = 0 < compressedSize ?
-        100 * (1 - (compressedSize / uncompressedSize)) :
+    const spaceSavingsPercent = (0 < compressedSize && 0 < uncompressedSize) ?
+        100 * (1 - (compressedSize / uncompressedSize)) :
         0;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
const spaceSavingsPercent = 0 < compressedSize ?
100 * (1 - (compressedSize / uncompressedSize)) :
0;
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
const spaceSavingsPercent = (0 < compressedSize && 0 < uncompressedSize) ?
100 * (1 - (compressedSize / uncompressedSize)) :
0;

🛠️ Refactor suggestion

Add validation for compression ratio

Currently, there's no validation that compressedSize <= uncompressedSize. If compressedSize > uncompressedSize, the percentage will be negative, which doesn't make sense for space savings.

     // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
-    const spaceSavingsPercent = 0 < compressedSize ?
-        100 * (1 - (compressedSize / uncompressedSize)) :
-        0;
+    let spaceSavingsPercent = 0;
+    if (0 < compressedSize && 0 < uncompressedSize) {
+        // Ensure compressed size is not greater than uncompressed size
+        if (compressedSize <= uncompressedSize) {
+            spaceSavingsPercent = 100 * (1 - (compressedSize / uncompressedSize));
+        } else {
+            // Log an error or handle unexpected data
+            console.error("Compressed size is greater than uncompressed size");
+        }
+    }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
const spaceSavingsPercent = 0 < compressedSize ?
100 * (1 - (compressedSize / uncompressedSize)) :
0;
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
let spaceSavingsPercent = 0;
if (0 < compressedSize && 0 < uncompressedSize) {
// Ensure compressed size is not greater than uncompressed size
if (compressedSize <= uncompressedSize) {
spaceSavingsPercent = 100 * (1 - (compressedSize / uncompressedSize));
} else {
// Log an error or handle unexpected data
console.error("Compressed size is greater than uncompressed size");
}
}

@davemarco davemarco marked this pull request as ready for review April 21, 2025 15:23

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (5)
components/log-viewer-webui/client/src/pages/IngestPage/Details/Files.tsx (1)

1-26: Clean implementation of the Files statistics card component

The component is well-structured and follows React best practices. The TODO comment is properly marked with an eslint-disable directive, acknowledging the temporary nature of the hardcoded value.

Consider formatting the statistics value with appropriate separators (like commas or spaces) for better readability, especially when real data is implemented.

- stat={DUMMY_FILES.toString()}
+ stat={DUMMY_FILES.toLocaleString()}
components/log-viewer-webui/client/src/pages/IngestPage/Details/Messages.tsx (1)

1-26: Clean implementation with room for localization improvement

The component is well-structured and follows React best practices. The TODO comment is properly documented with an eslint-disable directive.

For large numbers like 1,235,844, consider using number formatting for better readability of the statistics.

- stat={DUMMY_MESSAGES.toString()}
+ stat={DUMMY_MESSAGES.toLocaleString()}
components/log-viewer-webui/client/src/components/DashboardCard/index.tsx (1)

48-50: Consider using named exports consistently

The component is exported using a named export, but from the usage in StatCard, it seems like it might be intended as the default export for the module.

Either change other imports to use named imports or consider exporting this as the default:

- export {DashboardCard};
+ export default DashboardCard;
+ export {DashboardCard};
components/log-viewer-webui/client/src/components/StatCard/index.tsx (2)

40-48: Simplify props spread object construction

The current approach with conditional spreads works but can be simplified for better readability.

- const props: DashboardCardProps = {
-     title,
-     ...(titleColor ?
-         {titleColor} :
-         {}),
-     ...(backgroundColor ?
-         {backgroundColor} :
-         {}),
- };
+ const props: DashboardCardProps = {
+     title,
+     ...(titleColor && { titleColor }),
+     ...(backgroundColor && { backgroundColor })
+ };

52-54: Consider handling default values for statSize and statColor

The component doesn't handle the case where statSize or statColor are undefined, which could lead to inconsistent styling if these props aren't provided.

- <Text style={{color: statColor, fontSize: statSize}}>
+ <Text style={{
+     color: statColor || 'inherit',
+     fontSize: statSize || 'inherit'
+ }}>
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7a8ebfc and 7d62a72.

📒 Files selected for processing (10)
  • components/log-viewer-webui/client/src/components/DashboardCard/index.module.css (1 hunks)
  • components/log-viewer-webui/client/src/components/DashboardCard/index.tsx (1 hunks)
  • components/log-viewer-webui/client/src/components/StatCard/index.module.css (0 hunks)
  • components/log-viewer-webui/client/src/components/StatCard/index.tsx (1 hunks)
  • components/log-viewer-webui/client/src/pages/IngestPage/Details/Files.tsx (1 hunks)
  • components/log-viewer-webui/client/src/pages/IngestPage/Details/Messages.tsx (1 hunks)
  • components/log-viewer-webui/client/src/pages/IngestPage/Details/TimeRange.tsx (1 hunks)
  • components/log-viewer-webui/client/src/pages/IngestPage/Details/index.module.css (1 hunks)
  • components/log-viewer-webui/client/src/pages/IngestPage/SpaceSavings/index.tsx (3 hunks)
  • components/log-viewer-webui/client/src/pages/IngestPage/index.tsx (2 hunks)
💤 Files with no reviewable changes (1)
  • components/log-viewer-webui/client/src/components/StatCard/index.module.css
✅ Files skipped from review due to trivial changes (1)
  • components/log-viewer-webui/client/src/components/DashboardCard/index.module.css
🚧 Files skipped from review as they are similar to previous changes (4)
  • components/log-viewer-webui/client/src/pages/IngestPage/SpaceSavings/index.tsx
  • components/log-viewer-webui/client/src/pages/IngestPage/index.tsx
  • components/log-viewer-webui/client/src/pages/IngestPage/Details/index.module.css
  • components/log-viewer-webui/client/src/pages/IngestPage/Details/TimeRange.tsx
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}`: - Prefer `false == ` rather than `!`.

**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}: - Prefer false == <expression> rather than !<expression>.

  • components/log-viewer-webui/client/src/components/DashboardCard/index.tsx
  • components/log-viewer-webui/client/src/pages/IngestPage/Details/Messages.tsx
  • components/log-viewer-webui/client/src/pages/IngestPage/Details/Files.tsx
  • components/log-viewer-webui/client/src/components/StatCard/index.tsx

Comment on lines +37 to +38
className={styles["title"] || ""}
style={{color: titleColor}}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Improve fallback pattern for CSS class names

Same issue as with the card class - the logical OR fallback may not work as expected with CSS modules.

- className={styles["title"] || ""}
+ className={styles.title ?? ""}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
className={styles["title"] || ""}
style={{color: titleColor}}
className={styles.title ?? ""}
style={{ color: titleColor }}

Comment on lines +31 to +32
className={styles["card"] || ""}
hoverable={true}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Improve fallback pattern for CSS class names

The current fallback pattern using logical OR (||) may not work as expected with CSS modules. When styles["card"] is an empty string (but defined), it will still be used instead of falling back to the empty string.

- className={styles["card"] || ""}
+ className={styles.card ?? ""}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
className={styles["card"] || ""}
hoverable={true}
className={styles.card ?? ""}
hoverable={true}

@davemarco

Copy link
Copy Markdown
Contributor Author

@junhaoliao - this is ready for review

@junhaoliao junhaoliao left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's great in terms of aesthetics. i'll approve once we confirm the extraction of DashboardCard from StatCard is necessary.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason we want to extract this component from the StatCard component?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might have cards with a graph instead of a statistic. I thought having an empty card component was better, and then anything we want for content added as children

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, right

@junhaoliao

Copy link
Copy Markdown
Member

For the PR title, how about

feat(new-webui): Add card to Ingestion page showing time range, file count, and message count.

@davemarco davemarco changed the title feat(new-webui): Add card with time range, files, and messages to ingest page. feat(new-webui): Add card to Ingestion page showing time range, file count, and message count. Apr 23, 2025
@davemarco davemarco merged commit 3d0c3da into y-scope:main Apr 23, 2025
anlowee pushed a commit to anlowee/clp that referenced this pull request Apr 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants