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

add buttons for combined-account transaction pages on mobile #3734

Merged

Conversation

gabeklavans
Copy link
Contributor

@gabeklavans gabeklavans commented Oct 25, 2024

I quickly threw together the actual styling of these buttons. I'm very much open to changing it up, but just wanted to start the functionality here.

I was pleasantly surprised to see that the combined accounts pages that work on desktop also seem to work fine on mobile. This just adds a way to navigate to those URLs on mobile.

resolves #2333

@actual-github-bot actual-github-bot bot changed the title add buttons for combined-account transaction pages [WIP] add buttons for combined-account transaction pages Oct 25, 2024
Copy link

netlify bot commented Oct 25, 2024

Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit 19d2487
🔍 Latest deploy log https://app.netlify.com/sites/actualbudget/deploys/67777fbfeb8afb0008b0d3e2
😎 Deploy Preview https://deploy-preview-3734.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 25, 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
10 5.64 MB → 5.64 MB (+885 B) +0.01%
Changeset
File Δ Size
src/components/mobile/accounts/Accounts.tsx 📈 +885 B (+11.57%) 7.47 kB → 8.33 kB
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

Asset File Size % Changed
static/js/narrow.js 83.36 kB → 84.22 kB (+885 B) +1.04%

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
static/js/resize-observer.js 18.37 kB 0%
static/js/workbox-window.prod.es5.js 5.69 kB 0%
static/js/AppliedFilters.js 10.24 kB 0%
static/js/useAccountPreviewTransactions.js 1.63 kB 0%
static/js/indexeddb-main-thread-worker-e59fee74.js 13.5 kB 0%
static/js/BackgroundImage.js 122.29 kB 0%
static/js/wide.js 104.11 kB 0%
static/js/ReportRouter.js 1.58 MB 0%
static/js/index.js 3.71 MB 0%

Copy link
Contributor

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

gabeklavans added a commit to gabeklavans/actual that referenced this pull request Oct 25, 2024
@gabeklavans gabeklavans force-pushed the mobile-multi-account-view branch from 2632df9 to 53d7f7f Compare October 25, 2024 04:14
gabeklavans added a commit to gabeklavans/actual that referenced this pull request Oct 25, 2024
@gabeklavans gabeklavans force-pushed the mobile-multi-account-view branch from 53d7f7f to 96e1ef5 Compare October 25, 2024 04:22
@gabeklavans

This comment was marked as resolved.

@gabeklavans gabeklavans changed the title [WIP] add buttons for combined-account transaction pages [WIP] add buttons for combined-account transaction pages on mobile Oct 25, 2024
gabeklavans added a commit to gabeklavans/actual that referenced this pull request Oct 27, 2024
@gabeklavans gabeklavans force-pushed the mobile-multi-account-view branch from 96e1ef5 to 34c8971 Compare October 27, 2024 16:13
@gabeklavans gabeklavans changed the title [WIP] add buttons for combined-account transaction pages on mobile add buttons for combined-account transaction pages on mobile Oct 27, 2024
Copy link
Contributor

coderabbitai bot commented Oct 27, 2024

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/accounts/Accounts.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.

Walkthrough

The pull request modifies the Accounts.tsx component in the mobile client, focusing on enhancing the AccountHeader functionality. The changes introduce a new id property to the AccountHeaderProps type, allowing for more precise account identification. The AccountHeader component is transformed from a View to a Button, improving interactivity by enabling navigation to account-specific transactions. Styling adjustments are made to the component, including padding and font size modifications. The AccountList component is updated to pass the new id property to AccountHeader instances for both "On budget" and "Off budget" account sections.

Assessment against linked issues

Objective Addressed Explanation
Combined transactions list (#2333) Partial implementation visible, but full "all accounts" transaction view not clearly demonstrated
Navigation to account transactions
Improve mobile account screen usability

Possibly related PRs

Suggested labels

sparkles: feature, white_check_mark: approved

Suggested reviewers

  • joel-jeremy
  • 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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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 (2)
packages/desktop-client/src/components/mobile/accounts/Accounts.jsx (2)

Line range hint 23-53: LGTM! Consider adding accessibility labels.

The transformation from View to Button with navigation functionality aligns well with the PR objectives. The styling is consistent with mobile patterns.

Consider adding an accessibilityLabel prop to the Button for better screen reader support:

 <Button
   onPress={() => navigate(`/accounts/${id}`)}
+  accessibilityLabel={`View transactions for ${name}`}
   style={{
     flex: 1,

209-220: Consider using View component instead of div for consistency.

While the divider implementation is good, using a div element seems inconsistent with the rest of the codebase which uses the View component.

Consider this change for better consistency:

-            <div
+            <View
               style={{
                 width: '100%',
                 height: 2,
                 background: theme.pageText,
                 paddingLeft: 10,
                 paddingRight: 10,
                 marginTop: 20,
               }}
-            />
+            />
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between f265dd9 and 34c8971.

⛔ Files ignored due to path filters (1)
  • upcoming-release-notes/3734.md is excluded by !**/*.md
📒 Files selected for processing (1)
  • packages/desktop-client/src/components/mobile/accounts/Accounts.jsx (4 hunks)
🧰 Additional context used
📓 Learnings (1)
packages/desktop-client/src/components/mobile/accounts/Accounts.jsx (1)
Learnt from: joel-jeremy
PR: actualbudget/actual#3685
File: packages/desktop-client/src/components/accounts/Account.tsx:655-665
Timestamp: 2024-10-24T17:05:41.415Z
Learning: The Account component in 'packages/desktop-client/src/components/accounts/Account.tsx' is being rewritten in a separate PR.
🔇 Additional comments (3)
packages/desktop-client/src/components/mobile/accounts/Accounts.jsx (3)

190-194: LGTM! Clear implementation of combined budgeted accounts view.

The implementation provides a clear entry point to view all budgeted account transactions, which directly addresses the feature request from issue #2333.


224-227: LGTM! Consistent implementation for off-budget accounts view.

The implementation maintains consistency with the budgeted accounts section while providing clear navigation to combined off-budget transactions.


Line range hint 23-227: Verify navigation paths for combined account views.

The implementation looks solid overall and addresses the requirements from issue #2333. Let's verify the navigation paths to ensure consistency.

✅ Verification successful

Navigation implementation for combined account views is consistent

The verification shows that:

  • The navigation pattern in Accounts.jsx aligns with existing account navigation patterns in other components
  • Route handling for budgeted/offbudget accounts is properly defined in the sidebar component
  • The AccountHeader component is consistently used across both mobile and desktop account views
  • The implementation maintains compatibility with existing account-related components and test files

The changes successfully implement the combined account view navigation without introducing inconsistencies or regressions in the navigation paths.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify navigation paths and route handlers for combined account views

# Test: Check for any other components that might need similar navigation updates
rg -l "navigate\(\'/accounts/" --type jsx

# Test: Verify consistent route handling across the application
rg -l "\/accounts\/(budgeted|offbudget)" --type jsx

Length of output: 298


Script:

#!/bin/bash
# Let's fix the regex syntax and try again

# Check for navigation patterns to accounts
rg -l "navigate\('/accounts" --type jsx

# Check for route handlers with combined account paths
rg -l "/accounts/(budgeted|offbudget)" --type jsx

# Look for other potential route definitions
rg -l "path.*accounts" --type jsx

# Check for any AccountHeader usage
rg -l "AccountHeader" --type jsx

Length of output: 277


Script:

#!/bin/bash
# Search without file type restriction since jsx type isn't recognized

# Check for navigation patterns to accounts
rg -l "navigate\\('/accounts"

# Check for route handlers with combined account paths
rg -l "/accounts/(budgeted|offbudget)"

# Look for other potential route definitions
rg -l "path.*accounts"

# Check for any AccountHeader usage
rg -l "AccountHeader"

# Find all potential account-related components
fd -e jsx -e js | grep -i "account"

Length of output: 1595

@gabeklavans
Copy link
Contributor Author

Assessment against linked issues

Objective Addressed Explanation
Combined list of transactions across accounts on mobile (#2333) ❌ The PR does not implement the feature to view transactions across all accounts.

Fair. I can try adding another button on top of all the current ones for All Accounts, using the same header component for consistency.

@joel-jeremy
Copy link
Contributor

Thanks for this! I can verify that the functionality if good but the UI definitely needs some work. How about making the For Budget and Off Budget buttons more like headers and just put a cheveron to indicate that they are clickable?

gabeklavans added a commit to gabeklavans/actual that referenced this pull request Oct 29, 2024
@gabeklavans gabeklavans force-pushed the mobile-multi-account-view branch from 34c8971 to edc046e Compare October 29, 2024 03:35
@gabeklavans
Copy link
Contributor Author

gabeklavans commented Oct 29, 2024

How about making the For Budget and Off Budget buttons more like headers and just put a cheveron to indicate that they are clickable?

Yup, I like the sound of that. How's this next iteration I just pushed look?

Also, I may forgo adding the "All Accounts" view for this PR. It seems to be quite a bit more work to get right compared to the small change I'm making here, but this PR already solves the issue like 90% of the way for me, if that makes sense.

gabeklavans added a commit to gabeklavans/actual that referenced this pull request Oct 29, 2024
@gabeklavans gabeklavans force-pushed the mobile-multi-account-view branch from edc046e to 6869ef0 Compare October 29, 2024 03:39
@youngcw
Copy link
Member

youngcw commented Oct 29, 2024

I think this style with the chevrons looks really good.

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 (2)
packages/desktop-client/src/components/mobile/accounts/Accounts.jsx (2)

23-62: Good implementation of interactive headers with visual indicators.

The conversion to Button component and addition of chevron icon successfully implements the reviewer's suggestions and improves mobile UX.

However, here are some suggested improvements:

  1. Add ARIA label for better accessibility:
 <Button
   variant="bare"
+  aria-label={`View ${name} transactions`}
   onPress={() => navigate(`/accounts/${id}`)}
   style={{
  1. Consider adding hover/active states for better interaction feedback:
 <Button
   variant="bare"
   onPress={() => navigate(`/accounts/${id}`)}
   style={{
     flex: 1,
     flexDirection: 'row',
     marginTop: 10,
     padding: 0,
     color: theme.pageTextLight,
     width: '100%',
+    ':hover': {
+      backgroundColor: theme.hover
+    },
+    ':active': {
+      backgroundColor: theme.buttonBackgroundActive
+    },
     ...style,
   }}
 >

199-203: Current implementation provides a good foundation for mobile account navigation.

The addition of combined views for budgeted and off-budget accounts improves mobile navigation. However, to fully address issue #2333, consider these future enhancements:

  1. Add an "All Accounts" view as discussed in the PR comments
  2. Consider adding a loading state for the navigation transitions

For the "All Accounts" view, you could add it as:

<AccountHeader
  id="all"
  name="All Accounts"
  amount={getOnBudgetBalance() + getOffBudgetBalance()}
  style={{ marginBottom: 20 }}
/>

Also applies to: 220-224

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 34c8971 and 6869ef0.

⛔ Files ignored due to path filters (1)
  • upcoming-release-notes/3734.md is excluded by !**/*.md
📒 Files selected for processing (1)
  • packages/desktop-client/src/components/mobile/accounts/Accounts.jsx (4 hunks)
🧰 Additional context used
📓 Learnings (1)
packages/desktop-client/src/components/mobile/accounts/Accounts.jsx (1)
Learnt from: joel-jeremy
PR: actualbudget/actual#3685
File: packages/desktop-client/src/components/accounts/Account.tsx:655-665
Timestamp: 2024-10-24T17:05:41.415Z
Learning: The Account component in 'packages/desktop-client/src/components/accounts/Account.tsx' is being rewritten in a separate PR.
🔇 Additional comments (2)
packages/desktop-client/src/components/mobile/accounts/Accounts.jsx (2)

11-11: LGTM: Import addition aligns with UI requirements.

The addition of SvgCheveronRight import supports the reviewer's suggestion to add visual indicators for clickable headers.


27-57: Investigate visual regression test failures.

The Button component and chevron icon additions could affect layout in ways that trigger visual regression tests. Let's verify the impact:

@Teprifer
Copy link

I agree, looks good.

@joel-jeremy
Copy link
Contributor

joel-jeremy commented Oct 29, 2024

Looking better! Just one more thing, I think the new buttons could use some padding so that the touch target is larger.

Also you need to update the VRT screenshots. Please see https://github.com/actualbudget/actual/tree/master/packages/desktop-client#visual-regression

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 (1)
packages/desktop-client/src/components/mobile/accounts/Accounts.jsx (1)

27-42: Consider increasing touch target size for better mobile accessibility.

The current padding (7px top/bottom) might be insufficient for comfortable touch interaction on mobile devices. Apple's Human Interface Guidelines recommend a minimum touch target size of 44x44 points.

 <Button
   variant="bare"
   aria-label={`View ${name} transactions`}
   onPress={() => navigate(`/accounts/${id}`)}
   style={{
     flex: 1,
     flexDirection: 'row',
-    paddingTop: 7,
-    paddingBottom: 7,
+    paddingTop: 12,
+    paddingBottom: 12,
     paddingLeft: 0,
     paddingRight: 0,
     color: theme.pageTextLight,
     width: '100%',
     ...style,
   }}
 >
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 6869ef0 and 0741271.

📒 Files selected for processing (1)
  • packages/desktop-client/src/components/mobile/accounts/Accounts.jsx (4 hunks)
🧰 Additional context used
📓 Learnings (1)
packages/desktop-client/src/components/mobile/accounts/Accounts.jsx (1)
Learnt from: joel-jeremy
PR: actualbudget/actual#3685
File: packages/desktop-client/src/components/accounts/Account.tsx:655-665
Timestamp: 2024-10-24T17:05:41.415Z
Learning: The Account component in 'packages/desktop-client/src/components/accounts/Account.tsx' is being rewritten in a separate PR.
🔇 Additional comments (2)
packages/desktop-client/src/components/mobile/accounts/Accounts.jsx (2)

23-65: Update visual regression test screenshots.

The UI changes (new chevron icon, button styling, and section margins) will require updates to the visual regression test screenshots. This aligns with the VRT discrepancies mentioned in the PR comments.

#!/bin/bash
# Description: Check for existing visual regression tests

# Test: Look for VRT screenshot references
rg -l "accounts.*\.(png|jpg|jpeg)" --glob '!{node_modules,build,dist}/**'

202-206: Consider adding "All Accounts" view as discussed.

Based on the PR objectives and issue #2333, an "All Accounts" view was considered to show combined transactions. While the current implementation adds navigation for budgeted and off-budget accounts, it might be worth implementing the "All Accounts" view in a follow-up PR.

Let's verify the route handling for these new navigation targets:

Also applies to: 223-226

@joel-jeremy
Copy link
Contributor

The current padding (7px top/bottom) might be insufficient for comfortable touch interaction on mobile devices. Apple's Human Interface Guidelines recommend a minimum touch target size of 44x44 points.

 <Button
   variant="bare"
   aria-label={`View ${name} transactions`}
   onPress={() => navigate(`/accounts/${id}`)}
   style={{
     flex: 1,
     flexDirection: 'row',
-    paddingTop: 7,
-    paddingBottom: 7,
+    paddingTop: 12,
+    paddingBottom: 12,
     paddingLeft: 0,
     paddingRight: 0,
     color: theme.pageTextLight,
     width: '100%',
     ...style,
   }}
 >

I tried it with larger padding and it just looks kinda weird with so much space.

I find it still a bit too small. Can we make it similar size and padding as the other account buttons, but keeping the current background?

gabeklavans added a commit to gabeklavans/actual that referenced this pull request Nov 4, 2024
@gabeklavans gabeklavans force-pushed the mobile-multi-account-view branch 2 times, most recently from f6a5fc5 to 1498ae9 Compare November 4, 2024 03:32
gabeklavans added a commit to gabeklavans/actual that referenced this pull request Nov 4, 2024
gabeklavans added a commit to gabeklavans/actual that referenced this pull request Nov 4, 2024
@gabeklavans
Copy link
Contributor Author

I find it still a bit too small. Can we make it similar size and padding as the other account buttons, but keeping the current background?

How's this iteration look? Also just to note, even before this iteration, these buttons I think were still larger than the ones on the budget mobile page for tapping on each category to open their notes/options.

@joel-jeremy
Copy link
Contributor

I find it still a bit too small. Can we make it similar size and padding as the other account buttons, but keeping the current background?

How's this iteration look? Also just to note, even before this iteration, these buttons I think were still larger than the ones on the budget mobile page for tapping on each category to open their notes/options.

Looking good! One last comment: can we change the header buttons to a normal variant so that it also has the bounce effect when clicked (similar to the other account buttons) but remove the press highlight?

@gabeklavans
Copy link
Contributor Author

gabeklavans commented Nov 24, 2024

Looking good! One last comment: can we change the header buttons to a normal variant so that it also has the bounce effect when clicked (similar to the other account buttons) but remove the press highlight?

Sorry for the delay, just getting back to this.

So, if we're making it a normal variant again (how it was when I first opened the PR), is there a need for the chevron anymore? Since it will be pretty clear that this is a button and is clickable.

If there isn't a need, how do you think we should differentiate this button from the rest? A different colored border, perhaps? A different text color? Different height for the button?

@joel-jeremy
Copy link
Contributor

Looking good! One last comment: can we change the header buttons to a normal variant so that it also has the bounce effect when clicked (similar to the other account buttons) but remove the press highlight?

Sorry for the delay, just getting back to this.

So, if we're making it a normal variant again (how it was when I first opened the PR), is there a need for the chevron anymore? Since it will be pretty clear that this is a button and is clickable.

If there isn't a need, how do you think we should differentiate this button from the rest? A different colored border, perhaps? A different text color? Different height for the button?

Sorry for the confusion, what I meant was to keep the current style that but remove the press highlight and add the bounce effect that the normal variant has. This is so that all the buttons still have the same look and feel.

Press highlight:

Actual.-.Google.Chrome.2024-12-05.15-46-50.mp4

Mini bounce effect on click (this is enabled by the Button's bounce prop I believe):

Actual.-.Google.Chrome.2024-12-05.15-51-30.mp4

@gabeklavans
Copy link
Contributor Author

gabeklavans commented Jan 3, 2025

can we change the header buttons to a normal variant so that it also has the bounce effect when clicked (similar to the other account buttons) but remove the press highlight?

EDIT: I actually got both the highlight gone and the bounce added in one go with the workaround I mention below. It's actually not that hacky. Just required copy-pasting the button-bounce values, so could be prone to going out of style in the future. To fix that, I might take the contents of _getActiveStyles into an exported function that I can import here. But it's probably not worth the effort.

Old comment:


So, I was able to refer to other places in the codebase to get rid of the press highlight. But it seems pretty hacky to get the button bounce in place for a variant=bare button. There's an explicit catch in Button 2 that makes it so even if I set bounce={true} on the button, the bare variant won't allow it.

const _getActiveStyles = (
variant: ButtonVariant,
bounce: boolean,
): CSSProperties => {
switch (variant) {
case 'bare':
return { backgroundColor: theme.buttonBareBackgroundActive };
default:
return {
transform: bounce ? 'translateY(1px)' : undefined,
boxShadow: `0 1px 4px 0 ${
variant === 'primary'
? theme.buttonPrimaryShadow
: theme.buttonNormalShadow
}`,
transition: 'none',
};
}
};

All that means is we can be pretty sure that any other buttons that look like this won't bounce. I can still try to work around this if you think the effect will be worth it here.

@gabeklavans gabeklavans force-pushed the mobile-multi-account-view branch from 1498ae9 to 19d2487 Compare January 3, 2025 06:12
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

🧹 Nitpick comments (2)
packages/desktop-client/src/components/mobile/accounts/Accounts.tsx (2)

5-5: Prefer consistent import ordering.
Although this new import looks good, consider aligning it with your existing import conventions (e.g., grouping external libraries together or alphabetically). This makes the import section more readable.


59-67: Helpful pressed/hover states.
The custom class styling ensures visual feedback, but confirm that translating by 1px downward still feels natural on mobile.

You could test if a slightly larger or smaller translation offers a better user experience.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1498ae9 and 19d2487.

⛔ Files ignored due to path filters (3)
  • packages/desktop-client/e2e/accounts.mobile.test.js-snapshots/Mobile-Accounts-opens-the-accounts-page-and-asserts-on-balances-1-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/accounts.mobile.test.js-snapshots/Mobile-Accounts-opens-the-accounts-page-and-asserts-on-balances-2-chromium-linux.png is excluded by !**/*.png
  • packages/desktop-client/e2e/accounts.mobile.test.js-snapshots/Mobile-Accounts-opens-the-accounts-page-and-asserts-on-balances-3-chromium-linux.png is excluded by !**/*.png
📒 Files selected for processing (1)
  • packages/desktop-client/src/components/mobile/accounts/Accounts.tsx (5 hunks)
🧰 Additional context used
📓 Learnings (1)
packages/desktop-client/src/components/mobile/accounts/Accounts.tsx (1)
Learnt from: joel-jeremy
PR: actualbudget/actual#3685
File: packages/desktop-client/src/components/accounts/Account.tsx:655-665
Timestamp: 2024-11-10T16:45:31.225Z
Learning: The Account component in 'packages/desktop-client/src/components/accounts/Account.tsx' is being rewritten in a separate PR.
🔇 Additional comments (13)
packages/desktop-client/src/components/mobile/accounts/Accounts.tsx (13)

15-15: Great addition of SvgCheveronRight.
This icon nicely communicates navigation flows, especially on mobile.


29-29: Complete and clear interface extension.
Declaring id: string in the prop type clarifies the identity of the header for routing.


41-41: Straightforward usage of useNavigate.
This hook is suitable for mobile navigation flows and helps maintain consistent code with the rest of the app.


44-47: Button usage is solid, but consider consistent accessibility labeling.
The aria-label helps screen readers. Ensure that the label matches the user-facing text or otherwise clarifies action and context for accessibility.


51-54: Appropriate padding for touch targets.
The chosen top/bottom padding of 15px is typically good for mobile. Ensure any sibling components match or exceed these dimensions for consistent touch areas.


69-69: Container layout is well-structured.
This flex layout with centered alignment ensures the text and icon are well-positioned. No issues spotted here.


73-73: Font size of 17px is typical on mobile.
This size aligns with accessible design guidelines, but ensure consistent usage across the rest of the app’s mobile components.


93-93: Consistent text styling.
Reusing styles.text is good for a uniform UI. Ensure that the rest of the cell value styling is also consistent elsewhere in the code to avoid style drift.


97-97: Closing button tag structure.
The new layout is clean. Watch out for any possible onPress conflicts if the nested children also have touch handlers.


259-263: Enhanced navigability for On Budget section.
Introducing an id="onbudget" clarifies the route. Confirm that users understand the label "On budget" vs. "Off budget."


280-280: Similarly, off-budget section is consistent with the “On budget” approach.
This symmetry helps users stay oriented across different account groups on mobile.


36-36: Ensure id is mandatory at call sites.
Using id in multiple places makes sense, but double check that all existing AccountHeader usage indeed passes an id to avoid runtime errors.

✅ Verification successful

Let me check the AccountHeader component definition to understand its props interface.


Let me try a different approach to find the component definition.


All AccountHeader usages properly handle the id prop requirement

Based on the verification results, there are three different AccountHeader components in different files, each with its own prop interface:

  1. In packages/desktop-client/src/components/mobile/accounts/Accounts.tsx:

    • All usages pass the required id prop directly (onbudget and offbudget)
    • The component's type definition explicitly requires id: string
  2. In packages/desktop-client/src/components/mobile/accounts/AccountTransactions.tsx:

    • Passes the full account object which contains the id field (verified from the code using account.id)
  3. In packages/desktop-client/src/components/accounts/Header.tsx:

    • Different component with different props interface
    • Receives the full account object which contains the id field
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify that all <AccountHeader> usage includes 'id' prop
rg -A 3 '<AccountHeader' 

Length of output: 1696


Script:

#!/bin/bash
# Find AccountHeader component definition
ast-grep --pattern 'interface AccountHeaderProps {
  $$$
}'

# Also search for type definition
ast-grep --pattern 'type AccountHeaderProps = {
  $$$
}'

Length of output: 120


Script:

#!/bin/bash
# Find AccountHeader component and its props
rg -A 10 "AccountHeader.*Props" 

# Also search for the component definition directly
rg -A 15 "const AccountHeader.*=|function AccountHeader"

Length of output: 8774


79-87: Chevrons for clear forward navigation.
These lines effectively indicate navigability. If possible, also check that the color contrast meets WCAG accessibility guidelines.

@joel-jeremy
Copy link
Contributor

This looks good to me! Thanks!

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.

Combined list of transactions across accounts on mobile
4 participants