🛜 feat: Add special TE count display for unset state#1924
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a visual indicator (🛜 emoji) to display when Truth Egg (TE) count data is being fetched asynchronously from the API, improving the user experience by showing a loading state instead of displaying 0 or no value.
Key Changes:
- Introduced
-1as a sentinel value to indicate TE count is being fetched - Added conditional display logic to show 🛜 emoji when
TECount == -1 - Applied the display logic consistently across three different rendering contexts
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/boost/boost.go | Initialize TECount to -1 when starting asynchronous fetch, serving as a sentinel value for "loading" state |
| src/boost/boost_draw.go | Add conditional rendering logic in three locations to display 🛜 emoji for unset TE count (-1) instead of showing the numeric value |
Comment on lines
+309
to
+313
| if b.TECount == -1 { | ||
| sortRate = fmt.Sprint(" **TE:🛜** ") | ||
| } else { | ||
| sortRate = fmt.Sprintf(" **TE:%d** ", b.TECount) | ||
| } |
There was a problem hiding this comment.
This logic for handling TECount == -1 is duplicated in three locations (lines 309-313, 356-360, and 440-444). Consider extracting this into a helper function to reduce code duplication and improve maintainability.
For example:
func getTESortRate(teCount int) string {
if teCount == -1 {
return fmt.Sprint(" **TE:🛜** ")
}
return fmt.Sprintf(" **TE:%d** ", teCount)
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.