diff --git a/src/main/java/edu/kit/typicalc/view/content/infocontent/StartPageView.java b/src/main/java/edu/kit/typicalc/view/content/infocontent/StartPageView.java index 3b767eb..ac451fa 100644 --- a/src/main/java/edu/kit/typicalc/view/content/infocontent/StartPageView.java +++ b/src/main/java/edu/kit/typicalc/view/content/infocontent/StartPageView.java @@ -13,7 +13,7 @@ import edu.kit.typicalc.view.content.typeinferencecontent.MathjaxUnification; import edu.kit.typicalc.view.main.MainViewImpl; @Route(value = "", layout = MainViewImpl.class) -@PageTitle("Typicalc") +@PageTitle(MainViewImpl.PAGE_TITLE) @JsModule("./src/mathjax-setup.js") public class StartPageView extends VerticalLayout implements ControlPanelView { diff --git a/src/main/java/edu/kit/typicalc/view/main/MainViewImpl.java b/src/main/java/edu/kit/typicalc/view/main/MainViewImpl.java index 5cff413..1833df0 100644 --- a/src/main/java/edu/kit/typicalc/view/main/MainViewImpl.java +++ b/src/main/java/edu/kit/typicalc/view/main/MainViewImpl.java @@ -32,12 +32,13 @@ import java.util.stream.Collectors; @CssImport(value = "./styles/view/main/app-layout.css", themeFor = "vaadin-app-layout") @JavaScript("./src/svg-pan-zoom.min.js") @JavaScript("./src/tex-svg-full.js") -@PageTitle("Typicalc") @Route(TypeInferenceView.ROUTE + "/:term") public class MainViewImpl extends AppLayout implements MainView, BeforeEnterObserver, HasErrorParameter { private static final long serialVersionUID = -2411433187835906976L; + public static final String PAGE_TITLE = "Typicalc"; + private final UpperBar upperBar; /** diff --git a/src/main/java/edu/kit/typicalc/view/main/UpperBar.java b/src/main/java/edu/kit/typicalc/view/main/UpperBar.java index cd70b92..0c46478 100644 --- a/src/main/java/edu/kit/typicalc/view/main/UpperBar.java +++ b/src/main/java/edu/kit/typicalc/view/main/UpperBar.java @@ -9,10 +9,8 @@ import com.vaadin.flow.component.html.H1; import com.vaadin.flow.component.icon.Icon; import com.vaadin.flow.component.icon.VaadinIcon; import com.vaadin.flow.component.orderedlayout.HorizontalLayout; -import com.vaadin.flow.router.Location; import edu.kit.typicalc.view.content.infocontent.StartPageView; import edu.kit.typicalc.view.main.MainView.MainViewListener; -import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.Pair; import java.util.Map; @@ -63,7 +61,7 @@ public class UpperBar extends HorizontalLayout { add(new DrawerToggle(), viewTitle, inputBar, helpIcon); setId(UPPER_BAR_ID); - getThemeList().set("dark", true); //TODO remove magic string + getThemeList().set("dark", true); setSpacing(false); } @@ -91,7 +89,8 @@ public class UpperBar extends HorizontalLayout { private void routeToStartPage(Consumer setContent) { setContent.accept(new StartPageView()); - UI.getCurrent().getPage().getHistory().replaceState(null, new Location(StringUtils.EMPTY)); + UI.getCurrent().getPage().setTitle(MainViewImpl.PAGE_TITLE); + UI.getCurrent().getPage().executeJs("history.pushState(null, '', $0)", "/"); } private void onHelpIconClick() {