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

Refactor and Standardize Route paths #1362

Closed
wants to merge 1 commit into from

Conversation

AMIRKHANEF
Copy link
Member

@AMIRKHANEF AMIRKHANEF commented Jun 7, 2024

Works Done

  1. Paths changed:

    • /account/import-ledger -->> /import/ledger-full-screen
    • /account/create -->> /create-account-full-screen
    • /account/restore-json -->> /import/restore-json-full-screen
    • /account/import-seed -->> /import/seed-full-screen
    • /account/import-raw-seed -->> /import/raw-seed-full-screen
    • /account/export-all -->> /export/all
  2. ALLOWED_URL_ON_RESET_PASSWORD updated.

  3. packages/extension-ui/src/Popup/index.tsx routes updated.

Close #1361.

Summary by CodeRabbit

  • New Features

    • Introduced full-screen views for account creation, importing, and restoring actions.
  • Updates

    • Updated navigation paths across the app for a more consistent user experience, including new paths for creating accounts and importing data.
    • Adjusted allowed URLs on the reset password page to match the new full-screen paths.
  • Bug Fixes

    • Fixed navigation issues by updating outdated paths to the new full-screen URLs.

Copy link
Contributor

coderabbitai bot commented Jun 7, 2024

Walkthrough

The changes primarily involve updating various URL paths in the project to new full-screen paths. This includes changes in navigation and window opening functions across multiple components and constants. The updates ensure that actions such as account creation, importing, and restoring are directed to their respective full-screen views.

Changes

Files Change Summary
packages/extension-base/src/defaults.ts Updated ALLOWED_PATH to include /create-account-full-screen.
.../homeFullScreen/partials/HomeMenu.tsx Changed navigation path from /account/create to /create-account-full-screen.
.../homeFullScreen/partials/ImportAccSubMenuFullScreen.tsx Updated import and restore paths to new full-screen URLs.
.../fullscreen/onboarding/index.tsx Modified onboarding URLs to new full-screen paths.
.../partials/AddNewAccountButton.tsx Updated account creation URLs to /create-account-full-screen.
.../partials/ImportAccSubMenu.tsx Changed import and restore paths to new full-screen URLs.
.../partials/Menu.tsx Updated export all route to /export/all.
.../partials/NewAccountSubMenu.tsx Changed account creation URL to /create-account-full-screen.
.../popup/passwordManagement/Reset.tsx Updated URLs in _goToRestoreFromJson and _goToImport functions to new full-screen paths.
.../popup/passwordManagement/ResetFS.tsx Changed restore and import URLs to new full-screen paths.
.../popup/welcome/index.tsx Modified various action URLs to new full-screen paths.
.../util/constants.tsx Updated ALLOWED_URL_ON_RESET_PASSWORD to include new full-screen paths.
.../Popup/index.tsx Updated route paths for account creation, import, and export to new full-screen paths.

Sequence Diagram(s) (Beta)

sequenceDiagram
    participant User
    participant UI
    participant Router
    participant FullScreenHandler

    User->>UI: Click "Create Account"
    UI->>Router: Navigate to `/create-account-full-screen`
    Router->>FullScreenHandler: Handle full-screen view
    FullScreenHandler->>User: Display Create Account Full-Screen

    User->>UI: Click "Import JSON"
    UI->>Router: Navigate to `/import/restore-json-full-screen`
    Router->>FullScreenHandler: Handle full-screen view
    FullScreenHandler->>User: Display Import JSON Full-Screen
Loading

Poem

In the land of code, paths anew,
Full-screen views come into view.
Create, import, restore with ease,
Simplified journeys, designed to please.
With every click, a seamless ride,
In PolkaGate, where changes glide.


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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/extension-ui/src/Popup/index.tsx (2)

Line range hint 186-186: Consider replacing the delete operator to improve performance.

- delete (newPrices as Prices).currencyCode;
+ (newPrices as Prices).currencyCode = undefined;

Line range hint 200-200: Ensure all dependencies are specified in the useEffect hook.

-  }, []);
+  }, [_onAction]);
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 12282c7 and 757613c.

Files selected for processing (13)
  • packages/extension-base/src/defaults.ts (1 hunks)
  • packages/extension-polkagate/src/fullscreen/homeFullScreen/partials/HomeMenu.tsx (1 hunks)
  • packages/extension-polkagate/src/fullscreen/homeFullScreen/partials/ImportAccSubMenuFullScreen.tsx (2 hunks)
  • packages/extension-polkagate/src/fullscreen/onboarding/index.tsx (3 hunks)
  • packages/extension-polkagate/src/partials/AddNewAccountButton.tsx (1 hunks)
  • packages/extension-polkagate/src/partials/ImportAccSubMenu.tsx (2 hunks)
  • packages/extension-polkagate/src/partials/Menu.tsx (1 hunks)
  • packages/extension-polkagate/src/partials/NewAccountSubMenu.tsx (1 hunks)
  • packages/extension-polkagate/src/popup/passwordManagement/Reset.tsx (1 hunks)
  • packages/extension-polkagate/src/popup/passwordManagement/ResetFS.tsx (1 hunks)
  • packages/extension-polkagate/src/popup/welcome/index.tsx (2 hunks)
  • packages/extension-polkagate/src/util/constants.tsx (1 hunks)
  • packages/extension-ui/src/Popup/index.tsx (2 hunks)
Additional context used
Biome
packages/extension-ui/src/Popup/index.tsx

[error] 186-186: Avoid the delete operator which can impact performance. (lint/performance/noDelete)

Unsafe fix: Use an undefined assignment instead.


[error] 200-200: This hook does not specify all of its dependencies: _onAction (lint/correctness/useExhaustiveDependencies)

This dependency is not specified in the hook dependency list.

Either include it or remove the dependency array

Additional comments not posted (29)
packages/extension-base/src/defaults.ts (1)

4-4: Verify the update to ALLOWED_PATH.

Verification successful

The removed paths /account/import-ledger and /account/restore-json are not used elsewhere in the codebase, indicating that their removal from ALLOWED_PATH was likely intentional.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify if the removal of other paths from `ALLOWED_PATH` was intentional.

# Test: Search for usage of removed paths. Expect: No occurrences if removal was intentional.
rg --type python $'/account/import-ledger|/account/restore-json'

Length of output: 96



Script:

#!/bin/bash
# Description: Verify if the removal of other paths from `ALLOWED_PATH` was intentional.

# Test: Search for usage of removed paths. Expect: No occurrences if removal was intentional.
rg '/account/import-ledger|/account/restore-json'

Length of output: 51

packages/extension-polkagate/src/partials/NewAccountSubMenu.tsx (1)

30-30: Path update in windowOpen call is correct and aligns with the new routing strategy.

packages/extension-polkagate/src/partials/AddNewAccountButton.tsx (1)

25-26: Path updates in windowOpen and onAction calls are correct and align with the new routing strategy.

packages/extension-polkagate/src/popup/passwordManagement/Reset.tsx (1)

22-22: Path updates in windowOpen calls are correct and align with the new routing strategy.

Also applies to: 26-26

packages/extension-polkagate/src/popup/passwordManagement/ResetFS.tsx (2)

27-27: LGTM! The URL path update aligns with the PR objectives.


31-31: LGTM! The URL path update aligns with the PR objectives.

packages/extension-polkagate/src/popup/welcome/index.tsx (5)

26-26: LGTM! The URL path update aligns with the PR objectives.


32-32: LGTM! The URL path update aligns with the PR objectives.


38-38: LGTM! The URL path update aligns with the PR objectives.


50-50: LGTM! The URL path update aligns with the PR objectives.


56-56: LGTM! The URL path update aligns with the PR objectives.

packages/extension-polkagate/src/fullscreen/homeFullScreen/partials/ImportAccSubMenuFullScreen.tsx (4)

30-30: LGTM! The URL path update aligns with the PR objectives.


34-34: LGTM! The URL path update aligns with the PR objectives.


38-38: LGTM! The URL path update aligns with the PR objectives.


54-54: LGTM! The URL path update aligns with the PR objectives.

packages/extension-polkagate/src/partials/ImportAccSubMenu.tsx (4)

29-29: LGTM! The URL path update aligns with the PR objectives.


33-33: LGTM! The URL path update aligns with the PR objectives.


37-37: LGTM! The URL path update aligns with the PR objectives.


49-49: LGTM! The URL path update aligns with the PR objectives.

packages/extension-polkagate/src/fullscreen/homeFullScreen/partials/HomeMenu.tsx (1)

76-76: LGTM! Ensure all function calls to openOrFocusTab with the old path are updated to use the new path.

Verification successful

The verification confirms that all instances of the old path have been updated to the new path.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify all function calls to `openOrFocusTab` match the new path.

# Test: Search for the function usage with the old path. Expect: No occurrences.
rg --type python $'openOrFocusTab\("/account/create"\)'

Length of output: 87



Script:

#!/bin/bash
# Description: Verify all function calls to `openOrFocusTab` match the new path.

# Test: Search for the function usage with the old path. Expect: No occurrences.
rg --type tsx $'openOrFocusTab\("/account/create"\)'

Length of output: 81



Script:

#!/bin/bash
# Description: Verify all function calls to `openOrFocusTab` match the new path.

# Test: Search for the function usage with the old path. Expect: No occurrences.
rg --type typescript $'openOrFocusTab\("/account/create"\)'

Length of output: 95



Script:

#!/bin/bash
# Description: Verify all function calls to `openOrFocusTab` match the new path.

# Test: Search for the function usage with the old path. Expect: No occurrences.
rg --glob '*.tsx' $'openOrFocusTab\("/account/create"\)'

Length of output: 57

packages/extension-polkagate/src/fullscreen/onboarding/index.tsx (1)

43-43: LGTM! Ensure all function calls to windowOpen with the old paths are updated to use the new paths.

Also applies to: 49-49, 66-66, 78-78, 84-84

Verification successful

The previous script executed successfully and found no occurrences of the old paths in the codebase. This indicates that all instances of windowOpen have been updated to use the new paths.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify all function calls to `windowOpen` match the new paths.

# Test: Search for the function usage with the old paths. Expect: No occurrences.
rg --type python $'windowOpen\("/account/restore-json"\)|windowOpen\("/account/import-ledger"\)|windowOpen\("/account/create"\)|windowOpen\("/account/import-seed"\)|windowOpen\("/account/import-raw-seed"\)'

Length of output: 238



Script:

#!/bin/bash
# Description: Verify all function calls to `windowOpen` match the new paths.

# Test: Search for the function usage with the old paths. Expect: No occurrences.
rg --type js --type ts $'windowOpen\("/account/restore-json"\)|windowOpen\("/account/import-ledger"\)|windowOpen\("/account/create"\)|windowOpen\("/account/import-seed"\)|windowOpen\("/account/import-raw-seed"\)'

Length of output: 213

packages/extension-polkagate/src/partials/Menu.tsx (1)

68-68: LGTM! Ensure all function calls to onAction with the old path are updated to use the new path.

Verification successful

The verification confirms that there are no remaining instances of the old path "/account/export-all" in the codebase. The update to the new path has been correctly applied.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify all function calls to `onAction` match the new path.

# Test: Search for the function usage with the old path. Expect: No occurrences.
rg --type python $'onAction\("/account/export-all"\)'

Length of output: 85



Script:

#!/bin/bash
# Description: Verify all function calls to `onAction` match the new path.

# Test: Search for the function usage with the old path. Expect: No occurrences.
rg --type typescript $'onAction\("/account/export-all"\)'

Length of output: 93



Script:

#!/bin/bash
# Description: Verify all function calls to `onAction` match the new path.

# Test: Search for the function usage with the old path. Expect: No occurrences.
rg $'onAction\("/account/export-all"\)'

Length of output: 40

packages/extension-polkagate/src/util/constants.tsx (1)

212-212: LGTM! Ensure all uses of ALLOWED_URL_ON_RESET_PASSWORD are updated to reflect the new paths.

packages/extension-ui/src/Popup/index.tsx (6)

287-287: Updated route path for account creation aligns with PR objectives.


291-291: Updated route path for exporting all accounts aligns with PR objectives.


305-305: Updated route path for importing ledger accounts aligns with PR objectives.


308-308: Updated route path for importing raw seed accounts aligns with PR objectives.


309-309: Updated route path for restoring JSON accounts aligns with PR objectives.


310-310: Updated route path for importing seed accounts aligns with PR objectives.

@Nick-1979
Copy link
Member

@AMIRKHANEF

if we are going to have

/import/ledger-full-screen

then we can similarly have changes like

/import/attach-qr ==> /import/qr
/import/add-watch-only ==> /import/watch-only

an so on

right?

@AMIRKHANEF
Copy link
Member Author

@AMIRKHANEF

if we are going to have

/import/ledger-full-screen

then we can similarly have changes like

/import/attach-qr ==> /import/qr /import/add-watch-only ==> /import/watch-only

an so on

right?

good suggestion, I will handle it.

@AMIRKHANEF AMIRKHANEF closed this Sep 8, 2024
@AMIRKHANEF AMIRKHANEF deleted the Address1361 branch September 8, 2024 05:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor and Standardize Route Names
2 participants