-
Notifications
You must be signed in to change notification settings - Fork 53
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
Next into season 1 #2647
Next into season 1 #2647
Changes from 19 commits
5fca84b
06c9e22
1a48f2f
2e99610
5803a40
a9bffe8
c610451
e4e8f8b
ddb62bf
8a24dda
84c0a45
e2c694b
0d4e6f8
4718c4c
4fd331c
94a376b
9b9c4de
5abea52
1742288
cbeff22
6b05341
8af9607
ad2f9f4
8f43edc
282a116
57521f3
f9d9055
95cf687
f47aaad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import { EternumGlobalConfig, QuestType, findResourceById } from "@bibliothecadao/eternum"; | ||
import { QuestType, findResourceById } from "@bibliothecadao/eternum"; | ||
import { addSpacesBeforeCapitals, formatAmount } from "../utils/formatting"; | ||
import ResourceIcon from "./ResourceIcon"; | ||
import { formatAmount, addSpacesBeforeCapitals } from "../utils/formatting"; | ||
|
||
export default function QuestRewards() { | ||
return ( | ||
<div className="grid grid-cols-1 gap-6"> | ||
{Object.entries(EternumGlobalConfig.questResources).map(([questType, rewards]) => ( | ||
{Object.entries(ETERNUM_CONFIG().questResources).map(([questType, rewards]) => ( | ||
<div key={questType} className="p-4 rounded-lg border border-gray-200 dark:border-gray-700 bg-white/5"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π οΈ Refactor suggestion Optimize config access to prevent unnecessary re-renders. Calling Consider using React's useMemo or useEffect to cache the config: export default function QuestRewards() {
+ const [questResources, setQuestResources] = React.useState({});
+
+ React.useEffect(() => {
+ const loadConfig = async () => {
+ const config = await ETERNUM_CONFIG();
+ setQuestResources(config.questResources);
+ };
+ loadConfig();
+ }, []);
+
return (
<div className="grid grid-cols-1 gap-6">
- {Object.entries(ETERNUM_CONFIG().questResources).map(([questType, rewards]) => (
+ {Object.entries(questResources).map(([questType, rewards]) => (
|
||
<div className="font-bold text-lg mb-4"> | ||
{addSpacesBeforeCapitals(QuestType[Number(questType)] || "Unknown Quest")} | ||
|
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.
Fix formatting according to rustfmt standards.
The
format!
macro needs to be split across multiple lines.π Committable suggestion
π§° Tools
πͺ GitHub Actions: discord-bot
[error] 43-47: Code formatting does not match rustfmt style. The format! macro call needs to be split across multiple lines according to rustfmt standards.