kleros-v2 icon indicating copy to clipboard operation
kleros-v2 copied to clipboard

Atlas integration

Open tractorss opened this issue 1 year ago • 8 comments

  • inital effort to support siwe from atlas

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


PR-Codex overview

This PR focuses on restructuring API calls and updating environment variables.

Detailed summary

  • Restructured API calls for user management
  • Updated environment variables for different environments
  • Modified local storage to session storage for user settings
  • Updated regular expressions for email validation

The following files were skipped due to too many changes: web/src/utils/atlas/updateUser.ts, web/src/utils/atlas/loginUser.ts, web/src/components/EnsureAuth.tsx, web/src/app.tsx, web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/index.tsx, web/src/context/AtlasProvider.tsx, yarn.lock

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

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Improved authentication handling for more reliable user authentication.
    • Introduced a new context provider for enhanced user authorization management.
    • Added support for a local GraphQL endpoint for development and testing.
  • Bug Fixes

    • Enhanced token retrieval for better consistency during the upload process.
  • Dependencies

    • Updated viem package from version 2.1.0 to 2.17.3.
    • Removed dependency on supabase.
  • Refactor

    • Simplified authentication component structure and logic for better maintainability.
    • Updated multiple components to utilize the new context provider for user management.
    • Refined validation logic in form components for improved user input handling.
    • Adjusted authentication token key format for consistency in session storage.

tractorss avatar Jul 18 '24 10:07 tractorss

[!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

  • #1654: This PR introduces the AtlasProvider context, which is directly related to user authentication and email confirmation, similar to the main PR's focus on user session management and email confirmation processes.
  • #1687: This PR adds the uploadFile method to the AtlasProvider, which is relevant to the main PR's changes involving file uploads to IPFS and user-related functionalities.
  • #1708: This PR updates environment variables related to the Atlas integration, which aligns with the main PR's modifications to the REACT_APP_ATLAS_URI variable.
  • #1711: This PR renames the _arbitrableDisputeID to _arbitratorDisputeID, which is relevant to the context of dispute management and user interactions, connecting to the user-related functionalities in the main PR.

Suggested labels

Package: Backend Storage

Suggested reviewers

  • alcercu
  • kemuru

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:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, 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 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.

coderabbitai[bot] avatar Jul 18 '24 10:07 coderabbitai[bot]

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] avatar Jul 18 '24 10:07 netlify[bot]

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] avatar Jul 18 '24 10:07 netlify[bot]

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.

netlify[bot] avatar Jul 18 '24 10:07 netlify[bot]

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

fcanela avatar Jul 26 '24 12:07 fcanela

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

jaybuidl avatar Sep 06 '24 14:09 jaybuidl

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.

netlify[bot] avatar Oct 16 '24 12:10 netlify[bot]

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.

qlty-cloud-legacy[bot] avatar Oct 16 '24 17:10 qlty-cloud-legacy[bot]

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: @.***>

MAMware avatar Oct 21 '24 15:10 MAMware

Hi! ty, should i clone the comment there?

Hey Marcos, yes you can comment there.

Would you be interested in addressing this issue? 👀

tractorss avatar Oct 22 '24 05:10 tractorss