-
Notifications
You must be signed in to change notification settings - Fork 47
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
feat(web): show-coherency-percencentage-instead-of-ratio #1739
Conversation
WalkthroughThe changes involve modifications to two components, Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
🪧 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 (
|
✅ Deploy Preview for kleros-v2-testnet ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for kleros-v2-neo ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for kleros-v2-university ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for kleros-v2-testnet-devtools ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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.
Actionable comments posted: 2
🧹 Outside diff range and nitpick comments (2)
web/src/pages/Home/TopJurors/JurorCard/Coherency.tsx (1)
29-29
: Consider using toFixed(1) for better percentage precision.Using
Math.floor
might be too aggressive for rounding percentages. For example, 79.9% would be displayed as 79%, which could be misleading for users.Here's a suggested improvement:
-const getPercent = (num: number, den: number): string => `${Math.floor((num * 100) / den)}%`; +const getPercent = (num: number, den: number): string => `${((num * 100) / den).toFixed(1)}%`;This will show one decimal place (e.g., "79.9%") for more accurate representation.
web/src/pages/Home/TopJurors/Header/Coherency.tsx (1)
14-14
: Consider moving text content to JSX for better maintainability.While the change from "Votes" to "Coherency" aligns with the PR objective, using CSS
content
property for text content is not recommended. Consider moving this text to the component's JSX for better:
- Internationalization support
- Accessibility
- Maintainability
const Container = styled.div` display: flex; font-size: 12px !important; - &::before { - content: "Coherency"; - } color: ${({ theme }) => theme.secondaryText}; align-items: center; // ... rest of the styles `; const Coherency: React.FC = () => { const { width } = useWindowSize(); return ( <Container> + <span>Coherency</span> <WithHelpTooltip place={width > BREAKPOINT_LANDSCAPE ? "top" : "left"} tooltipMsg={coherentVotesTooltipMsg} ></WithHelpTooltip> </Container> ); };
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
web/src/pages/Home/TopJurors/Header/Coherency.tsx
(2 hunks)web/src/pages/Home/TopJurors/JurorCard/Coherency.tsx
(2 hunks)
🔇 Additional comments (2)
web/src/pages/Home/TopJurors/JurorCard/Coherency.tsx (1)
Line range hint 1-17
: LGTM! Clean imports and well-typed interface.
The component's interface clearly defines the required props for coherency calculation.
web/src/pages/Home/TopJurors/Header/Coherency.tsx (1)
Line range hint 29-35
: Verify coherency calculation consistency.
Let's ensure the coherency percentage calculation in the JurorCard component matches the description in this tooltip.
a709812
Code Climate has analyzed commit a709812 and detected 0 issues on this pull request. View more on Code Climate. |
|
PR-Codex overview
This PR updates the
Coherency
component in theJurorCard
and modifies the associated styles and tooltip messages to enhance clarity and functionality.Detailed summary
Coherency
component to display aTooltip
with the percentage of coherent votes.getPercent
function to calculate the percentage of coherent votes.::before
content from "Votes" to "Coherency".Summary by CodeRabbit
New Features
Bug Fixes