kleros / kleros-v2

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

Feat/kleros app #1756

Open Harman-singh-waraich opened 4 days ago

Harman-singh-waraich commented 4 days ago

PR-Codex overview

This PR focuses on restructuring the kleros-app library by consolidating utility functions, enhancing type safety, and improving error handling. It also updates various dependencies and refines components for better user experience.

Detailed summary

The following files were skipped due to too many changes: web/src/context/AtlasProvider.tsx, yarn.lock

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

Summary by CodeRabbit

Release Notes

coderabbitai[bot] commented 4 days ago

Walkthrough

This pull request introduces several significant changes to the kleros-app project, including the addition of a README.md file for documentation, a new ESLint configuration file, and a package.json file for dependency management. It also includes the creation of various components and utility functions, such as a custom hook for session storage and several GraphQL operations for user management. Additionally, there are updates to existing components and the removal of obsolete files, enhancing the overall structure and organization of the codebase.

Changes

File Path Change Summary
kleros-app/README.md New documentation file created for the kleros-app project.
kleros-app/eslint.config.mjs New ESLint configuration file added to enforce coding standards.
kleros-app/package.json New package.json file created for the @kleros/kleros-app package.
kleros-app/src/App.tsx New App component created as the entry point of the application.
kleros-app/src/index.html New HTML file created as the main entry point for the application.
kleros-app/src/lib/atlas/hooks/useSessionStorage.ts New custom hook for managing session storage state.
kleros-app/src/lib/atlas/index.ts Exported all entities from ./providers and ./utils modules.
kleros-app/src/lib/atlas/providers/AtlasProvider.tsx New context provider for user authentication and interactions with Atlas service.
kleros-app/src/lib/atlas/providers/index.ts Exported all entities from AtlasProvider.
kleros-app/src/lib/atlas/utils/addUser.ts New utility function for adding a user via GraphQL mutation.
kleros-app/src/lib/atlas/utils/createMessage.ts Updated createMessage function to include an optional statement parameter.
kleros-app/src/lib/atlas/utils/fetchUser.ts New utility function for fetching user data from a GraphQL API.
kleros-app/src/lib/atlas/utils/getNonce.ts New utility function for fetching a nonce associated with an address using GraphQL.
kleros-app/src/lib/atlas/utils/index.ts Introduced Products and Roles enums and re-exported various utility functions.
kleros-app/src/lib/atlas/utils/loginUser.ts New utility function for user login via GraphQL mutation.
kleros-app/src/lib/atlas/utils/updateEmail.ts New utility function for updating a user's email address via GraphQL mutation.
kleros-app/src/lib/atlas/utils/uploadToIpfs.ts New utility function for uploading files to IPFS.
kleros-app/src/lib/index.ts Exported all members from the module.
kleros-app/src/utils/index.ts New utility function isUndefined added.
kleros-app/tsconfig.json New TypeScript configuration file added.
package.json Added new workspace for kleros-app.
prettier-config/package.json Updated prettier dependency version.
web/.eslintrc.json Deleted ESLint configuration file.
web/eslint.config.mjs New ESLint configuration file added.
web/package.json Updated dependencies and added new packages.
web/src/components/EnsureAuth.tsx Updated to use new toast notifications and changed import source.
web/src/context/AtlasProvider.tsx Simplified by removing custom context management and using _AtlasProvider from @kleros/kleros-app.
web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/EmailVerificationInfo.tsx Updated import paths and added toast notifications for email updates.
web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx Updated import paths and added toast notifications for user addition and email updates.
web/src/pages/Cases/CaseDetails/Evidence/SubmitEvidenceModal.tsx Enhanced error handling and updated import paths.
web/src/pages/Resolver/Policy/index.tsx Updated import paths and improved toast notifications for file uploads.
web/src/pages/Settings/EmailConfirmation/index.tsx Updated import path and formatted styled components.
web/src/utils/atlas/addUser.ts Deleted file containing user addition functionality.
web/src/utils/atlas/fetchUser.ts Deleted file containing user fetching functionality.
web/src/utils/atlas/getNonce.ts Deleted file containing nonce fetching functionality.
web/src/utils/atlas/index.ts Deleted aggregator file for utility functions.
web/src/utils/atlas/loginUser.ts Deleted file containing user login functionality.
web/src/utils/atlas/updateEmail.ts Deleted file containing email update functionality.
web/src/utils/atlas/uploadToIpfs.ts Deleted file containing IPFS upload functionality.
web/src/utils/uploadFormDataToIPFS.ts Deleted file for uploading FormData to IPFS.
web/src/utils/wrapWithToast.ts Added new toast utility functions for user feedback.
kleros-app/vite.config.js New Vite configuration file added for the kleros-app library.
web/netlify.toml Updated Netlify build command for workspace installations.

Possibly related PRs

Suggested reviewers

🐇 In the garden, changes bloom bright,
A README to guide, shining light.
New hooks and functions, all in a row,
With toasts for the users, watch them glow!
Kleros-app grows, a leap and a bound,
In this code wonderland, joy is found! 🌼


🪧 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 4 days ago

Deploy Preview for kleros-v2-neo ready!

Name Link
Latest commit 86a88bcfe4af595d07e48b131bb06c7b2f2b91e9
Latest deploy log https://app.netlify.com/sites/kleros-v2-neo/deploys/6744acee4bb1d20008aac960
Deploy Preview https://deploy-preview-1756--kleros-v2-neo.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.

netlify[bot] commented 4 days ago

Deploy Preview for kleros-v2-testnet failed. Why did it fail? →

Name Link
Latest commit 86a88bcfe4af595d07e48b131bb06c7b2f2b91e9
Latest deploy log https://app.netlify.com/sites/kleros-v2-testnet/deploys/6744aceee7f74e0008402c2d
netlify[bot] commented 4 days ago

Deploy Preview for kleros-v2-university ready!

Name Link
Latest commit 86a88bcfe4af595d07e48b131bb06c7b2f2b91e9
Latest deploy log https://app.netlify.com/sites/kleros-v2-university/deploys/6744aceec58f770008fc0909
Deploy Preview https://deploy-preview-1756--kleros-v2-university.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.

netlify[bot] commented 4 days ago

Deploy Preview for kleros-v2-testnet-devtools failed. Why did it fail? →

Name Link
Latest commit 86a88bcfe4af595d07e48b131bb06c7b2f2b91e9
Latest deploy log https://app.netlify.com/sites/kleros-v2-testnet-devtools/deploys/6744aceed17d8800083b9958
codeclimate[bot] commented 5 hours ago

Code Climate has analyzed commit 86a88bcf 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.

sonarcloud[bot] commented 5 hours ago

Quality Gate Failed Quality Gate failed

Failed conditions
20.9% Duplication on New Code (required ≤ 10%)

See analysis details on SonarQube Cloud