make every button that requires an account pop up a login prompt

This commit is contained in:
2026-10-27 08:46:09 +03:00
parent df2a334d7c
commit 3368686201
5 changed files with 32 additions and 10 deletions
+3 -6
View File
@@ -1,10 +1,8 @@
import { useState } from 'react'
import { useAuth } from '../auth'
import AuthModal from './AuthModal'
import { useAuth, useAuthModal } from '../auth'
export default function ProfileBar() {
const { user, loading, logout } = useAuth()
const [showAuth, setShowAuth] = useState(false)
const { openAuthModal } = useAuthModal()
return (
<>
@@ -26,12 +24,11 @@ export default function ProfileBar() {
</button>
</div>
) : (
<button className="btn btn-primary" onClick={() => setShowAuth(true)}>
<button className="btn btn-primary" onClick={openAuthModal}>
Войти
</button>
)}
</div>
{showAuth && <AuthModal onClose={() => setShowAuth(false)} />}
</>
)
}