kleros-v2
kleros-v2 copied to clipboard
Atlas integration
- 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
viempackage from version2.1.0to2.17.3. - Removed dependency on
supabase.
- Updated
-
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.
[!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
AtlasProvidercontext, 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
uploadFilemethod to theAtlasProvider, 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_URIvariable. - #1711: This PR renames the
_arbitrableDisputeIDto_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
@coderabbitaiin 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
@coderabbitaiin 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 pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaior@coderabbitai titleanywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile 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.
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 |
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...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
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...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
LGTM so far. Ping again when it is out of draft
It looks great. Let's hold on merging as it would break Neo right now, Neo needs to point to the master branch instead.
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...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
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
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.
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: @.***>
Hi! ty, should i clone the comment there?
Hey Marcos, yes you can comment there.
Would you be interested in addressing this issue? 👀