Closed cwastche closed 1 month ago
The latest updates on your projects. Learn more about Vercel for Git โ๏ธ
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
eternum | โ Ready (Inspect) | Visit Preview | ๐ฌ Add feedback | Jun 12, 2024 9:52pm |
โฑ๏ธ Estimated effort to review [1-5] | 3 |
๐งช Relevant tests | No |
๐ Security concerns | No |
โก Key issues to review |
Possible Bug: The refactoring in `useQuests.tsx` introduces a new way to handle quests by checking if all prizes have been claimed. However, the logic assumes that all quests have prizes which might not always be the case. This could potentially lead to runtime errors if any quest does not have a `prizes` array. |
Redundancy: The `useQuests.tsx` and `HintBox.tsx` both contain logic related to checking if a quest's prizes have been claimed. This could be simplified and centralized to avoid redundancy and potential discrepancies in quest status handling. |
Category | Suggestion | Score |
Maintainability |
Reduce redundancy by consolidating repeated state update calls into a single function___ **Consolidate the repeatedsetIsLoading(true) calls into a single function to reduce redundancy and improve maintainability.** [client/src/ui/components/hints/HintBox.tsx [39-54]](https://github.com/BibliothecaDAO/eternum/pull/915/files#diff-5cf22aac8f0607d764110992d7cb5eac12ced82af11478c86e79fd3659cefc6aR39-R54) ```diff -setIsLoading(true); +startLoading(); ``` Suggestion importance[1-10]: 9Why: Consolidating repeated `setIsLoading(true)` calls into a single function significantly improves maintainability and reduces redundancy, making the code cleaner and easier to manage. | 9 |
Reduce redundancy by using a constant for repeated steps in quest definitions___ **Refactor the repeated steps in each quest object to a constant to avoid redundancy andpotential errors in future modifications.** [client/src/hooks/helpers/useQuests.tsx [35]](https://github.com/BibliothecaDAO/eternum/pull/915/files#diff-02207afc6e5bd13a56e092c44f234cbddae30dd5cf9704eb786a3b8f7da20d33R35-R35) ```diff -steps: [{ description: "Claim Food" }, { description: "Build a farm" }], +steps: commonSteps, ``` Suggestion importance[1-10]: 8Why: This suggestion addresses maintainability by reducing redundancy, which can help prevent potential errors in future modifications. It is a good practice to use constants for repeated values. | 8 | |
Performance |
Optimize code by ensuring
___
**Ensure that the | 7 |
Readability |
Improve code readability by using more descriptive variable names___ **Use a more descriptive variable name thanupdatedQuests to reflect the nature of the data, such as questsWithClaimStatus .**
[client/src/hooks/helpers/useQuests.tsx [30]](https://github.com/BibliothecaDAO/eternum/pull/915/files#diff-02207afc6e5bd13a56e092c44f234cbddae30dd5cf9704eb786a3b8f7da20d33R30-R30)
```diff
-const updatedQuests = [
+const questsWithClaimStatus = [
```
Suggestion importance[1-10]: 6Why: Using more descriptive variable names enhances code readability and maintainability. However, this is a minor improvement and does not affect the functionality. | 6 |
User description
PR Type
Enhancement, Bug fix
Description
HasClaimedStartingResources
component.Changes walkthrough ๐
useQuests.tsx
Enhance quest tracking and completion logic
client/src/hooks/helpers/useQuests.tsx
HasClaimedStartingResources
component to track claimedresources.
HintBox.tsx
Update HintBox component to handle claimed quests
client/src/ui/components/hints/HintBox.tsx
claimed
property to quest interface.hasClaimed
logic.BottomNavigation.tsx
Improve quest button state handling in navigation
client/src/ui/modules/navigation/BottomNavigation.tsx
claimableQuests
.