style: UI-Optimierungen für Message-Views

This commit is contained in:
2026-03-20 15:10:29 +01:00
parent e532780e2a
commit c2bc4e4900
3 changed files with 22 additions and 46 deletions

View File

@@ -1220,8 +1220,8 @@ vaadin-grid-tree-toggle[expanded] .nav-expand-icon {
border-radius: 22px !important; border-radius: 22px !important;
background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 249, 255, 0.9)) !important; background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 249, 255, 0.9)) !important;
box-shadow: var(--app-shadow-sm) !important; box-shadow: var(--app-shadow-sm) !important;
max-width: 100% !important;
margin-bottom: 0.85rem !important; margin-bottom: 0.85rem !important;
box-sizing: border-box !important;
} }
.message-section { .message-section {
@@ -1281,10 +1281,14 @@ vaadin-grid-tree-toggle[expanded] .nav-expand-icon {
padding: 1rem 1.15rem; padding: 1rem 1.15rem;
} }
.message-thread { .message-thread-scroller {
border: 1px solid var(--app-border-strong); border: 1px solid var(--app-border-strong);
background: linear-gradient(180deg, rgba(239, 244, 255, 0.72), rgba(248, 250, 252, 0.92)); background: linear-gradient(180deg, rgba(239, 244, 255, 0.72), rgba(248, 250, 252, 0.92));
border-radius: 24px; border-radius: 24px;
overflow-y: auto !important;
}
.message-thread {
padding: 1rem !important; padding: 1rem !important;
} }

View File

@@ -182,6 +182,7 @@ public class MessageDetailsView extends Main implements BeforeEnterObserver, Has
messagesScroller.setHeightFull(); messagesScroller.setHeightFull();
messagesScroller.setScrollDirection(Scroller.ScrollDirection.VERTICAL); messagesScroller.setScrollDirection(Scroller.ScrollDirection.VERTICAL);
messagesScroller.getStyle().set("flex", "1 1 auto"); messagesScroller.getStyle().set("flex", "1 1 auto");
messagesScroller.addClassName("message-thread-scroller");
contentLayout.add(messagesScroller); contentLayout.add(messagesScroller);
contentLayout.setFlexGrow(1, messagesScroller); contentLayout.setFlexGrow(1, messagesScroller);
@@ -669,10 +670,6 @@ public class MessageDetailsView extends Main implements BeforeEnterObserver, Has
} }
private HorizontalLayout createHeaderLayout(String clientName, String conversationTitle) { private HorizontalLayout createHeaderLayout(String clientName, String conversationTitle) {
Button backButton = new Button("Zurück", VaadinIcon.ARROW_LEFT.create());
backButton.addThemeVariants(com.vaadin.flow.component.button.ButtonVariant.LUMO_TERTIARY);
backButton.addClickListener(e -> UI.getCurrent().navigate("user-messages/" + participantKey));
VerticalLayout titleLayout = new VerticalLayout(); VerticalLayout titleLayout = new VerticalLayout();
titleLayout.setPadding(false); titleLayout.setPadding(false);
titleLayout.setSpacing(false); titleLayout.setSpacing(false);
@@ -685,7 +682,7 @@ public class MessageDetailsView extends Main implements BeforeEnterObserver, Has
titleLayout.add(title, subtitle); titleLayout.add(title, subtitle);
HorizontalLayout layout = new HorizontalLayout(backButton, titleLayout); HorizontalLayout layout = new HorizontalLayout(titleLayout);
layout.setWidthFull(); layout.setWidthFull();
layout.setAlignItems(com.vaadin.flow.component.orderedlayout.FlexComponent.Alignment.CENTER); layout.setAlignItems(com.vaadin.flow.component.orderedlayout.FlexComponent.Alignment.CENTER);
layout.setSpacing(true); layout.setSpacing(true);
@@ -709,9 +706,10 @@ public class MessageDetailsView extends Main implements BeforeEnterObserver, Has
attachButton.getElement().setAttribute("aria-label", "Bild anhängen"); attachButton.getElement().setAttribute("aria-label", "Bild anhängen");
attachButton.addClickListener(event -> openImageUploadDialog()); attachButton.addClickListener(event -> openImageUploadDialog());
Button sendButton = new Button("Senden", VaadinIcon.PAPERPLANE.create()); Button sendButton = new Button(VaadinIcon.PAPERPLANE.create());
sendButton.addThemeVariants(com.vaadin.flow.component.button.ButtonVariant.LUMO_PRIMARY); sendButton.addThemeVariants(com.vaadin.flow.component.button.ButtonVariant.LUMO_PRIMARY);
sendButton.getStyle().set("height", "60px"); sendButton.getStyle().set("height", "60px");
sendButton.getStyle().set("min-width", "90px");
sendButton.addClickListener(e -> { sendButton.addClickListener(e -> {
String message = messageInput.getValue(); String message = messageInput.getValue();

View File

@@ -1,14 +1,11 @@
package de.assecutor.votianlt.pages.view; package de.assecutor.votianlt.pages.view;
import com.vaadin.flow.component.UI; import com.vaadin.flow.component.UI;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.button.ButtonVariant;
import com.vaadin.flow.component.html.Div; import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.component.html.H2; import com.vaadin.flow.component.html.H2;
import com.vaadin.flow.component.html.H3; import com.vaadin.flow.component.html.H3;
import com.vaadin.flow.component.html.Main; import com.vaadin.flow.component.html.Main;
import com.vaadin.flow.component.html.Span; import com.vaadin.flow.component.html.Span;
import com.vaadin.flow.component.icon.VaadinIcon;
import com.vaadin.flow.component.orderedlayout.HorizontalLayout; import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
import com.vaadin.flow.component.orderedlayout.VerticalLayout; import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.router.BeforeEvent; import com.vaadin.flow.router.BeforeEvent;
@@ -90,21 +87,14 @@ public class UserMessagesView extends Main implements HasUrlParameter<String>, H
Map<MessageType, List<Message>> messagesByType = conversation.stream().collect(Collectors Map<MessageType, List<Message>> messagesByType = conversation.stream().collect(Collectors
.groupingBy(message -> Optional.ofNullable(message.getMessageType()).orElse(MessageType.GENERAL))); .groupingBy(message -> Optional.ofNullable(message.getMessageType()).orElse(MessageType.GENERAL)));
VerticalLayout generalSection = createGeneralMessagesSection(messagesByType.get(MessageType.GENERAL)); addGeneralMessagesTo(contentLayout, messagesByType.get(MessageType.GENERAL));
addJobMessagesTo(contentLayout, messagesByType.get(MessageType.JOB_RELATED));
VerticalLayout jobSection = createJobMessagesSection(messagesByType.get(MessageType.JOB_RELATED));
contentLayout.add(generalSection, jobSection);
} }
private HorizontalLayout createHeaderLayout(String clientName) { private HorizontalLayout createHeaderLayout(String clientName) {
Button backButton = new Button(getTranslation("button.back"), VaadinIcon.ARROW_LEFT.create());
backButton.addThemeVariants(ButtonVariant.LUMO_TERTIARY);
backButton.addClickListener(e -> UI.getCurrent().navigate("messages"));
H2 title = new H2(getTranslation("usermessages.title.with", clientName)); H2 title = new H2(getTranslation("usermessages.title.with", clientName));
HorizontalLayout layout = new HorizontalLayout(backButton, title); HorizontalLayout layout = new HorizontalLayout(title);
layout.setWidthFull(); layout.setWidthFull();
layout.setAlignItems(com.vaadin.flow.component.orderedlayout.FlexComponent.Alignment.CENTER); layout.setAlignItems(com.vaadin.flow.component.orderedlayout.FlexComponent.Alignment.CENTER);
layout.setSpacing(true); layout.setSpacing(true);
@@ -113,16 +103,10 @@ public class UserMessagesView extends Main implements HasUrlParameter<String>, H
return layout; return layout;
} }
private VerticalLayout createGeneralMessagesSection(List<Message> generalMessages) { private void addGeneralMessagesTo(VerticalLayout target, List<Message> generalMessages) {
VerticalLayout section = new VerticalLayout();
section.setPadding(true);
section.setSpacing(true);
section.setWidthFull();
section.addClassName("message-section");
H3 title = new H3(getTranslation("usermessages.general.title")); H3 title = new H3(getTranslation("usermessages.general.title"));
title.addClassName("message-section-title"); title.addClassName("message-section-title");
section.add(title); target.add(title);
List<Message> sortedMessages = new ArrayList<>(); List<Message> sortedMessages = new ArrayList<>();
if (generalMessages != null) { if (generalMessages != null) {
@@ -139,26 +123,18 @@ public class UserMessagesView extends Main implements HasUrlParameter<String>, H
LocalDateTime lastMessageTime = latest != null ? latest.getCreatedAt() : null; LocalDateTime lastMessageTime = latest != null ? latest.getCreatedAt() : null;
String preview = resolvePreview(latest); String preview = resolvePreview(latest);
section.add(createMessageCard(getTranslation("usermessages.general.conversation"), preview, lastMessageTime, target.add(createMessageCard(getTranslation("usermessages.general.conversation"), preview, lastMessageTime,
messageCount, unreadCount, "general")); messageCount, unreadCount, "general"));
return section;
} }
private VerticalLayout createJobMessagesSection(List<Message> jobMessages) { private void addJobMessagesTo(VerticalLayout target, List<Message> jobMessages) {
VerticalLayout section = new VerticalLayout();
section.setPadding(true);
section.setSpacing(true);
section.setWidthFull();
section.addClassName("message-section");
H3 title = new H3(getTranslation("usermessages.job.title")); H3 title = new H3(getTranslation("usermessages.job.title"));
title.addClassName("message-section-title"); title.addClassName("message-section-title");
section.add(title); target.add(title);
if (jobMessages == null || jobMessages.isEmpty()) { if (jobMessages == null || jobMessages.isEmpty()) {
section.add(new Span(getTranslation("usermessages.no.job.messages"))); target.add(new Span(getTranslation("usermessages.no.job.messages")));
return section; return;
} }
Map<String, List<Message>> messagesByJob = jobMessages.stream() Map<String, List<Message>> messagesByJob = jobMessages.stream()
@@ -171,11 +147,9 @@ public class UserMessagesView extends Main implements HasUrlParameter<String>, H
.filter(message -> message.getOrigin() == MessageOrigin.CLIENT && !message.isRead()).count(); .filter(message -> message.getOrigin() == MessageOrigin.CLIENT && !message.isRead()).count();
String conversationTitle = getTranslation("usermessages.job.conversation", jobKey); String conversationTitle = getTranslation("usermessages.job.conversation", jobKey);
section.add(createMessageCard(conversationTitle, resolvePreview(latest), latest.getCreatedAt(), target.add(createMessageCard(conversationTitle, resolvePreview(latest), latest.getCreatedAt(),
messages.size(), unreadCount, "job-" + sanitizeConversationId(jobKey))); messages.size(), unreadCount, "job-" + sanitizeConversationId(jobKey)));
}); });
return section;
} }
private String resolvePreview(Message message) { private String resolvePreview(Message message) {
@@ -236,7 +210,7 @@ public class UserMessagesView extends Main implements HasUrlParameter<String>, H
// Add all elements to card // Add all elements to card
VerticalLayout cardContent = new VerticalLayout(titleRow, preview, metaRow); VerticalLayout cardContent = new VerticalLayout(titleRow, preview, metaRow);
cardContent.setWidthFull(); cardContent.setWidthFull();
cardContent.setPadding(false); cardContent.setPadding(true);
cardContent.setSpacing(false); cardContent.setSpacing(false);
card.add(cardContent); card.add(cardContent);