Closed cwastche closed 3 months 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 14, 2024 1:58pm |
β±οΈ Estimated effort to review [1-5] | 3 |
π§ͺ Relevant tests | No |
π Security concerns | No |
β‘ Key issues to review |
Possible Bug: The `notificationLocation` prop in `CircleButton` component is set to default "topleft" which might not be suitable for all use cases. It's important to ensure that this default setting is appropriate across all instances where `CircleButton` is used or consider making it a required prop without a default to enforce explicit configuration. |
Code Duplication: The logic for calculating notification positions in `CircleButton` is directly embedded within the component. This could be refactored into a utility function or custom hook to improve code reuse and maintainability. |
Category | Suggestion | Score |
Enhancement |
Enhance the uniqueness of the key attribute in the list component___ **Replace the hardcoded key attribute with a more unique identifier by combiningarmy.entity_id with another unique property of the army, such as army.army_id , to avoid potential key collisions in lists where armies might have the same entity_id but different army_id .**
[client/src/ui/components/military/EntitiesArmyTable.tsx [20]](https://github.com/BibliothecaDAO/eternum/pull/933/files#diff-c54efdb5349a28b5997ea9a8de6e9bcca6c2f3acea25281f0ea2c8ede9e0c08bR20-R20)
```diff
-return Suggestion importance[1-10]: 8Why: This suggestion improves the uniqueness of the key attribute, which is crucial for React's reconciliation process and helps prevent potential key collisions in lists. | 8 |
Possible bug |
Implement error handling for resource arrival data retrieval___ **Add error handling forgetAllArrivalsWithResources().length to manage cases where getAllArrivalsWithResources() might return null or undefined , preventing runtime errors.**
[client/src/ui/modules/navigation/RightNavigationModule.tsx [122]](https://github.com/BibliothecaDAO/eternum/pull/933/files#diff-8b98807e05dc7525757f9d43f5a3b1a081305f54aa3be0d5be4b2a130160bd0cR122-R122)
```diff
-notification={getAllArrivalsWithResources().length}
+notification={getAllArrivalsWithResources() ? getAllArrivalsWithResources().length : 0}
```
Suggestion importance[1-10]: 8Why: Implementing error handling for `getAllArrivalsWithResources().length` is important to prevent runtime errors when the function returns `null` or `undefined`, ensuring the application remains robust. | 8 |
Add validation for
___
**Consider using a more robust type check or validation for | 7 |
PR Type
Enhancement, Bug fix Closes #914
Description
ArmyChip
component inEntitiesArmyTable
.notificationLocation
prop toCircleButton
component and implemented dynamic notification positioning.notificationLocation
prop forCircleButton
inBottomNavigation
andRightNavigationModule
.useEntityArmies
anduseStamina
inLeftNavigationModule
.notification
andnotificationLocation
props forCircleButton
inLeftNavigationModule
.Changes walkthrough π
EntitiesArmyTable.tsx
Fix key props in EntitiesArmyTable component.
client/src/ui/components/military/EntitiesArmyTable.tsx
ArmyChip
component.CircleButton.tsx
Add notification location prop to CircleButton component.
client/src/ui/elements/CircleButton.tsx
notificationLocation
prop toCircleButton
.BottomNavigation.tsx
Set notification location for CircleButton in BottomNavigation.
client/src/ui/modules/navigation/BottomNavigation.tsx
notificationLocation
prop forCircleButton
in BottomNavigation.LeftNavigationModule.tsx
Add army stamina check and notification in LeftNavigationModule.
client/src/ui/modules/navigation/LeftNavigationModule.tsx
useEffect
import.useEntityArmies
anduseStamina
.notification
andnotificationLocation
props forCircleButton
.RightNavigationModule.tsx
Set notification location for CircleButton in RightNavigationModule.
client/src/ui/modules/navigation/RightNavigationModule.tsx
notificationLocation
prop forCircleButton
inRightNavigationModule.