Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ polishing report responsitivity #3636

Merged
merged 4 commits into from
Oct 12, 2024
Merged

Conversation

MatissJanis
Copy link
Member

Related #3282

@actual-github-bot actual-github-bot bot changed the title ✨ polishing report responsitivity [WIP] ✨ polishing report responsitivity Oct 11, 2024
Copy link

netlify bot commented Oct 11, 2024

Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit a4f1d40
🔍 Latest deploy log https://app.netlify.com/sites/actualbudget/deploys/670aaeed70417f0008eab129
😎 Deploy Preview https://deploy-preview-3636.demo.actualbudget.org
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

github-actions bot commented Oct 11, 2024

Bundle Stats — desktop-client

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
9 5.34 MB → 5.34 MB (+422 B) +0.01%
Changeset
File Δ Size
src/components/common/SpaceBetween.tsx 🆕 +326 B 0 B → 326 B
src/components/filters/CompactFiltersButton.tsx 📈 +124 B (+49.80%) 249 B → 373 B
src/components/filters/FiltersButton.tsx 📈 +35 B (+10.39%) 337 B → 372 B
src/components/filters/FilterExpression.tsx 📈 +198 B (+5.87%) 3.3 kB → 3.49 kB
src/components/reports/ReportTopbar.tsx 📈 +210 B (+3.83%) 5.35 kB → 5.56 kB
src/components/common/Tooltip.tsx 📈 +21 B (+1.52%) 1.35 kB → 1.37 kB
src/components/reports/Header.tsx 📈 +38 B (+0.78%) 4.78 kB → 4.81 kB
src/components/reports/reports/CustomReport.tsx 📉 -42 B (-0.18%) 22.41 kB → 22.37 kB
src/components/reports/ReportSidebar.tsx 📉 -122 B (-0.67%) 17.68 kB → 17.56 kB
src/components/reports/reports/Spending.tsx 📉 -344 B (-1.65%) 20.38 kB → 20.05 kB
src/components/reports/ModeButton.tsx 📉 -22 B (-3.51%) 626 B → 604 B
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

Asset File Size % Changed
static/js/AppliedFilters.js 20.96 kB → 21.31 kB (+357 B) +1.66%
static/js/ReportRouter.js 1.51 MB → 1.51 MB (+44 B) +0.00%
static/js/index.js 3.34 MB → 3.34 MB (+21 B) +0.00%

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
static/js/usePreviewTransactions.js 1.64 kB 0%
static/js/resize-observer.js 18.37 kB 0%
static/js/indexeddb-main-thread-worker-e59fee74.js 13.5 kB 0%
static/js/BackgroundImage.js 122.29 kB 0%
static/js/narrow.js 82.55 kB 0%
static/js/wide.js 242.95 kB 0%

Copy link
Contributor

github-actions bot commented Oct 11, 2024

Bundle Stats — loot-core

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
1 1.26 MB 0%

Changeset

No files were changed

View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

No assets were bigger

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
kcab.worker.js 1.26 MB 0%

Copy link
Contributor

coderabbitai bot commented Oct 11, 2024

Walkthrough

This pull request introduces a new React component named SpaceBetween, located in SpaceBetween.tsx. The component accepts props defined by the SpaceBetweenProps type, which includes optional properties for direction, gap, and style, along with a required children prop. The component defaults to a horizontal direction and a gap of 15, utilizing the View component for rendering its children with appropriate flex styles.

Additionally, the Header, ReportSidebar, Spending, and CustomReport components are modified to incorporate the new SpaceBetween component. In Header.tsx, existing View components are replaced with SpaceBetween to enhance layout responsiveness. Similar replacements occur in ReportSidebar.tsx and Spending.tsx, improving spacing management. The CustomReport component sees enhancements in state management and performance optimization through a new function. Other components, such as FilterExpression, FiltersButton, and ModeButton, receive minor styling adjustments, but their core functionalities remain unchanged.

Suggested labels

::sparkles: Merged

Suggested reviewers

  • MikesGlitch
  • youngcw

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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 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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (16)
packages/desktop-client/src/components/common/SpaceBetween.tsx (2)

7-12: LGTM: Well-defined prop types with a minor enhancement suggestion.

The SpaceBetweenProps type is clear and well-structured. The use of optional properties provides flexibility, and requiring the children prop ensures the component always has content.

Consider adding JSDoc comments to describe each prop, especially for direction and gap. This would enhance the developer experience when using this component. For example:

type SpaceBetweenProps = {
  /** The direction of the space between items. Defaults to 'horizontal'. */
  direction?: 'horizontal' | 'vertical';
  /** The size of the gap between items in pixels. Defaults to 15. */
  gap?: number;
  /** Additional CSS styles to apply to the container. */
  style?: CSSProperties;
  /** The content to be rendered within the SpaceBetween component. */
  children: ReactNode;
};

14-33: LGTM: Well-implemented component with a minor enhancement suggestion.

The SpaceBetween component is concisely implemented and follows React best practices. The use of default prop values and dynamic styles based on the direction prop provides excellent flexibility.

Consider memoizing the style object to optimize performance, especially if this component is used frequently. You can use the useMemo hook to achieve this:

import React, { type ReactNode, useMemo } from 'react';

// ... (rest of the imports and type definition)

export const SpaceBetween = ({
  direction = 'horizontal',
  gap = 15,
  style,
  children,
}: SpaceBetweenProps) => {
  const containerStyle = useMemo(() => ({
    flexWrap: 'wrap' as const,
    flexDirection: direction === 'horizontal' ? 'row' : 'column',
    alignItems: 'center' as const,
    gap,
    ...style,
  }), [direction, gap, style]);

  return (
    <View style={containerStyle}>
      {children}
    </View>
  );
};

This optimization ensures that the style object is only recalculated when its dependencies change, potentially improving render performance.

packages/desktop-client/src/components/common/Tooltip.tsx (1)

55-55: LGTM! Consider adding a comment for clarity.

The addition of flexShrink: 0 is a good improvement. It ensures that the tooltip maintains its size even in constrained spaces, which aligns with the PR's objective of enhancing report responsiveness.

Consider adding a brief comment explaining the purpose of flexShrink: 0. For example:

style={{
  minHeight: 'auto',
  flexShrink: 0, // Prevent tooltip from shrinking in constrained spaces
}}

This will help future developers understand the reasoning behind this style choice.

packages/desktop-client/src/components/filters/FilterExpression.tsx (2)

65-69: Approved with a suggestion for improvement

The new style properties for the Button component effectively manage its layout and prevent overflow issues. However, consider using CSS custom properties (variables) for values like the delete button width to improve maintainability.

Consider refactoring the maxWidth calculation:

- maxWidth: 'calc(100% - 26px)',
+ maxWidth: `calc(100% - var(--delete-button-width, 26px))`,

This change allows for easier updates if the delete button size changes in the future.


71-79: Approved with a suggestion for consistency

The new style properties for the inner div effectively manage content overflow and improve the visual presentation of the filter expression. However, for consistency and easier maintenance, consider using a single padding shorthand property.

Consider refactoring the padding properties:

- paddingBlock: 1,
- paddingLeft: 5,
- paddingRight: 2,
+ padding: '1px 2px 1px 5px',

This change maintains the same padding values while making the code more concise and easier to read.

packages/desktop-client/src/components/reports/Header.tsx (3)

79-128: Good use of nested SpaceBetween components.

The nested SpaceBetween components provide excellent control over spacing and layout. The conditional gap in the outer component enhances responsiveness.

For consistency, consider using a named constant for the gap value (currently 5) in the inner SpaceBetween. This would make future adjustments easier and maintain consistency across the component.

const INNER_GAP = 5;

// ...

<SpaceBetween gap={INNER_GAP}>
  {/* ... */}
</SpaceBetween>

Line range hint 131-177: Good use of SpaceBetween for button layout.

The SpaceBetween component effectively manages the spacing between buttons, improving the overall layout.

Consider adding aria-label attributes to the buttons to enhance accessibility, especially for the "bare" variant buttons. For example:

<Button
  variant="bare"
  onPress={() => onChangeDates(...getLatestRange(2))}
  aria-label="View last 3 months"
>
  3 months
</Button>

Line range hint 194-204: Improved layout for AppliedFilters.

The addition of a View wrapper for AppliedFilters with a top margin improves the visual separation and layout control.

For consistency with the SpaceBetween usage elsewhere in the component, consider replacing the View with a SpaceBetween:

{filters && filters.length > 0 && (
  <SpaceBetween direction="vertical" gap={5}>
    <AppliedFilters
      conditions={filters}
      onUpdate={onUpdateFilter}
      onDelete={onDeleteFilter}
      conditionsOp={conditionsOp}
      onConditionsOpChange={onConditionsOpChange}
    />
  </SpaceBetween>
)}

This change would maintain consistency in spacing management throughout the component.

packages/desktop-client/src/components/reports/ReportSidebar.tsx (3)

Line range hint 181-200: LGTM: Improved layout with SpaceBetween component

The introduction of the SpaceBetween component here improves the layout and spacing of the "Mode" selection buttons. The gap prop ensures consistent spacing between children, and the style prop adds appropriate padding.

Consider extracting the inline style object to a separate constant or using a predefined style from your theme to improve readability and maintainability.


Line range hint 395-430: LGTM: Improved layout for Date filters section

The use of the SpaceBetween component here enhances the layout and spacing of the "Date filters" section. The gap prop ensures consistent spacing between children, and the style prop adds appropriate margins.

For consistency with the previous SpaceBetween usage, consider using padding instead of margin in the style prop. This would make the spacing behavior more uniform across the component.


Line range hint 1-563: Overall improvement in layout consistency and responsiveness

The introduction of the SpaceBetween component in key areas of the ReportSidebar has improved the layout consistency and responsiveness of the UI. These changes align well with the PR objective of "polishing report responsitivity".

To further enhance the component's consistency and maintainability, consider:

  1. Standardizing the use of SpaceBetween throughout the component, replacing other View components used for layout where appropriate.
  2. Extracting common style properties (like gap sizes and padding/margin values) into constants or theme variables to ensure consistency and ease future adjustments.
  3. Reviewing the remaining View components to see if they can benefit from the SpaceBetween component's spacing capabilities.

These additional refactors could further improve the overall responsiveness and maintainability of the ReportSidebar component.

packages/desktop-client/src/components/reports/reports/Spending.tsx (5)

239-239: LGTM: SpaceBetween improves layout management

The introduction of SpaceBetween here improves code readability and maintainability. It provides a more semantic way to manage the layout of child components.

Consider setting the gap prop to a named constant or theme variable (e.g., theme.spacing.none) instead of a hard-coded 0, to maintain consistency across the application.


261-261: LGTM: SpaceBetween enhances form layout

The use of SpaceBetween here improves the visual consistency and maintainability of the form layout.

Consider setting the gap prop to a named constant or theme variable (e.g., theme.spacing.small) instead of a hard-coded 5, to maintain consistency and allow for easier global adjustments.


304-304: LGTM: Separator margins adjusted

The adjustments to the separator's margins ensure proper spacing with the new SpaceBetween layout.

Consider using theme variables for margin values (e.g., theme.spacing.medium) to maintain consistency across the application and allow for easier global adjustments.


308-308: LGTM: SpaceBetween improves mode button layout

The use of SpaceBetween here enhances the visual consistency and maintainability of the mode selection button group.

Consider setting the gap prop to a named constant or theme variable (e.g., theme.spacing.small) instead of a hard-coded 5, to maintain consistency and allow for easier global adjustments. This suggestion applies to all instances of SpaceBetween in this file.


Line range hint 26-395: Overall: Improved layout management with SpaceBetween

The introduction of the SpaceBetween component throughout this file significantly improves layout management, code readability, and maintainability. The changes are consistent and well-implemented.

To further enhance consistency and maintainability, consider the following refactoring:

  1. Create a set of named constants or use existing theme variables for spacing values (e.g., SPACING_NONE, SPACING_SMALL, SPACING_MEDIUM).
  2. Replace all hard-coded values in gap props and margin styles with these constants.
  3. Use these constants consistently across all SpaceBetween components and related styles in this file.

This refactoring will make it easier to maintain consistent spacing throughout the application and allow for global adjustments if needed.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 37ad584 and aa5635c.

⛔ Files ignored due to path filters (1)
  • upcoming-release-notes/3636.md is excluded by !**/*.md
📒 Files selected for processing (9)
  • packages/desktop-client/src/components/common/SpaceBetween.tsx (1 hunks)
  • packages/desktop-client/src/components/common/Tooltip.tsx (1 hunks)
  • packages/desktop-client/src/components/filters/FilterExpression.tsx (1 hunks)
  • packages/desktop-client/src/components/filters/FiltersButton.tsx (1 hunks)
  • packages/desktop-client/src/components/reports/Header.tsx (4 hunks)
  • packages/desktop-client/src/components/reports/ModeButton.tsx (0 hunks)
  • packages/desktop-client/src/components/reports/ReportSidebar.tsx (5 hunks)
  • packages/desktop-client/src/components/reports/reports/CustomReport.tsx (0 hunks)
  • packages/desktop-client/src/components/reports/reports/Spending.tsx (6 hunks)
💤 Files with no reviewable changes (2)
  • packages/desktop-client/src/components/reports/ModeButton.tsx
  • packages/desktop-client/src/components/reports/reports/CustomReport.tsx
🧰 Additional context used
🔇 Additional comments (7)
packages/desktop-client/src/components/filters/FiltersButton.tsx (1)

9-12: Approved: Improved layout consistency for the filter icon

The addition of flexShrink: 0 to the SvgFilter component's style is a good improvement. This change prevents the icon from shrinking when the button is resized, ensuring consistent layout and appearance across different screen sizes and resolutions. This minor adjustment contributes to the overall goal of enhancing report responsiveness and polishing the UI.

packages/desktop-client/src/components/common/SpaceBetween.tsx (1)

1-5: LGTM: Imports are appropriate and well-structured.

The imports are correctly defined and include all necessary dependencies for the component. The use of relative paths indicates a well-organized project structure.

packages/desktop-client/src/components/reports/Header.tsx (3)

13-13: LGTM: SpaceBetween import added correctly.

The import statement for the new SpaceBetween component is correctly placed and uses the appropriate path.


73-78: Great improvement in responsiveness!

The use of SpaceBetween with conditional direction and alignment based on isNarrowWidth enhances the component's responsiveness. This change effectively replaces the previous static layout with a more flexible one.


Line range hint 1-207: Overall, excellent improvements to layout and responsiveness.

The changes in this file significantly enhance the Header component's layout and responsiveness, aligning well with the PR's objective of "polishing report responsitivity". The introduction of SpaceBetween components provides better control over spacing and alignment, especially in responsive scenarios.

Key improvements:

  1. Enhanced responsiveness using conditional layouts based on screen width.
  2. Improved spacing management throughout the component.
  3. Better organization of nested components.

These changes maintain the existing functionality while making the UI more flexible and maintainable. Great job on the refactoring!

packages/desktop-client/src/components/reports/ReportSidebar.tsx (1)

17-17: LGTM: New import for SpaceBetween component

The import statement for the SpaceBetween component has been correctly added. This new component will likely improve the layout and spacing management within the ReportSidebar.

packages/desktop-client/src/components/reports/reports/Spending.tsx (1)

26-26: LGTM: SpaceBetween import added correctly

The import for the SpaceBetween component is correctly placed and follows the existing import structure.

@@ -52,7 +52,7 @@ export const Tooltip = ({

return (
<View
style={{ minHeight: 'auto' }}
style={{ minHeight: 'auto', flexShrink: 0 }}
Copy link
Member Author

Choose a reason for hiding this comment

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

Screenshot 2024-10-11 at 19 47 09

fix for the tiny icons

@@ -62,8 +62,21 @@ export function FilterExpression<T extends RuleConditionEntity>({
variant="bare"
isDisabled={customName != null}
onPress={() => setEditing(true)}
style={{
Copy link
Member Author

Choose a reason for hiding this comment

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

Screenshot 2024-10-11 at 19 49 20

fix for filters expanding out-of-bounds

@@ -6,7 +6,10 @@ import { Button } from '../common/Button2';
export function FiltersButton({ onPress }: { onPress: () => void }) {
return (
<Button variant="bare" onPress={onPress}>
<SvgFilter style={{ width: 12, height: 12, marginRight: 5 }} /> Filter
<SvgFilter
Copy link
Member Author

Choose a reason for hiding this comment

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

Fix the the icon in "Filters" button becoming small when resizing browser

flexShrink: 0,
}}
>
<View
<SpaceBetween
Copy link
Member Author

Choose a reason for hiding this comment

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

Various small re-alignments in cashflow & networth pages on small devices (i.e. mobile). To make the filters look slightly better on small resolutions.

@@ -177,16 +178,13 @@ export function ReportSidebar({
<strong>Display</strong>
</Text>
</View>
<View
<SpaceBetween
Copy link
Member Author

Choose a reason for hiding this comment

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

No user-facing update here. Just a small code improvement.

@@ -23,6 +23,7 @@ import { Block } from '../../common/Block';
import { Button } from '../../common/Button2';
import { Paragraph } from '../../common/Paragraph';
import { Select } from '../../common/Select';
import { SpaceBetween } from '../../common/SpaceBetween';
Copy link
Member Author

Choose a reason for hiding this comment

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

Improving how the filters look in mobile & smaller resolutions.

@MatissJanis MatissJanis changed the title [WIP] ✨ polishing report responsitivity ✨ polishing report responsitivity Oct 11, 2024
@MikesGlitch MikesGlitch self-assigned this Oct 12, 2024
@MikesGlitch
Copy link
Contributor

MikesGlitch commented Oct 12, 2024

Found one small thing but it's unrelated to your PR. If you're interested, it's to do with the overflow of the toolbar :

test

MikesGlitch
MikesGlitch previously approved these changes Oct 12, 2024
Copy link
Contributor

@MikesGlitch MikesGlitch left a comment

Choose a reason for hiding this comment

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

Looks great.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (4)
packages/desktop-client/src/components/filters/CompactFiltersButton.tsx (2)

8-8: LGTM! Consider using a theme variable for consistency.

The addition of a minimum width to the Button component is a good improvement for layout stability. This change aligns well with the PR objective of enhancing report responsiveness.

Consider using a theme variable or constant for the minWidth value (20px) to ensure consistency across the application. This would make it easier to maintain and adjust the compact button sizes globally if needed in the future.


9-13: LGTM! Consider optimizing to reduce redundancy.

The changes to the SvgFilter component improve layout stability and responsiveness, which aligns well with the PR objectives. Setting explicit dimensions and preventing shrinking are good practices for icon components.

To optimize the code and reduce redundancy, consider consolidating the width and height values:

 <SvgFilter
-  width={15}
-  height={15}
-  style={{ width: 15, height: 15, flexShrink: 0 }}
+  style={{ width: 15, height: 15, flexShrink: 0 }}
 />

This change maintains the same functionality while making the code more concise and easier to maintain.

packages/desktop-client/src/components/reports/ReportTopbar.tsx (2)

74-74: Consider responsive design for overflow handling.

The addition of overflowY: 'auto' improves responsiveness by allowing vertical scrolling when needed. However, consider if this is the best approach for all screen sizes.

You might want to implement a more responsive design that adjusts the layout for different screen sizes before resorting to scrolling. For example:

import { useMediaQuery } from 'react-responsive';

// Inside your component
const isSmallScreen = useMediaQuery({ maxWidth: 768 });

// In your JSX
<View
  style={{
    flexDirection: isSmallScreen ? 'column' : 'row',
    alignItems: isSmallScreen ? 'flex-start' : 'center',
    overflowY: isSmallScreen ? 'auto' : 'visible',
    // ... other styles
  }}
>
  {/* Your existing content */}
</View>

This approach would stack the elements vertically on smaller screens and enable scrolling only when necessary.


193-219: Good use of SpaceBetween for improved layout.

The introduction of the SpaceBetween component enhances the layout structure and responsiveness. The custom styling ensures proper spacing and alignment of the FilterButton and SaveReport components.

Consider extracting the inline styles to a separate constant or using a styled-component for better readability:

const spaceBetweenStyles = {
  flexWrap: 'nowrap' as const,
  justifyContent: 'space-between' as const,
  flex: 1,
};

// In your JSX
<SpaceBetween style={spaceBetweenStyles}>
  {/* ... */}
</SpaceBetween>

This approach would make the component more readable and easier to maintain.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 7edbf62 and a4f1d40.

⛔ Files ignored due to path filters (24)
  • packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Area-Graph-and-checks-the-visuals-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Area-Graph-and-checks-the-visuals-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Area-Graph-and-checks-the-visuals-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Bar-Graph-and-checks-the-visuals-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Bar-Graph-and-checks-the-visuals-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Bar-Graph-and-checks-the-visuals-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Data-Table-and-checks-the-visuals-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Data-Table-and-checks-the-visuals-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Data-Table-and-checks-the-visuals-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Donut-Graph-and-checks-the-visuals-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Donut-Graph-and-checks-the-visuals-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Donut-Graph-and-checks-the-visuals-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Line-Graph-and-checks-the-visuals-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Line-Graph-and-checks-the-visuals-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Switches-to-Line-Graph-and-checks-the-visuals-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Validates-that-show-labels-button-shows-the-labels-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Validates-that-show-labels-button-shows-the-labels-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Validates-that-show-labels-button-shows-the-labels-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Validates-that-show-legend-button-shows-the-legend-side-bar-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Validates-that-show-legend-button-shows-the-legend-side-bar-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Validates-that-show-legend-button-shows-the-legend-side-bar-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Validates-that-show-summary-button-shows-the-summary-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Validates-that-show-summary-button-shows-the-summary-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/reports.test.js-snapshots/Reports-custom-reports-Validates-that-show-summary-button-shows-the-summary-3-chromium-linux.png is excluded by !**/*.png
📒 Files selected for processing (2)
  • packages/desktop-client/src/components/filters/CompactFiltersButton.tsx (1 hunks)
  • packages/desktop-client/src/components/reports/ReportTopbar.tsx (4 hunks)
🧰 Additional context used
🔇 Additional comments (4)
packages/desktop-client/src/components/filters/CompactFiltersButton.tsx (1)

Line range hint 1-15: Overall, good improvements to component responsiveness.

The changes made to the CompactFiltersButton component contribute positively to the PR's objective of enhancing report responsiveness. The modifications to both the Button and SvgFilter components improve layout stability and consistency.

While the changes are good as they are, consider the minor suggestions provided above to further optimize the code and maintain consistency across the application.

packages/desktop-client/src/components/reports/ReportTopbar.tsx (3)

17-17: LGTM: SpaceBetween import added correctly.

The import statement for the SpaceBetween component is properly placed and follows the existing import structure.


200-218: LGTM: FilterButton and SaveReport properly integrated.

The FilterButton and SaveReport components are correctly placed within the SpaceBetween component. Their functionality remains intact, and the new layout improves their spacing and alignment.


Line range hint 1-224: Overall, good improvements to ReportTopbar responsiveness.

The changes made to this file successfully enhance the responsiveness and layout of the ReportTopbar component. The introduction of the SpaceBetween component and the adjustments to the styling contribute to a more flexible and maintainable structure. The suggestions provided are minor and aimed at further improving code readability and responsiveness.

@MatissJanis
Copy link
Member Author

Good idea @MikesGlitch . Updated the report topbar to scale better. It's not ideal.. but better than before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants