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

Update Electron help menu to reflect new in-app menu #3699

Merged
merged 4 commits into from
Oct 23, 2024

Conversation

jfdoming
Copy link
Contributor

Modifies the Electron menu items to match the web app

Copy link

netlify bot commented Oct 20, 2024

Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit 6165879
🔍 Latest deploy log https://app.netlify.com/sites/actualbudget/deploys/6715a9761d08510008323da2
😎 Deploy Preview https://deploy-preview-3699.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 20, 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.31 MB → 5.31 MB (+44 B) +0.00%
Changeset
File Δ Size
home/runner/work/actual/actual/packages/loot-core/src/client/actions/app.ts 📈 +753 B (+118.03%) 638 B → 1.36 kB
src/components/Titlebar.tsx 📈 +17 B (+0.21%) 7.99 kB → 8.01 kB
src/components/HelpMenu.tsx 📉 -647 B (-24.99%) 2.53 kB → 1.9 kB
src/util/router-tools.ts 📉 -79 B (-30.86%) 256 B → 177 B
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

Asset File Size % Changed
static/js/index.js 3.32 MB → 3.32 MB (+44 B) +0.00%

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
static/js/usePreviewTransactions.js 1.64 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/BackgroundImage.js 122.29 kB 0%
static/js/narrow.js 82.57 kB 0%
static/js/AppliedFilters.js 21.3 kB 0%
static/js/wide.js 232.12 kB 0%
static/js/ReportRouter.js 1.51 MB 0%

Copy link
Contributor

github-actions bot commented Oct 20, 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.27 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.27 MB 0%

@jfdoming jfdoming force-pushed the jfdoming/help-menu-electron branch from 152a4fe to 6165879 Compare October 21, 2024 01:08
@jfdoming jfdoming changed the title [WIP]: Update Electron help menu to reflect new in-app menu Update Electron help menu to reflect new in-app menu Oct 21, 2024
@jfdoming jfdoming requested a review from MikesGlitch October 21, 2024 01:29
Copy link
Contributor

coderabbitai bot commented Oct 21, 2024

Walkthrough

The pull request includes several changes across multiple files, primarily focusing on the HelpMenu and Titlebar components, as well as utility functions related to routing and menu configurations. In HelpMenu.tsx, the getPageDocs function has been removed, and the logic for opening documentation has shifted to a Redux action called openDocsForCurrentPage. This change simplifies the documentation access process by eliminating direct URL handling. The Titlebar.tsx component has been updated to conditionally render the HelpMenu based on whether the application is running in an Electron environment. The openUrl function has been removed from router-tools.ts, indicating a broader shift away from direct URL navigation. Additionally, modifications in menu.ts include changes to menu labels and the removal of certain submenu items. Finally, new functions related to documentation access have been introduced in app.ts, enhancing the overall functionality of the application.

Possibly related PRs

  • Move help-related items under one single menu #3648: This PR modifies the HelpMenu.tsx component, including the removal of the getPageDocs function and the introduction of the openDocsForCurrentPage action, indicating a direct relationship in terms of changes made to the same file and functionality related to help documentation access.

Suggested labels

sparkles: Merged

Suggested reviewers

  • 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: 3

🧹 Outside diff range and nitpick comments (1)
packages/desktop-client/src/components/HelpMenu.tsx (1)

57-57: Approve changes in HelpMenu component with a minor suggestion

The modifications to the HelpMenu component significantly simplify its logic and align well with the PR objectives:

  1. Removing the getPageDocs function and related pathname-based logic reduces complexity.
  2. Using dispatch(openDocsForCurrentPage()) centralizes the documentation opening logic.

These changes improve maintainability and consistency with the rest of the application.

For improved readability, consider extracting the dispatch call to a separate function:

const openDocs = () => dispatch(openDocsForCurrentPage());

// Then in handleItemSelect:
case 'docs':
  openDocs();
  break;

This minor refactoring would enhance the function's clarity and make it easier to add any potential pre- or post-processing steps in the future.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 4e07357 and 6165879.

⛔ Files ignored due to path filters (1)
  • upcoming-release-notes/3699.md is excluded by !**/*.md
📒 Files selected for processing (5)
  • packages/desktop-client/src/components/HelpMenu.tsx (2 hunks)
  • packages/desktop-client/src/components/Titlebar.tsx (2 hunks)
  • packages/desktop-client/src/util/router-tools.ts (0 hunks)
  • packages/desktop-electron/menu.ts (2 hunks)
  • packages/loot-core/src/client/actions/app.ts (1 hunks)
💤 Files with no reviewable changes (1)
  • packages/desktop-client/src/util/router-tools.ts
🧰 Additional context used
📓 Learnings (1)
packages/desktop-client/src/components/HelpMenu.tsx (1)
Learnt from: jfdoming
PR: actualbudget/actual#3648
File: packages/desktop-client/src/components/HelpMenu.tsx:48-66
Timestamp: 2024-10-13T00:54:56.185Z
Learning: In `HelpMenu.tsx`, when implementing the `getPageDocs` function, prefer using a switch statement over an object map to allow for more flexibility with custom logic, such as handling pages under `/accounts`.
🔇 Additional comments (6)
packages/loot-core/src/client/actions/app.ts (1)

55-80: Summary: Good progress on centralizing documentation access

The changes in this file align well with the PR objectives of updating the help menu. By introducing getPageDocs and openDocsForCurrentPage, you've centralized the handling of documentation URLs, which should make it easier to maintain and update these links in the future.

This refactoring aligns with the broader changes mentioned in the PR summary, moving away from direct URL handling in components like HelpMenu.tsx to a more centralized approach using Redux actions.

While the implementation is generally good, consider the suggestions in the previous comments to further improve type safety, error handling, and compatibility with different routing setups.

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

8-8: Approve changes in imports

The modifications to the imports reflect a positive shift towards centralized documentation handling:

  1. Adding openDocsForCurrentPage from 'loot-core/client/actions' indicates a move towards using a Redux action for opening documentation.
  2. Removing useLocation and openUrl imports suggests that the component no longer needs to handle URL determination and navigation directly.

These changes align well with the goal of simplifying the documentation access process and centralizing it through Redux actions.


Line range hint 1-100: Addressing previous learning about getPageDocs

A previous learning suggested using a switch statement for the getPageDocs function. However, this learning is no longer applicable to the current implementation:

  1. The getPageDocs function has been removed entirely.
  2. The new implementation uses a centralized Redux action (openDocsForCurrentPage) to handle documentation access.

This change represents a significant improvement in the code structure, moving away from direct URL handling to a more maintainable and centralized approach. The current implementation aligns better with Redux patterns and simplifies the component's logic.


Line range hint 1-100: Summary of changes in HelpMenu.tsx

The modifications to HelpMenu.tsx significantly improve the component's structure and align well with the PR objectives:

  1. Simplification: Removal of getPageDocs and related pathname-based logic reduces complexity.
  2. Centralization: Introduction of openDocsForCurrentPage action centralizes documentation access.
  3. Consistency: Changes align better with Redux patterns and improve overall code maintainability.

These changes contribute positively to the project by streamlining the help menu functionality and improving code quality. The new implementation should make future maintenance and extensions easier.

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

10-13: LGTM: Import changes align with PR objectives.

The addition of the isElectron import from the shared environment module is consistent with the PR's goal of updating Electron-specific functionality. This change enables the component to differentiate between Electron and non-Electron environments, which is crucial for the menu updates.


346-346: Verify user experience in Electron environments.

The conditional rendering of the HelpMenu component based on !isElectron() aligns with the PR objectives. This change ensures that the help menu is only displayed in non-Electron environments, which is likely intended to avoid duplication with the native Electron menu.

However, it's important to verify that:

  1. The native Electron menu provides equivalent functionality to the HelpMenu component.
  2. Users in Electron environments still have easy access to help resources.

To ensure that help functionality is still accessible in Electron environments, please run the following verification:

This will help confirm that help-related items are properly configured in the Electron menu.

packages/loot-core/src/client/actions/app.ts Show resolved Hide resolved
packages/loot-core/src/client/actions/app.ts Show resolved Hide resolved
packages/desktop-electron/menu.ts Show resolved Hide resolved
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

@jfdoming jfdoming merged commit 15351e0 into actualbudget:master Oct 23, 2024
20 checks passed
@jfdoming jfdoming deleted the jfdoming/help-menu-electron branch October 23, 2024 01:20
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