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

refactor/ui(directions): directions component refactor #1685

Open
wants to merge 17 commits into
base: next
Choose a base branch
from

Conversation

LAMM26
Copy link
Contributor

@LAMM26 LAMM26 commented May 31, 2024

Please check if the PR fulfills these requirements

What is the current behavior? (You can also link to an open issue here)
After having deployed the private routing option and having multiple feedback from different users on the component, many features were not clear or unknown to many of them and/or the UI was not user-friendly.

What is the new behavior?

  • Code refactored for the main component and its sub-components, including cleaning the code, adding strong-typed code, deleting unused classes, methods, variables, etc.
  • Changes to UI:
    • Placeholder in stop to indicate what action the user can do.
    • Formatting of coordinates of stop.
    • 'Add intermediate stop' button moved between starting point end destination stops.
    • Actions (zoom, copy, download) moved below inputs for added clarity.
    • Move stop, clear stop and delete stop always showing, not only on hover.
    • Icons changed in steps
    • Better formatting of duration and distance travelled.
    • Formatting and adjustments of copied directions and download directions
  • New feature:
    • When tracking is active, the user can select his current location as a stop

image

Does this PR introduce a breaking change? (check one with "x")

  • Yes
  • No

If this PR contains a breaking change, please describe the impact and migration path for existing applications:

Other information:

@LAMM26 LAMM26 marked this pull request as ready for review June 5, 2024 13:39
Copy link
Collaborator

@alecarn alecarn left a comment

Choose a reason for hiding this comment

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

Premier tests

  1. À l'ajout d'un premier point , on déclanche la requête et on obtient une erreur. Tout comme au deuxième image
  2. Modifier la coordonée directement dans l'input ne change pas la position sur la carte et ne trigger pas une nouvelle recherche d'itinéraire.

Proposition:

  1. Est-ce qu'on pourrait afficher les boutons de drag et de supression seulement lorsqu'on hover la ligne avec le curseur?
  2. Avoir au moins un point de départ et d'arrivée avant de proposer d'ajouter un point intermédiaire?
  3. Google Map, au lieu d'ajouter un point intermédiaire, ils utilisent ajouter une destination et il positionne le bouton à la fin.

'\n';
localCnt++;
});
// URL
Copy link
Collaborator

Choose a reason for hiding this comment

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

Idéalement supprimer les commentaires qui n'ajoute pas de valeur. Si c'est pour indiquer des sections d'une méthode c'est souvent un signe qu'on pourrait la décomposer en sous-méthode pour améliorer la lisibilité. Par exemple, getSummary(), getUrl(), getBody()

*
* @return {string | undefined} The generated link, or undefined if the route service is not available.
*/
private getLink(): string {
Copy link
Collaborator

Choose a reason for hiding this comment

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

On pourrait corriger le type de retour pour string | undefined comme en commentaire

.all()
.map((stop) => roundCoordTo(stop.coordinates, 6));
let directionsUrl = '';
.map((stop: Stop) => roundCoordTo(stop.coordinates, 6));
Copy link
Collaborator

Choose a reason for hiding this comment

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

On n'est pas obligé d'ajouter les types lorsque Typescript est capable de le déduire. Par exemple ici (stop: Stop), la définition du type est optionnel parce que le stopsStore indique déjà le type de la propriété view et le bon type sera déduit par Typescript. L'intellisense nous donne une bonne indiquation si l'inférence de Typescript fonctionne ou non et parfois on doit l'ajouter mais dans la majorité du cas ça l'ajoute une pollution visuel.

Tout comme let directionsUrl: string = ''; vu qu'on initialise la variable avec un string vide, Typescript peut déjà déduire le bon type.

<div class="igo-input-container" *ngIf="directions && activeDirection">
<mat-form-field *ngIf="directions && directions.length > 1">
<div class="igo-input-container" *ngIf="routes && activeRoute">
<mat-form-field *ngIf="routes?.length > 1" [matTooltip]="activeRoute.title">
Copy link
Collaborator

Choose a reason for hiding this comment

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

On peut enlever le optionnal chaining on a une condition qui vérifie si routes est défini

formatDuration(activeRoute.duration) +
')'
: ''
}}
Copy link
Collaborator

Choose a reason for hiding this comment

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

On pourrait faire une méthode getRouteTitle pour améliorer la lisibilité du template

@@ -64,7 +68,7 @@ export interface SourceProposal {
meta: SearchMeta;
}

export interface Direction {
export interface Directions {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Pourquoi le pluriel? Habituellement, c'est utilisé pour représenter une Liste

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Purement sémantique, en anglais 'Direction' est une direction cardinale (nord, est, droite, gauche), 'Directions' est la série d'instructions pour aller à un endroit, ce qui fait plus de sens dans le contexte. Google Maps parle de 'Directions' par exemple

@@ -131,146 +137,191 @@ export class DirectionsService {
doc.setFontSize(10);
doc.text(attributionText, xPosition, yPosition);
}
}
}*/
Copy link
Collaborator

Choose a reason for hiding this comment

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

Faire le ménage, supprimer le code commenté

@@ -27,6 +27,7 @@ import {
PrintPaperFormat,
PrintResolution
} from './print.type';
import { Size } from 'ol/size';
Copy link
Collaborator

Choose a reason for hiding this comment

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

On ajoute une nouvelle dépendance à Openlayers. Idéalement, on aimerait faire abstraction de Ol pour les types lorsqu'on peut le faire.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Je vais changer pour number[]

@Input() debounce: number = 200;
@Input() length: number = 2;
@Input() coordRoundedDecimals: number = 6;
@Input() zoomToActiveRoute$: Subject<void> = new Subject();
@Input() zoomOnActiveRoute$: Subject<void> = new Subject();
@Input() authenticated$: BehaviorSubject<boolean>;
Copy link
Collaborator

Choose a reason for hiding this comment

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

On pourrait améliorer la composition en spécifiant quel @input est requis, par ex: @Input({ required: true })

@LAMM26
Copy link
Contributor Author

LAMM26 commented Sep 20, 2024

Premier tests

  1. À l'ajout d'un premier point , on déclanche la requête et on obtient une erreur. Tout comme au deuxième image
  2. Modifier la coordonée directement dans l'input ne change pas la position sur la carte et ne trigger pas une nouvelle recherche d'itinéraire.

Proposition:

  1. Est-ce qu'on pourrait afficher les boutons de drag et de supression seulement lorsqu'on hover la ligne avec le curseur?
  2. Avoir au moins un point de départ et d'arrivée avant de proposer d'ajouter un point intermédiaire?
  3. Google Map, au lieu d'ajouter un point intermédiaire, ils utilisent ajouter une destination et il positionne le bouton à la fin.

Je ne suis pas capable d'avoir l'erreur au premier et deuxième clic.

Changer le texte des coordonnées ne change pas la pin en effet mais il iCherche devrait faire une nouvelle proposition. J'ai enlever le comportement qu'on doit cliquer sur le x rouge avant de pouvoir sélectionner un nouveau point dans la carte aussi.

J'ai mis le drag et le delete au hover seulement. On ajoute aussi une destination maintenant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants