-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
375a932
commit c69ba91
Showing
10 changed files
with
111 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# TODO | ||
|
||
## Links | ||
|
||
- [PC-TicketNumber](https://passculture.atlassian.net/browse/PC-TicketNumber) | ||
- [MobTime](https://mobtime.hadrienmp.fr/mob/pass-culture) | ||
|
||
--- | ||
|
||
## Tasks | ||
|
||
- [ ] CAS 0 : Utilisation de `formatToFrenchDecimal()` | ||
- [ ] Modifier `formatToFrenchDecimal()` pour qu'il fasse la conversion en XPF | ||
|
||
|
||
- [ ] CAS 1 : Prix en dur dans le code : | ||
- [ ] 1.1 : Crédits par âges | ||
- [ ] Utiliser `useDepositAmountsByAge()` lorsque le crédit est marqué en dur car il utilise directement `formatToFrenchDecimal()`: | ||
- [ ] `300\u00a0€` | ||
- [ ] `30\u00a0€` | ||
- [ ] `20\u00a0€` | ||
- [ ] 1.2 : Crédit par seuil comme la part pour les offres numériques (plus tard le spectacle vivant) | ||
- [ ] Utiliser `formatToFrenchDecimal(NUMERIC_AMOUNT)` | ||
- [ ] Créer une constante la part du crédit pour les offres numériques. ex: const NUMERIC_AMOUNT = 10.000. | ||
|
||
|
||
- [ ] CAS 2 : Utilisation de `useMaxPrice()` (ex `${maxPrice}\u00a0€ ...`) | ||
- [ ] Utiliser des centimes plutôt que des euros dans `useMaxPrice()` ? | ||
|
||
|
||
- [ ] CAS 3 : Utilisation de `getDisplayPrice()` (ex: `dès 15,60\u00a0€` (tableau de prix)) | ||
|
||
|
||
- [ ] CAS 4 : Utilisation de `formatPriceInEuroToDisplayPrice()` | ||
|
||
|
||
- [ ] CAS 5 : Mention de "€" (ex: `en €`) | ||
- [ ] Créer une fonction qui ne gère pas les crédits mais juste les devises | ||
|
||
--- | ||
|
||
## Tasks for another US | ||
|
||
- [ ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { MAX_PRICE } from 'features/search/helpers/reducer.helpers' | ||
import { useLocation } from 'libs/location' | ||
import { EURO_TO_XPF_RATE } from 'libs/parsers/pricesConversion' | ||
|
||
export const useGetMaxPrice = (): number => { | ||
const { selectedPlace } = useLocation() | ||
const isNewCaledonianLocation = selectedPlace?.info === 'Nouvelle-Calédonie' | ||
|
||
return isNewCaledonianLocation ? MAX_PRICE * EURO_TO_XPF_RATE : MAX_PRICE | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,17 @@ | ||
import { useAuthContext } from 'features/auth/context/AuthContext' | ||
import { isUserExBeneficiary } from 'features/profile/helpers/isUserExBeneficiary' | ||
import { MAX_PRICE } from 'features/search/helpers/reducer.helpers' | ||
import { useGetMaxPrice } from 'features/search/helpers/useMaxPrice/useGetMaxPrice' | ||
import { convertCentsToEuros } from 'libs/parsers/pricesConversion' | ||
|
||
export const useMaxPrice = (): number => { | ||
const maxPrice = useGetMaxPrice() | ||
const { user } = useAuthContext() | ||
|
||
const initialCredit = user?.domainsCredit?.all.initial | ||
|
||
if (!user || !initialCredit) return MAX_PRICE | ||
if (!user || !initialCredit) return maxPrice | ||
|
||
if (isUserExBeneficiary(user) || initialCredit === 0) return MAX_PRICE | ||
if (isUserExBeneficiary(user) || initialCredit === 0) return maxPrice | ||
|
||
return convertCentsToEuros(initialCredit) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/features/search/pages/modals/PriceModal/useCurrencyToDisplay.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { useLocation } from 'libs/location' | ||
|
||
export const useCurrencyToDisplay = () => { | ||
const { selectedPlace } = useLocation() | ||
const isNewCaledonianLocation = selectedPlace?.info === 'Nouvelle-Calédonie' | ||
|
||
return isNewCaledonianLocation ? 'CSP' : '€' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters