Skip to content

PB-424: Time slider year entry button#782

Merged
LukasJoss merged 9 commits intodevelopfrom
feat-PB-424-time-slider-year-entry-button
Apr 19, 2024
Merged

PB-424: Time slider year entry button#782
LukasJoss merged 9 commits intodevelopfrom
feat-PB-424-time-slider-year-entry-button

Conversation

@LukasJoss
Copy link
Contributor

@LukasJoss LukasJoss commented Apr 12, 2024

@cypress
Copy link

cypress bot commented Apr 12, 2024

Passing run #1801 ↗︎

0 162 19 0 Flakiness 0

Details:

PB-424: Add translation to invalid time slider year message
Project: web-mapviewer Commit: eb1587d347
Status: Passed Duration: 06:30 💡
Started: Apr 19, 2024 10:33 AM Ended: Apr 19, 2024 10:40 AM

Review all test suite changes for PR #782 ↗︎

@LukasJoss LukasJoss force-pushed the feat-PB-424-time-slider-year-entry-button branch 3 times, most recently from 466ab84 to dbf8d93 Compare April 12, 2024 14:34
@LukasJoss LukasJoss requested review from ltkum, ltshb and pakb April 12, 2024 14:45
Comment on lines +307 to +357
<input
v-model="displayedYear"
data-cy="time-slider-bar-cursor-year"
maxlength="4"
class="time-slider-bar-cursor-year"
type="text"
@input="setYearToInputIfValid"
/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The input should only allow numbers and a valid year between the min an max defined. If an invalid year is provided the input box should be marked as invalid in red using the bootstrap validation (see https://getbootstrap.com/docs/5.0/forms/validation/ and some example in the code).
Pressing enter should validate the year and exit the input editing.
On the year input we should not allow to grab and move the cursor as it make almost impossible to select the year by click and select.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a specific reason why the year should only be evaluated after pressing enter? I personally prefer if it auto validates after the input contains four characters

Copy link
Contributor

@ltkum ltkum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was not so sure about the watcher, but in the end, it's a durable approach if we start modifying currentYear in multiple part of the file.

After testing a bit (and checking the legacy viewer), there is something that's not very user friendly : when selecting the input field and keeping the mouse pressed, we both move the time slider and the selection within the input field.
On the old mapviewer, only the sides of the time slider cursor allowed it to move, and the middle was only an input field. I would also keep it like that :
clicking on the input field : does not call the 'onMouseDown' event which allows the time slider to move and to set a year.
clicking on the sides : same behavior as now.

this would also reduce a bit the commits sent by the timeSlider

@ltshb what do you think ? (we can totally do this in a second time)

Comment on lines +280 to +281
currentYear.value = parseInt(displayedYear.value)
setCurrentYearAndDispatchToStore(currentYear.value)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currentYear is already set within 'setCurrentYearAndDispatchToStore', there is no need to assign its value here.

@LukasJoss LukasJoss force-pushed the feat-PB-424-time-slider-year-entry-button branch 2 times, most recently from b5d2302 to 17b712b Compare April 17, 2024 13:50
@LukasJoss LukasJoss requested a review from ltshb April 17, 2024 13:58
Copy link
Contributor

@ltshb ltshb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code is good just about the language changes in the tippy. Also the translation needs to be updated, you can send me the translation by slack and I add them to the spreadsheet.

Comment on lines +178 to +186
tippyInstance = tippy(yearCursorInput.value, {
content:
i18n.t('outside_valid_year_range') +
'{' +
ALL_YEARS[0] +
'-' +
ALL_YEARS[ALL_YEARS.length - 1] +
'}',
arrow: true,
hideOnClick: false,
placement: 'bottom',
trigger: 'manual',
theme: 'danger',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to manage the content also when the language changes

@LukasJoss LukasJoss force-pushed the feat-PB-424-time-slider-year-entry-button branch 2 times, most recently from 53c6c99 to 931d920 Compare April 19, 2024 08:34
@LukasJoss LukasJoss requested a review from ltshb April 19, 2024 08:40
Copy link
Contributor

@ltshb ltshb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a slight tooltip formating improvment

Comment on lines +198 to +203
i18n.t('outside_valid_year_range') +
'{' +
ALL_YEARS[0] +
'-' +
ALL_YEARS[ALL_YEARS.length - 1] +
'}'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perso I would not use the {} simply

return `${i18n.t('outside_valid_year_range')} ${ALL_YEARS[0]}-${ALL_YEARS[ALL_YEARS.length - 1]}`

The output will look nicer less coding.

@LukasJoss LukasJoss force-pushed the feat-PB-424-time-slider-year-entry-button branch from 931d920 to edcdf98 Compare April 19, 2024 10:12
@LukasJoss LukasJoss force-pushed the feat-PB-424-time-slider-year-entry-button branch from edcdf98 to eb1587d Compare April 19, 2024 10:27
@LukasJoss LukasJoss merged commit 07e2d53 into develop Apr 19, 2024
@LukasJoss LukasJoss deleted the feat-PB-424-time-slider-year-entry-button branch April 19, 2024 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants