-
Notifications
You must be signed in to change notification settings - Fork 34
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
Enh/modular config #1139
base: main
Are you sure you want to change the base?
Enh/modular config #1139
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
PR Reviewer Guide 🔍
|
PR Code Suggestions ✨
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pull request introduces a more modular and flexible configuration system for the Eternum project. It moves away from hardcoded constants to a more dynamic configuration approach, allowing for easier customization and maintenance. The changes span across the client, contracts, and SDK, ensuring consistency throughout the project.
Key changes include:
- Introduction of a ConfigManager class for handling configuration data.
- Removal of hardcoded constants in favor of configuration-based values.
- Updates to various systems (e.g., stamina, travel) to use the new configuration approach.
- Addition of new configuration options and restructuring of existing ones.
While the changes generally improve the project's flexibility, there are a few areas that need attention, such as the use of fs
in the client-side code and potential inconsistencies in stamina cost calculations. These have been noted in the inline comments.
Overall, this is a significant improvement in the project's architecture, but care should be taken to ensure all systems are updated correctly to use the new configuration system.
Thanks for using MentatBot. Give comments a 👍 or 👎 to help me improve!
client/src/ui/components/cityview/realm/buildings/labor/SelectableLaborResource.tsx
Outdated
Show resolved
Hide resolved
619bc10
to
9ba37d1
Compare
User description
Thought: Should we make a separate manager for the client that fetches config values onchain directly ?
PR Type
enhancement, configuration changes
Description
ConfigManager
class for centralized configuration management across the project.ConfigManager
instance in various components and hooks.ConfigManager
.Changes walkthrough 📝
15 files
index.ts
Implemented `ConfigManager` for centralized configuration management
sdk/packages/eternum/src/config/index.ts
ConfigManager
class for managing configuration.building, population, and more.
resources.ts
Refactored resource constants and added `ResourceMultipliers`
sdk/packages/eternum/src/constants/resources.ts
ResourceMultipliers
constant.SelectPreviewBuilding.tsx
Integrated `ConfigManager` in SelectPreviewBuilding component
client/src/ui/components/construction/SelectPreviewBuilding.tsx
ConfigManager
instance.useLeaderBoardStore.tsx
Integrated `ConfigManager` in LeaderBoard store
client/src/hooks/store/useLeaderBoardStore.tsx
ConfigManager
instance.StructureConstructionMenu.tsx
Integrated `ConfigManager` in StructureConstructionMenu component
client/src/ui/components/structures/construction/StructureConstructionMenu.tsx
ConfigManager
instance.Combat.tsx
Integrated `ConfigManager` in Combat hints component
client/src/ui/components/hints/Combat.tsx
ConfigManager
instance.index.ts
Cleaned up utility functions and imports
sdk/packages/eternum/src/utils/index.ts
global.ts
Updated global configuration constants
sdk/packages/eternum/src/constants/global.ts
ConfigManager
.HyperstructurePanel.tsx
Integrated `ConfigManager` in HyperstructurePanel component
client/src/ui/components/hyperstructures/HyperstructurePanel.tsx
ConfigManager
instance.TopMiddleNavigation.tsx
Integrated `ConfigManager` in TopMiddleNavigation component
client/src/ui/modules/navigation/TopMiddleNavigation.tsx
ConfigManager
instance.index.ts
Added travel stamina cost configuration method in provider
sdk/packages/eternum/src/provider/index.ts
useRealm.tsx
Integrated `ConfigManager` in useRealm hook
client/src/hooks/helpers/useRealm.tsx
ConfigManager
instance.WorldStructures.tsx
Integrated `ConfigManager` in WorldStructures hints component
client/src/ui/components/hints/WorldStructures.tsx
ConfigManager
instance.config.ts
Added `EternumConfig` interface
sdk/packages/eternum/src/types/config.ts
EternumConfig
interface for configuration management.TheMap.tsx
Integrated `ConfigManager` in TheMap hints component
client/src/ui/components/hints/TheMap.tsx
ConfigManager
instance.2 files
stamina.cairo
...
contracts/src/models/stamina.cairo
...
contracts.cairo
...
contracts/src/systems/map/contracts.cairo
...