-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
167 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,58 @@ | ||
import { StatusPill } from "./StatusPill"; | ||
import { Title } from "./Title"; | ||
import { signInUrl as gitHubSignInUrl } from "@wasp/auth/helpers/GitHub"; | ||
import { AiFillGithub } from "react-icons/ai"; | ||
import { BiSolidUser } from "react-icons/bi"; | ||
import { BiSolidUser, BiSolidHome } from "react-icons/bi"; | ||
import { RxQuestionMarkCircled } from "react-icons/rx"; | ||
import useAuth from "@wasp/auth/useAuth"; | ||
import { Link } from "@wasp/router"; | ||
|
||
|
||
export function Header({ currentStatus, isStatusVisible }) { | ||
export function Header({ currentStatus, isStatusVisible, isUserPage, setIsLoginModalOpen }) { | ||
const { data: user } = useAuth(); | ||
|
||
return ( | ||
<div className="mb-4 bg-slate-50 p-8 rounded-xl md:flex justify-between items-center"> | ||
<Title /> | ||
{!!user?.username && isStatusVisible && ( | ||
<div className="flex flex-col items-end gap-1"> | ||
<div className="flex items-center gap-3 mb-2 mr-1"> | ||
{/* <p className="hidden md:block text-gray-700 "> | ||
hey, <span className="font-semibold">{user.username} </span>{" "} | ||
</p> */} | ||
{isStatusVisible && ( | ||
<div className="flex flex-col items-end gap-2"> | ||
<div className="flex items-center gap-3 my-1 mr-1"> | ||
<a href="#faq" className="flex items-center justify-center space-x-1 text-slate-500 hover:text-slate-600"> | ||
<span className="text-sm font-normal">Help</span> | ||
<RxQuestionMarkCircled className="text-base text-slate-600" /> | ||
</a> | ||
|
||
<div className="relative group"> | ||
<Link to="/user"> | ||
<button | ||
onClick={() => { | ||
if (!user) { | ||
setIsLoginModalOpen(true); | ||
} else { | ||
window.location.href = "/user"; | ||
} | ||
}} | ||
> | ||
<BiSolidUser className="w-5 h-5 text-slate-600" /> | ||
<div className="absolute text-center whitespace-nowrap bg-slate-600 text-white text-xs rounded py-1 px-4 bottom-100 left-1/2 transform -translate-x-1/2 opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all ease-in-out duration-275"> | ||
<div className="absolute text-center whitespace-nowrap bg-slate-600 text-white text-xs rounded py-1 px-4 bottom-100 left-1/2 transform -translate-x-1/2 translate-y-1 opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all ease-in-out duration-275"> | ||
My Apps | ||
</div> | ||
</Link> | ||
</button> | ||
</div> | ||
</div> | ||
<StatusPill status={currentStatus.status} className="hidden md:flex"> | ||
{currentStatus.message} | ||
</StatusPill> | ||
</div> | ||
)} | ||
{isUserPage && ( | ||
<div className="flex items-center justify-center gap-3 mr-2"> | ||
<button className="relative group"> | ||
<Link to="/"> | ||
<BiSolidHome className="w-5 h-5 text-slate-600 mr-1" /> | ||
<div className="absolute text-center whitespace-nowrap bg-slate-600 text-white text-xs rounded py-1 px-4 bottom-100 left-1/2 transform -translate-x-1/2 translate-y-1 opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all ease-in-out duration-275"> | ||
Home | ||
</div> | ||
</Link> | ||
</button> | ||
</div> | ||
)} | ||
</div> | ||
); | ||
} | ||
|
||
function GithubLoginButton() { | ||
return ( | ||
<button | ||
className="button gray flex !text-gray-800 hover:bg-slate-300 shadow-md" | ||
onClick={() => (window.location.href = gitHubSignInUrl)} | ||
> | ||
<AiFillGithub className="w-6 h-6 mr-2" /> Sign in with GitHub | ||
</button> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.