PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.17.0
GiveWP – Donation Plugin and Fundraising Platform v4.17.0
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 / admin / components / EventDetailsPage / index.tsx

index.tsx in GiveWP – Donation Plugin and Fundraising Platform 4.17.0, at src/EventTickets/resources/admin/components/EventDetailsPage/index.tsx

76 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import {useState} from 'react';
2 import cx from 'classnames';
3 import {__} from '@wordpress/i18n';
4 import {GiveIcon} from '@givewp/components';
5 import styles from './EventDetailsPage.module.scss';
6 import {GiveEventTicketsDetails} from './types';
7 import EventSection from './EventSection';
8 import TicketTypesSection from './TicketTypesSection';
9 import DonationFormsSection from './DonationFormsSection';
10 import AttendeesSection from './AttendeesSection';
11
12 declare global {
13 interface Window {
14 GiveEventTicketsDetails: GiveEventTicketsDetails;
15 }
16 }
17
18 const tabs = {
19 overview: __('Overview', 'give'),
20 attendees: __('Attendees', 'give'),
21 };
22
23 export default function EventDetailsPage() {
24 const [activeTab, setActiveTab] = useState<'overview' | 'attendees'>('overview');
25 const [updateErrors, setUpdateErrors] = useState<{errors: Array<number>; successes: Array<number>}>({
26 errors: [],
27 successes: [],
28 });
29
30 return (
31 <>
32 <article className={styles.page}>
33 <header className={styles.pageHeader}>
34 <div className={styles.flexRow}>
35 <GiveIcon size={'1.875rem'} />
36 <h1 className={styles.pageTitle}>{__('Event details', 'give')}</h1>
37 </div>
38 <div className={styles.flexRow}>
39 <a
40 href={`${window.GiveEventTicketsDetails.adminUrl}edit.php?post_type=give_forms&page=give-event-tickets`}
41 className={`button button-secondary ${styles.goToEventsListButton}`}
42 >
43 {__('Go to events list', 'give')}
44 </a>
45 </div>
46 </header>
47 <div className={cx('wp-header-end', 'hidden')} />
48
49 <nav className={styles.tabsNav}>
50 {Object.keys(tabs).map((tab) => (
51 <button
52 key={tab}
53 className={cx(styles.tabButton, activeTab === tab && styles.activeTab)}
54 onClick={() => setActiveTab(tab as 'overview' | 'attendees')}
55 >
56 {tabs[tab]}
57 </button>
58 ))}
59 </nav>
60
61 <div className={styles.pageContent}>
62 {activeTab === 'attendees' ? (
63 <AttendeesSection />
64 ) : (
65 <>
66 <EventSection setUpdateErrors={setUpdateErrors} />
67 <TicketTypesSection />
68 <DonationFormsSection />
69 </>
70 )}
71 </div>
72 </article>
73 </>
74 );
75 }
76