Display username in profile container when logged in

This commit is contained in:
Connor Wittman 2024-10-18 19:31:20 -04:00
parent c2ebd8307f
commit 2d7b91413b
2 changed files with 23 additions and 0 deletions

View File

@ -35,6 +35,15 @@ pub fn Profile() -> impl IntoView {
view! { view! {
<div class="profile-container"> <div class="profile-container">
<div class="profile-name">
<Show
when=move || logged_in.get().unwrap_or_default()
fallback=|| view!{
<h1>Not Logged In</h1>
}>
<h1>{move || user.get().map(|user| user.map(|user| user.username).unwrap_or_default())}</h1>
</Show>
</div>
<div class="profile-icon" on:click=open_dropdown> <div class="profile-icon" on:click=open_dropdown>
<Show <Show
when=move || logged_in.get().unwrap_or_default() when=move || logged_in.get().unwrap_or_default()

View File

@ -15,6 +15,20 @@
border: 0.2rem solid rgba(89, 89, 89, 0.199); border: 0.2rem solid rgba(89, 89, 89, 0.199);
padding: 0.5rem; padding: 0.5rem;
.profile-name {
display: flex;
flex-direction: column;
margin-left: 0.5rem;
h1 {
font-size: 1.2rem;
margin: 0;
}
h2 {
font-size: 1rem;
margin: 0;
}
}
.profile-icon { .profile-icon {
display: inline-flex; display: inline-flex;
padding: 0.2rem; padding: 0.2rem;