-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged PR 32003: Stadspas ui verbeteringen
- Na uitloggen blijft de knop om pas te laten zien op het home scherm staan (of komt dat om dat het uitloggen toch niet helemaal goed ging?) - gefixt - Het scherm van Tegoed betalingen kan weer scrollen - Passen tonen vanaf pashouder toont goede pas in pas swiper - foutmeldingen op detailscherm staan op de goede plek - pas-tonen knop kijkt zelf of die getoond moet worden en bepaalt aantal passen voor label - componenten in mappen gezet voor beter overzicht To do: - Eerst bolletje wit maken wanneer eerste pas wordt getoond. Gaat wel goed wanneer start index anders dan 0 is. Related work items: #124490
- Loading branch information
Showing
27 changed files
with
253 additions
and
149 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
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 |
---|---|---|
@@ -1,23 +1,25 @@ | ||
import simplur from 'simplur' | ||
import {Button} from '@/components/ui/buttons/Button' | ||
import {useDispatch} from '@/hooks/redux/useDispatch' | ||
import {useGetSecureCityPasses} from '@/modules/city-pass/hooks/useGetSecureCityPasses' | ||
import {showCityPasses} from '@/modules/city-pass/slice' | ||
|
||
type Props = { | ||
passCount: number | ||
index?: number | ||
} | ||
|
||
export const ShowCityPassButton = ({passCount}: Props) => { | ||
export const ShowCityPassButton = ({index}: Props) => { | ||
const dispatch = useDispatch() | ||
const cityPasses = useGetSecureCityPasses() | ||
|
||
return ( | ||
return cityPasses.length ? ( | ||
<Button | ||
iconName="city-pass-pass" | ||
label={simplur`Laat mijn [pas|passen] zien${[passCount]}`} | ||
label={simplur`Laat mijn [pas|passen] zien${[cityPasses.length]}`} | ||
onPress={() => { | ||
dispatch(showCityPasses()) | ||
dispatch(showCityPasses(index)) | ||
}} | ||
testID="CityPassLogoutButton" | ||
/> | ||
) | ||
) : null | ||
} |
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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
79 changes: 79 additions & 0 deletions
79
src/modules/city-pass/components/details/CityPassDetails.tsx
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,79 @@ | ||
import {skipToken} from '@reduxjs/toolkit/query' | ||
import {Box} from '@/components/ui/containers/Box' | ||
import {PleaseWait} from '@/components/ui/feedback/PleaseWait' | ||
import {SomethingWentWrong} from '@/components/ui/feedback/SomethingWentWrong' | ||
import {Column} from '@/components/ui/layout/Column' | ||
import {useGetSecureItem} from '@/hooks/secureStorage/useGetSecureItem' | ||
import {BudgetBalanceButton} from '@/modules/city-pass/components/BudgetBalanceButton' | ||
import {ShowCityPassButton} from '@/modules/city-pass/components/ShowCityPassButton' | ||
import {CityPassDetailsInfo} from '@/modules/city-pass/components/details/CityPassDetailsInfo' | ||
import {CityPassDetailsName} from '@/modules/city-pass/components/details/CityPassDetailsName' | ||
import {DiscountTransactions} from '@/modules/city-pass/components/transactions/DiscountTransactions' | ||
import {SOMETHING_WENT_WRONG_TEXT} from '@/modules/city-pass/constants' | ||
import {useGetCityPassesQuery} from '@/modules/city-pass/service' | ||
import {CityPass} from '@/modules/city-pass/types' | ||
import {SecureItemKey} from '@/utils/secureStorage' | ||
|
||
type Props = { | ||
passNumber: CityPass['passNumber'] | ||
} | ||
|
||
export const CityPassDetails = ({passNumber}: Props) => { | ||
const {item: secureAccessToken} = useGetSecureItem( | ||
SecureItemKey.cityPassAccessToken, | ||
) | ||
|
||
const { | ||
data: cityPasses, | ||
isLoading, | ||
isError, | ||
} = useGetCityPassesQuery(secureAccessToken ? secureAccessToken : skipToken) | ||
const cityPass = cityPasses?.find(cp => cp.passNumber === passNumber) | ||
const cityPassIndex = cityPasses?.findIndex( | ||
cp => cp.passNumber === passNumber, | ||
) | ||
|
||
if (isLoading) { | ||
return ( | ||
<Box grow> | ||
<Column gutter="md"> | ||
<PleaseWait testID="CityPassDashboardPleaseWait" /> | ||
<ShowCityPassButton index={cityPassIndex} /> | ||
</Column> | ||
</Box> | ||
) | ||
} | ||
|
||
return ( | ||
<Box grow> | ||
<Column gutter="lg"> | ||
{!!cityPass && <CityPassDetailsName cityPass={cityPass} />} | ||
<ShowCityPassButton index={cityPassIndex} /> | ||
{!cityPass || isError ? ( | ||
<SomethingWentWrong | ||
testID="CityPassDetailsSomethingWentWrong" | ||
text={SOMETHING_WENT_WRONG_TEXT} | ||
title="" | ||
/> | ||
) : ( | ||
<Column gutter="xl"> | ||
<Column gutter="lg"> | ||
<CityPassDetailsInfo cityPass={cityPass} /> | ||
{cityPass.budgets?.map(budget => ( | ||
<BudgetBalanceButton | ||
budget={budget} | ||
key={budget.code} | ||
passNumber={passNumber} | ||
/> | ||
))} | ||
</Column> | ||
<DiscountTransactions | ||
dateEnd={cityPass.dateEnd} | ||
passNumber={passNumber} | ||
/> | ||
</Column> | ||
)} | ||
</Column> | ||
</Box> | ||
) | ||
} |
60 changes: 60 additions & 0 deletions
60
src/modules/city-pass/components/details/CityPassDetailsInfo.tsx
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,60 @@ | ||
import {HideFromAccessibility} from '@/components/features/accessibility/HideFromAccessibility' | ||
import {Button} from '@/components/ui/buttons/Button' | ||
import {SingleSelectable} from '@/components/ui/containers/SingleSelectable' | ||
import {Column} from '@/components/ui/layout/Column' | ||
import {Row} from '@/components/ui/layout/Row' | ||
import {Phrase} from '@/components/ui/text/Phrase' | ||
import {useNavigation} from '@/hooks/navigation/useNavigation' | ||
import {CityPassDetailsPassNumber} from '@/modules/city-pass/components/details/CityPassDetailsPassNumber' | ||
import {CityPassRouteName} from '@/modules/city-pass/routes' | ||
import {CityPass} from '@/modules/city-pass/types' | ||
|
||
type Props = { | ||
cityPass: CityPass | ||
} | ||
|
||
export const CityPassDetailsInfo = ({cityPass}: Props) => { | ||
const {navigate} = useNavigation() | ||
const {dateEndFormatted, id, passNumberComplete, securityCode} = cityPass | ||
|
||
return ( | ||
<Column gutter="md"> | ||
<CityPassDetailsPassNumber passNumberComplete={passNumberComplete} /> | ||
{!!securityCode && ( | ||
<Row | ||
align="between" | ||
gutter="md" | ||
valign="center"> | ||
<HideFromAccessibility> | ||
<Phrase testID="CityPassCityPassDetailsSecurityCodeLabel"> | ||
Beveiligingscode | ||
</Phrase> | ||
</HideFromAccessibility> | ||
<Button | ||
accessibilityLabel="Toon beveiligingscode" | ||
label="Toon" | ||
onPress={() => { | ||
navigate(CityPassRouteName.securityCode, {id}) | ||
}} | ||
testID="CityPassCityPassDetailsSecurityCodeButton" | ||
variant="secondary" | ||
/> | ||
</Row> | ||
)} | ||
<SingleSelectable testID="CityPassCityPassDetailsExpiryDate"> | ||
<Row | ||
align="between" | ||
gutter="md"> | ||
<Phrase testID="CityPassCityPassDetailsExpiryDateLabel"> | ||
Geldig tot en met | ||
</Phrase> | ||
<Phrase | ||
emphasis="strong" | ||
testID="CityPassCityPassDetailsExpiryDateValue"> | ||
{dateEndFormatted} | ||
</Phrase> | ||
</Row> | ||
</SingleSelectable> | ||
</Column> | ||
) | ||
} |
31 changes: 31 additions & 0 deletions
31
src/modules/city-pass/components/details/CityPassDetailsName.tsx
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,31 @@ | ||
import {SingleSelectable} from '@/components/ui/containers/SingleSelectable' | ||
import {Column} from '@/components/ui/layout/Column' | ||
import {Phrase} from '@/components/ui/text/Phrase' | ||
import {Title} from '@/components/ui/text/Title' | ||
import {CityPass} from '@/modules/city-pass/types' | ||
|
||
type Props = { | ||
cityPass: CityPass | ||
} | ||
|
||
export const CityPassDetailsName = ({cityPass}: Props) => { | ||
const {firstname, infix, lastname} = cityPass.owner | ||
|
||
return ( | ||
<Column halign="center"> | ||
<SingleSelectable testID="CityPassCityPassDetailsName"> | ||
<Title | ||
testID="CityPassCityPassDetailsTitle" | ||
text={firstname} | ||
textAlign="center" | ||
/> | ||
<Phrase | ||
emphasis="strong" | ||
testID="CityPassCityPassDetailsSubtitle" | ||
textAlign="center"> | ||
{`${infix ? infix + ' ' : ''}${lastname}`} | ||
</Phrase> | ||
</SingleSelectable> | ||
</Column> | ||
) | ||
} |
File renamed without changes.
File renamed without changes.
Oops, something went wrong.