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

(PC-34793) feat(BookingPage): disposal forbidden banner #7776

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
60 changes: 37 additions & 23 deletions src/features/bookings/components/BookingDetailsContent.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import React from 'react'
import { ScrollView } from 'react-native'
import styled from 'styled-components/native'

import { BookingOfferResponseAddress, BookingReponse, BookingVenueResponse } from 'api/gen'
import { TicketCutout } from 'features/bookings/components/TicketCutout'
Expand All @@ -7,6 +9,7 @@ import { BookingProperties } from 'features/bookings/types'
import { VenueBlockAddress, VenueBlockVenue } from 'features/offer/components/OfferVenueBlock/type'
import { VenueBlockWithItinerary } from 'features/offer/components/OfferVenueBlock/VenueBlockWithItinerary'
import { formatFullAddress } from 'shared/address/addressFormatter'
import { ErrorBanner } from 'ui/components/banners/ErrorBanner'
import { InfoBanner } from 'ui/components/banners/InfoBanner'
import { IdCard } from 'ui/svg/icons/IdCard'
import { getSpacing, TypoDS } from 'ui/theme'
Expand All @@ -30,30 +33,36 @@ export const BookingDetailsContent = ({
!!offerFullAddress && (properties.isEvent || (properties.isPhysical && !properties.isDigital))

const { hourLabel, dayLabel } = getBookingLabels(booking, properties)

return (
<TicketCutout
hour={hourLabel == '' ? undefined : hourLabel}
day={dayLabel == '' ? undefined : dayLabel}
isDuo={properties.isDuo}
venueInfo={
<VenueBlockWithItinerary
shouldDisplayItineraryButton={shouldDisplayItineraryButton}
offerFullAddress={offerFullAddress}
venue={getVenueBlockVenue(booking.stock.offer.venue)}
address={getVenueBlockAddress(booking.stock.offer.address)}
offerId={offer.id}
thumbnailSize={VENUE_THUMBNAIL_SIZE}
/>
}
title={offer.name}
infoBanner={
<InfoBanner
message="Tu auras besoin de ta carte d’identité pour accéder à l’évènement."
icon={IdCard}
/>
}>
<TypoDS.Body>qrcode</TypoDS.Body>
</TicketCutout>
<ScrollView>
<TicketCutout
hour={hourLabel == '' ? undefined : hourLabel}
day={dayLabel == '' ? undefined : dayLabel}
isDuo={properties.isDuo}
venueInfo={
<VenueBlockWithItinerary
shouldDisplayItineraryButton={shouldDisplayItineraryButton}
offerFullAddress={offerFullAddress}
venue={getVenueBlockVenue(booking.stock.offer.venue)}
address={getVenueBlockAddress(booking.stock.offer.address)}
offerId={offer.id}
thumbnailSize={VENUE_THUMBNAIL_SIZE}
/>
}
title={offer.name}
infoBanner={
<InfoBanner
message="Tu auras besoin de ta carte d’identité pour accéder à l’évènement."
icon={IdCard}
/>
}>
<TypoDS.Body>qrcode</TypoDS.Body>
</TicketCutout>
<ErrorBannerContainer>
<ErrorBanner message="Tu n’as pas le droit de céder ou de revendre ton billet." />
</ErrorBannerContainer>
</ScrollView>
)
}

Expand All @@ -66,3 +75,8 @@ function getVenueBlockAddress(
): VenueBlockAddress | undefined {
return address ?? undefined
}

const ErrorBannerContainer = styled.View({
marginHorizontal: getSpacing(6),
marginTop: getSpacing(8),
})
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,16 @@ describe('BookingDetails', () => {
openItinerary.mockRestore()
getBookingProperties.mockRestore()
})

it('should display banner warning about disposal', async () => {
renderBookingDetails(ongoingBookings)

await screen.findByText(ongoingBookings.stock.offer.name)

expect(
screen.getByText('Tu n’as pas le droit de céder ou de revendre ton billet.')
).toBeOnTheScreen()
})
})
})

Expand Down
Loading