Skip to content
This repository has been archived by the owner on Mar 10, 2022. It is now read-only.

(PC-11116): Allow pro user with no structures to reach refunds page #1523

Merged
merged 2 commits into from
Oct 18, 2021

Conversation

asagot-ansa
Copy link
Contributor

@asagot-ansa asagot-ansa commented Oct 12, 2021

Ajout d'une vérification sur la possibilité d'avoir une liste de venues vide renvoyées par l'API quand l'utilisateur n'a pas de structures rattachées; auquel cas on affiche un message d'informations plutôt qu'avoir un loader infini.

@asagot-ansa asagot-ansa force-pushed the pc-11116-no-results-page-refunds branch from 31c4fdb to 66e2e7d Compare October 12, 2021 12:41
@codecov
Copy link

codecov bot commented Oct 12, 2021

Codecov Report

Merging #1523 (91a1de7) into master (b5b379a) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1523      +/-   ##
==========================================
+ Coverage   87.87%   87.88%   +0.01%     
==========================================
  Files         377      377              
  Lines        6400     6406       +6     
  Branches     1745     1750       +5     
==========================================
+ Hits         5624     5630       +6     
  Misses        748      748              
  Partials       28       28              
Impacted Files Coverage Δ
src/components/layout/CsvTable/CsvTable.jsx 100.00% <100.00%> (ø)
...pages/Reimbursements/ReimbursementsWithFilters.jsx 98.38% <100.00%> (+0.17%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b5b379a...91a1de7. Read the comment docs.

@asagot-ansa asagot-ansa force-pushed the pc-11116-no-results-page-refunds branch from 66e2e7d to 698cc4c Compare October 12, 2021 15:25
Copy link
Contributor

@gael-boyenval gael-boyenval left a comment

Choose a reason for hiding this comment

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

LGTM : nickel!
une petite proposition pour simplifier la lecture, à prendre ou à laisser

Comment on lines 133 to 142
{isLoading ? (
<Spinner />
) : (
venuesOptions.length ? (
<>
<p>
Les remboursements s’effectuent tous les 15 jours, rétroactivement suite à la validation
d’une contremarque dans le guichet ou à la validation automatique des contremarques
d’évènements. Cette page est automatiquement mise à jour à chaque remboursement.
</p>
Copy link
Contributor

Choose a reason for hiding this comment

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

Je pense que c'est pas mal tant que possible d'éviter les if imbriqués, surtout quand l'enfant est aussi long (arrivé en bas de la lecture du composant, on a oublié dans quel test on se trouve)
pour la lecture, peut-être un truc comme :

Suggested change
{isLoading ? (
<Spinner />
) : (
venuesOptions.length ? (
<>
<p>
Les remboursements s’effectuent tous les 15 jours, rétroactivement suite à la validation
d’une contremarque dans le guichet ou à la validation automatique des contremarques
d’évènements. Cette page est automatiquement mise à jour à chaque remboursement.
</p>
{ isLoading && <Spinner /> }
{ hasNoResults && (...no result message) }
{ hasResults && (le form) }

et une définition plus haut

const hasNoResults = !isLoading && !venuesOptions.length
const hasResults = !isLoading && !!venuesOptions.length // ou venuesOptions.length > 0

@asagot-ansa asagot-ansa merged commit 41c2aef into master Oct 18, 2021
@asagot-ansa asagot-ansa deleted the pc-11116-no-results-page-refunds branch October 18, 2021 07:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants