diff --git a/src/main/java/edu/kit/typicalc/view/main/InputBar.java b/src/main/java/edu/kit/typicalc/view/main/InputBar.java index f7f26ed..4a93f08 100644 --- a/src/main/java/edu/kit/typicalc/view/main/InputBar.java +++ b/src/main/java/edu/kit/typicalc/view/main/InputBar.java @@ -55,12 +55,13 @@ public class InputBar extends HorizontalLayout implements LocaleChangeObserver { protected InputBar(Consumer>> callback) { this.callback = callback; + setId(INPUT_BAR_ID); + infoIcon = new Button(new Icon(VaadinIcon.INFO_CIRCLE)); infoIcon.addClickListener(event -> onInfoIconClick()); inputField = new TextField(); - inputField.getElement().setAttribute("autofocus", ""); - inputField.setPlaceholder(getTranslation("root.inputFieldPlaceholder")); + inputField.getElement().setAttribute("autofocus", ""); // focus on page load inputField.setId(INPUT_FIELD_ID); inputField.setClearButtonVisible(true); inputField.setMaxLength(MAX_INPUT_LENGTH); @@ -72,10 +73,11 @@ public class InputBar extends HorizontalLayout implements LocaleChangeObserver { Button lambdaButton = new Button(getTranslation("root.lambda")); lambdaButton.setId(LAMBDA_BUTTON_ID); UI.getCurrent().getPage().executeJs("window.lambdaButtonListener($0, $1);", LAMBDA_BUTTON_ID, INPUT_FIELD_ID); + typeAssumptions = new Button("", event -> onTypeAssumptionsButton()); typeAssumptions.setId(ASS_BUTTON_ID); typeAssumptionsArea = new TypeAssumptionsArea(); - exampleButton = new Button(VaadinIcon.PAPERCLIP.create(), event -> onExampleButtonClick()); + exampleButton = new Button(getTranslation("root.exampleButton"), event -> onExampleButtonClick()); exampleButton.setId(EXAMPLE_BUTTON_ID); inferTypeButton = new Button("", event -> onTypeInferButtonClick()); inferTypeButton.addClickShortcut(Key.ENTER).listenOn(this); @@ -83,7 +85,6 @@ public class InputBar extends HorizontalLayout implements LocaleChangeObserver { inferTypeButton.setId(INFER_BUTTON_ID); add(infoIcon, typeAssumptions, lambdaButton, inputField, exampleButton, inferTypeButton); - setId(INPUT_BAR_ID); } /** 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 a46a795..faff633 100644 --- a/src/main/java/edu/kit/typicalc/view/main/MainViewImpl.java +++ b/src/main/java/edu/kit/typicalc/view/main/MainViewImpl.java @@ -53,7 +53,6 @@ public class MainViewImpl extends AppLayout * Creates a new MainViewImpl. */ public MainViewImpl() { - setDrawerOpened(false); MainViewListener presenter = new Presenter(new ModelImpl(), this); upperBar = new UpperBar(presenter, this::processInput); addToNavbar(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 8fd3d5e..873a471 100644 --- a/src/main/java/edu/kit/typicalc/view/main/UpperBar.java +++ b/src/main/java/edu/kit/typicalc/view/main/UpperBar.java @@ -1,6 +1,5 @@ package edu.kit.typicalc.view.main; -import com.vaadin.flow.component.applayout.DrawerToggle; import com.vaadin.flow.component.button.Button; import com.vaadin.flow.component.dependency.CssImport; import com.vaadin.flow.component.html.Anchor; @@ -36,7 +35,6 @@ public class UpperBar extends HorizontalLayout implements LocaleChangeObserver { private static final String UPPER_BAR_ID = "header"; private final InputBar inputBar; - private final Button toggle; private final Button helpButton; private final transient MainViewListener presenter; @@ -45,7 +43,7 @@ public class UpperBar extends HorizontalLayout implements LocaleChangeObserver { /** * Initializes a new UpperBar with the provided mainViewListener. * - * @param presenter the listener used to communicate with the model + * @param presenter the listener used to communicate with the model * @param inputConsumer function to handle user input */ protected UpperBar(MainViewListener presenter, Consumer>> inputConsumer) { @@ -53,7 +51,6 @@ public class UpperBar extends HorizontalLayout implements LocaleChangeObserver { this.presenter = presenter; this.inputConsumer = inputConsumer; - toggle = new DrawerToggle(); H1 viewTitle = new H1(new Anchor("/", getTranslation("root.typicalc"))); viewTitle.setId(VIEW_TITLE_ID); this.inputBar = new InputBar(this::typeInfer); @@ -62,7 +59,7 @@ public class UpperBar extends HorizontalLayout implements LocaleChangeObserver { helpButton.addClickListener(event -> new HelpDialog().open()); helpButton.setId(HELP_ICON_ID); - add(/*toggle, */viewTitle, inputBar, helpButton); + add(viewTitle, inputBar, helpButton); setId(UPPER_BAR_ID); getThemeList().set("dark", true); setSpacing(false); @@ -96,7 +93,6 @@ public class UpperBar extends HorizontalLayout implements LocaleChangeObserver { @Override public void localeChange(LocaleChangeEvent event) { - toggle.getElement().setAttribute("title", getTranslation("root.drawerToggleTooltip")); helpButton.getElement().setAttribute("title", getTranslation("root.helpIconTooltip")); } } diff --git a/src/main/resources/language/translation_de.properties b/src/main/resources/language/translation_de.properties index 43deb4b..b48f6df 100644 --- a/src/main/resources/language/translation_de.properties +++ b/src/main/resources/language/translation_de.properties @@ -1,6 +1,7 @@ root.close=Schließen root.save=Speichern root.copied=LaTeX-Code in Zwischenablage kopiert. +root.exampleButton=📂 Beispiele root.selectExample=Beispiel auswählen: root.typeInfer=Typisieren root.operatingHelp=Hilfe @@ -144,7 +145,6 @@ verwendeten Pakete aufgelistet. root.correctAssumptions=Korrigiere oder lösche die ungültigen Typannahmen (rot hinterlegt) \ vor dem Schließen des Dialogs. root.copyLatexTooltip=Kopiere LaTeX-code -root.drawerToggleTooltip=Ableitungsregeln root.helpIconTooltip=Hilfe und Sprachwechsel root.exampleTooltip=Beispielterme root.shareButtonTooltip=LaTeX-Code und Permalink diff --git a/src/main/resources/language/translation_en.properties b/src/main/resources/language/translation_en.properties index 302275a..3fdda19 100644 --- a/src/main/resources/language/translation_en.properties +++ b/src/main/resources/language/translation_en.properties @@ -1,6 +1,7 @@ root.close=Close root.save=Save root.copied=LaTeX code copied to clipboard. +root.exampleButton=📂 Examples root.selectExample=Select example: root.typeInfer=Type root.operatingHelp=Help @@ -121,7 +122,6 @@ root.text8=The dialog contains a permalink to the current page, the LaTeX-code o to compile the code. root.correctAssumptions=Correct or delete the invalid type assumptions (red background) before closing the dialog. root.copyLatexTooltip=Copy LaTeX code -root.drawerToggleTooltip=Type inference rules root.helpIconTooltip=Help and language switch root.exampleTooltip=Example terms root.shareButtonTooltip=LaTeX code and permalink