kleros / kleros-v2

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

Atlas integration for authentication, user settings, email confirmation, uploads #1654

Closed Harman-singh-waraich closed 2 weeks ago

Harman-singh-waraich commented 3 months ago

Related to https://github.com/kleros/atlas/pull/57


PR-Codex overview

This PR primarily focuses on refactoring and restructuring the authentication and user management functionalities, with significant changes to various utility functions, environment variables, and component implementations for email confirmation and user settings.

Detailed summary

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

Summary by CodeRabbit

Summary by CodeRabbit

coderabbitai[bot] commented 3 months ago

[!CAUTION]

Review failed

The pull request is closed.

Walkthrough

The recent updates introduce a comprehensive user authentication management system through the implementation of the AtlasProvider, which facilitates interactions with an Atlas API. A new EmailConfirmation component has been added to handle the email verification process. Additionally, utility functions for confirming emails and fetching user data have been introduced, enhancing state management and streamlining user interactions. Several files related to IPFS uploads and authentication middleware have been removed, reflecting a shift in the project's architecture.

Changes

File Change Summary
web/src/context/AtlasProvider.tsx Implemented AtlasProvider for user authentication and session management. Added IAtlasProvider interface and useAtlasProvider hook.
web/src/pages/Settings/EmailConfirmation/index.tsx Added EmailConfirmation component for handling email verification using query parameters.
web/src/utils/atlas/confirmEmail.ts Introduced confirmEmail function with GraphQL mutation for email confirmation. Added types ConfirmEmailData and ConfirmEmailResponse.
web/src/utils/atlas/fetchUser.ts Added fetchUser function to retrieve user data via GraphQL, including types GetUserResponse and User.
web/src/utils/atlas/index.ts Updated to re-export uploadToIpfs along with other user management functionalities.
web/src/utils/atlas/uploadToIpfs.ts Introduced functionality for uploading files to IPFS, including enumerations and structured payload types.
web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/EmailVerificationInfo.tsx Added EmailVerificationInfo component to display email verification status and resend verification email. Introduced IEmailInfo interface.
web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx Modified FormContactDetails component to use useAtlasProvider for user settings management, simplifying logic and integrating email update functionality.
web/package.json Updated project version to 0.2.0, removed generate:supabase script, and updated dependencies.
web/.env.* Added REACT_APP_ATLAS_URI environment variable to multiple .env files.
web/netlify/functions/uploadToIPFS.ts, web/netlify/middleware/authMiddleware.ts Deleted files related to IPFS upload functionality and authentication middleware.

Possibly related PRs

Suggested labels

Package: Backend Storage

Suggested reviewers

Poem

In the realm of code, a rabbit hops,
With emails confirmed and no more flops.
Tokens dance and sessions thrive,
In the Atlas, we come alive!
New hooks and states, a joyful cheer,
For every user, we hold dear. πŸ‡βœ¨


πŸͺ§ 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://coderabbit.ai/docs) 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 3 months ago

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

Name Link
Latest commit e72bd47116842c144ee0950bcdebdc867582c423
Latest deploy log https://app.netlify.com/sites/kleros-v2-university/deploys/670ffb9c46f8b900089d1d3d
netlify[bot] commented 3 months ago

Deploy Preview for kleros-v2-neo ready!

Name Link
Latest commit e72bd47116842c144ee0950bcdebdc867582c423
Latest deploy log https://app.netlify.com/sites/kleros-v2-neo/deploys/670ffb9c2539af0008e607c2
Deploy Preview https://deploy-preview-1654--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 3 months ago

Deploy Preview for kleros-v2-testnet ready!

Name Link
Latest commit e72bd47116842c144ee0950bcdebdc867582c423
Latest deploy log https://app.netlify.com/sites/kleros-v2-testnet/deploys/670ffb9c4ebc9c00086506f2
Deploy Preview https://deploy-preview-1654--kleros-v2-testnet.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.

fcanela commented 3 months ago

LGTM so far. Ping again when it is out of draft

jaybuidl commented 1 month ago

It looks great. Let's hold on merging as it would break Neo right now, Neo needs to point to the master branch instead.

netlify[bot] commented 2 weeks ago

Deploy Preview for kleros-v2-testnet-devtools ready!

Name Link
Latest commit e72bd47116842c144ee0950bcdebdc867582c423
Latest deploy log https://app.netlify.com/sites/kleros-v2-testnet-devtools/deploys/670ffb9cc34939000862a448
Deploy Preview https://deploy-preview-1654--kleros-v2-testnet-devtools.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.

sonarcloud[bot] commented 2 weeks ago

Quality Gate Passed Quality Gate passed

Issues
8 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

codeclimate[bot] commented 2 weeks ago

Code Climate has analyzed commit e72bd471 and detected 28 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 3
Duplication 6
Style 19

View more on Code Climate.

MAMware commented 2 weeks ago

Hi! ty, should i clone the comment there?

-------- Mensaje original -------- De: TurbanCoder @.> Fecha: 21/10/2024 11:34 (GMT-03:00) A: kleros/kleros-v2 @.> CC: Marcos Meneses @.>, Comment @.> Asunto: Re: [kleros/kleros-v2] Atlas integration for authentication, user settings, email confirmation, uploads (PR #1654)

@Harman-singh-waraich commented on this pull request.


In web/src/context/AtlasProvider.tsxhttps://github.com/kleros/kleros-v2/pull/1654#discussion_r1808947246:

  • const intervalId = setInterval(() => {
  • setIsVerified(verifySession());
  • }, 5000);
  • return () => {
  • clearInterval(intervalId);
  • };

Hello, Thanks for taking time to suggest the strategy. Much appreciated. We will be tackling this optimization in issue #1717https://github.com/kleros/kleros-v2/issues/1717 . You are welcome to review the applied strategy.

Thanks for the feedback 😊

β€” Reply to this email directly, view it on GitHubhttps://github.com/kleros/kleros-v2/pull/1654#discussion_r1808947246, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AQOWOZEZPLRF3BQ53U3CQCTZ4UGF7AVCNFSM6AAAAABLCLH5PSVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDGOBSGMYTMNJYGE. You are receiving this because you commented.Message ID: @.***>

Harman-singh-waraich commented 2 weeks ago

Hi! ty, should i clone the comment there?

Hey Marcos, yes you can comment there.

Would you be interested in addressing this issue? πŸ‘€