fixing flow and signout working with dropdown
This commit is contained in:
@@ -15,6 +15,7 @@ import router from "next/router";
|
|||||||
import Moment from "react-moment";
|
import Moment from "react-moment";
|
||||||
import { User } from "../../models/user";
|
import { User } from "../../models/user";
|
||||||
import { generateGreetings } from "../../helpers/dateTime";
|
import { generateGreetings } from "../../helpers/dateTime";
|
||||||
|
import { Dropdown, Menu } from "antd";
|
||||||
|
|
||||||
export default function Header() {
|
export default function Header() {
|
||||||
const { logOut } = useAuth();
|
const { logOut } = useAuth();
|
||||||
@@ -32,6 +33,17 @@ export default function Header() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const UserMenu = (
|
||||||
|
<Menu>
|
||||||
|
<Menu.Item>
|
||||||
|
<button onClick={handleSignOut}>manage team</button>
|
||||||
|
</Menu.Item>
|
||||||
|
<Menu.Item danger>
|
||||||
|
<button onClick={handleSignOut}>sign out</button>
|
||||||
|
</Menu.Item>
|
||||||
|
</Menu>
|
||||||
|
);
|
||||||
|
|
||||||
const today = new Date();
|
const today = new Date();
|
||||||
const periodOfDay = generateGreetings();
|
const periodOfDay = generateGreetings();
|
||||||
return (
|
return (
|
||||||
@@ -96,16 +108,17 @@ export default function Header() {
|
|||||||
<FaTh className="text-lg text-gray-400 hover:text-white ease-in-out duration-300 hover:scale-110 hover:cursor-pointer" />
|
<FaTh className="text-lg text-gray-400 hover:text-white ease-in-out duration-300 hover:scale-110 hover:cursor-pointer" />
|
||||||
|
|
||||||
{/* avatar */}
|
{/* avatar */}
|
||||||
<span className="relative flex">
|
<Dropdown overlay={UserMenu}>
|
||||||
<span className="bg-gray-200 bg-opacity-30 rounded-full shadow-md absolute w-full h-full"></span>
|
<span className="relative flex hover:cursor-pointer">
|
||||||
<span className="absolute top-0 right-0 w-3 h-3 bg-green-400 rounded-full"></span>
|
<span className="bg-gray-200 bg-opacity-30 rounded-full shadow-md absolute w-full h-full"></span>
|
||||||
<Image
|
<span className="absolute top-0 right-0 w-3 h-3 bg-green-400 rounded-full"></span>
|
||||||
src="/avatars/svg/Artboards_Diversity_Avatars_by_Netguru-22.svg"
|
<img
|
||||||
alt="profile"
|
src={user.avatarUrl}
|
||||||
width={50}
|
alt="asdf"
|
||||||
height={50}
|
className="rounded-full w-12"
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
|
</Dropdown>
|
||||||
</span>
|
</span>
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import unfetch from "isomorphic-unfetch";
|
|||||||
import { FaPeopleCarry, FaArrowRight, FaBullhorn } from "react-icons/fa";
|
import { FaPeopleCarry, FaArrowRight, FaBullhorn } from "react-icons/fa";
|
||||||
import BackgroundLayout from "../../components/Layouts/BackgroundLayout";
|
import BackgroundLayout from "../../components/Layouts/BackgroundLayout";
|
||||||
import TeamService from "../../services/teamService";
|
import TeamService from "../../services/teamService";
|
||||||
|
import Loading from "../../components/Loading";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* figure out where to take the user based on everything
|
* figure out where to take the user based on everything
|
||||||
@@ -68,13 +69,13 @@ function RouteHandler() {
|
|||||||
console.log(error);
|
console.log(error);
|
||||||
router.push("/teams/login");
|
router.push("/teams/login");
|
||||||
}
|
}
|
||||||
})();
|
|
||||||
|
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
|
})();
|
||||||
}, [currUser]);
|
}, [currUser]);
|
||||||
|
|
||||||
if (loading || !user) {
|
if (loading || !user) {
|
||||||
return <div></div>;
|
return <Loading />;
|
||||||
}
|
}
|
||||||
|
|
||||||
// not in a team yet, and have not created a team yet
|
// not in a team yet, and have not created a team yet
|
||||||
|
|||||||
Reference in New Issue
Block a user