Rephrase defense options for scouting app
Marissa Tsoi provided me with an updated list of defense descriptions
she wanted.
I also added some code to make sure that each screen scrolls back to
the top. Otherwise, it's easy to miss the some of the input fields.
Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: I816404766cb18024a6aac329051b27a75ba374bd
diff --git a/scouting/www/entry/entry.component.ts b/scouting/www/entry/entry.component.ts
index e45b6aa..aaf23dd 100644
--- a/scouting/www/entry/entry.component.ts
+++ b/scouting/www/entry/entry.component.ts
@@ -1,4 +1,4 @@
-import { Component, OnInit } from '@angular/core';
+import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';
import { FormsModule } from '@angular/forms';
import * as flatbuffer_builder from 'org_frc971/external/com_github_google_flatbuffers/ts/builder';
@@ -38,6 +38,8 @@
mechanicallyBroke: boolean = false;
lostComs: boolean = false;
+ @ViewChild("header") header: ElementRef;
+
nextSection() {
if (this.section === 'Team Selection') {
this.section = 'Auto';
@@ -51,7 +53,11 @@
this.section = 'Review and Submit';
} else if (this.section === 'Review and Submit') {
this.submitDataScouting();
+ return;
}
+ // Scroll back to the top so that we can be sure the user sees the
+ // entire next screen. Otherwise it's easy to overlook input fields.
+ this.scrollToTop();
}
prevSection() {
@@ -66,6 +72,14 @@
} else if (this.section === 'Review and Submit') {
this.section = 'Other';
}
+ // Scroll back to the top so that we can be sure the user sees the
+ // entire previous screen. Otherwise it's easy to overlook input
+ // fields.
+ this.scrollToTop();
+ }
+
+ private scrollToTop() {
+ this.header.nativeElement.scrollIntoView();
}
async submitDataScouting() {