Skip to content
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/removal challenge justification display #42

Merged
merged 6 commits into from
Jun 20, 2024

Conversation

Harman-singh-waraich
Copy link
Contributor

@Harman-singh-waraich Harman-singh-waraich commented Jun 19, 2024

  • Adds display for Justification for Removal and Challenge Requests
  • Adds a new field externalDisputeID in Request entity, to make it easier to link it to evidences
  • Adds challengeTime field in Request enitity
  • Updates the addresses in List and Item Cards

PR-Codex overview

This PR enhances the Curate application by adding challenge time tracking, improving UI components, updating subgraph queries, and refining data fetching functions.

Detailed summary

  • Added challengeTime tracking to requests
  • Updated UI components for Header, RegistryInformationCard, and JustificationDetails
  • Modified subgraph queries for useRequestsQuery and useEvidences
  • Implemented fetchJsonIpfs data fetching function
  • Updated environment variables and dependencies
  • Enhanced scrollbar styling
  • Updated schema with externalDisputeID field

The following files were skipped due to too many changes: web/src/components/HistoryDisplay/Party/JustificationDetails.tsx, web/src/components/HistoryDisplay/Party/index.tsx, web/src/components/InformationCards/RegistryInformationCard/TopInfo.tsx, web/src/components/InformationCards/ItemInformationCard/index.tsx, web/src/components/HistoryDisplay/index.tsx, web/src/components/HistoryDisplay/Party/JustificationModal.tsx

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Summary by CodeRabbit

  • New Features

    • Introduced externalDisputeID and challengeTime fields in request details.
    • Added new React components: Party, JustificationDetails, and JustificationModal.
    • Introduced custom hook useEvidences for fetching evidence data.
    • Implemented a new function fetchJsonIpfs for fetching JSON data from IPFS.
  • Enhancements

    • Updated several components to improve alias display and justification handling.
    • Updated @kleros/ui-components-library to version 2.13.1.
    • Enhanced styling for custom scrollbars.
  • Configuration

    • Updated subgraph URLs in .env.devnet.public.
  • Bug Fixes

    • Fixed fetcher function in GraphqlBatcher.tsx to handle core service requests.

Copy link
Contributor

coderabbitai bot commented Jun 19, 2024

Walkthrough

This update introduces several enhancements and fixes across different parts of the project. Significant changes include adding new fields to the GraphQL schema and corresponding updates to the data handling logic in both the backend and frontend. Additionally, there are updates to the React application UI components, custom hooks for handling GraphQL data, and upgraded dependencies. The goal is to increase functionality, improve user experience, and maintainability of the codebase.

Changes

File(s) Change Summary
subgraph/schema.graphql Added externalDisputeID and challengeTime fields to the Request type.
subgraph/src/Curate.ts Updated handleRequestChallenged function to set challengeTime field.
subgraph/src/entities/Request.ts Removed Registry import, assigned externalDisputeID.
web/.env.devnet.public Updated subgraph URLs for ARBSEPOLIA and CORE services.
web/package.json Upgraded @kleros/ui-components-library dependency version.
web/src/components/HistoryDisplay/... Introduced Party, JustificationDetails, and JustificationModal components for displaying request details and handling justifications.
web/src/components/InformationCards/... Modified components to improve layout and UX, added new styled components.
web/src/components/StyledSkeleton.tsx Added new styled components for skeleton placeholders.
web/src/consts/index.ts Switched to the nullish coalescing operator for default COURT_SITE value.
web/src/context/GraphqlBatcher.tsx Modified fetcher function to accept additional isCore parameter.
web/src/hooks/queries/... Added custom hook useEvidences for fetching evidence data. Updated useRequestsQuery to include new fields.
web/src/utils/fetchJsonIpfs.ts Introduced a utility function to fetch JSON data from IPFS.

Sequence Diagram(s)

sequenceDiagram
    participant Client as Client Application
    participant API as GraphQL API
    participant IPFS as IPFS Service
    
    Note over Client,API: Request creation or update flow
    Client->>API: Create/Update Request (POST)
    API->>API: Save `challengeTime` & `externalDisputeID`
    API-->>Client: Confirmation response
    
    Note over Client,IPFS: Fetching justification details
    Client->>API: Query for evidence with Justification
    API->>IPFS: Fetch JSON from URI
    IPFS-->>API: Return JSON data
    API-->>Client: Evidence data with Justification
Loading

Poem

In the realm of code so bright,
Schema fields take flight,
With challengeTime and disputes external,
Our data flows eternal.
UI and hooks now in harmony,
A symphony of digital alchemy.
Celebrate with rabbits' cheer,
New features, oh so dear!


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?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

netlify bot commented Jun 19, 2024

Deploy Preview for curate-v2 ready!

Name Link
🔨 Latest commit 9b02617
🔍 Latest deploy log https://app.netlify.com/sites/curate-v2/deploys/6674298182acd400083911f3
😎 Deploy Preview https://deploy-preview-42--curate-v2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Outside diff range and nitpick comments (2)
web/src/components/HistoryDisplay/Party/JustificationModal.tsx (1)

43-47: Consider using more descriptive names for the interface properties.

For better readability and maintainability, consider renaming isRemoval to isRemovalRequest to clearly indicate its purpose.

subgraph/schema.graphql (1)

Line range hint 166-178: Ensure consistency in documentation comments.

The documentation for externalDisputeID could be improved for clarity. Consider specifying what "requestID" refers to explicitly, and ensure that the description is clear and concise.

-  "External ID of the dispute, this is always there since it's just requestID. Please use disputed field to check if the dispute was created."
+  "External ID of the dispute, corresponding to the requestID. This field is always present. Use the 'disputed' field to check if a dispute has been initiated."
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 3ba2584 and 16e4324.

Files ignored due to path filters (2)
  • web/src/assets/svgs/icons/close-circle.svg is excluded by !**/*.svg
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
Files selected for processing (19)
  • subgraph/schema.graphql (2 hunks)
  • subgraph/src/Curate.ts (1 hunks)
  • subgraph/src/entities/Request.ts (2 hunks)
  • web/.env.devnet.public (1 hunks)
  • web/package.json (1 hunks)
  • web/src/components/HistoryDisplay/Party/Header.tsx (1 hunks)
  • web/src/components/HistoryDisplay/Party/JustificationDetails.tsx (1 hunks)
  • web/src/components/HistoryDisplay/Party/JustificationModal.tsx (1 hunks)
  • web/src/components/HistoryDisplay/Party/index.tsx (1 hunks)
  • web/src/components/HistoryDisplay/index.tsx (5 hunks)
  • web/src/components/InformationCards/ItemInformationCard/index.tsx (3 hunks)
  • web/src/components/InformationCards/RegistryInformationCard/TopInfo.tsx (2 hunks)
  • web/src/components/InformationCards/RegistryInformationCard/index.tsx (2 hunks)
  • web/src/components/StyledSkeleton.tsx (2 hunks)
  • web/src/consts/index.ts (1 hunks)
  • web/src/context/GraphqlBatcher.tsx (1 hunks)
  • web/src/hooks/queries/useEvidences.ts (1 hunks)
  • web/src/hooks/queries/useRequestsQuery.ts (3 hunks)
  • web/src/utils/fetchJsonIpfs.ts (1 hunks)
Files skipped from review due to trivial changes (4)
  • web/.env.devnet.public
  • web/package.json
  • web/src/components/HistoryDisplay/Party/Header.tsx
  • web/src/consts/index.ts
Additional context used
Biome
web/src/components/HistoryDisplay/index.tsx

[error] 87-87: Unnecessary use of boolean literals in conditional expression. (lint/complexity/noUselessTernary)

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

web/src/components/HistoryDisplay/Party/JustificationModal.tsx

[error] 113-115: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)

Unsafe fix: Omit the else clause.

subgraph/src/Curate.ts

[error] 2-2: Do not shadow the global "BigInt" property. (lint/suspicious/noShadowRestrictedNames)

Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global.

Additional comments not posted (26)
web/src/utils/fetchJsonIpfs.ts (2)

7-22: The error handling and response processing in fetchJsonIpfs function are well-implemented.


25-25: The export of fetchJsonIpfs as default is appropriate for utility modules like this.

web/src/hooks/queries/useEvidences.ts (2)

8-15: The GraphQL query in useEvidences is well-structured to fetch evidence based on group ID and order by timestamp.


17-32: The useEvidences hook is correctly implemented with conditional fetching and uses graphqlBatcher for optimized data fetching.

web/src/hooks/queries/useRequestsQuery.ts (2)

Line range hint 11-34: The GraphQL fragment RequestDetails is comprehensive and includes new fields like externalDisputeID and challengeTime, aligning with the PR's objectives.


11-11: The useItemRequests hook is correctly implemented, ensuring efficient and conditional data fetching.

Also applies to: 34-34

web/src/components/HistoryDisplay/Party/index.tsx (2)

36-49: The Party component is well-structured, taking relevant props and integrating the JustificationModal effectively.


9-29: The styled components in the Party component are appropriately defined, ensuring consistent theming and design.

web/src/components/HistoryDisplay/Party/JustificationDetails.tsx (2)

33-37: Define the Justification type correctly.


39-56: The JustificationDetails component is well-structured and uses React best practices.

subgraph/src/entities/Request.ts (1)

34-34: Ensure that externalDisputeID is utilized appropriately in the system.

Verification successful

The usage of externalDisputeID has been verified in relevant parts of the system. It is used in the Request.ts file, the JustificationModal.tsx component, and within the useRequestsQuery.ts hook.

  • subgraph/src/entities/Request.ts: request.externalDisputeID = event.params._requestID;
  • web/src/components/HistoryDisplay/Party/JustificationModal.tsx: useEvidences(request.externalDisputeID);
  • web/src/hooks/queries/useRequestsQuery.ts: externalDisputeID
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the usage of `externalDisputeID` across the system.

# Test: Search for usage of `externalDisputeID`. Expect: Proper usage in relevant parts of the system.
rg --type graphql $'externalDisputeID'

Length of output: 69



Script:

#!/bin/bash
# Description: Verify the usage of `externalDisputeID` across the system.

# Test: Search for usage of `externalDisputeID`. Expect: Proper usage in relevant parts of the system.
rg 'externalDisputeID' --type ts --type graphql

Length of output: 79



Script:

#!/bin/bash
# Description: Verify the usage of `externalDisputeID` across the system.

# Test: Search for usage of `externalDisputeID`. Expect: Proper usage in relevant parts of the system.
rg 'externalDisputeID' --type ts --type js

Length of output: 362

web/src/context/GraphqlBatcher.tsx (2)

18-18: Adding isCore as an optional parameter enhances the flexibility of GraphQL queries.


24-25: Ensure error handling is robust in the GraphQL fetcher function.

web/src/components/StyledSkeleton.tsx (2)

41-61: The new skeleton components for Justification details are well-designed to match the UI specifications.


78-84: The SkeletonJustificationCard component is correctly implemented to display loading states.

web/src/components/InformationCards/RegistryInformationCard/index.tsx (2)

35-40: Introduce a new styled component AliasContainer.

This addition provides a consistent styling for alias display across the application, improving user interface consistency.


89-94: Updated BottomInfo section to include AliasContainer.

The nested AliasContainer enhances the semantic structure and visual grouping of the Submitted by information. This change aligns with modern UI practices by making information more accessible and visually appealing.

web/src/components/InformationCards/ItemInformationCard/index.tsx (2)

80-85: Introduce a new styled component AliasContainer.

This addition is consistent with similar changes in other components, promoting uniformity in the design of various card components across the application.


120-127: Updated BottomInfo section to include AliasContainer.

The use of AliasContainer here mirrors the update in RegistryInformationCard, ensuring that the UI remains consistent across different types of information cards. This is crucial for maintaining a coherent user experience.

web/src/components/HistoryDisplay/index.tsx (5)

3-3: Import additional styled-components utilities.

The inclusion of css and Theme from styled-components is necessary for the dynamic styling used in this file, particularly for responsive layouts.


11-12: Introduce import for new Party component and landscapeStyle.

These imports are essential for the new functionality related to displaying party information and adjusting styles based on the landscape orientation.


27-34: Add new CSS class .party-wrapper with responsive styling.

This addition enhances the UI by making the party information responsive, aligning with modern web design practices.


63-63: Add optional isItem parameter to constructItemsFromRequest function.

This parameter allows the function to handle item-specific logic, increasing its versatility and aligning with the expanded functionality of the application.


78-81: Enhanced timeline items with party details.

Integrating the Party component into the timeline items allows for a more detailed and interactive history display, significantly improving user engagement and information accessibility.

Also applies to: 104-104, 109-111

web/src/components/InformationCards/RegistryInformationCard/TopInfo.tsx (2)

14-14: Import shortenAddress utility.

This utility is crucial for displaying user-friendly, shortened addresses, enhancing readability and user experience.


140-141: Use shortenAddress to display registry addresses.

Applying shortenAddress in the Copiable component improves the display of potentially long blockchain addresses, making them more manageable and user-friendly.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 16e4324 and 3942a7d.

Files selected for processing (1)
  • web/src/components/HistoryDisplay/Party/index.tsx (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • web/src/components/HistoryDisplay/Party/index.tsx

@jaybuidl
Copy link
Member

image

  1. Let's make sure that the copied address and the display address is the same

  2. Let's make the address label a link going to the explorer + remove the explorer icon

@jaybuidl jaybuidl self-requested a review June 19, 2024 11:51
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 3942a7d and e6b162d.

Files selected for processing (3)
  • web/src/components/HistoryDisplay/Party/JustificationDetails.tsx (1 hunks)
  • web/src/components/InformationCards/RegistryInformationCard/TopInfo.tsx (3 hunks)
  • web/src/styles/customScrollbar.ts (1 hunks)
Files skipped from review due to trivial changes (1)
  • web/src/styles/customScrollbar.ts
Files skipped from review as they are similar to previous changes (2)
  • web/src/components/HistoryDisplay/Party/JustificationDetails.tsx
  • web/src/components/InformationCards/RegistryInformationCard/TopInfo.tsx

Copy link
Contributor

@kemuru kemuru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just 2 tiny things:

  1. remove the space between by and :
image
  1. put text-decoration: underline when you hover this address and color that underline as primaryBlue
image

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e6b162d and d24382e.

Files selected for processing (3)
  • web/src/components/InformationCards/ItemInformationCard/index.tsx (2 hunks)
  • web/src/components/InformationCards/RegistryInformationCard/TopInfo.tsx (4 hunks)
  • web/src/components/InformationCards/RegistryInformationCard/index.tsx (2 hunks)
Files skipped from review as they are similar to previous changes (3)
  • web/src/components/InformationCards/ItemInformationCard/index.tsx
  • web/src/components/InformationCards/RegistryInformationCard/TopInfo.tsx
  • web/src/components/InformationCards/RegistryInformationCard/index.tsx

@kemuru kemuru self-requested a review June 20, 2024 09:42
Copy link
Contributor

@kemuru kemuru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@jaybuidl jaybuidl merged commit 18eca3a into master Jun 20, 2024
6 checks passed
@jaybuidl jaybuidl deleted the feat/removal-challenge-justification-display branch June 20, 2024 16:22
@coderabbitai coderabbitai bot mentioned this pull request Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants