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

In Frontend, Refactor Hardcoded Values to Use Constants or Configuration #87

Open
OhmSpectator opened this issue Nov 26, 2023 · 5 comments
Labels
front Issues related to Web UI good first issue Good for newcomers refactoring No new features, just refactoring

Comments

@OhmSpectator
Copy link
Member

Description

Currently, several components set the selected region to a hardcoded value of 'World' or check against it. This approach can lead to potential issues with maintainability and flexibility as the application scales or undergoes changes.

Suggested Improvement

Refactor the code to replace hardcoded strings and values with constants or configuration objects. This will centralize the management of these values and make the codebase more maintainable.

Implementation Details

  • Create a constants.js file or a similar configuration file in the src directory.
  • Define constants for commonly used values, such as default region names, IDs, and any other relevant information.
  • Import and use these constants within the HierarchySwitcher component and any other components where hardcoded values are used.

Benefits

  • Maintainability: Centralizing hardcoded values makes it easier to manage and update them.
  • Scalability: As new features or hierarchies are added, having a single source of truth for these values simplifies the process.
  • Best Practices: Aligns with best practices in React development for managing application-wide static data.

Acceptance Criteria

  • No hardcoded strings or values are present in the components.
  • All default values are sourced from a constants/configuration file.
  • The application behaves as expected with no regressions in functionality.
@OhmSpectator OhmSpectator added good first issue Good for newcomers front Issues related to Web UI refactoring No new features, just refactoring labels Nov 26, 2023
@VishalD51
Copy link

@OhmSpectator I'm willing to work on this. Could you assign this issue to me, please?

@OhmSpectator
Copy link
Member Author

@VishalD51 ok!

VishalD51 added a commit to VishalD51/track-your-regions that referenced this issue Nov 27, 2023
@VishalD51
Copy link

@OhmSpectator Can you please check this PR: #89
and Let me know if you want more changes regarding this. Thanks!

@OhmSpectator
Copy link
Member Author

@VishalD51 thanks! I'll check the PR in the next few days.

@OhmSpectator OhmSpectator moved this to 👀 In review in Track Your Regions Nov 29, 2023
@OhmSpectator OhmSpectator linked a pull request Nov 29, 2023 that will close this issue
@OhmSpectator
Copy link
Member Author

The default zoom level (9) from RegionMap should also be added to the constants.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
front Issues related to Web UI good first issue Good for newcomers refactoring No new features, just refactoring
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants