use of com.dala.data.user.User in project DoodleVerse by davidemarcoli.
the class MainLayout method createFooter.
private Footer createFooter() {
Footer layout = new Footer();
layout.addClassNames("footer");
Optional<User> maybeUser = authenticatedUser.get();
if (maybeUser.isPresent()) {
User user = maybeUser.get();
Avatar avatar = new Avatar(user.getName(), user.getProfilePictureUrl());
avatar.addClassNames("me-xs");
ContextMenu userMenu = new ContextMenu(avatar);
userMenu.setOpenOnClick(true);
userMenu.addItem("Logout", e -> {
authenticatedUser.logout();
});
Span name = new Span(user.getName());
name.addClassNames("font-medium", "text-s", "text-secondary");
layout.add(avatar, name);
} else {
Anchor loginLink = new Anchor("login", "Sign in");
layout.add(loginLink);
}
return layout;
}
Aggregations