kleros / kleros-v2

Kleros version 2
https://v2.kleros.builders
MIT License
62 stars 44 forks source link

Feat/kleros dapp #1755

Closed Harman-singh-waraich closed 4 days ago

Harman-singh-waraich commented 5 days ago

PR-Codex overview

This PR focuses on restructuring the kleros-app codebase by removing several utility files, updating dependencies, and enhancing the AtlasProvider. It also introduces new functionalities for user management and email handling while improving the overall application structure.

Detailed summary

The following files were skipped due to too many changes: yarn.lock

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

Summary by CodeRabbit

coderabbitai[bot] commented 5 days ago

Walkthrough

The pull request introduces significant changes across multiple files in the Kleros application. Key modifications include updates to the .gitignore file to exclude additional build artifacts and cache files, the creation of a new ESLint configuration, and the addition of a package.json file for the kleros-app package. Several React components and utility functions are introduced, including user authentication features and hooks for session storage. Additionally, existing files are updated for improved user feedback mechanisms during operations such as email updates and file uploads.

Changes

File Path Change Summary
.gitignore Added entries for .parcel-cache, Yarn v2 cache, Serverless Webpack, .stylelintcache, .svelte-kit, and .history.
kleros-app/eslint.config.mjs Created a new ESLint configuration with various plugins and rules for JavaScript/TypeScript projects.
kleros-app/package.json Introduced a new package.json file specifying metadata, scripts, and dependencies for the @kleros/kleros-app package.
kleros-app/src/App.tsx Added a new App component as the entry point for the React application.
kleros-app/src/index.html Created a new HTML file for the Kleros application with basic structure and a script tag for the main module.
kleros-app/src/lib/atlas/hooks/useSessionStorage.ts Introduced a custom hook for managing session storage state.
kleros-app/src/lib/atlas/index.ts Exported all entities from the providers and utils modules.
kleros-app/src/lib/atlas/providers/AtlasProvider.tsx Added a context provider for user authentication and interactions with an Atlas service.
kleros-app/src/lib/atlas/utils/addUser.ts Created a GraphQL mutation for adding a user with error handling.
kleros-app/src/lib/atlas/utils/createMessage.ts Updated the createMessage function to include an optional statement parameter.
kleros-app/src/lib/atlas/utils/fetchUser.ts Introduced functionality to fetch user data from a GraphQL API.
kleros-app/src/lib/atlas/utils/getNonce.ts Added a function to fetch a nonce value associated with an Ethereum address.
kleros-app/src/lib/atlas/utils/index.ts Added new enums for Products and Roles, and re-exported utility functions.
kleros-app/src/lib/atlas/utils/loginUser.ts Created a GraphQL mutation for user login functionality.
kleros-app/src/lib/atlas/utils/updateEmail.ts Introduced a GraphQL mutation for updating a user's email address.
kleros-app/src/lib/atlas/utils/uploadToIpfs.ts Added functionality for uploading files to IPFS with error handling.
web/src/components/EnsureAuth.tsx Enhanced the EnsureAuth component with toast notifications for user sign-in actions.
web/src/context/AtlasProvider.tsx Simplified the AtlasProvider component by utilizing the _AtlasProvider from @kleros/kleros-app.
web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/EmailVerificationInfo.tsx Updated to include toast notifications for email update processes.
web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx Enhanced with toast notifications for email updates and user additions.
web/src/pages/Cases/CaseDetails/Evidence/SubmitEvidenceModal.tsx Improved error handling and user feedback during file uploads.
web/src/pages/Resolver/Policy/index.tsx Updated file upload handling with enhanced error notifications.
web/src/pages/Settings/EmailConfirmation/index.tsx Updated import paths and improved styled component formatting.
web/src/utils/index.ts Added a utility function isUndefined for type safety.
kleros-app/tsconfig.json Introduced a TypeScript configuration file for the Kleros application.
package.json Updated workspace structure and added new development dependencies.
prettier-config/package.json Upgraded the prettier dependency version.
web/package.json Added a dependency on the @kleros/kleros-app package.
web/src/utils/atlas/*.ts Removed various utility files related to user management and GraphQL operations.

Possibly related PRs

Suggested labels

Type: FeatureπŸ—Ώ, Package: Web

Suggested reviewers

Poem

πŸ‡ In the land of code where rabbits play,
New features hop in, brightening the day.
With hooks and toasts, our app's a delight,
Ignoring the clutter, our future is bright!
So let's raise a cheer for this code we adore,
With every new change, we leap and explore! 🌟


πŸͺ§ Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit , please review it.` - `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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.` - `@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 using 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. ### Other keywords and placeholders - Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. - Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description. - Add `@coderabbitai` or `@coderabbitai title` anywhere in the PR title to generate the title automatically. ### CodeRabbit Configuration 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](https://docs.coderabbit.ai/guides/configure-coderabbit) 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](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit. - Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.
netlify[bot] commented 5 days ago

Deploy Preview for kleros-v2-testnet-devtools failed. Why did it fail? β†’

Name Link
Latest commit 34f25c79db4844b3c2cd8c3af50b9026257dfd79
Latest deploy log https://app.netlify.com/sites/kleros-v2-testnet-devtools/deploys/673db29045b129000822d710
netlify[bot] commented 5 days ago

Deploy Preview for kleros-v2-testnet failed. Why did it fail? β†’

Name Link
Latest commit
Latest deploy log https://app.netlify.com/sites/kleros-v2-testnet/deploys/673ed047a111e907ea9a22f4
netlify[bot] commented 5 days ago

Deploy Preview for kleros-v2-university failed. Why did it fail? β†’

Name Link
Latest commit 34f25c79db4844b3c2cd8c3af50b9026257dfd79
Latest deploy log https://app.netlify.com/sites/kleros-v2-university/deploys/673db29076843e0008103d01
codeclimate[bot] commented 5 days ago

Code Climate has analyzed commit 34f25c79 and detected 30 issues on this pull request.

Here's the issue category breakdown:

Category Count
Duplication 6
Style 24

View more on Code Climate.

netlify[bot] commented 5 days ago

Deploy Preview for kleros-v2-neo failed. Why did it fail? β†’

Name Link
Latest commit 34f25c79db4844b3c2cd8c3af50b9026257dfd79
Latest deploy log https://app.netlify.com/sites/kleros-v2-neo/deploys/673db29018bc32000890ab09
sonarcloud[bot] commented 5 days ago

Quality Gate Failed Quality Gate failed

Failed conditions
11.1% Duplication on New Code (required ≀ 10%)

See analysis details on SonarQube Cloud

Harman-singh-waraich commented 4 days ago

Closing as too many conflicts in yarn.lock making it dirty. Migrated changes to #1756 on latest dev branch