Hu-Fi / Mr.Market

Mr. Market is the exchange oracle of HuFi, and a CeFi crypto bot on Mixin Messenger
https://mr-market-one.vercel.app
GNU Affero General Public License v3.0
1 stars 6 forks source link

Fix ios input #160

Closed zed-wong closed 5 months ago

zed-wong commented 5 months ago

Type

Enhancement


Description


Changes walkthrough

Relevant files
Enhancement
exchanges.svelte
Update input pattern for decimal validation                           

interface/src/lib/components/grow/arbitrage/new/easy/exchanges.svelte - Changed input pattern to allow decimal numbers.
+1/-1     
amount.svelte
Simplify input fields and remove inputmode                             

interface/src/lib/components/grow/marketMaking/new/easy/amount.svelte
  • Removed inputmode attribute from input fields.
  • Simplified input type specification.
  • +2/-2     
    inputs.svelte
    Refactor input fields for bids component                                 

    interface/src/lib/components/spot/bids/inputs.svelte
  • Removed inputmode attribute from multiple input fields.
  • Adjusted input handling for limit and market order types.
  • +0/-4     
    input.svelte
    Remove inputmode from swap input field                                     

    interface/src/lib/components/swap/input.svelte - Removed inputmode attribute from the input field.
    +0/-1     
    output.svelte
    Remove inputmode from swap output field                                   

    interface/src/lib/components/swap/output.svelte - Removed inputmode attribute from the output field.
    +0/-1     

    โœจ PR-Agent usage: Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    railway-app[bot] commented 5 months ago

    This PR is being deployed to Railway ๐Ÿš…

    railway-app[bot] commented 5 months ago

    This PR is being deployed to Railway ๐Ÿš…

    vercel[bot] commented 5 months ago

    The latest updates on your projects. Learn more about Vercel for Git โ†—๏ธŽ

    Name Status Preview Updated (UTC)
    mr-market โœ… Ready (Inspect) Visit Preview Apr 17, 2024 10:12am
    github-actions[bot] commented 5 months ago

    PR Description updated to latest commit (https://github.com/Hu-Fi/Mr.Market/commit/e5151143087a9e890b7fc34ba3b45cbac906afef)

    github-actions[bot] commented 5 months ago

    PR Review

    (Review updated until commit https://github.com/Hu-Fi/Mr.Market/commit/e5151143087a9e890b7fc34ba3b45cbac906afef)

    โฑ๏ธ Estimated effort to review [1-5] 2, because the changes are straightforward and localized to input field attributes across several Svelte components. The modifications are mainly about removing the 'inputmode' attribute and adjusting regex patterns for input validation.
    ๐Ÿงช Relevant tests No
    ๐Ÿ” Possible issues Regex Pattern Inconsistency: The regex pattern "\d*\.?\d*" used in 'exchanges.svelte' might not be robust enough for strict decimal validation as it allows multiple dots and does not enforce digit presence before or after the dot.
    ๐Ÿ”’ Security concerns No
    Code feedback:
    relevant fileinterface/src/lib/components/grow/arbitrage/new/easy/exchanges.svelte
    suggestion       Consider refining the regex pattern to ensure it accurately validates decimal inputs. A more precise pattern might be "^\d+(\.\d+)?$" which ensures at least one digit before and at most one dot followed by one or more digits. [important]
    relevant linepattern="\d*\.?\d*"


    โœจ Review tool usage guide:
    **Overview:** The `review` tool scans the PR code changes, and generates a PR review which includes several types of feedbacks, such as possible PR issues, security threats and relevant test in the PR. More feedbacks can be [added](https://pr-agent-docs.codium.ai/tools/review/#general-configurations) by configuring the tool. The tool can be triggered [automatically](https://pr-agent-docs.codium.ai/usage-guide/automations_and_usage/#github-app-automatic-tools-when-a-new-pr-is-opened) every time a new PR is opened, or can be invoked manually by commenting on any PR. - When commenting, to edit [configurations](https://github.com/Codium-ai/pr-agent/blob/main/pr_agent/settings/configuration.toml#L23) related to the review tool (`pr_reviewer` section), use the following template: ``` /review --pr_reviewer.some_config1=... --pr_reviewer.some_config2=... ``` - With a [configuration file](https://pr-agent-docs.codium.ai/usage-guide/configuration_options/), use the following template: ``` [pr_reviewer] some_config1=... some_config2=... ``` See the review [usage page](https://pr-agent-docs.codium.ai/tools/review/) for a comprehensive guide on using this tool.
    github-actions[bot] commented 5 months ago

    PR Description updated to latest commit (https://github.com/Hu-Fi/Mr.Market/commit/e5151143087a9e890b7fc34ba3b45cbac906afef)

    github-actions[bot] commented 5 months ago

    Persistent review updated to latest commit https://github.com/Hu-Fi/Mr.Market/commit/e5151143087a9e890b7fc34ba3b45cbac906afef

    github-actions[bot] commented 5 months ago

    PR Code Suggestions

    CategorySuggestions                                                                                                                                                       
    Enhancement
    Enhance the regex pattern to enforce a specific number of decimal places. ___ **The regex pattern for the input field only allows numbers and a single dot, which might
    not be sufficient for all decimal inputs, especially those requiring a specific format or
    precision. Consider enhancing the regex pattern to enforce a more precise format, such as
    limiting the number of decimal places.** [interface/src/lib/components/grow/arbitrage/new/easy/exchanges.svelte [233]](https://github.com/Hu-Fi/Mr.Market/pull/160/files#diff-76a6a96298f7905c2da1e23483669b1951f5de3e0b25f37df050d78eb0878233R233-R233) ```diff -pattern="\d*\.?\d*" +pattern="^\d+(\.\d{1,2})?$" ```
    Usability
    Restore the input mode for decimal numbers to improve mobile usability. ___ **The input field lacks an explicit input mode for decimal numbers, which was present in the
    previous version. Restoring inputmode="decimal" can improve the mobile user experience by
    bringing up the appropriate keyboard.** [interface/src/lib/components/grow/marketMaking/new/easy/amount.svelte [35]](https://github.com/Hu-Fi/Mr.Market/pull/160/files#diff-459a25a5ea5b96b0229135f3d0cef5dfc4bb8b073efd3be20b13d92890eade55R35-R35) ```diff - + ```
    Add inputmode="decimal" to ensure the numeric keypad is available for mobile users. ___ **The removal of inputmode="decimal" could negatively affect mobile users by not showing the
    numeric keypad. Consider adding it back to ensure that the numeric keypad is available for
    easier input of numeric values.** [interface/src/lib/components/spot/bids/inputs.svelte [199-201]](https://github.com/Hu-Fi/Mr.Market/pull/160/files#diff-12445a9b778b968349e9b5aa908c04ef41c20d7fa6f232d972fb3e936a93bfd0R199-R201) ```diff -
    Reinstate inputmode="decimal" to improve the mobile user interface for numerical inputs. ___ **Consider reintroducing inputmode="decimal" to the input field to enhance the user
    experience on mobile devices by displaying the appropriate keyboard for numerical input.** [interface/src/lib/components/swap/input.svelte [82-86]](https://github.com/Hu-Fi/Mr.Market/pull/160/files#diff-3ebcc855afc26c1448e6d2669f19afae0350fd0aa75f427f7be8dc6478622973R82-R86) ```diff -
    Restore inputmode="decimal" to facilitate numeric input on mobile devices. ___ **Adding inputmode="decimal" back to the output amount input field can help mobile users by
    automatically bringing up the numeric keypad, which is more suitable for entering numbers.** [interface/src/lib/components/swap/output.svelte [82-86]](https://github.com/Hu-Fi/Mr.Market/pull/160/files#diff-9ddd5334cd6d09b1881f372f5c1a41de1af7fa031abbbe1eb6a429f977037b35R82-R86) ```diff -

    โœจ Improve tool usage guide:
    **Overview:** The `improve` tool scans the PR code changes, and automatically generates suggestions for improving the PR code. The tool can be triggered [automatically](https://pr-agent-docs.codium.ai/usage-guide/automations_and_usage/#github-app-automatic-tools-when-a-new-pr-is-opened) every time a new PR is opened, or can be invoked manually by commenting on a PR. - When commenting, to edit [configurations](https://github.com/Codium-ai/pr-agent/blob/main/pr_agent/settings/configuration.toml#L78) related to the improve tool (`pr_code_suggestions` section), use the following template: ``` /improve --pr_code_suggestions.some_config1=... --pr_code_suggestions.some_config2=... ``` - With a [configuration file](https://pr-agent-docs.codium.ai/usage-guide/configuration_options/), use the following template: ``` [pr_code_suggestions] some_config1=... some_config2=... ``` See the improve [usage page](https://pr-agent-docs.codium.ai/tools/improve/) for a comprehensive guide on using this tool.
    github-actions[bot] commented 5 months ago

    PR Code Suggestions

    CategorySuggestions                                                                                                                                                       
    Enhancement
    Refine the regex pattern to ensure only valid decimal numbers can be entered. ___ **The pattern attribute for the input field is set to allow any number of digits followed by
    an optional decimal point and more digits. This regex pattern does not restrict the input
    to valid decimal numbers as it allows multiple decimal points. Consider refining the regex
    pattern to ensure only valid decimal numbers can be entered.** [interface/src/lib/components/grow/arbitrage/new/easy/exchanges.svelte [233]](https://github.com/Hu-Fi/Mr.Market/pull/160/files#diff-76a6a96298f7905c2da1e23483669b1951f5de3e0b25f37df050d78eb0878233R233-R233) ```diff -pattern="\d*\.?\d*" +pattern="^\d+(\.\d+)?$" ```
    Add a pattern attribute to restrict input to numeric values. ___ **The input field lacks any constraints on the type of data that can be entered. To improve
    usability and prevent errors, consider adding a pattern attribute to restrict input to
    numeric values, similar to other input fields in the project.** [interface/src/lib/components/grow/marketMaking/new/easy/amount.svelte [35]](https://github.com/Hu-Fi/Mr.Market/pull/160/files#diff-459a25a5ea5b96b0229135f3d0cef5dfc4bb8b073efd3be20b13d92890eade55R35-R35) ```diff - + ```
    Usability
    Reintroduce inputmode="decimal" to enhance mobile user experience. ___ **The removal of inputmode="decimal" from the input fields may affect mobile users by not
    bringing up the numeric keypad, which is crucial for ease of use in numeric inputs.
    Consider reintroducing inputmode="decimal" to enhance mobile user experience.** [interface/src/lib/components/spot/bids/inputs.svelte [200]](https://github.com/Hu-Fi/Mr.Market/pull/160/files#diff-12445a9b778b968349e9b5aa908c04ef41c20d7fa6f232d972fb3e936a93bfd0R200-R200) ```diff - + ```
    Add inputmode="decimal" to improve mobile usability. ___ **The removal of inputmode="decimal" might degrade the user experience by not providing an
    appropriate keyboard layout for numerical input on mobile devices. Adding it back can
    improve usability.** [interface/src/lib/components/swap/input.svelte [84]](https://github.com/Hu-Fi/Mr.Market/pull/160/files#diff-3ebcc855afc26c1448e6d2669f19afae0350fd0aa75f427f7be8dc6478622973R84-R84) ```diff - + ```
    Reinstate inputmode="decimal to improve the mobile user interface. ___ **Similar to other inputs, the removal of inputmode="decimal" could negatively impact mobile
    users by not showing the numeric keypad for numeric inputs. Re-adding this attribute could
    enhance the user interface for mobile users.** [interface/src/lib/components/swap/output.svelte [84]](https://github.com/Hu-Fi/Mr.Market/pull/160/files#diff-9ddd5334cd6d09b1881f372f5c1a41de1af7fa031abbbe1eb6a429f977037b35R84-R84) ```diff - + ```

    โœจ Improve tool usage guide:
    **Overview:** The `improve` tool scans the PR code changes, and automatically generates suggestions for improving the PR code. The tool can be triggered [automatically](https://pr-agent-docs.codium.ai/usage-guide/automations_and_usage/#github-app-automatic-tools-when-a-new-pr-is-opened) every time a new PR is opened, or can be invoked manually by commenting on a PR. - When commenting, to edit [configurations](https://github.com/Codium-ai/pr-agent/blob/main/pr_agent/settings/configuration.toml#L78) related to the improve tool (`pr_code_suggestions` section), use the following template: ``` /improve --pr_code_suggestions.some_config1=... --pr_code_suggestions.some_config2=... ``` - With a [configuration file](https://pr-agent-docs.codium.ai/usage-guide/configuration_options/), use the following template: ``` [pr_code_suggestions] some_config1=... some_config2=... ``` See the improve [usage page](https://pr-agent-docs.codium.ai/tools/improve/) for a comprehensive guide on using this tool.