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

front: fixed bug or first number of the position field cannot be cleared #7879

Merged
merged 1 commit into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion front/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@
"offset": {
"label": "Position",
"description": "Offset of the point in meters to the beginning of the track section",
"error": "The offset of the split point to the beginning must be greater than 0 and smaller than {{max}}"
"error": "The offset of the split point to the beginning must be greater than 1 and smaller than {{max}}"
},
"actions": {
"save": "Save the split"
Expand Down
2 changes: 1 addition & 1 deletion front/public/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@
"offset": {
"label": "Position",
"description": "Distance entre le point et le début du TIV (en mètres)",
"error": "La position doit être un nombre compris entre 0 et {{max}}"
"error": "La position doit être un nombre compris entre 1 et {{max}}"
},
"actions": {
"save": "Sauvegarder la division"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ const TrackSplitLeftPanel: FC<unknown> = () => {
id="offset"
type="number"
inputProps={{ required: true }}
value={state.offset / 1000}
min={0}
value={state.offset === 0 ? '' : state.offset / 1000}
anisometropie marked this conversation as resolved.
Show resolved Hide resolved
min={1}
max={trackLength}
whiteBG
focus
Expand All @@ -100,8 +100,10 @@ const TrackSplitLeftPanel: FC<unknown> = () => {
: undefined
}
onChange={(e) => {
if (!Number.isNaN(e.target.valueAsNumber))
setState((prev) => ({ ...prev, offset: e.target.valueAsNumber * 1000 }));
setState((prev) => ({
...prev,
offset: e.target.valueAsNumber * 1000 || 0,
}));
}}
/>
</form>
Expand Down
Loading