Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds randomized tips to Prediction Model UI #3348

Merged
merged 1 commit into from
Aug 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 23 additions & 6 deletions public/javascripts/SVLabel/src/SVLabel/PredictionModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ function PredictionModel() {

const predictionModelExamplesDescriptor = {
'CurbRamp': {
'subtitle': 'Tip: The #1 curb ramp mistake is labeling <b>driveways</b> as curb ramps.',
'tips': [
'Tip: do <b>not</b> label <b>driveways</b> as curb ramps.',
'Tip: do <b>not</b> label sidewalk-to-alleyway transitions as curb ramps unless a ramp is clearly visible.'
],
'correct-examples': [
{
'image': 'assets/images/tutorials/PM_Correct_CurbRamp_1.png',
Expand Down Expand Up @@ -108,7 +111,10 @@ function PredictionModel() {
],
},
'NoCurbRamp': {
'subtitle': '48% of curb ramps are missed by users.',
'tips': [
'Tip: do <b>not</b> label <b>residential walkways</b> (house-to-curb paths) as missing curb ramps.',
'Tip: if there is <b>no sidewalk</b>, use a No Sidewalk label and not Missing Curb Ramp.'
],
'correct-examples': [
{
'image': 'assets/images/tutorials/PM_Correct_NoCurbRamp_1.png',
Expand Down Expand Up @@ -143,7 +149,10 @@ function PredictionModel() {
],
},
'Obstacle': {
'subtitle': '48% of curb ramps are missed by users.',
'tips': [
'Tip: an obstacle <b>blocks</b> the pedestrian path with limited space to avoid.',
'Tip: only label obstacles that are <b>on the pedestrian path</b>.'
],
'correct-examples': [
{
'image': 'assets/images/tutorials/PM_Correct_Obstacle_1.png',
Expand Down Expand Up @@ -178,7 +187,11 @@ function PredictionModel() {
],
},
'SurfaceProblem': {
'subtitle': '48% of curb ramps are missed by users.',
'tips': [
'Tip: only label problems that are <b>on the pedestrian path</b>.',
'Tip: do <b>not</b> label surface problems if they are on a <b>driveway</b>.',
'Tip: always check sidewalks on <b>both sides of the road</b>.'
],
'correct-examples': [
{
'image': 'assets/images/tutorials/PM_Correct_SurfaceProblem_1.png',
Expand Down Expand Up @@ -213,7 +226,10 @@ function PredictionModel() {
],
},
'NoSidewalk': {
'subtitle': '48% of curb ramps are missed by users.',
'tips': [
'Tip: always double check that a sidewalk is <b>actually missing</b>.',
'Tip: if a sidewalk exists but a curb ramp is missing, use the <b>missing curb ramp label</b>.'
],
'correct-examples': [
{
'image': 'assets/images/tutorials/PM_Correct_NoSidewalk_1.png',
Expand Down Expand Up @@ -366,8 +382,9 @@ function PredictionModel() {

const labelProps = currLabel.getProperties();

let randomTip = Math.floor(Math.random() * predictionModelExamplesDescriptor[labelProps.labelType].tips.length);
$('.label-type', $predictionModelPopupContainer).text(i18next.t(`common:${util.camelToKebab(labelProps.labelType)}`));
$('.prediction-model-popup-text', $predictionModelPopupContainer).html(predictionModelExamplesDescriptor[labelProps.labelType].subtitle); // this could contain HTML.
$('.prediction-model-popup-text', $predictionModelPopupContainer).html(predictionModelExamplesDescriptor[labelProps.labelType].tips[randomTip]); // this could contain HTML.

$predictionModelPopupContainer.show();
uiStartTime = new Date().getTime();
Expand Down