Closed cwastche closed 2 days 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 30, 2024 7:19pm |
โฑ๏ธ Estimated effort to review [1-5] | 2 |
๐งช Relevant tests | No |
๐ Security concerns | No |
โก Key issues to review |
Possible Bug: The resource prop is used in HoverBuilding component without null checking. Since resource is optional (resource? ), ensure that it is not undefined before using it in ResourceInfo .
|
Category | Suggestion | Score |
Best practice |
Ensure type safety by defining the type of the 'resource' prop___ **Add type definition for the newresource prop in the HoverBuilding component to ensure type safety and better maintainability.** [client/src/ui/components/construction/ExistingBuildings.tsx [300]](https://github.com/BibliothecaDAO/eternum/pull/1054/files#diff-b8b13d61f7fc906dae1ff3473650c5893b1d3971d1b65e062a1fb4c6ed5e749bR300-R300) ```diff -resource, +resource?: ResourcesIds, ``` Suggestion importance[1-10]: 10Why: Adding a type definition for the `resource` prop is essential for maintaining type safety and improving code maintainability, making this a highly valuable suggestion. | 10 |
Possible bug |
Replace the non-null assertion with a default value or conditional rendering___ **Avoid using the non-null assertion operator (! ) on resource in the ResourceInfo component to prevent runtime errors. Instead, handle the potential undefined or null values gracefully.** [client/src/ui/components/construction/ExistingBuildings.tsx [316]](https://github.com/BibliothecaDAO/eternum/pull/1054/files#diff-b8b13d61f7fc906dae1ff3473650c5893b1d3971d1b65e062a1fb4c6ed5e749bR316-R316) ```diff - Suggestion importance[1-10]: 9Why: Avoiding the non-null assertion operator and handling potential undefined values gracefully is important for preventing runtime errors, making this a significant improvement. | 9 |
Possible issue |
Add a default value or handle the potential undefined state for the 'resource' prop___ **Ensure that theresource prop in BuiltBuilding component is always provided or handled properly when undefined. If resource is optional, consider adding a default value or conditional rendering to avoid runtime errors.** [client/src/ui/components/construction/ExistingBuildings.tsx [288]](https://github.com/BibliothecaDAO/eternum/pull/1054/files#diff-b8b13d61f7fc906dae1ff3473650c5893b1d3971d1b65e062a1fb4c6ed5e749bR288-R288) ```diff -resource={resource} +resource={resource ?? 'defaultResource'} ``` Suggestion importance[1-10]: 8Why: This suggestion addresses a potential runtime error by ensuring that the `resource` prop is always defined, which is crucial for preventing crashes and improving code robustness. | 8 |
Enhancement |
Simplify the lambda expression in the map function for better readability___ **Simplify the rendering ofQuestCard components by removing unnecessary parentheses and maintaining the concise syntax as shown in the new code.** [client/src/ui/components/hints/HintBox.tsx [169]](https://github.com/BibliothecaDAO/eternum/pull/1054/files#diff-5cf22aac8f0607d764110992d7cb5eac12ced82af11478c86e79fd3659cefc6aR169-R169) ```diff -{depthQuests?.map((quest: Quest) => Suggestion importance[1-10]: 6Why: This suggestion improves code readability by simplifying the lambda expression, which is a minor but useful enhancement. | 6 |
PR Type
Bug fix, Enhancement Closes #1051
Description
resource
prop toBuiltBuilding
andHoverBuilding
components to fix and enhance hover information for resource buildings.HoverBuilding
to useresource
prop forResourceInfo
.QuestDepthGroup
component.Changes walkthrough ๐
ExistingBuildings.tsx
Fix and enhance hover information for resource buildings
client/src/ui/components/construction/ExistingBuildings.tsx
resource
prop toBuiltBuilding
andHoverBuilding
components.HoverBuilding
to useresource
prop forResourceInfo
.HintBox.tsx
Format quest mapping in QuestDepthGroup component
client/src/ui/components/hints/HintBox.tsx - Minor formatting change in `QuestDepthGroup` component.