refactor(auth): open nostr-login directly

This commit is contained in:
enes 2024-10-07 15:36:29 +02:00
parent 67d545de2f
commit 532cdaed8e
3 changed files with 7 additions and 32 deletions

View File

@ -28,6 +28,8 @@ import { faClose } from '@fortawesome/free-solid-svg-icons'
import useMediaQuery from '@mui/material/useMediaQuery' import useMediaQuery from '@mui/material/useMediaQuery'
import { useLogout } from '../../hooks/useLogout' import { useLogout } from '../../hooks/useLogout'
import { launch as launchNostrLoginDialog } from 'nostr-login'
export const AppBar = () => { export const AppBar = () => {
const navigate = useNavigate() const navigate = useNavigate()
const logout = useLogout() const logout = useLogout()
@ -128,7 +130,7 @@ export const AppBar = () => {
<Button <Button
startIcon={<ButtonIcon />} startIcon={<ButtonIcon />}
onClick={() => { onClick={() => {
navigate(appPublicRoutes.nostr) launchNostrLoginDialog('welcome')
}} }}
variant="contained" variant="contained"
> >

View File

@ -1,7 +1,6 @@
import { Box, Button } from '@mui/material' import { Box, Button } from '@mui/material'
import { useEffect } from 'react' import { useEffect } from 'react'
import { Outlet, useLocation, useNavigate } from 'react-router-dom' import { Outlet, useLocation } from 'react-router-dom'
import { appPublicRoutes } from '../../routes'
import { saveVisitedLink } from '../../utils' import { saveVisitedLink } from '../../utils'
import { CardComponent } from '../../components/Landing/CardComponent/CardComponent' import { CardComponent } from '../../components/Landing/CardComponent/CardComponent'
import { Container } from '../../components/Container' import { Container } from '../../components/Container'
@ -20,13 +19,13 @@ import {
} from '@fortawesome/free-solid-svg-icons' } from '@fortawesome/free-solid-svg-icons'
import { FontAwesomeIconStack } from '../../components/FontAwesomeIconStack' import { FontAwesomeIconStack } from '../../components/FontAwesomeIconStack'
import { Footer } from '../../components/Footer/Footer' import { Footer } from '../../components/Footer/Footer'
import { launch as launchNostrLoginDialog } from 'nostr-login'
export const LandingPage = () => { export const LandingPage = () => {
const navigate = useNavigate()
const location = useLocation() const location = useLocation()
const onSignInClick = async () => { const onSignInClick = async () => {
navigate(appPublicRoutes.nostr) launchNostrLoginDialog('welcome')
} }
const cards = [ const cards = [

View File

@ -1,11 +1,7 @@
import { Modal } from '../layouts/modal'
import { CreatePage } from '../pages/create' import { CreatePage } from '../pages/create'
import { HomePage } from '../pages/home' import { HomePage } from '../pages/home'
import { LandingPage } from '../pages/landing' import { LandingPage } from '../pages/landing'
import { Login } from '../pages/login'
import { Nostr } from '../pages/nostr'
import { ProfilePage } from '../pages/profile' import { ProfilePage } from '../pages/profile'
import { Register } from '../pages/register'
import { SettingsPage } from '../pages/settings/Settings' import { SettingsPage } from '../pages/settings/Settings'
import { CacheSettingsPage } from '../pages/settings/cache' import { CacheSettingsPage } from '../pages/settings/cache'
import { NostrLoginPage } from '../pages/settings/nostrLogin' import { NostrLoginPage } from '../pages/settings/nostrLogin'
@ -87,29 +83,7 @@ export const publicRoutes: PublicRouteProps[] = [
{ {
path: appPublicRoutes.landingPage, path: appPublicRoutes.landingPage,
hiddenWhenLoggedIn: true, hiddenWhenLoggedIn: true,
element: <LandingPage />, element: <LandingPage />
children: [
{
element: <Modal />,
children: [
{
path: appPublicRoutes.login,
hiddenWhenLoggedIn: true,
element: <Login />
},
{
path: appPublicRoutes.register,
hiddenWhenLoggedIn: true,
element: <Register />
},
{
path: appPublicRoutes.nostr,
hiddenWhenLoggedIn: true,
element: <Nostr />
}
]
}
]
}, },
{ {
path: appPublicRoutes.profile, path: appPublicRoutes.profile,