Getting Started
Applied Actions
Data Request ActionsLogin Request ActionsBus ActionsExcitation System ActionsGenerator ActionsIBR ActionsllcHVDClink ActionsLoad ActionsSeries Capacitor ActionsSeries Fact ActionsShunt Capacitor ActionsShunt Fact ActionsShunt Reactor ActionsSingleLineDiagram ActionsTransformersThreeWinding ActionsTransformersTwoWinding ActionsTransmission Lines ActionsTurbine Governor ActionsUser ActionsTransmission Lines Actions
Model Schemas
Bus ModelsChanges modelsDefault params modelsExcitation System modelsGenerator ModelsIBR ModelsllcHVDClink ModelsvscHVDClink ModelsLoad ModelsHistory ModelsSeries Capacitor ModelsSeries Fact ModelsShunt Capacitor ActionsShunt Fact ModelsShunt Reactor ModelsSingleLineDiagram ModelsTransformersThreeWinding ModelsTransformersTwoWinding ModelsTransmission Lines ModelsTurbine Governor ModelsUser Models
Components
Add Columns ComponentCreate Form ComponentDelete Confirmation ComponentDisplay Table ComponentFile Upload ComponentFiltered History ComponentForm Skeleton ComponentLogin Form ComponentLogin Provider ComponentNavbar ComponentNothing to Display ComponentPush Mock Data ComponentRegistration Form ComponentSearch ComponentSidebar ComponentTable Heading ComponentTable Skeleton Component
Navbar
`Navbar` renders user information and logout functionality based on the `session` state retrieved via `useSession`, showing user details and a logout button when authenticated, utilizing the `signOut` function and displaying a logout loading toast.
In the src/content/docs/component directory, You can find the Navbar.mdx
Functions
Navbar
const Navbar = () => {
const { data: session } = useSession();
return (
<div className="absolute right-5 top-2.5">
{session ? (
<div className="flex items-center gap-2">
<div className="flex items-center gap-2">
<Avatar className="scale-110">
<AvatarImage src={session.user.image || pfp} />
<AvatarFallback>CN</AvatarFallback>
</Avatar>
<div>
<p className="text-base">{session.user.name}</p>
<p className="text-xs text-gray-500">{session.user.email}</p>
</div>
</div>
<CiLogout
className="text-3xl cursor-pointer"
title="Logout"
onClick={() => {
signOut();
toast.loading("Logging out...");
}}
/>
</div>
) : (
""
)}
</div>
);
};
export default Navbar;
The Navbar component displays the user's avatar, name, and email if they are logged in. It also provides a logout button represented by the "CiLogout" icon. Upon clicking the logout button, it triggers the sign-out process and displays a loading toast indicating that the user is logging out. If no user is logged in, the component doesn't render anything.
Scroll to top