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

✨ (dashboards) ability to save filters & timeframes on spending widgets #3432

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

MatissJanis
Copy link
Member

@MatissJanis MatissJanis commented Sep 13, 2024

Allowing to save spending widgets in dashboards. This required a bit of refactoring to move from LocalPrefs to widgets.

This is a breaking change sadly (i.e. the saved local-pref values will be lost). But IMO that's fine since this is an experimental feature that is expected to have breaking changes.

@actual-github-bot actual-github-bot bot changed the title ✨ (dashboards) ability to save filters & timeframes on spending widgets [WIP] ✨ (dashboards) ability to save filters & timeframes on spending widgets Sep 13, 2024
Copy link

netlify bot commented Sep 13, 2024

Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit 20622f1
🔍 Latest deploy log https://app.netlify.com/sites/actualbudget/deploys/66ec5fd8bcb1d10008894035
😎 Deploy Preview https://deploy-preview-3432.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 Sep 13, 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.28 MB → 5.28 MB (+454 B) +0.01%
Changeset
File Δ Size
src/components/reports/DateRange.tsx 📈 +257 B (+15.63%) 1.61 kB → 1.86 kB
src/components/reports/ReportRouter.tsx 📈 +163 B (+13.24%) 1.2 kB → 1.36 kB
src/components/reports/reports/Spending.tsx 📈 +980 B (+5.38%) 17.8 kB → 18.76 kB
src/components/common/Select.tsx 📈 +48 B (+1.85%) 2.54 kB → 2.58 kB
src/components/reports/reportRanges.ts 📈 +10 B (+0.29%) 3.37 kB → 3.38 kB
src/components/reports/graphs/SpendingGraph.tsx 📈 +22 B (+0.27%) 7.91 kB → 7.93 kB
src/components/reports/Overview.tsx 📈 +30 B (+0.19%) 15.68 kB → 15.71 kB
src/components/reports/Header.tsx 📉 -29 B (-0.57%) 4.93 kB → 4.9 kB
src/components/reports/spreadsheets/spending-spreadsheet.ts 📉 -40 B (-0.62%) 6.25 kB → 6.21 kB
src/components/reports/reports/SpendingCard.tsx 📉 -987 B (-17.61%) 5.47 kB → 4.51 kB
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

Asset File Size % Changed
static/js/ReportRouter.js 1.5 MB → 1.5 MB (+406 B) +0.03%
static/js/index.js 3.31 MB → 3.31 MB (+48 B) +0.00%

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
static/js/usePreviewTransactions.js 1.59 kB 0%
static/js/indexeddb-main-thread-worker-e59fee74.js 13.5 kB 0%
static/js/resize-observer.js 18.37 kB 0%
static/js/AppliedFilters.js 20.97 kB 0%
static/js/BackgroundImage.js 122.29 kB 0%
static/js/narrow.js 80.95 kB 0%
static/js/wide.js 225.37 kB 0%

Copy link
Contributor

github-actions bot commented Sep 13, 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.19 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.19 MB 0%

@MatissJanis MatissJanis changed the title [WIP] ✨ (dashboards) ability to save filters & timeframes on spending widgets ✨ (dashboards) ability to save filters & timeframes on spending widgets Sep 13, 2024
@Teprifer
Copy link

Teprifer commented Sep 14, 2024

  • Opening the graph the month comparison defaulted to April and September with the single month option selected,
    But changing time period then selecting single month set it to September and September.
    Suggest defaulting to Current month vs last month, e.g.

    Compare: $currentMonth
    To: $lastMonth

    Assuming there's data, although your thought to always show a graph even if it's empty to give new users an idea of what they could come back to in the future is fair too.

/ed/ removed incorrect info (see Carkom's comment below)

@carkom
Copy link
Contributor

carkom commented Sep 14, 2024

@Teprifer you are not using the most up-to-date version of edge.

@Teprifer
Copy link

@carkom Doh! I'd updated but not refreshed enough -.- Thanks for the heads up.

@carkom
Copy link
Contributor

carkom commented Sep 15, 2024

Fatal Error found:

  1. Create new spending graph
  2. Open it
  3. Change "To" month to January (or some month with no data)
  4. Click "Budgeted" or "Average" button
  5. Error in SpendingGraph.tsx (w.months[a]] is undefined)

Copy link
Contributor

@carkom carkom left a comment

Choose a reason for hiding this comment

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

Code looks good. Only suggestion is for a "live" graph option for "single-month". The error I mentioned happens in many situations, so needs to be de-bugged.

options={[
...(reportMode === 'single-month'
? []
: [['current-month', t('Current Month')] as const]),
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd suggest we remove the actual current month from the list so it's not duplicated. Could we also offer a "last month" option in the "to" selection and create a "live" graph when "single month" button is chosen?

Copy link
Member Author

Choose a reason for hiding this comment

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

I actually removed the notion of "current month" and instead aligned the functionality with the other reports to have a more consistent interface. It did seem like a good idea in the beginning to use the "current month" label, but it actually has a fair few complexities that I hadn't considered. Maybe we will bring it back in a future revision. But for now - no.

--

Added the "live/static" button.

@carkom
Copy link
Contributor

carkom commented Sep 18, 2024

@MatissJanis - the calculateTimeRange is not handling reversed dates. Not sure how it should handle them but current functionality is not very intuitive. I guess just an absolute value for the "month difference"?

  1. use live graph
  2. single-month
  3. compare = August
  4. CompareTo = May
  5. Save
  6. go to reports overview
  7. Notice that the range says December 2024 to September 2024

It's also making the "CompareTo" (which is saved as "end" in the code and the dotted gray line in the graph) equal to the current month which is not the intended function. Current month should be green in a live graph. Seems like the calculateTimeRange is giving you "start" and "end" in reverse order.

Copy link

coderabbitai bot commented Sep 18, 2024

Walkthrough

The pull request introduces a series of modifications across multiple components in the desktop client. Key updates include the addition of new properties for customization, adjustments to rendering logic based on specific conditions, and improvements to type safety. The refactoring of components aims to streamline data handling and enhance the overall functionality of the application, particularly in relation to spending reports and widget management.

Changes

Files Change Summary
packages/desktop-client/src/components/common/Select.tsx Added popoverStyle property to SelectProps for customizing popover styling. Updated popover component to utilize this new prop.
packages/desktop-client/src/components/reports/DateRange.tsx Introduced conditional rendering logic for 'budget' and 'average' types.
packages/desktop-client/src/components/reports/Header.tsx Modified rendering condition for View component based on path.
packages/desktop-client/src/components/reports/Overview.tsx Added widgetId prop to SpendingCard component for enhanced tracking.
packages/desktop-client/src/components/reports/ReportRouter.tsx Added dynamic route for /spending/:id to render specific spending reports.
packages/desktop-client/src/components/reports/graphs/SpendingGraph.tsx Enhanced type safety by modifying months structure and updating CustomTooltipProps. Adjusted logic for handling optional properties.
packages/desktop-client/src/components/reports/reports/Spending.tsx Refactored to use useParams for fetching widget ID and improved loading state management. Introduced SpendingInternal function for better organization.
packages/desktop-client/src/components/reports/reports/SpendingCard.tsx Removed local preferences for filters, relying on meta prop instead. Simplified date range calculations and rendering logic.
packages/desktop-client/src/components/reports/spreadsheets/spending-spreadsheet.ts Removed setDataCheck parameter from createSpendingSpreadsheet function, simplifying its responsibilities.
packages/loot-core/src/types/models/dashboard.d.ts Expanded SpendingWidget type with new optional properties for improved functionality.
packages/loot-core/src/types/models/reports.d.ts Removed spendingReportModeType type declaration, indicating a shift in report processing.
packages/loot-core/src/types/prefs.d.ts Removed properties related to spending report preferences from LocalPrefs type, suggesting a refactor in preference management.
packages/loot-core/src/types/models/reports.d.ts Removed properties related to spending report preferences from LocalPrefs type, suggesting a refactor in preference management.

Possibly related PRs

Suggested labels

sparkles: Merged


Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 2771afc and 20622f1.

Files selected for processing (1)
  • packages/desktop-client/src/components/reports/reports/Spending.tsx (6 hunks)
Additional comments not posted (2)
packages/desktop-client/src/components/reports/reports/Spending.tsx (2)

41-53: LGTM!

The Spending function is well-structured and uses the useParams and useWidget hooks effectively to retrieve the spending widget data based on the URL parameter. The loading state is handled appropriately by displaying a LoadingIndicator while the data is being fetched. The fetched widget data is then passed to the SpendingInternal component for rendering.


Line range hint 59-552: LGTM!

The SpendingInternal function is well-structured and encapsulates the main logic and rendering of the spending widget. It effectively uses various hooks and state variables to manage the widget's state and user interactions. The function initializes the state variables based on the widget's metadata and fetches the necessary data for populating the interval options.

The graph data is memoized based on the filter conditions and comparison dates using the useReport hook, which optimizes performance by avoiding unnecessary re-calculations.

The event handlers for saving the widget, updating the report mode, and updating the comparison dates are defined appropriately.

The UI components, including the mode buttons, comparison date selects, filter button, and the spending graph, are rendered based on the widget's metadata and user selections. Additional information such as the spent amount, budgeted amount, and average spent amount is displayed to provide meaningful insights to the user.

Overall, the SpendingInternal function is well-implemented and follows good practices for managing state and rendering in a React component.


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

@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 (1)
packages/desktop-client/src/components/reports/reports/Spending.tsx (1)

Line range hint 63-584: Consider breaking down the UI rendering logic into smaller components.

The function is using the useFilters, useReport, useNavigate, and useResponsive hooks for state management, data fetching, navigation, and responsive design, which are good practices. However, the UI rendering logic is quite complex and could be broken down into smaller components for better readability and maintainability.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 183c4b2 and 2b900f6.

Files ignored due to path filters (1)
  • upcoming-release-notes/3432.md is excluded by !**/*.md
Files selected for processing (12)
  • packages/desktop-client/src/components/common/Select.tsx (3 hunks)
  • packages/desktop-client/src/components/reports/DateRange.tsx (1 hunks)
  • packages/desktop-client/src/components/reports/Header.tsx (1 hunks)
  • packages/desktop-client/src/components/reports/Overview.tsx (1 hunks)
  • packages/desktop-client/src/components/reports/ReportRouter.tsx (1 hunks)
  • packages/desktop-client/src/components/reports/graphs/SpendingGraph.tsx (8 hunks)
  • packages/desktop-client/src/components/reports/reports/Spending.tsx (8 hunks)
  • packages/desktop-client/src/components/reports/reports/SpendingCard.tsx (4 hunks)
  • packages/desktop-client/src/components/reports/spreadsheets/spending-spreadsheet.ts (0 hunks)
  • packages/loot-core/src/types/models/dashboard.d.ts (1 hunks)
  • packages/loot-core/src/types/models/reports.d.ts (0 hunks)
  • packages/loot-core/src/types/prefs.d.ts (0 hunks)
Files not reviewed due to no reviewable changes (3)
  • packages/desktop-client/src/components/reports/spreadsheets/spending-spreadsheet.ts
  • packages/loot-core/src/types/models/reports.d.ts
  • packages/loot-core/src/types/prefs.d.ts
Additional comments not posted (20)
packages/desktop-client/src/components/reports/ReportRouter.tsx (1)

20-20: LGTM! The new route aligns with the PR objective.

The addition of the /spending/:id route with a dynamic :id parameter enables rendering the Spending component for specific spending reports. This change supports the PR objective of allowing users to save individual spending widgets within dashboards, as each saved widget would have a unique identifier.

The implementation looks good and does not appear to negatively impact existing functionality.

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

65-70: LGTM!

The new else if block correctly handles the rendering logic for 'budget' and 'average' types. It formats the startDate and displays the appropriate comparison text, enhancing the component's functionality and user experience.

packages/loot-core/src/types/models/dashboard.d.ts (1)

44-50: LGTM! The changes enhance the functionality and versatility of the SpendingWidget.

The addition of the new optional properties (conditions, conditionsOp, timeFrame, and mode) allows for more detailed and customizable representations of spending data:

  • conditions and conditionsOp enable more complex filtering or criteria to be applied to the spending data.
  • timeFrame introduces a temporal aspect to the widget, allowing it to be configured for different periods.
  • mode provides the ability for the widget to operate in different contexts, such as 'single-month', 'budget', or 'average'.

The breaking change is justified given the experimental nature of the feature, as mentioned in the PR objectives. The refactoring effort to transition from LocalPrefs to a widget-based approach seems to be a step towards a more modular and maintainable codebase.

packages/desktop-client/src/components/common/Select.tsx (2)

29-29: LGTM!

The new optional popoverStyle property enhances the flexibility of the Select component by allowing custom styles for the popover. The type CSSProperties is correctly imported and used. This change doesn't introduce any breaking changes or issues.


55-55: LGTM!

The popoverStyle prop is correctly destructured with a default value of an empty object, ensuring that existing code will continue to work without any issues. Applying the popoverStyle prop to the style attribute of the Popover component allows custom styles to be applied when the popover is rendered. These changes are consistent with the addition of the popoverStyle property to the SelectProps type and don't introduce any breaking changes or issues.

Also applies to: 116-116

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

26-26: LGTM!

The widgetId prop is a valid addition to the SpendingCardProps type.


34-36: LGTM!

The destructuring of the widgetId prop and the default value assignment for the meta prop are valid changes.


40-46: LGTM!

The variable assignments for isDashboardsFeatureEnabled, start, end, and spendingReportMode are valid and consistent with the provided context.


51-59: LGTM!

The variable assignments for selection and getGraphData are valid and consistent with the provided context. The use of useMemo for memoizing the getGraphData function is a good optimization.


Line range hint 63-169: LGTM!

The variable assignments, conditional rendering, and the use of the DateRange, SpendingGraph, and LoadingIndicator components are all valid and consistent with the provided context.

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

76-76: Verify the impact of removing the '/reports/spending' condition.

The change in the conditional rendering logic removes the check for '/reports/spending' path. This means that the View component will now be rendered for any path other than '/reports/custom'.

Please clarify the intention behind this change and verify if it aligns with the expected user interface behavior for different report paths. Ensure that removing the '/reports/spending' condition does not lead to any unintended consequences.

To verify the impact, run the following script:

Verification successful

The removal of '/reports/spending' condition appears intentional and beneficial.

After verifying the codebase, it's clear that the change in Header.tsx allows the View component to be rendered for all report paths except '/reports/custom'. This includes '/reports/spending', '/reports/net-worth', and '/reports/cash-flow'.

The impact of this change is that it simplifies the conditional logic and provides consistent behavior across different report types. It doesn't introduce any issues with existing functionality.

To make the code more explicit and easier to maintain, you might consider using a constant for the excluded path:

const CUSTOM_REPORT_PATH = '/reports/custom';
// ...
{!path.includes(CUSTOM_REPORT_PATH) && (
  // View component
)}

This change enhances readability and allows for easier updates if more paths need to be excluded in the future.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the rendering behavior for different report paths.

# Test: Search for the usage of `'/reports/spending'` path. 
# Expect: Occurrences in other components that might be impacted by this change.
rg --type typescript $'/reports/spending'

# Test: Search for the usage of other report paths (excluding custom and spending).
# Expect: Occurrences of other report paths to verify the rendering behavior.
rg --type typescript $'/reports/(?!custom|spending)\w+'

Length of output: 376


Script:

#!/bin/bash
# Description: Verify the rendering behavior for different report paths.

# Search for the usage of '/reports/spending' path
rg --type ts '/reports/spending'

# Search for the usage of '/reports/custom' path
rg --type ts '/reports/custom'

# Search for other report paths
rg --type ts '/reports/\w+'

# Search for conditional rendering related to report paths
ast-grep --lang typescript --pattern 'path.includes("/reports/")'

# Search for Switch or conditional statements related to report paths
ast-grep --lang typescript --pattern 'switch ($path) { $$$ case "/reports/$_": $$$ }'

Length of output: 3398

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

35-41: LGTM!

The change to the months property in the PayloadItem type provides more flexibility by allowing a dynamic set of month entries. This is a good improvement to the data structure.


48-49: LGTM!

The changes to the balanceTypeOp and selection properties in the CustomTooltipProps type enforce stricter typing. This improves the clarity of the expected values and reduces the risk of incorrect usage. Good job on enhancing the type safety!


65-65: LGTM!

The addition of optional chaining (?.) in several places improves the robustness of the code by safely accessing properties that may not exist in the months object. This prevents potential runtime errors. Nice work on handling the optional properties gracefully!

Also applies to: 88-88, 92-92, 108-108, 112-112


128-128: LGTM!

The change to the mode property in the SpendingGraphProps type enforces stricter typing and improves clarity. The adjustments to the thisMonthMax and selectionMax logic ensure that the code remains robust against undefined values. These changes enhance the type safety and reliability of the code. Well done!

Also applies to: 144-158


161-167: LGTM!

The explicit type definition for the tick formatter enhances type safety for the tick formatting function. This is a good practice to ensure that the function receives and returns the expected types. Nice work on improving the type safety!

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

548-548: Excellent addition of the widgetId prop to support saving spending widgets!

The widgetId prop, set to the unique identifier item.i, is a crucial change that enables the SpendingCard component to manage its state and settings based on the widget instance. This aligns perfectly with the PR objective of transitioning from LocalPrefs to a widget-based approach for saving spending widgets within dashboards.

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

45-57: LGTM!

The function is using the useParams hook to retrieve the widget ID from the URL and the useWidget hook to fetch the spending widget data, which are good practices for dynamic routing and data fetching. It also handles the loading state by displaying a LoadingIndicator while the widget data is being fetched, which is a good practice for user experience.


136-157: LGTM!

The onSaveWidget function is saving the widget settings, which is a good practice for user experience.


37-40: Skipping the review of the calculateTimeRange function.

The calculateTimeRange function is imported from an external file and is being used correctly to calculate the start and end dates based on the time frame and mode. Since the function is not defined in this file, it cannot be reviewed in detail.

@MatissJanis
Copy link
Member Author

Thanks @carkom ! This has now been fixed: I aligned the date logic between the spending report and the cashflow/networth reports.

Also sligthly updated the paddings to better align with the other reports.

@carkom
Copy link
Contributor

carkom commented Sep 18, 2024

Thanks @carkom ! This has now been fixed: I aligned the date logic between the spending report and the cashflow/networth reports.

Also sligthly updated the paddings to better align with the other reports.

I'm not sure it works like this. There's a couple issues with aligning to network/cashflow.

  • cashflow/networth are date ranges and this is just 2 separate months so it's not entirely necessary to align them as they are different logic.
  • The "primary" month should be green in the graph. As it is currently, the primary month is gray
  • The displays in the upper right area don't work quite right for current month
  • It's a bit jumpy as you navigate from one mode to the next the code is constantly switching the months around

@carkom
Copy link
Contributor

carkom commented Sep 18, 2024

@MatissJanis
Ultimately the saving part of the UI is error free. The UX could use some polish but I can do that in a later PR if you're fine with that plan. I don't see it as a problem since it's still behind a feature flag.

carkom
carkom previously approved these changes Sep 18, 2024
Copy link
Contributor

@carkom carkom left a comment

Choose a reason for hiding this comment

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

Code is all good. No fatal errors found in QA testing the UI.

@MatissJanis
Copy link
Member Author

I'm not sure it works like this. There's a couple issues with aligning to network/cashflow.

  • cashflow/networth are date ranges and this is just 2 separate months so it's not entirely necessary to align them as they are different logic.
  • The "primary" month should be green in the graph. As it is currently, the primary month is gray
  • The displays in the upper right area don't work quite right for current month
  • It's a bit jumpy as you navigate from one mode to the next the code is constantly switching the months around

hmm.. yea, I see your point. The spending report doesn't actually have a "start" & "end" date as the others do. Those are just two dates we compare. I updated the PR to reflect that (removed start/end variable usages and instead using the previous - compare/compareTo).

Also removed validateStart/end and instead using Math.abs as you recommended. That makes more sense now that I think about it.

Sorry for so many rounds of review. The dashboard interface is the part that worries me the most - we need to get that right the first time. Other UX improvements can be patched later, but not the interface so much.

LMK if you have any more feedback/ideas what we should change. Happy to do more as part of this PR too :)

Copy link
Contributor

@matt-fidd matt-fidd left a comment

Choose a reason for hiding this comment

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

Maybe not one for this PR (or maybe is, depends if you want to or not!) but we've lost the indication of "saved state" from the button. IMO it was quite nice to know if you had unsaved changes but it's far from crucial so no issue if we want to drop it.

image
vs
image

variant={isLive ? 'primary' : 'normal'}
onPress={() => setIsLive(state => !state)}
>
{isLive ? 'Live' : 'Static'}
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like you've translated everything but this one, just highlighting in case you missed it.

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.

4 participants