Skip to content

Commit

Permalink
Updated links
Browse files Browse the repository at this point in the history
  • Loading branch information
samie committed Feb 22, 2024
1 parent b15dbeb commit e3ce351
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
3 changes: 0 additions & 3 deletions demo/src/main/java/com/example/application/Application.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package com.example.application;

import com.vaadin.flow.component.page.AppShellConfigurator;
import com.vaadin.flow.component.page.Push;
import com.vaadin.flow.shared.ui.Transport;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

Expand All @@ -19,7 +17,6 @@
@SpringBootApplication
@Theme("nps")
@PWA(shortName = "Feedback", name = "Feedback")
@Push(transport = Transport.WEBSOCKET)
public class Application implements AppShellConfigurator {

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,11 @@ public class FeedbackSheet {

private String sheetId;

private FeedbackSheet(String sheetId, String credentialsFilePath) {
public FeedbackSheet(String sheetId, String credentialsFilePath) {
this.sheetId = sheetId;
this.credentialsFilePath = credentialsFilePath;
}

public static FeedbackSheet getSheet(String sheetId, String credentialsFilePath) {
return new FeedbackSheet(sheetId, credentialsFilePath);
}

/**
* Append a user score to the spreadsheet.
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
@Route(value = "")
public class NPSView extends VerticalLayout {

public static final String DEFAULT_LINK_TEXT = "Go back to vaadin.com";
public static final String DEFAULT_LINK_TEXT = "Visit vaadin.com";
public static final String DEFAULT_LINK = "https://vaadin.com/";
public static final String DEFAULT_HEADER = "Thank you for visiting us.";
public static final String DEFAULT_QUESTION = NPS.DEFAULT_NPS_QUESTION;
Expand All @@ -28,11 +28,14 @@ public class NPSView extends VerticalLayout {
private static final String DEVELOPMENT_CREDENTIAL_FILE = "/workspaces/nps/.devcontainer/local/service_account_credentials.json";

private static final String DEFAULT_SHEET_ID = "1aTfU2_XuZU-HgUhSBu4_oB_gB4hhro-RzNsdN9_8YX8";
private static final String SHEET_LINK = "https://docs.google.com/spreadsheets/d/1aTfU2_XuZU-HgUhSBu4_oB_gB4hhro-RzNsdN9_8YX8";
private static final String SHEET_LINK_TEXT = "See responses";

NPS nps = new NPS();
H2 header = new H2(DEFAULT_HEADER);
Paragraph thankYou = new Paragraph(DEFAULT_THANK_YOU);
Anchor closeLink = new Anchor(DEFAULT_LINK, DEFAULT_LINK_TEXT);
Anchor sheetLink = new Anchor(SHEET_LINK, SHEET_LINK_TEXT);

String productName = "default";

Expand All @@ -47,11 +50,15 @@ public NPSView() {
nps.addValueChangeListener(e -> {
header.setVisible(false);
replace(nps, thankYou);
add(sheetLink);
add(closeLink);

String credentialFileName = getCredentialFileName();
String sheetId = getSheetId();
// Store the results into a Google Sheet
FeedbackSheet.getSheet(getSheetId(), getCredentialFileName())
.append(productName,"" + UI.getCurrent().hashCode(), e.getValue());
FeedbackSheet feedbackSheet = new FeedbackSheet(sheetId,
credentialFileName);
feedbackSheet.append(productName,"" + UI.getCurrent().hashCode(), e.getValue());
});

// Styling
Expand Down

0 comments on commit e3ce351

Please sign in to comment.