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

✨ release tracking budget feature #3833

Merged
merged 10 commits into from
Nov 18, 2024
Merged

Conversation

MatissJanis
Copy link
Member

Solves #2999

@actual-github-bot actual-github-bot bot changed the title ✨ release tracking budget feature [WIP] ✨ release tracking budget feature Nov 14, 2024
Copy link

netlify bot commented Nov 14, 2024

Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit ef4de7c
🔍 Latest deploy log https://app.netlify.com/sites/actualbudget/deploys/673bb26907f40600087328fa
😎 Deploy Preview https://deploy-preview-3833.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 Nov 14, 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.43 MB → 5.43 MB (-606 B) -0.01%
Changeset
File Δ Size
node_modules/clsx/dist/clsx.js 🆕 +509 B 0 B → 509 B
node_modules/clsx/dist/clsx.js?commonjs-module 🆕 +27 B 0 B → 27 B
src/components/mobile/MobileNavTabs.tsx 📈 +56 B (+1.11%) 4.92 kB → 4.97 kB
node_modules/react-grid-layout/build/ReactGridLayout.js 📉 -1 B (-0.00%) 24.96 kB → 24.96 kB
node_modules/react-grid-layout/build/GridItem.js 📉 -1 B (-0.00%) 21.49 kB → 21.49 kB
node_modules/react-grid-layout/build/components/WidthProvider.js 📉 -1 B (-0.02%) 5.22 kB → 5.22 kB
src/components/settings/index.tsx 📉 -34 B (-0.54%) 6.16 kB → 6.13 kB
src/hooks/useFeatureFlag.ts 📉 -23 B (-6.05%) 380 B → 357 B
src/components/settings/Experimental.tsx 📉 -706 B (-14.20%) 4.85 kB → 4.17 kB
node_modules/clsx/dist/clsx.mjs 🔥 -368 B (-100%) 368 B → 0 B
node_modules/clsx/dist/clsx.mjs?commonjs-proxy 🔥 -64 B (-100%) 64 B → 0 B
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

No assets were bigger

Smaller

Asset File Size % Changed
static/js/index.js 3.44 MB → 3.44 MB (-539 B) -0.01%
static/js/ReportRouter.js 1.49 MB → 1.49 MB (-67 B) -0.00%

Unchanged

Asset File Size % Changed
static/js/indexeddb-main-thread-worker-e59fee74.js 13.5 kB 0%
static/js/AppliedFilters.js 21.3 kB 0%
static/js/BackgroundImage.js 122.29 kB 0%
static/js/workbox-window.prod.es5.js 5.69 kB 0%
static/js/resize-observer.js 18.37 kB 0%
static/js/narrow.js 82.68 kB 0%
static/js/wide.js 242.81 kB 0%

Copy link
Contributor

github-actions bot commented Nov 14, 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.32 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.32 MB 0%

@MatissJanis

This comment was marked as resolved.

@MatissJanis

This comment was marked as resolved.

@MatissJanis

This comment was marked as resolved.

@@ -43,6 +43,43 @@ export function MobileNavTabs() {
padding: 10,
};

const [{ y }, api] = useSpring(() => ({ y: OPEN_DEFAULT_Y }));
Copy link
Member Author

Choose a reason for hiding this comment

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

Technically there are no changes here. I just re-arranged the constant definitions so that openDefault could be accessed by the NavLink definitions. It will now close the bottom nav bar whenever a item in the nav is clicked (thus navigating to a different page).

This should make the VRT tests more stable. 🤞

@MatissJanis

This comment was marked as resolved.

@MatissJanis MatissJanis changed the title [WIP] ✨ release tracking budget feature ✨ release tracking budget feature Nov 18, 2024
Copy link
Contributor

coderabbitai bot commented Nov 18, 2024

Walkthrough

The pull request introduces several changes across multiple files in the desktop client. In settings-page.js, the enableExperimentalFeature method has been removed along with its associated calls, indicating a shift in budget type management. The MobileNavTabs.tsx file has been updated to include new animation functionalities using the useSpring hook, with modifications to the NavTabProps type to accommodate click events. The Experimental.tsx file sees the removal of the TrackingBudgetFeature function, which previously managed a feature toggle for "reportBudget." Consequently, in index.tsx, the conditional rendering of the BudgetTypeSettings component is eliminated, ensuring it is always displayed. The useFeatureFlag.ts file reflects a reduction in initialized feature flags by removing the reportBudget property. Lastly, the prefs.d.ts file updates the FeatureFlag type to exclude the reportBudget option. Overall, these changes streamline the management of budget types and experimental features across the application.

Possibly related PRs

Suggested labels

':sparkles: Merged', ':white_check_mark: Approved'

Suggested reviewers

  • youngcw
  • MikesGlitch

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 eslint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

packages/desktop-client/src/components/mobile/MobileNavTabs.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-eslint-plugin".

(The package "eslint-plugin-eslint-plugin" was not found when loaded as a Node module from the directory "/packages/eslint-plugin-actual".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-eslint-plugin@latest --save-dev

The plugin "eslint-plugin-eslint-plugin" was referenced from the config file in "packages/eslint-plugin-actual/.eslintrc.js".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.


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 (4)
packages/desktop-client/src/components/settings/Experimental.tsx (1)

Line range hint 65-142: Consider architectural improvements for feature flag management

While the implementation is functional, consider these architectural improvements:

  1. Centralize feature documentation
  2. Add feature flag deprecation tracking
  3. Consider A/B testing capabilities

Would you like me to propose a more robust feature flag management system that includes these improvements?

packages/desktop-client/src/components/settings/index.tsx (1)

Line range hint 108-115: Consider addressing the TODO comment about ID management.

There's a low-priority TODO comment about eliminating or conditionally showing certain IDs. This technical debt should be tracked and addressed in a future update.

Would you like me to create a GitHub issue to track this technical debt item? I can help outline the requirements and considerations for managing these IDs.

packages/desktop-client/src/components/mobile/MobileNavTabs.tsx (2)

48-81: Consider adding error boundaries for animation failures

The animation control functions are well-implemented with proper memoization and smooth transitions. The wobbly effect on cancel is a nice UX touch. However, consider wrapping the animation logic in an error boundary to gracefully handle any potential animation failures.

class AnimationErrorBoundary extends React.Component {
  componentDidCatch(error: Error) {
    // Fallback to default state
    api.start({ y: OPEN_DEFAULT_Y, immediate: true });
    // Log error or notify monitoring service
  }
  // ... rest of implementation
}

242-242: Consider enhancing accessibility for navigation tabs

The NavTab component implementation is type-safe and correctly handles the onClick prop. However, consider enhancing accessibility by adding ARIA attributes and keyboard navigation support.

function NavTab({ Icon: TabIcon, name, path, style, onClick }: NavTabProps) {
  return (
    <NavLink
      to={path}
+     role="tab"
+     aria-label={name}
+     onKeyDown={(e) => {
+       if (e.key === 'Enter' || e.key === ' ') {
+         onClick?.(e);
+       }
+     }}
      style={({ isActive }) => ({
        ...styles.noTapHighlight,
        alignItems: 'center',
        color: isActive ? theme.mobileNavItemSelected : theme.mobileNavItem,
        display: 'flex',
        flexDirection: 'column',
        textDecoration: 'none',
        textAlign: 'center',
        ...style,
      })}
      onClick={onClick}
    >
      <TabIcon width={22} height={22} />
      {name}
    </NavLink>
  );
}

Also applies to: 245-245, 259-259

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 7010ab1 and ef4de7c.

⛔ Files ignored due to path filters (7)
  • packages/desktop-client/e2e/settings.mobile.test.js-snapshots/Mobile-Settings-checks-that-settings-page-can-be-opened-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/settings.mobile.test.js-snapshots/Mobile-Settings-checks-that-settings-page-can-be-opened-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/settings.mobile.test.js-snapshots/Mobile-Settings-checks-that-settings-page-can-be-opened-3-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/settings.mobile.test.js-snapshots/Mobile-Settings-checks-that-settings-page-can-be-opened-4-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/settings.mobile.test.js-snapshots/Mobile-Settings-checks-that-settings-page-can-be-opened-5-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/settings.mobile.test.js-snapshots/Mobile-Settings-checks-that-settings-page-can-be-opened-6-chromium-linux.png is excluded by !**/*.png
  • upcoming-release-notes/3833.md is excluded by !**/*.md
📒 Files selected for processing (6)
  • packages/desktop-client/e2e/page-models/settings-page.js (0 hunks)
  • packages/desktop-client/src/components/mobile/MobileNavTabs.tsx (5 hunks)
  • packages/desktop-client/src/components/settings/Experimental.tsx (1 hunks)
  • packages/desktop-client/src/components/settings/index.tsx (1 hunks)
  • packages/desktop-client/src/hooks/useFeatureFlag.ts (0 hunks)
  • packages/loot-core/src/types/prefs.d.ts (0 hunks)
💤 Files with no reviewable changes (3)
  • packages/desktop-client/e2e/page-models/settings-page.js
  • packages/desktop-client/src/hooks/useFeatureFlag.ts
  • packages/loot-core/src/types/prefs.d.ts
🔇 Additional comments (6)
packages/desktop-client/src/components/settings/Experimental.tsx (3)

Line range hint 16-26: LGTM: Well-structured type definition

The FeatureToggleProps type is well-defined with clear documentation of required and optional properties.


Line range hint 28-63: LGTM: Robust FeatureToggle implementation

The FeatureToggle component is well-implemented with:

  • Proper state management using hooks
  • Accessibility support with labels
  • Clear visual feedback for disabled state
  • Error handling
  • External feedback link integration

Line range hint 1-15: Verify complete removal of reportBudget feature flag

The removal of the tracking budget feature from experimental settings suggests it's now a stable feature. Let's verify all related code has been cleaned up.

✅ Verification successful

The tracking budget feature has been released and is now a stable feature

The search results confirm that the tracking budget feature has been released as a stable feature, as evidenced by:

  • Release note in upcoming-release-notes/3833.md: "Release tracking budget feature"
  • No references to reportBudget feature flag in the codebase
  • All tracking budget code is now part of the main implementation, not behind feature flags

The code cleanup is complete and consistent across the codebase. The feature has been properly integrated into the main codebase with:

  • Proper type definitions
  • Complete component implementations
  • Well-structured queries and handlers
  • Mobile and desktop support
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining references to reportBudget feature flag
echo "Searching for reportBudget references..."
rg -i "reportbudget|tracking.?budget"

# Search for any remaining feature flag initialization
echo "Checking feature flag initialization..."
ast-grep --pattern 'flags: { $$$ reportBudget $$$ }'

Length of output: 18864

packages/desktop-client/src/components/settings/index.tsx (1)

179-179: LGTM! Budget type settings are now a stable feature.

The removal of the feature flag conditional for BudgetTypeSettings indicates that this feature has graduated from experimental status to become a stable part of the application.

Let's verify that this change is consistent with the removal of the feature flag across the codebase:

✅ Verification successful

The removal of the feature flag is consistent with the codebase

Looking at the evidence:

  1. The reportBudget feature flag is completely removed from the FeatureFlag type definition in prefs.d.ts
  2. There are no remaining references to reportBudget in the codebase
  3. The BudgetTypeSettings component now directly uses useSyncedPref for budget type management without any feature flag checks
  4. The component allows switching between 'rollover' (envelope) and 'report' (tracking) budgeting types as stable features
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify complete removal of reportBudget feature flag

# Check for any remaining references to the reportBudget feature flag
rg "reportBudget" --type ts --type tsx

# Check for any remaining feature flag conditional rendering of BudgetTypeSettings
ast-grep --pattern 'useFeatureFlag($_, "reportBudget")'

Length of output: 124


Script:

#!/bin/bash
# Let's try different approaches to verify the feature flag removal

# Search for reportBudget using ripgrep without file type restrictions
rg "reportBudget"

# Search for any useFeatureFlag usage
rg "useFeatureFlag"

# Search for BudgetTypeSettings component usage
rg "BudgetTypeSettings"

# Look for feature flag related imports
rg "import.*FeatureFlag"

Length of output: 11257


Script:

#!/bin/bash
# Let's check the feature flags type definition and the BudgetTypeSettings component

# Check feature flags type definition
rg -A 10 "type FeatureFlag =" 

# Look at the BudgetTypeSettings component implementation
cat packages/desktop-client/src/components/settings/BudgetTypeSettings.tsx

Length of output: 2611

packages/desktop-client/src/components/mobile/MobileNavTabs.tsx (2)

3-3: LGTM: Clean type imports and spring animation setup

The ComponentProps import and spring animation initialization are well-structured and follow React best practices.

Also applies to: 46-47


132-134: LGTM: NavTab click handler implementation

The click handler implementation correctly closes the navigation bar on navigation, which should improve test stability as mentioned in the previous review.

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.

LGTM

@MatissJanis MatissJanis merged commit 23bb89b into master Nov 18, 2024
20 checks passed
@MatissJanis MatissJanis deleted the matiss/release-reportBudget branch November 18, 2024 22:41
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.

3 participants