Fix new button,
also redirects if user is not signed in
This commit is contained in:
@@ -72,9 +72,12 @@ const MainLayout = ({ children}) => {
|
||||
</ul>
|
||||
<ul className="flex items-center">
|
||||
<li className={getActiveClasses("mr-8 h-10 w-10 rounded-full border-2 border-gray-700 flex items-center justify-center", {'border-indigo-300': currentUser})}>
|
||||
<button className="h-full w-full" onClick={() => currentUser && routes.newPart2({userName: data?.user?.userName})}>
|
||||
<Svg name="plus" className={getActiveClasses("text-gray-700 w-full h-full",{'text-indigo-300': currentUser})} />
|
||||
</button>
|
||||
{isAuthenticated && data?.user?.userName ?
|
||||
<Link className="h-full w-full" to={routes.newPart2({userName: data?.user?.userName})}>
|
||||
<Svg name="plus" className="text-indigo-300 w-full h-full" />
|
||||
</Link>:
|
||||
<Svg name="plus" className="text-gray-700 w-full h-full" />
|
||||
}
|
||||
</li>
|
||||
<li className="h-10 w-10 border-1 rounded-full border-indigo-300 text-indigo-200">
|
||||
<div aria-describedby={popoverId} onMouseOver={togglePopover}>
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
import { useEffect } from 'react'
|
||||
import { useAuth } from '@redwoodjs/auth'
|
||||
import { navigate, routes } from '@redwoodjs/router'
|
||||
|
||||
import MainLayout from 'src/layouts/MainLayout'
|
||||
import Part2Cell from 'src/components/Part2Cell'
|
||||
|
||||
|
||||
const NewPart2Page = ({userName}) => {
|
||||
const { currentUser } = useAuth()
|
||||
const { isAuthenticated, currentUser } = useAuth()
|
||||
useEffect(() => {!isAuthenticated &&
|
||||
navigate(routes.home())},
|
||||
[currentUser])
|
||||
return (
|
||||
<MainLayout>
|
||||
<Part2Cell
|
||||
|
||||
Reference in New Issue
Block a user