-
Notifications
You must be signed in to change notification settings - Fork 35
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
new donkey event + improve event stream #1904
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Failed to generate code suggestions for PR |
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.
The changes in this pull request are well-implemented and improve the functionality and user experience of the event stream. The addition of the BurnDonkey event in both the Cairo contract and TypeScript components is a good feature. The EventStream component has been significantly enhanced with better styling, more detailed event information, and improved interactivity. The use of type-safe configurations and dynamic action generation based on event data is a good practice. Overall, the code is well-structured and consistent. Some minor suggestions for improvement include adding comments to explain complex logic and constants, and considering error handling for potential edge cases.
Thanks for using MentatBot. Give comments a 👍 or 👎 to help me improve!
import { currencyFormat } from "@/ui/utils/utils"; | ||
import { ContractAddress, findResourceById, Position } from "@bibliothecadao/eternum"; | ||
import { Component, ComponentValue, defineComponentSystem, getComponentValue, World } from "@dojoengine/recs"; | ||
import { getEntityIdFromKeys, hexToAscii } from "@dojoengine/utils"; | ||
import { useEffect, useState } from "react"; | ||
import { MessageIcon } from "../social/PlayerId"; | ||
|
||
const EVENT_STREAM_SIZE = 8; |
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.
Consider adding a comment explaining the purpose of the EVENT_STREAM_SIZE constant.
@@ -36,53 +40,95 @@ | |||
AcceptOrder = "AcceptOrder", | |||
} | |||
|
|||
const EVENT_CONFIG = { | |||
const EVENT_CONFIG: { |
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.
The type definition for EVENT_CONFIG is a good practice for type safety. Consider adding a comment explaining its structure and purpose.
color: "#C5E1A5", | ||
}, | ||
}; | ||
|
||
interface EventData { | ||
name: string | undefined; | ||
action: string; | ||
eventType: EventType; | ||
timestamp: number; | ||
position: Position | undefined; |
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.
Consider adding error handling for cases where the component value might be undefined.
@@ -28,6 +41,17 @@ mod donkey_systems { | |||
let mut donkeys: Resource = ResourceCustomImpl::get(world, (payer_id, ResourceTypes::DONKEY)); | |||
donkeys.burn(donkey_amount); | |||
donkeys.save(world); | |||
|
|||
// emit burn donkey event |
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.
Good addition of the BurnDonkey event. Consider adding a comment explaining the purpose and significance of this event.
No description provided.