Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lensauth #215

Closed
wants to merge 9 commits into from
Closed

Lensauth #215

wants to merge 9 commits into from

Conversation

XxSNiPxX
Copy link

Added Lens Protocol Login and Register for their Test net.

Added Protected routes for the dashboard.

Error Code ERESOLVE: There's a dependency conflict between [email protected] and the installed [email protected]. react-scripts requires a TypeScript version compatible with ^3.2.1 || ^4, but [email protected] exceeds this range.

Solutions include downgrading TypeScript, using --legacy-peer-deps or --force during installation, or updating dependencies for compatibility.

@XxSNiPxX XxSNiPxX changed the base branch from v1.0.0 to v2.0.0 July 27, 2024 14:30
@XxSNiPxX XxSNiPxX self-assigned this Jul 27, 2024
@XxSNiPxX XxSNiPxX requested review from Jadapema and geolffreym July 27, 2024 14:30
@geolffreym
Copy link
Member

geolffreym commented Jul 28, 2024

@Jadapema @XxSNiPxX this issue (error Code ERESOLVE) is related to create-react-app? Can we improve the development stack migrating to vite?
#216

@XxSNiPxX
Copy link
Author

@Jadapema @XxSNiPxX this issue (error Code ERESOLVE) is related to create-react-app? Can we improve the development stack migrating to vite? #216

It is yeah, but it works and should not matter. Just force install the libraries. The dependency issue is with some web3 libraries that are not currently used.

@WatchItDev WatchItDev deleted a comment from Jadapema Jul 28, 2024
Copy link
Member

@geolffreym geolffreym left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM after check the comments..

src/App.tsx Outdated
@@ -52,13 +64,21 @@ export default function App() {

`;

const queryClient = new QueryClient();
const wagmiConfig = createConfig({ chains: [polygonAmoy], connectors: [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be worth adding an environment variable to determine which chain to use?
e.g., process.env.NODE_ENV === 'development' ? polygonAmoy : ...

metaMask(),
safe(),
], transports: { [polygonAmoy.id]: http(), },});
const lensConfig: LensConfig = { environment: development, bindings: bindings(wagmiConfig),};

console.info(`%c${charAt}`, 'color: #4A34B8');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can eventually use a Babel utility like 'transform-remove-console' to remove logs and keep them for debugging purposes. In the meantime, can we try to keep the logs with only useful information?

src/App.tsx Outdated
@@ -69,15 +89,29 @@ export default function App() {
themeStretch: false,
}}
>
<WagmiProvider config={wagmiConfig}>
<QueryClientProvider client={queryClient}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool addition :).

handle: username, to: wallet,});
console.log(result)
if (!isRelaySuccess(result)) { console.error(`Something went wrong`, result); }
window.location.reload();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just wondering if we should have a component to display the issue here?

@@ -33,3 +33,4 @@ export const MAPBOX_API = process.env.REACT_APP_MAPBOX_API;

// ROOT PATH AFTER LOGIN SUCCESSFUL
export const PATH_AFTER_LOGIN = paths.dashboard.root; // as '/dashboard'
export const PATH_BEFORE_LOGIN = '/login'; // as '/dashboard'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

paths is a hub for paths? it worth to keep all the routes in there?

Copy link
Member

@Jadapema Jadapema left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @XxSNiPxX,

Thank you for the Lens Auth integration you've done. I’ve left some comments in the code with a few ideas and suggestions to improve the implementation.

One suggestion is regarding the login routes. What do you think about allowing users to log in from any part of the app, without blocking them from viewing catalogs and movie information? Instead, we could prompt them to log in only when they try to interact with certain functionalities. I left a comment in the context about this, as it would require us to eliminate the login routes and handle everything in the context. We could then create a new task to integrate a login modal.

Additionally, it would be great to address some ESLint warnings that are appearing, which I believe are caused by unused imports.

Thanks again for your hard work. I'm excited to move forward with these tweaks and improvements.

import React, { createContext, useContext, useState, useCallback, useEffect, useMemo } from 'react';
import { useNavigate } from 'react-router-dom';
import { SessionType, useSession } from '@lens-protocol/react-web';

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering if we could handle everything related to login, logout, etc., through the sessionContext you expose here. This approach might allow users to explore the application and prompt them to log in only when they try to interact with certain functionalities, possibly through a modal.

I'm planning to take care of the design tasks related to the login dynamics to help us move forward on this issue and have better clarity on how it should work. What do you think?

src/App.tsx Outdated
@@ -39,6 +39,18 @@ import MotionLazy from 'src/components/animate/motion-lazy';
import SnackbarProvider from 'src/components/snackbar/snackbar-provider';
import { SettingsProvider, SettingsDrawer } from 'src/components/settings';


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking that we could group imports by context to improve code clarity. For example, we could separate imports from external libraries from local ones.

@@ -0,0 +1 @@
legacy-peer-deps=true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a .npmrc file so that it can be installed normally with npm i. However, this is just a temporary fix. Eventually, we should find a more permanent solution to resolve the dependency conflict.

Copy link

@Jadapema Jadapema closed this Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants