From bc535bb09e1a81c69f35b0296839e9cf2a74aa50 Mon Sep 17 00:00:00 2001 From: Sami Ekblad Date: Wed, 24 May 2023 11:23:13 +0000 Subject: [PATCH] added demo code and pwa --- demo/frontend/themes/{myapp => nps}/styles.css | 0 demo/frontend/themes/{myapp => nps}/theme.json | 0 demo/pom.xml | 7 +++++++ .../com/example/application/Application.java | 5 ++++- .../{EmptyView.java => FeedbackView.java} | 18 +++++++++--------- 5 files changed, 20 insertions(+), 10 deletions(-) rename demo/frontend/themes/{myapp => nps}/styles.css (100%) rename demo/frontend/themes/{myapp => nps}/theme.json (100%) rename demo/src/main/java/com/example/application/views/empty/{EmptyView.java => FeedbackView.java} (66%) diff --git a/demo/frontend/themes/myapp/styles.css b/demo/frontend/themes/nps/styles.css similarity index 100% rename from demo/frontend/themes/myapp/styles.css rename to demo/frontend/themes/nps/styles.css diff --git a/demo/frontend/themes/myapp/theme.json b/demo/frontend/themes/nps/theme.json similarity index 100% rename from demo/frontend/themes/myapp/theme.json rename to demo/frontend/themes/nps/theme.json diff --git a/demo/pom.xml b/demo/pom.xml index 7ac57c00..9712957e 100644 --- a/demo/pom.xml +++ b/demo/pom.xml @@ -78,6 +78,13 @@ vaadin-testbench-junit5 test + + + org.vaadin.addons.nps + nps + 1.0-SNAPSHOT + + diff --git a/demo/src/main/java/com/example/application/Application.java b/demo/src/main/java/com/example/application/Application.java index 8ae639ce..32360652 100644 --- a/demo/src/main/java/com/example/application/Application.java +++ b/demo/src/main/java/com/example/application/Application.java @@ -5,6 +5,8 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import com.vaadin.flow.server.PWA; + /** * The entry point of the Spring Boot application. * @@ -13,7 +15,8 @@ * */ @SpringBootApplication -@Theme(value = "myapp") +@Theme(value = "nps") +@PWA(shortName = "Feedback", name = "Feedback") public class Application implements AppShellConfigurator { public static void main(String[] args) { diff --git a/demo/src/main/java/com/example/application/views/empty/EmptyView.java b/demo/src/main/java/com/example/application/views/empty/FeedbackView.java similarity index 66% rename from demo/src/main/java/com/example/application/views/empty/EmptyView.java rename to demo/src/main/java/com/example/application/views/empty/FeedbackView.java index c8055340..097b70ee 100644 --- a/demo/src/main/java/com/example/application/views/empty/EmptyView.java +++ b/demo/src/main/java/com/example/application/views/empty/FeedbackView.java @@ -8,21 +8,21 @@ import com.vaadin.flow.router.Route; import com.vaadin.flow.theme.lumo.LumoUtility.Margin; -@PageTitle("Empty") +import org.vaadin.addons.nps.NPS; + +@PageTitle("Feedback") @Route(value = "") -public class EmptyView extends VerticalLayout { +public class FeedbackView extends VerticalLayout { - public EmptyView() { - setSpacing(false); + NPS nps = new NPS(); - Image img = new Image("images/empty-plant.png", "placeholder plant"); - img.setWidth("200px"); - add(img); + public FeedbackView() { + setSpacing(false); - H2 header = new H2("This place intentionally left empty"); + H2 header = new H2("Thank you for visiting us."); header.addClassNames(Margin.Top.XLARGE, Margin.Bottom.MEDIUM); add(header); - add(new Paragraph("It’s a place where you can grow your own UI 🤗")); + add(nps); setSizeFull(); setJustifyContentMode(JustifyContentMode.CENTER);