PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.15.5
GiveWP – Donation Plugin and Fundraising Platform v4.15.5
4.17.0 4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 All 256 releases
give / src / EventTickets / resources / blocks / EventTicketsBlock / Edit / BlockPlaceholder.tsx

BlockPlaceholder.tsx in GiveWP – Donation Plugin and Fundraising Platform 4.15.5, at src/EventTickets/resources/blocks/EventTicketsBlock/Edit/BlockPlaceholder.tsx

41 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import EventTicketsHeader from '../../../components/EventTicketsHeader';
2 import EventTicketsDescription from '../../../components/EventTicketsDescription';
3 import EventTicketsList from '../../../components/EventTicketsList';
4 import {getWindowData} from '@givewp/form-builder/common';
5
6 /**
7 * @since 3.20.0 Hide tickets once the event has ended.
8 * @since 3.6.0
9 */
10 export default function BlockPlaceholder({attributes}) {
11 const {events, ticketsLabel, soldOutMessage} = window.eventTicketsBlockSettings;
12 const event = events.find((event) => event.id === attributes.eventId);
13 const {currency} = getWindowData();
14
15 if (!event) {
16 return null;
17 }
18
19 const startDateTimeObj = new Date(event.startDateTime);
20 const endDateTimeObj = new Date(event.endDateTime);
21 const hasEnded = endDateTimeObj < new Date();
22
23 return (
24 <div className={'givewp-event-tickets-block__placeholder'}>
25 <div className={'givewp-event-tickets'}>
26 <EventTicketsHeader title={event.title} startDateTime={startDateTimeObj} endDateTime={endDateTimeObj} />
27
28 {event.description && <EventTicketsDescription description={event.description} />}
29
30 {!hasEnded && (
31 <EventTicketsList
32 ticketTypes={event.ticketTypes}
33 currency={currency}
34 currencyRate={1}
35 />
36 )}
37 </div>
38 </div>
39 );
40 }
41