Closed cwastche closed 1 week 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 | Jul 2, 2024 3:03pm |
β±οΈ Estimated effort to review [1-5] | 4 |
π§ͺ Relevant tests | No |
π Security concerns | No |
β‘ Key issues to review |
Possible Bug: The removal of the
|
Redundancy and Maintenance: The introduction of tableOfContents in multiple components could be refactored into a more centralized approach to avoid redundancy and ease future maintenance. | |
Performance Concern: The dynamic generation of components and frequent use of map in rendering methods (e.g., in Combat.tsx and Resources.tsx ) could lead to performance issues, especially if these components are re-rendered often. |
Category | Suggestion | Score |
Enhancement |
Replace fragment shorthand with a
___
**Replace the fragment shorthand ( | 9 |
Possible bug |
Enhance key uniqueness to prevent rendering issues___ **To avoid potential issues with key uniqueness which can lead to rendering bugs, considerusing a more unique key for the list items in the HyperstructureConstructionTable . Currently, the key is based on the index, which might not be unique if the data changes. A combination of resource ID and index could be a better choice.** [client/src/ui/components/hints/WorldStructures.tsx [114-118]](https://github.com/BibliothecaDAO/eternum/pull/1059/files#diff-fd691959c413d4c715c44e2aef3397de6ab93b337cdd8761faec5332a080d9d6R114-R118) ```diff {constructionCost.slice(colIndex * 6, (colIndex + 1) * 6).map((cost, index) => ( -
+ Suggestion importance[1-10]: 9Why: Using a more unique key for list items helps prevent potential rendering bugs. This is crucial for ensuring the stability and correctness of the component's rendering logic. | 9 |
Performance |
Optimize rendering by memoizing the static data array___ **Consider using React's useMemo hook to optimize the rendering of theconcepts array. This array is derived from static data and does not change unless the component re-renders for other reasons. By memoizing it, you can avoid unnecessary recalculations and re-renders.** [client/src/ui/components/hints/WorldStructures.tsx [14-32]](https://github.com/BibliothecaDAO/eternum/pull/1059/files#diff-fd691959c413d4c715c44e2aef3397de6ab93b337cdd8761faec5332a080d9d6R14-R32) ```diff -const concepts = [ +const concepts = useMemo(() => [ { name: "Hyperstructures", content: ( <>
Naturally occurring structures discovered during exploration, enabling players to harvest precious resources
from the world.
),
},
-];
+], []);
```
Suggestion importance[1-10]: 8Why: Using React's useMemo hook to memoize the static data array can improve performance by preventing unnecessary recalculations and re-renders. This is a significant optimization for components that rely on static data. | 8 |
Accessibility |
Improve accessibility by using semantic HTML tags___ **To improve accessibility and semantic HTML structure, replace the genericdiv elements with section tags in the component rendering. This change will help screen readers and other assistive technologies better understand the structure of the page.** [client/src/ui/components/hints/WorldStructures.tsx [42-47]](https://github.com/BibliothecaDAO/eternum/pull/1059/files#diff-fd691959c413d4c715c44e2aef3397de6ab93b337cdd8761faec5332a080d9d6R42-R47) ```diff {concepts.map((concept) => ( -
+
+
))}
```
{concept.name}{concept.content} -Suggestion importance[1-10]: 7Why: Replacing generic div elements with section tags enhances the semantic structure of the HTML, which improves accessibility for screen readers and other assistive technologies. This is a good practice for better accessibility. | 7 |
Maintainability |
Break down large JSX blocks into smaller components for better readability and maintainability___ **To improve the readability and maintainability of the JSX code, consider breaking down thelarge JSX blocks into smaller, more manageable components. This will make the code easier to understand and maintain, especially as the application scales.** [client/src/ui/components/hints/WorldStructures.tsx [37-49]](https://github.com/BibliothecaDAO/eternum/pull/1059/files#diff-fd691959c413d4c715c44e2aef3397de6ab93b337cdd8761faec5332a080d9d6R37-R49) ```diff return ( <>
-
- ))}
+ {concepts.map((concept) => {concept.name}- {concept.content} -
+
+);
+
```
{concept.name}+ {concept.content} +Suggestion importance[1-10]: 6Why: Breaking down large JSX blocks into smaller components improves code readability and maintainability. While this is beneficial, it is a minor improvement compared to performance or bug fixes. | 6 |
PR Type
Enhancement, Documentation
Description
SelectPreviewBuildingMenu
component by removing redundantdiv
wrapper.Buildings
hints.Combat
hints content withHeadline
,tableOfContents
, and expanded concepts.GettingStarted
hints withtableOfContents
and expanded content on key concepts.Hyperstructures
section toWorld Structures
inHintModal
.Hyperstructures
component.Resources
hints withtableOfContents
and reorganized content on resource production and storage.TheMap
hints withtableOfContents
and expanded content on exploration and travel costs.Trading
hints withHeadline
,tableOfContents
, and expanded content on marketplace and AMM.Transport
hints withHeadline
,tableOfContents
, and expanded content on transport and donkeys.WorldStructures
component with detailed tables for Hyperstructure creation and construction costs.tableOfContents
for generating a table of contents.className
prop toEntityList
for additional styling flexibility.hintSection
prop toOSInterface
andOSWindow
components.SecondaryPopup.Head
to includeHintModalButton
ifhintSection
is provided.HintModalButton
fromLeaderboardPanel
.HintModalButton
toWorldStructuresMenu
.Changes walkthrough π
12 files
SelectPreviewBuilding.tsx
Simplify SelectPreviewBuildingMenu component structure
client/src/ui/components/construction/SelectPreviewBuilding.tsx
div
wrapper aroundHintModalButton
andTabs
.utils.tsx
Add utility function for table of contents
client/src/ui/components/hints/utils.tsx
tableOfContents
for generating a table ofcontents.
EntityList.tsx
Add className prop to EntityList component
client/src/ui/components/list/EntityList.tsx
className
prop toEntityList
for additional styling flexibility.Config.tsx
Add hintSection prop to OSInterface
client/src/ui/components/navigation/Config.tsx - Added `hintSection` prop to `OSInterface`.
OSWindow.tsx
Enhance OSWindow with hintSection prop and HintModalButton
client/src/ui/components/navigation/OSWindow.tsx
hintSection
prop toOSWindow
component.SecondaryPopup.Head
to includeHintModalButton
ifhintSection
is provided.
LeaderboardPanel.tsx
Remove HintModalButton from LeaderboardPanel
client/src/ui/components/worldmap/leaderboard/LeaderboardPanel.tsx - Removed `HintModalButton` from `LeaderboardPanel`.
SecondaryPopup.tsx
Update SecondaryPopup.Head to include HintModalButton
client/src/ui/elements/SecondaryPopup.tsx
SecondaryPopup.Head
to includeHintModalButton
ifhintSection
is provided.
Guilds.tsx
Add hintSection prop to OSWindow in Guilds component
client/src/ui/modules/guilds/Guilds.tsx - Added `hintSection` prop to `OSWindow` in `Guilds` component.
LeaderBoard.tsx
Add hintSection prop to OSWindow in Leaderboard component
client/src/ui/modules/leaderboard/LeaderBoard.tsx - Added `hintSection` prop to `OSWindow` in `Leaderboard` component.
Military.tsx
Add className prop to EntityList in Military component
client/src/ui/modules/military/Military.tsx - Added `className` prop to `EntityList` in `Military` component.
BottomNavigation.tsx
Update conditions for showing leaderboard and guilds buttons
client/src/ui/modules/navigation/BottomNavigation.tsx
quest status.
WorldStructuresMenu.tsx
Add HintModalButton to WorldStructuresMenu
client/src/ui/modules/world-structures/WorldStructuresMenu.tsx - Added `HintModalButton` to `WorldStructuresMenu`.
10 files
Buildings.tsx
Remove storage of food section from Buildings hints
client/src/ui/components/hints/Buildings.tsx - Removed the section on storage of food.
Combat.tsx
Enhance and restructure Combat hints content
client/src/ui/components/hints/Combat.tsx
Headline
andtableOfContents
for better structure.GettingStarted.tsx
Improve GettingStarted hints with table of contents and expanded
content
client/src/ui/components/hints/GettingStarted.tsx
tableOfContents
for better navigation.HintModal.tsx
Rename Hyperstructures section to World Structures in HintModal
client/src/ui/components/hints/HintModal.tsx - Renamed `Hyperstructures` section to `World Structures`.
Hyperstructures.tsx
Remove Hyperstructures component
client/src/ui/components/hints/Hyperstructures.tsx - Removed the entire Hyperstructures component.
Resources.tsx
Enhance Resources hints with table of contents and reorganized content
client/src/ui/components/hints/Resources.tsx
tableOfContents
for better navigation.TheMap.tsx
Improve TheMap hints with table of contents and expanded content
client/src/ui/components/hints/TheMap.tsx
tableOfContents
for better navigation.Trading.tsx
Enhance Trading hints with table of contents and expanded content
client/src/ui/components/hints/Trading.tsx
Headline
andtableOfContents
for better structure.Transport.tsx
Improve Transport hints with table of contents and expanded content
client/src/ui/components/hints/Transport.tsx
Headline
andtableOfContents
for better structure.WorldStructures.tsx
Add new WorldStructures component with detailed tables
client/src/ui/components/hints/WorldStructures.tsx
costs.