@nnc-digital/nnc-design-system 1.0.0-beta17 → 1.0.0-beta18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.d.ts +2 -0
- package/build/index.esm.js +814 -1
- package/build/index.esm.js.map +1 -1
- package/build/index.js +823 -0
- package/build/index.js.map +1 -1
- package/build/index.mjs.js +814 -1
- package/build/index.mjs.js.map +1 -1
- package/build/library/library/structure/HeroImage/HeroImage.storydata.d.ts +0 -1
- package/build/library/structure/HeroImage/HeroImage.storydata.d.ts +0 -1
- package/build/src/index.d.ts +2 -0
- package/build/src/library/structure/HeroImage/HeroImage.storydata.d.ts +0 -1
- package/build/src/themes/ThemeUtils.d.ts +95 -0
- package/build/themes/ThemeUtils.d.ts +95 -0
- package/build/themes/themes/ThemeUtils.d.ts +95 -0
- package/package.json +1 -1
package/build/index.esm.js
CHANGED
|
@@ -33703,5 +33703,818 @@ var DirectoryDocumentList = function (_a) {
|
|
|
33703
33703
|
React.createElement(Column, { small: "full", medium: "full", large: "full" }, !isLoading && (React.createElement(Pagination, { currentPage: pageNumber, totalResults: totalResults, resultsPerPage: perPage, postTo: directoryPath, buttonClickOverride: setPageNumber }))))))));
|
|
33704
33704
|
};
|
|
33705
33705
|
|
|
33706
|
-
|
|
33706
|
+
var Event = function (_a) {
|
|
33707
|
+
var _b, _c;
|
|
33708
|
+
var id = _a.id, name = _a.name, description = _a.description, descriptionElement = _a.descriptionElement, startDateTime = _a.startDateTime, endDateTime = _a.endDateTime, eventType = _a.eventType, audience = _a.audience, organization = _a.organization, location = _a.location, email = _a.email, fees = _a.fees, url = _a.url, websiteUrlTitle = _a.websiteUrlTitle, contacts = _a.contacts, uploads = _a.uploads, socialProfiles = _a.socialProfiles, shortListPath = _a.shortListPath, isRecurring = _a.isRecurring, recurrencePattern = _a.recurrencePattern, registrationDeadline = _a.registrationDeadline, capacity = _a.capacity, currentAttendees = _a.currentAttendees;
|
|
33709
|
+
var labelLetters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L'];
|
|
33710
|
+
var _d = useState(false), notServer = _d[0], setNotServer = _d[1];
|
|
33711
|
+
var themeContext = useContext(ThemeContext);
|
|
33712
|
+
var favourites = useDirectoryShortListContext().favourites.favourites;
|
|
33713
|
+
useEffect(function () {
|
|
33714
|
+
setNotServer(true);
|
|
33715
|
+
}, []);
|
|
33716
|
+
var formatEventDateTime = function (startDateTime, endDateTime) {
|
|
33717
|
+
var startDate = new Date(startDateTime);
|
|
33718
|
+
var options = {
|
|
33719
|
+
weekday: 'long',
|
|
33720
|
+
year: 'numeric',
|
|
33721
|
+
month: 'long',
|
|
33722
|
+
day: 'numeric',
|
|
33723
|
+
hour: '2-digit',
|
|
33724
|
+
minute: '2-digit',
|
|
33725
|
+
};
|
|
33726
|
+
var formatted = startDate.toLocaleDateString('en-GB', options);
|
|
33727
|
+
if (endDateTime) {
|
|
33728
|
+
var endDate = new Date(endDateTime);
|
|
33729
|
+
var endTime = endDate.toLocaleTimeString('en-GB', { hour: '2-digit', minute: '2-digit' });
|
|
33730
|
+
formatted += " - ".concat(endTime);
|
|
33731
|
+
}
|
|
33732
|
+
return formatted;
|
|
33733
|
+
};
|
|
33734
|
+
var transformEventDetails = function () {
|
|
33735
|
+
var details = [];
|
|
33736
|
+
if (fees) {
|
|
33737
|
+
details.push({
|
|
33738
|
+
term: 'Cost',
|
|
33739
|
+
definition: fees,
|
|
33740
|
+
});
|
|
33741
|
+
}
|
|
33742
|
+
if (eventType) {
|
|
33743
|
+
details.push({
|
|
33744
|
+
term: 'Event type',
|
|
33745
|
+
definition: eventType,
|
|
33746
|
+
});
|
|
33747
|
+
}
|
|
33748
|
+
if (audience && audience.length > 0) {
|
|
33749
|
+
details.push({
|
|
33750
|
+
term: 'Target audience',
|
|
33751
|
+
definition: audience.join(', '),
|
|
33752
|
+
});
|
|
33753
|
+
}
|
|
33754
|
+
if (isRecurring && recurrencePattern) {
|
|
33755
|
+
details.push({
|
|
33756
|
+
term: 'Recurrence',
|
|
33757
|
+
definition: recurrencePattern,
|
|
33758
|
+
});
|
|
33759
|
+
}
|
|
33760
|
+
if (registrationDeadline) {
|
|
33761
|
+
var deadline = new Date(registrationDeadline);
|
|
33762
|
+
details.push({
|
|
33763
|
+
term: 'Registration deadline',
|
|
33764
|
+
definition: deadline.toLocaleDateString('en-GB', {
|
|
33765
|
+
weekday: 'long',
|
|
33766
|
+
year: 'numeric',
|
|
33767
|
+
month: 'long',
|
|
33768
|
+
day: 'numeric',
|
|
33769
|
+
}),
|
|
33770
|
+
});
|
|
33771
|
+
}
|
|
33772
|
+
if (capacity && currentAttendees !== undefined) {
|
|
33773
|
+
details.push({
|
|
33774
|
+
term: 'Availability',
|
|
33775
|
+
definition: "".concat(currentAttendees, " / ").concat(capacity, " registered"),
|
|
33776
|
+
});
|
|
33777
|
+
}
|
|
33778
|
+
else if (capacity) {
|
|
33779
|
+
details.push({
|
|
33780
|
+
term: 'Capacity',
|
|
33781
|
+
definition: "".concat(capacity, " spaces"),
|
|
33782
|
+
});
|
|
33783
|
+
}
|
|
33784
|
+
return details;
|
|
33785
|
+
};
|
|
33786
|
+
return (React.createElement(Container$7, { "data-testid": "Event" },
|
|
33787
|
+
React.createElement(Row$1, null,
|
|
33788
|
+
React.createElement(Column, { small: "full", medium: "full", large: "full" },
|
|
33789
|
+
React.createElement(Row$1, null,
|
|
33790
|
+
React.createElement(Column, { small: "full", medium: "full", large: "full" },
|
|
33791
|
+
React.createElement(ServiceHeader$1, null,
|
|
33792
|
+
React.createElement(Heading, { level: 1, text: name }),
|
|
33793
|
+
(organization === null || organization === void 0 ? void 0 : organization.logo) && (React.createElement(ServiceImageOuter, null,
|
|
33794
|
+
React.createElement(ServiceImageContainer$1, null,
|
|
33795
|
+
React.createElement(ServiceImage$1, { src: organization.logo, alt: name + ' logo', loading: "lazy" })))))),
|
|
33796
|
+
React.createElement(Column, { small: "full", medium: "full", large: "full" }, notServer && (React.createElement(ShortListLinks, null,
|
|
33797
|
+
shortListPath && (React.createElement(Favourites$1, { href: shortListPath },
|
|
33798
|
+
React.createElement(HeartIcon, { colourFill: themeContext.theme_vars.colours.action }),
|
|
33799
|
+
" Shortlist (",
|
|
33800
|
+
favourites.length,
|
|
33801
|
+
")")),
|
|
33802
|
+
React.createElement(DirectoryAddToShortList, { id: id, name: name, snippet: transformSnippet(description, 350), email: email, website: url, phone: (_c = (_b = contacts === null || contacts === void 0 ? void 0 : contacts[0]) === null || _b === void 0 ? void 0 : _b.phones) === null || _c === void 0 ? void 0 : _c.flatMap(function (phone) { return phone.number; }).join(', '), addresses: (location === null || location === void 0 ? void 0 : location.address) ? [{
|
|
33803
|
+
id: location.address.id,
|
|
33804
|
+
address_1: location.address.address1,
|
|
33805
|
+
city: location.address.city,
|
|
33806
|
+
state_province: location.address.county,
|
|
33807
|
+
postal_code: location.address.postcode,
|
|
33808
|
+
country: location.address.country
|
|
33809
|
+
}] : [], fees: fees })))))),
|
|
33810
|
+
React.createElement(Column, { small: "full", medium: "full", large: "full", classes: "striped-column" },
|
|
33811
|
+
React.createElement(Heading, { level: 2, text: "Event date and time" }),
|
|
33812
|
+
React.createElement("div", { style: { fontSize: '1.2rem', fontWeight: 'bold', marginBottom: '1rem' } }, formatEventDateTime(startDateTime, endDateTime)),
|
|
33813
|
+
organization && (React.createElement("p", null,
|
|
33814
|
+
React.createElement("strong", null, "Organised by:"),
|
|
33815
|
+
" ",
|
|
33816
|
+
organization.name))),
|
|
33817
|
+
location && (location.address || location.isVirtual) && (React.createElement(Column, { small: "full", medium: "full", large: "full", classes: "striped-column" },
|
|
33818
|
+
React.createElement(Row$1, null,
|
|
33819
|
+
React.createElement(Column, { small: "full", medium: "full", large: "one-third" }, location.isVirtual ? (React.createElement("div", null,
|
|
33820
|
+
React.createElement(Heading, { level: 2, text: "Virtual event" }),
|
|
33821
|
+
React.createElement("p", null, "This is an online event."),
|
|
33822
|
+
location.virtualMeetingInfo && (React.createElement("div", null,
|
|
33823
|
+
React.createElement("strong", null, "Meeting details:"),
|
|
33824
|
+
React.createElement("div", { dangerouslySetInnerHTML: { __html: location.virtualMeetingInfo } }))))) : (React.createElement("div", null,
|
|
33825
|
+
React.createElement(Heading, { level: 2, text: location.name || 'Event location' }),
|
|
33826
|
+
location.address && (React.createElement(PhysicalAddress, null,
|
|
33827
|
+
React.createElement("p", { dangerouslySetInnerHTML: {
|
|
33828
|
+
__html: Object.values(location.address)
|
|
33829
|
+
.filter(function (item) { var _a; return item !== '' && item !== ((_a = location.address) === null || _a === void 0 ? void 0 : _a.id); })
|
|
33830
|
+
.join(' <br />'),
|
|
33831
|
+
} }),
|
|
33832
|
+
location.latitude && location.longitude && (React.createElement(Button$4, { url: "https://google.com/maps/dir//".concat(location.latitude, ",").concat(location.longitude), text: "Get directions" })))),
|
|
33833
|
+
location.accessibility && location.accessibility.length > 0 && (React.createElement(React.Fragment, null,
|
|
33834
|
+
React.createElement(Heading, { level: 3, text: "Accessibility" }),
|
|
33835
|
+
React.createElement("ul", null, location.accessibility.map(function (accessibility) { return (React.createElement("li", { key: accessibility.id }, accessibility.accessibility)); }))))))),
|
|
33836
|
+
React.createElement(Column, { small: "full", medium: "full", large: "two-thirds" }, !location.isVirtual &&
|
|
33837
|
+
location.latitude &&
|
|
33838
|
+
location.longitude && (React.createElement(React.Fragment, null,
|
|
33839
|
+
notServer && (React.createElement(DirectoryMap, { mapProps: {
|
|
33840
|
+
centre: "".concat(location.latitude, ",").concat(location.longitude),
|
|
33841
|
+
imageAltText: "".concat(location.name || 'Event location', " shown on a map"),
|
|
33842
|
+
zoom: 14,
|
|
33843
|
+
size: '640x320',
|
|
33844
|
+
mapMarkers: [
|
|
33845
|
+
{
|
|
33846
|
+
lat: parseFloat(location.latitude),
|
|
33847
|
+
lng: parseFloat(location.longitude),
|
|
33848
|
+
label: labelLetters[0],
|
|
33849
|
+
title: location.name || 'Event location',
|
|
33850
|
+
},
|
|
33851
|
+
],
|
|
33852
|
+
} })),
|
|
33853
|
+
React.createElement(MapLink, { href: "https://www.google.com/maps/search/?api=1&query=".concat(location.latitude, "%2C").concat(location.longitude) }, "View in Google Maps"))))))),
|
|
33854
|
+
(email || url || (contacts === null || contacts === void 0 ? void 0 : contacts.length) > 0) && (React.createElement(Column, { small: "full", medium: "full", large: "full", classes: "striped-column" },
|
|
33855
|
+
React.createElement(Heading, { level: 2, text: "How to contact about this event" }),
|
|
33856
|
+
React.createElement(ServiceContact, { email: email, website: url, websiteTitle: websiteUrlTitle, contacts: contacts }))),
|
|
33857
|
+
React.createElement(Column, { small: "full", medium: "full", large: "full", classes: "striped-column" },
|
|
33858
|
+
React.createElement(Heading, { level: 2, text: "About this event" }),
|
|
33859
|
+
React.createElement("div", null,
|
|
33860
|
+
React.createElement(React.Fragment, null, descriptionElement)),
|
|
33861
|
+
React.createElement(SummaryList, { terms: transformEventDetails(), hasMargin: false })),
|
|
33862
|
+
(uploads === null || uploads === void 0 ? void 0 : uploads.length) > 0 && (React.createElement(Column, { small: "full", medium: "full", large: "full", classes: "striped-column" },
|
|
33863
|
+
React.createElement(Heading, { level: 2, text: "Event resources" }),
|
|
33864
|
+
React.createElement(DownloadableFiles, { files: uploads }))),
|
|
33865
|
+
(socialProfiles === null || socialProfiles === void 0 ? void 0 : socialProfiles.length) > 0 && (React.createElement(Column, { small: "full", medium: "full", large: "full", classes: "striped-column" },
|
|
33866
|
+
React.createElement(Heading, { level: 2, text: "Follow this event" }),
|
|
33867
|
+
React.createElement(ServiceSocialLinks, { profiles: socialProfiles }))))));
|
|
33868
|
+
};
|
|
33869
|
+
|
|
33870
|
+
({
|
|
33871
|
+
id: 'event-1',
|
|
33872
|
+
name: 'Family Fun Day at Wicksteed Park',
|
|
33873
|
+
description: 'Join us for an exciting family fun day with activities for all ages. There will be face painting, balloon animals, live music, and special discounts on park rides. A perfect day out for families with children of all ages.',
|
|
33874
|
+
descriptionElement: (React.createElement("div", null,
|
|
33875
|
+
React.createElement("p", null, "Join us for an exciting family fun day with activities for all ages. There will be face painting, balloon animals, live music, and special discounts on park rides."),
|
|
33876
|
+
React.createElement("p", null, "A perfect day out for families with children of all ages. Food and refreshments will be available throughout the day."))),
|
|
33877
|
+
startDateTime: '2025-07-15T10:00:00',
|
|
33878
|
+
endDateTime: '2025-07-15T16:00:00',
|
|
33879
|
+
eventType: 'Family Event',
|
|
33880
|
+
audience: ['Families', 'Children', 'Young People'],
|
|
33881
|
+
organization: {
|
|
33882
|
+
id: 'org-1',
|
|
33883
|
+
name: 'Wicksteed Park',
|
|
33884
|
+
description: 'A family theme park and nature reserve in Kettering',
|
|
33885
|
+
logo: 'https://via.placeholder.com/200x100?text=Wicksteed+Park',
|
|
33886
|
+
url: 'https://www.wicksteedpark.co.uk',
|
|
33887
|
+
},
|
|
33888
|
+
location: {
|
|
33889
|
+
id: 1,
|
|
33890
|
+
name: 'Wicksteed Park',
|
|
33891
|
+
description: 'Main entrance and activities area',
|
|
33892
|
+
isVisitable: true,
|
|
33893
|
+
latitude: '52.3991',
|
|
33894
|
+
longitude: '-0.7358',
|
|
33895
|
+
address: {
|
|
33896
|
+
id: 1,
|
|
33897
|
+
address1: 'Barton Road',
|
|
33898
|
+
city: 'Kettering',
|
|
33899
|
+
county: 'Northamptonshire',
|
|
33900
|
+
postcode: 'NN15 6NJ',
|
|
33901
|
+
country: 'United Kingdom',
|
|
33902
|
+
},
|
|
33903
|
+
accessibility: [
|
|
33904
|
+
{
|
|
33905
|
+
id: 1,
|
|
33906
|
+
accessibility: 'Wheelchair accessible paths',
|
|
33907
|
+
},
|
|
33908
|
+
{
|
|
33909
|
+
id: 2,
|
|
33910
|
+
accessibility: 'Accessible toilets',
|
|
33911
|
+
},
|
|
33912
|
+
{
|
|
33913
|
+
id: 3,
|
|
33914
|
+
accessibility: 'Disabled parking available',
|
|
33915
|
+
},
|
|
33916
|
+
],
|
|
33917
|
+
},
|
|
33918
|
+
email: 'events@wicksteedpark.co.uk',
|
|
33919
|
+
fees: 'Free entry to event activities. Park entry charges apply.',
|
|
33920
|
+
url: 'https://www.wicksteedpark.co.uk/events/family-fun-day',
|
|
33921
|
+
websiteUrlTitle: 'Book tickets online',
|
|
33922
|
+
contacts: [
|
|
33923
|
+
{
|
|
33924
|
+
id: 1,
|
|
33925
|
+
name: 'Event Information',
|
|
33926
|
+
title: 'General Enquiries',
|
|
33927
|
+
phones: [
|
|
33928
|
+
{
|
|
33929
|
+
id: 1,
|
|
33930
|
+
number: '01536 512475',
|
|
33931
|
+
},
|
|
33932
|
+
],
|
|
33933
|
+
},
|
|
33934
|
+
],
|
|
33935
|
+
uploads: [
|
|
33936
|
+
{
|
|
33937
|
+
title: 'Event Programme',
|
|
33938
|
+
url: '/files/family-fun-day-programme.pdf',
|
|
33939
|
+
size: '2.5MB',
|
|
33940
|
+
type: 'PDF',
|
|
33941
|
+
archived: false,
|
|
33942
|
+
},
|
|
33943
|
+
{
|
|
33944
|
+
title: 'Activity Map',
|
|
33945
|
+
url: '/files/activity-map.pdf',
|
|
33946
|
+
size: '1.2MB',
|
|
33947
|
+
type: 'PDF',
|
|
33948
|
+
archived: false,
|
|
33949
|
+
},
|
|
33950
|
+
],
|
|
33951
|
+
socialProfiles: [
|
|
33952
|
+
{
|
|
33953
|
+
id: 1,
|
|
33954
|
+
name: 'Wicksteed Park Facebook',
|
|
33955
|
+
social_network: 'facebook',
|
|
33956
|
+
link: 'https://facebook.com/wicksteedpark',
|
|
33957
|
+
},
|
|
33958
|
+
{
|
|
33959
|
+
id: 2,
|
|
33960
|
+
name: 'Wicksteed Park Twitter',
|
|
33961
|
+
social_network: 'twitter',
|
|
33962
|
+
link: 'https://twitter.com/wicksteedpark',
|
|
33963
|
+
},
|
|
33964
|
+
],
|
|
33965
|
+
updatedAt: '2025-01-15',
|
|
33966
|
+
shortListPath: '/events/shortlist',
|
|
33967
|
+
isRecurring: false,
|
|
33968
|
+
registrationDeadline: '2025-07-10T23:59:59',
|
|
33969
|
+
capacity: 500,
|
|
33970
|
+
currentAttendees: 342,
|
|
33971
|
+
});
|
|
33972
|
+
({
|
|
33973
|
+
id: 'event-2',
|
|
33974
|
+
name: 'Online Parenting Workshop: Managing Screen Time',
|
|
33975
|
+
description: 'A comprehensive online workshop for parents and carers about managing children\'s screen time effectively. Learn practical strategies, understand the latest research, and connect with other parents.',
|
|
33976
|
+
descriptionElement: (React.createElement("div", null,
|
|
33977
|
+
React.createElement("p", null, "A comprehensive online workshop for parents and carers about managing children's screen time effectively."),
|
|
33978
|
+
React.createElement("p", null, "During this 2-hour session, you'll learn:"),
|
|
33979
|
+
React.createElement("ul", null,
|
|
33980
|
+
React.createElement("li", null, "Evidence-based strategies for healthy screen time limits"),
|
|
33981
|
+
React.createElement("li", null, "How to create engaging offline activities"),
|
|
33982
|
+
React.createElement("li", null, "Understanding age-appropriate content"),
|
|
33983
|
+
React.createElement("li", null, "Building family media agreements")),
|
|
33984
|
+
React.createElement("p", null, "There will be time for Q&A and connecting with other parents."))),
|
|
33985
|
+
startDateTime: '2025-03-20T19:00:00',
|
|
33986
|
+
endDateTime: '2025-03-20T21:00:00',
|
|
33987
|
+
eventType: 'Workshop',
|
|
33988
|
+
audience: ['Parents', 'Carers'],
|
|
33989
|
+
organization: {
|
|
33990
|
+
id: 'org-2',
|
|
33991
|
+
name: 'Northamptonshire Family Support',
|
|
33992
|
+
description: 'Supporting families across Northamptonshire',
|
|
33993
|
+
logo: 'https://via.placeholder.com/200x100?text=Family+Support',
|
|
33994
|
+
url: 'https://www.northantsfamilysupport.org.uk',
|
|
33995
|
+
},
|
|
33996
|
+
location: {
|
|
33997
|
+
id: 2,
|
|
33998
|
+
name: 'Online Event',
|
|
33999
|
+
description: 'Join from the comfort of your own home',
|
|
34000
|
+
isVirtual: true,
|
|
34001
|
+
virtualMeetingInfo: 'Zoom link will be sent 24 hours before the event. Please ensure you have a stable internet connection and a quiet space.',
|
|
34002
|
+
},
|
|
34003
|
+
email: 'workshops@northantsfamilysupport.org.uk',
|
|
34004
|
+
fees: 'Free',
|
|
34005
|
+
url: 'https://www.northantsfamilysupport.org.uk/workshops/screen-time',
|
|
34006
|
+
websiteUrlTitle: 'Register for this workshop',
|
|
34007
|
+
contacts: [
|
|
34008
|
+
{
|
|
34009
|
+
id: 1,
|
|
34010
|
+
name: 'Workshop Team',
|
|
34011
|
+
title: 'Registration Support',
|
|
34012
|
+
phones: [
|
|
34013
|
+
{
|
|
34014
|
+
id: 1,
|
|
34015
|
+
number: '01604 123456',
|
|
34016
|
+
},
|
|
34017
|
+
],
|
|
34018
|
+
},
|
|
34019
|
+
],
|
|
34020
|
+
uploads: [
|
|
34021
|
+
{
|
|
34022
|
+
title: 'Workshop Preparation Guide',
|
|
34023
|
+
url: '/files/screen-time-prep-guide.pdf',
|
|
34024
|
+
size: '800KB',
|
|
34025
|
+
type: 'PDF',
|
|
34026
|
+
archived: false,
|
|
34027
|
+
},
|
|
34028
|
+
],
|
|
34029
|
+
updatedAt: '2025-01-10',
|
|
34030
|
+
shortListPath: '/events/shortlist',
|
|
34031
|
+
isRecurring: true,
|
|
34032
|
+
recurrencePattern: 'Monthly on the third Thursday',
|
|
34033
|
+
registrationDeadline: '2025-03-18T23:59:59',
|
|
34034
|
+
capacity: 50,
|
|
34035
|
+
currentAttendees: 23,
|
|
34036
|
+
});
|
|
34037
|
+
|
|
34038
|
+
var EventList = function (_a) {
|
|
34039
|
+
var eventsPath = _a.eventsPath, shortListPath = _a.shortListPath, events = _a.events, _b = _a.search, search = _b === void 0 ? '' : _b, setSearch = _a.setSearch, _c = _a.proximity, proximity = _c === void 0 ? 2 : _c, _d = _a.showPostcodeSearch, showPostcodeSearch = _d === void 0 ? true : _d, _e = _a.postcode, postcode = _e === void 0 ? '' : _e, setPostcode = _a.setPostcode, _f = _a.totalResults, totalResults = _f === void 0 ? 0 : _f, _g = _a.pageNumber, pageNumber = _g === void 0 ? 1 : _g, setPageNumber = _a.setPageNumber, _h = _a.perPage, perPage = _h === void 0 ? 5 : _h, _j = _a.extractLength, extractLength = _j === void 0 ? 300 : _j, _k = _a.eventTypes, eventTypes = _k === void 0 ? [] : _k, setEventTypes = _a.setEventTypes, _l = _a.audiences, audiences = _l === void 0 ? [] : _l, setAudiences = _a.setAudiences, selectedMonth = _a.selectedMonth, setSelectedMonth = _a.setSelectedMonth, selectedYear = _a.selectedYear, setSelectedYear = _a.setSelectedYear, _m = _a.mapCenter, mapCenter = _m === void 0 ? '52.40410666556486,-0.7237065995821512' : _m, _o = _a.mapZoom, mapZoom = _o === void 0 ? 9 : _o, _p = _a.isLoading, isLoading = _p === void 0 ? false : _p, _q = _a.isError, isError = _q === void 0 ? false : _q; _a.hideOldEvents;
|
|
34040
|
+
var _s = useLocalStorage("".concat(eventsPath.replace(/\//g, ''), "-accordion"), []), accordions = _s[0], setAccordions = _s[1];
|
|
34041
|
+
var _t = useLocalStorage("".concat(eventsPath.replace(/\//g, ''), "-accordion-all"), true), openAll = _t[0], setOpenAll = _t[1];
|
|
34042
|
+
var _u = useLocalStorage("".concat(eventsPath.replace(/\//g, ''), "-show-map"), false), showMap = _u[0], setShowMap = _u[1];
|
|
34043
|
+
var _v = useState(false), showFilters = _v[0], setShowFilters = _v[1];
|
|
34044
|
+
var _w = useDirectoryShortListContext(), _x = _w.favourites, favourites = _x.favourites; _x.setFavourites; _w.toggleFavourites; _w.isFavourite;
|
|
34045
|
+
var _y = useState(false), notServer = _y[0], setNotServer = _y[1];
|
|
34046
|
+
var _z = useState(search), searchTerm = _z[0], setSearchTerm = _z[1];
|
|
34047
|
+
var _0 = useState(postcode), postcodeSearch = _0[0], setPostcodeSearch = _0[1];
|
|
34048
|
+
var themeContext = useContext(ThemeContext);
|
|
34049
|
+
var _1 = useState(false), filtersActive = _1[0], setFiltersActive = _1[1];
|
|
34050
|
+
useEffect(function () {
|
|
34051
|
+
setNotServer(true);
|
|
34052
|
+
setFiltersActive(hasActiveFilters());
|
|
34053
|
+
}, []);
|
|
34054
|
+
useEffect(function () {
|
|
34055
|
+
setFiltersActive(hasActiveFilters());
|
|
34056
|
+
}, [selectedMonth, selectedYear, eventTypes, audiences, search, postcode]);
|
|
34057
|
+
// Initialize accordions
|
|
34058
|
+
if (accordions.length === 0) {
|
|
34059
|
+
var tempAccordions_1 = [];
|
|
34060
|
+
// Date filter
|
|
34061
|
+
tempAccordions_1.push(false);
|
|
34062
|
+
// Event types
|
|
34063
|
+
eventTypes === null || eventTypes === void 0 ? void 0 : eventTypes.forEach(function () {
|
|
34064
|
+
tempAccordions_1.push(false);
|
|
34065
|
+
});
|
|
34066
|
+
// Audiences
|
|
34067
|
+
audiences === null || audiences === void 0 ? void 0 : audiences.forEach(function () {
|
|
34068
|
+
tempAccordions_1.push(false);
|
|
34069
|
+
});
|
|
34070
|
+
setAccordions(tempAccordions_1);
|
|
34071
|
+
}
|
|
34072
|
+
var optionChecked = function (e, categoryIndex, singleSelection, isEventType) {
|
|
34073
|
+
if (isEventType === void 0) { isEventType = true; }
|
|
34074
|
+
var categories = isEventType ? eventTypes : audiences;
|
|
34075
|
+
var setCategories = isEventType ? setEventTypes : setAudiences;
|
|
34076
|
+
var newCategories = __spreadArray([], categories, true);
|
|
34077
|
+
if (singleSelection) {
|
|
34078
|
+
newCategories[categoryIndex].options.forEach(function (option) {
|
|
34079
|
+
option.checked = false;
|
|
34080
|
+
});
|
|
34081
|
+
}
|
|
34082
|
+
newCategories[categoryIndex].options.find(function (option) {
|
|
34083
|
+
if (option.id === e.target.value) {
|
|
34084
|
+
option.checked = !option.checked;
|
|
34085
|
+
}
|
|
34086
|
+
});
|
|
34087
|
+
setCategories(newCategories);
|
|
34088
|
+
};
|
|
34089
|
+
var clearCategory = function (categoryIndex, isEventType) {
|
|
34090
|
+
if (isEventType === void 0) { isEventType = true; }
|
|
34091
|
+
var categories = isEventType ? eventTypes : audiences;
|
|
34092
|
+
var setCategories = isEventType ? setEventTypes : setAudiences;
|
|
34093
|
+
var newCategories = __spreadArray([], categories, true);
|
|
34094
|
+
newCategories[categoryIndex].options.forEach(function (option) {
|
|
34095
|
+
option.checked = false;
|
|
34096
|
+
});
|
|
34097
|
+
setCategories(newCategories);
|
|
34098
|
+
};
|
|
34099
|
+
var clearDateFilter = function () {
|
|
34100
|
+
setSelectedMonth(undefined);
|
|
34101
|
+
setSelectedYear(undefined);
|
|
34102
|
+
};
|
|
34103
|
+
var from = pageNumber * perPage - (perPage - 1);
|
|
34104
|
+
var to = from + ((events === null || events === void 0 ? void 0 : events.length) ? events.length - 1 : 0);
|
|
34105
|
+
var clearSearch = function () {
|
|
34106
|
+
window.location.href = eventsPath;
|
|
34107
|
+
};
|
|
34108
|
+
var toggleAccordion = function (index) {
|
|
34109
|
+
var updatedAccordions = __spreadArray([], accordions, true);
|
|
34110
|
+
updatedAccordions[index] = !updatedAccordions[index];
|
|
34111
|
+
setAccordions(updatedAccordions);
|
|
34112
|
+
};
|
|
34113
|
+
var toggleAll = function () {
|
|
34114
|
+
setOpenAll(!openAll);
|
|
34115
|
+
var updatedAccordions = accordions.map(function () {
|
|
34116
|
+
return openAll;
|
|
34117
|
+
});
|
|
34118
|
+
setAccordions(updatedAccordions);
|
|
34119
|
+
};
|
|
34120
|
+
var submitSearch = function (e) {
|
|
34121
|
+
e.preventDefault();
|
|
34122
|
+
setSearch(searchTerm);
|
|
34123
|
+
setPostcode(postcodeSearch);
|
|
34124
|
+
};
|
|
34125
|
+
var letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
|
34126
|
+
var labelLetters = letters.split('');
|
|
34127
|
+
var mapProps = {
|
|
34128
|
+
centre: mapCenter,
|
|
34129
|
+
zoom: mapZoom,
|
|
34130
|
+
size: '640x320',
|
|
34131
|
+
imageAltText: 'Event search results displayed on a map',
|
|
34132
|
+
mapMarkers: events
|
|
34133
|
+
.filter(function (event) {
|
|
34134
|
+
var _a, _b;
|
|
34135
|
+
return ((_a = event.location) === null || _a === void 0 ? void 0 : _a.latitude) && ((_b = event.location) === null || _b === void 0 ? void 0 : _b.longitude);
|
|
34136
|
+
})
|
|
34137
|
+
.map(function (event, index) {
|
|
34138
|
+
var _a, _b;
|
|
34139
|
+
return {
|
|
34140
|
+
lat: parseFloat(((_a = event.location) === null || _a === void 0 ? void 0 : _a.latitude) || '0'),
|
|
34141
|
+
lng: parseFloat(((_b = event.location) === null || _b === void 0 ? void 0 : _b.longitude) || '0'),
|
|
34142
|
+
label: labelLetters[index],
|
|
34143
|
+
title: "<a href=".concat(event.id, ">").concat(event.name, "</a>"),
|
|
34144
|
+
};
|
|
34145
|
+
}),
|
|
34146
|
+
};
|
|
34147
|
+
var hasActiveFilters = function () {
|
|
34148
|
+
return (search !== '' ||
|
|
34149
|
+
postcode !== '' ||
|
|
34150
|
+
selectedMonth !== undefined ||
|
|
34151
|
+
selectedYear !== undefined ||
|
|
34152
|
+
eventTypes.some(function (category) {
|
|
34153
|
+
return category.options.some(function (option) {
|
|
34154
|
+
return option.checked == true;
|
|
34155
|
+
});
|
|
34156
|
+
}) ||
|
|
34157
|
+
audiences.some(function (category) {
|
|
34158
|
+
return category.options.some(function (option) {
|
|
34159
|
+
return option.checked == true;
|
|
34160
|
+
});
|
|
34161
|
+
}));
|
|
34162
|
+
};
|
|
34163
|
+
var formatEventDateTime = function (startDateTime, endDateTime) {
|
|
34164
|
+
var startDate = new Date(startDateTime);
|
|
34165
|
+
var options = {
|
|
34166
|
+
weekday: 'long',
|
|
34167
|
+
year: 'numeric',
|
|
34168
|
+
month: 'long',
|
|
34169
|
+
day: 'numeric',
|
|
34170
|
+
hour: '2-digit',
|
|
34171
|
+
minute: '2-digit',
|
|
34172
|
+
};
|
|
34173
|
+
var formatted = startDate.toLocaleDateString('en-GB', options);
|
|
34174
|
+
if (endDateTime) {
|
|
34175
|
+
var endDate = new Date(endDateTime);
|
|
34176
|
+
var endTime = endDate.toLocaleTimeString('en-GB', { hour: '2-digit', minute: '2-digit' });
|
|
34177
|
+
formatted += " - ".concat(endTime);
|
|
34178
|
+
}
|
|
34179
|
+
return formatted;
|
|
34180
|
+
};
|
|
34181
|
+
var monthNames = [
|
|
34182
|
+
'January', 'February', 'March', 'April', 'May', 'June',
|
|
34183
|
+
'July', 'August', 'September', 'October', 'November', 'December'
|
|
34184
|
+
];
|
|
34185
|
+
var currentYear = new Date().getFullYear();
|
|
34186
|
+
var years = Array.from({ length: 5 }, function (_, i) { return currentYear + i; });
|
|
34187
|
+
return (React.createElement(Container$3, { "data-testid": "EventList" },
|
|
34188
|
+
React.createElement(Row$1, null,
|
|
34189
|
+
React.createElement(Column, { small: "full", medium: "full", large: "full" },
|
|
34190
|
+
React.createElement(SearchHeader$1, null,
|
|
34191
|
+
React.createElement(FormWithLine, { hideLine: true, onSubmit: submitSearch },
|
|
34192
|
+
React.createElement(Row$1, null,
|
|
34193
|
+
React.createElement(Column, { small: "full", medium: "one-half", large: "one-third" },
|
|
34194
|
+
React.createElement(Label$1, { htmlFor: "eventSearch" }, "What events are you looking for?"),
|
|
34195
|
+
React.createElement(HintText, { text: "Enter the name of a specific event or organisation" }),
|
|
34196
|
+
React.createElement(Input, { name: "eventSearch", type: "text", defaultValue: searchTerm, id: "eventSearch", onChange: function (e) {
|
|
34197
|
+
setSearchTerm(e.target.value);
|
|
34198
|
+
} })),
|
|
34199
|
+
showPostcodeSearch && (React.createElement(Column, { small: "full", medium: "one-half", large: "one-third" },
|
|
34200
|
+
React.createElement(Label$1, { htmlFor: "postcode" }, "Postcode (optional)"),
|
|
34201
|
+
React.createElement(HintText, { text: "Enter a postcode to see results within ".concat(proximity, " miles") }),
|
|
34202
|
+
React.createElement(Input, { name: "postcode", type: "text", defaultValue: postcodeSearch, id: "postcode", onChange: function (e) { return setPostcodeSearch(e.target.value); }, autocomplete: "postal-code" }))),
|
|
34203
|
+
React.createElement(Column, { small: "full", medium: "one-half", large: "one-third" },
|
|
34204
|
+
React.createElement(ButtonContainer$2, null,
|
|
34205
|
+
React.createElement(Button$1, { size: "large", onClick: submitSearch, type: "submit" },
|
|
34206
|
+
React.createElement(ButtonText$1, null, "Search"),
|
|
34207
|
+
React.createElement(IconDownload, { colourFill: "#fff" })),
|
|
34208
|
+
filtersActive && (React.createElement(Button$1, { size: "large", onClick: clearSearch, type: "button", "$isWarning": true },
|
|
34209
|
+
React.createElement(ButtonText$1, null, "Clear search"))))))))),
|
|
34210
|
+
React.createElement(Column, { small: "full", medium: "one-third", large: "one-third" },
|
|
34211
|
+
React.createElement(FilterToggle, { type: "button", onClick: function (e) { return setShowFilters(!showFilters); } }, showFilters ? "Hide Filters" : "Show Filters"),
|
|
34212
|
+
React.createElement(FilterContainer, { "$showFilters": showFilters },
|
|
34213
|
+
React.createElement(Row$1, null,
|
|
34214
|
+
React.createElement(Column, { small: "full", medium: "full", large: "full" },
|
|
34215
|
+
React.createElement(ResultInfo$1, null, "Refine your search")),
|
|
34216
|
+
notServer && (React.createElement(React.Fragment, null,
|
|
34217
|
+
React.createElement(Column, { small: "full", medium: "full", large: "full" },
|
|
34218
|
+
React.createElement(AccordionControls, null,
|
|
34219
|
+
filtersActive ? (React.createElement(TextLink$1, { onClick: clearSearch, type: "button" },
|
|
34220
|
+
React.createElement(ButtonText$1, null, "Clear all filters"))) : (React.createElement("div", null)),
|
|
34221
|
+
React.createElement(TextLink$1, { onClick: toggleAll, type: "button", "aria-expanded": !openAll },
|
|
34222
|
+
openAll ? 'Open all' : 'Close all',
|
|
34223
|
+
React.createElement(VisuallyHidden, null, " sections")))),
|
|
34224
|
+
React.createElement(Column, { small: "full", medium: "full", large: "full" },
|
|
34225
|
+
React.createElement(Fieldset$1, null,
|
|
34226
|
+
React.createElement(Legend$1, { onClick: function (e) { return toggleAccordion(0); } },
|
|
34227
|
+
React.createElement(LegendButton, { onClick: function (e) { return toggleAccordion(0); }, type: "button" },
|
|
34228
|
+
"Select date range",
|
|
34229
|
+
React.createElement(AccordionIcon, { "$isOpen": accordions[0] }))),
|
|
34230
|
+
React.createElement(Accordion, { "$isOpen": accordions[0] },
|
|
34231
|
+
React.createElement(ClearFilter$1, null,
|
|
34232
|
+
React.createElement(TextLink$1, { onClick: clearDateFilter }, "Clear filter")),
|
|
34233
|
+
React.createElement(Row$1, null,
|
|
34234
|
+
React.createElement(Column, { small: "full", medium: "one-half", large: "one-half" },
|
|
34235
|
+
React.createElement(DropDownSelect, { id: "event_month", label: "Month", selected: (selectedMonth === null || selectedMonth === void 0 ? void 0 : selectedMonth.toString()) || '', onChange: function (e) { return setSelectedMonth(e.target.value ? parseInt(e.target.value) : undefined); }, options: __spreadArray([
|
|
34236
|
+
{ title: 'All months', value: '' }
|
|
34237
|
+
], monthNames.map(function (month, index) { return ({
|
|
34238
|
+
title: month,
|
|
34239
|
+
value: (index + 1).toString(),
|
|
34240
|
+
}); }), true) })),
|
|
34241
|
+
React.createElement(Column, { small: "full", medium: "one-half", large: "one-half" },
|
|
34242
|
+
React.createElement(DropDownSelect, { id: "event_year", label: "Year", selected: (selectedYear === null || selectedYear === void 0 ? void 0 : selectedYear.toString()) || '', onChange: function (e) { return setSelectedYear(e.target.value ? parseInt(e.target.value) : undefined); }, options: __spreadArray([
|
|
34243
|
+
{ title: 'All years', value: '' }
|
|
34244
|
+
], years.map(function (year) { return ({
|
|
34245
|
+
title: year.toString(),
|
|
34246
|
+
value: year.toString(),
|
|
34247
|
+
}); }), true) })))))), eventTypes === null || eventTypes === void 0 ? void 0 :
|
|
34248
|
+
eventTypes.map(function (category, categoryIndex) { return (React.createElement(Column, { small: "full", medium: "full", large: "full", key: category.label },
|
|
34249
|
+
React.createElement(Fieldset$1, null,
|
|
34250
|
+
React.createElement(Legend$1, null,
|
|
34251
|
+
React.createElement(LegendButton, { onClick: function (e) { return toggleAccordion(categoryIndex + 1); }, type: "button" },
|
|
34252
|
+
category.label,
|
|
34253
|
+
React.createElement(AccordionIcon, { "$isOpen": accordions[categoryIndex + 1] }))),
|
|
34254
|
+
React.createElement(Accordion, { "$isOpen": accordions[categoryIndex + 1] },
|
|
34255
|
+
React.createElement(ClearFilter$1, null,
|
|
34256
|
+
React.createElement(TextLink$1, { onClick: function (e) { return clearCategory(categoryIndex, true); } }, "Clear filter")),
|
|
34257
|
+
category.options.map(function (taxonomy) { return (React.createElement(Category$2, { key: taxonomy.id },
|
|
34258
|
+
React.createElement(RadioCheckboxInput, { name: taxonomy.vocabulary, value: taxonomy.id, label: taxonomy.name, singleSelection: category.singleSelection, checked: taxonomy.checked, onChange: function (e) { return optionChecked(e, categoryIndex, category.singleSelection, true); } }))); }))))); }), audiences === null || audiences === void 0 ? void 0 :
|
|
34259
|
+
audiences.map(function (category, categoryIndex) { return (React.createElement(Column, { small: "full", medium: "full", large: "full", key: category.label },
|
|
34260
|
+
React.createElement(Fieldset$1, null,
|
|
34261
|
+
React.createElement(Legend$1, null,
|
|
34262
|
+
React.createElement(LegendButton, { onClick: function (e) { return toggleAccordion(eventTypes.length + categoryIndex + 1); }, type: "button" },
|
|
34263
|
+
category.label,
|
|
34264
|
+
React.createElement(AccordionIcon, { "$isOpen": accordions[eventTypes.length + categoryIndex + 1] }))),
|
|
34265
|
+
React.createElement(Accordion, { "$isOpen": accordions[eventTypes.length + categoryIndex + 1] },
|
|
34266
|
+
React.createElement(ClearFilter$1, null,
|
|
34267
|
+
React.createElement(TextLink$1, { onClick: function (e) { return clearCategory(categoryIndex, false); } }, "Clear filter")),
|
|
34268
|
+
category.options.map(function (taxonomy) { return (React.createElement(Category$2, { key: taxonomy.id },
|
|
34269
|
+
React.createElement(RadioCheckboxInput, { name: taxonomy.vocabulary, value: taxonomy.id, label: taxonomy.name, singleSelection: category.singleSelection, checked: taxonomy.checked, onChange: function (e) { return optionChecked(e, categoryIndex, category.singleSelection, false); } }))); }))))); })))))),
|
|
34270
|
+
React.createElement(Column, { small: "full", medium: "two-thirds", large: "two-thirds" },
|
|
34271
|
+
React.createElement(Row$1, null, isError ? (React.createElement(Column, { small: "full", medium: "full", large: "full" },
|
|
34272
|
+
React.createElement(AlertBannerService, null,
|
|
34273
|
+
React.createElement("p", null, "Sorry, there was a problem fetching events. Please try again later.")))) : isLoading ? (React.createElement(LoadingContainer$1, null,
|
|
34274
|
+
React.createElement(LoadingSpinner, null),
|
|
34275
|
+
React.createElement("p", null, "Loading"))) : (React.createElement(React.Fragment, null,
|
|
34276
|
+
React.createElement(Column, { small: "full", medium: "full", large: "full" },
|
|
34277
|
+
(events === null || events === void 0 ? void 0 : events.length) > 0 ? (React.createElement(ResultInfo$1, null,
|
|
34278
|
+
"Showing ",
|
|
34279
|
+
from,
|
|
34280
|
+
" to ",
|
|
34281
|
+
to,
|
|
34282
|
+
" out of ",
|
|
34283
|
+
totalResults.toLocaleString())) : (React.createElement(ResultInfo$1, null, "No events found")),
|
|
34284
|
+
React.createElement(FavouritesContainer, null,
|
|
34285
|
+
(events === null || events === void 0 ? void 0 : events.length) > 0 && (React.createElement(MapToggle, { type: "button", size: "large", onClick: function (e) { return setShowMap(!showMap); } }, showMap ? "Hide Map" : "Show Map")),
|
|
34286
|
+
React.createElement(Favourites, { href: shortListPath },
|
|
34287
|
+
React.createElement(HeartIcon, { colourFill: themeContext.theme_vars.colours.action }),
|
|
34288
|
+
" Shortlist (",
|
|
34289
|
+
favourites.length,
|
|
34290
|
+
")"))),
|
|
34291
|
+
React.createElement(Column, { small: "full", medium: "full", large: "full" },
|
|
34292
|
+
React.createElement(Pagination, { currentPage: pageNumber, totalResults: totalResults, resultsPerPage: perPage, postTo: eventsPath, buttonClickOverride: setPageNumber })),
|
|
34293
|
+
React.createElement(Column, { small: "full", medium: "full", large: "full" }, notServer && React.createElement(React.Fragment, null, (events === null || events === void 0 ? void 0 : events.length) > 0 && showMap && React.createElement(DirectoryMap, { mapProps: mapProps }))),
|
|
34294
|
+
events.map(function (event, index) {
|
|
34295
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
34296
|
+
var snippet = transformSnippet(event.description, extractLength);
|
|
34297
|
+
return (React.createElement(Column, { small: "full", medium: "full", large: "full", key: event.id },
|
|
34298
|
+
React.createElement(ServiceContainer, { "$resultNumber": index },
|
|
34299
|
+
React.createElement(Row$1, null,
|
|
34300
|
+
React.createElement(Column, { small: "full", medium: "full", large: "full" },
|
|
34301
|
+
React.createElement(ServiceHeader, null,
|
|
34302
|
+
React.createElement(ServiceLink$1, { href: "".concat(event.id) }, event.name),
|
|
34303
|
+
showMap && ((_a = event.location) === null || _a === void 0 ? void 0 : _a.latitude) && ((_b = event.location) === null || _b === void 0 ? void 0 : _b.longitude) && (React.createElement(MarkerContainer, null,
|
|
34304
|
+
React.createElement("span", null, labelLetters[index]),
|
|
34305
|
+
React.createElement(PinIcon, { colourFill: themeContext.theme_vars.colours.action_dark }))))),
|
|
34306
|
+
React.createElement(Column, { small: "full", medium: "full", large: "full" },
|
|
34307
|
+
React.createElement(Age, null, formatEventDateTime(event.startDateTime, event.endDateTime)),
|
|
34308
|
+
event.organization && (React.createElement("p", { style: { fontSize: '0.9rem', color: '#666', marginBottom: '8px' } },
|
|
34309
|
+
"Organised by: ",
|
|
34310
|
+
React.createElement("strong", null, event.organization.name))),
|
|
34311
|
+
event.eventType && (React.createElement("p", { style: { fontSize: '0.9rem', color: '#666', marginBottom: '8px' } },
|
|
34312
|
+
"Event type: ",
|
|
34313
|
+
React.createElement("strong", null, event.eventType))),
|
|
34314
|
+
event.audience && event.audience.length > 0 && (React.createElement("p", { style: { fontSize: '0.9rem', color: '#666', marginBottom: '8px' } },
|
|
34315
|
+
"Audience: ",
|
|
34316
|
+
React.createElement("strong", null, event.audience.join(', '))))),
|
|
34317
|
+
React.createElement(Column, { small: "full", medium: ((_c = event.organization) === null || _c === void 0 ? void 0 : _c.logo) ? 'two-thirds' : 'full', large: ((_d = event.organization) === null || _d === void 0 ? void 0 : _d.logo) ? 'two-thirds' : 'full' },
|
|
34318
|
+
React.createElement("div", null, snippet)),
|
|
34319
|
+
((_e = event.organization) === null || _e === void 0 ? void 0 : _e.logo) && (React.createElement(Column, { small: "full", medium: "one-third", large: "one-third" },
|
|
34320
|
+
React.createElement(ServiceImageContainer, null,
|
|
34321
|
+
React.createElement(ServiceImage, { src: event.organization.logo, alt: event.name + ' logo', loading: "lazy" })))),
|
|
34322
|
+
React.createElement(Column, { small: "full", medium: "full", large: "full" },
|
|
34323
|
+
React.createElement(DirectoryAddToShortList, { id: event.id, name: event.name, snippet: snippet, email: event.email, website: event.url, phone: (_h = (_g = (_f = event.contacts) === null || _f === void 0 ? void 0 : _f[0]) === null || _g === void 0 ? void 0 : _g.phones) === null || _h === void 0 ? void 0 : _h.flatMap(function (phone) { return phone.number; }).join(', '), addresses: ((_j = event.location) === null || _j === void 0 ? void 0 : _j.address) ? [{
|
|
34324
|
+
id: event.location.address.id,
|
|
34325
|
+
address_1: event.location.address.address1,
|
|
34326
|
+
city: event.location.address.city,
|
|
34327
|
+
state_province: event.location.address.county,
|
|
34328
|
+
postal_code: event.location.address.postcode,
|
|
34329
|
+
country: event.location.address.country
|
|
34330
|
+
}] : [], fees: event.fees }))))));
|
|
34331
|
+
}),
|
|
34332
|
+
React.createElement(Column, { small: "full", medium: "full", large: "full" },
|
|
34333
|
+
React.createElement(Pagination, { currentPage: pageNumber, totalResults: totalResults, resultsPerPage: perPage, postTo: eventsPath, buttonClickOverride: setPageNumber })))))))));
|
|
34334
|
+
};
|
|
34335
|
+
|
|
34336
|
+
/**
|
|
34337
|
+
* Filters out events that have already ended based on their end date/time
|
|
34338
|
+
* @param events Array of events to filter
|
|
34339
|
+
* @param hideOldEvents Whether to hide old events (defaults to true)
|
|
34340
|
+
* @returns Filtered array of events
|
|
34341
|
+
*/
|
|
34342
|
+
var filterOldEvents = function (events, hideOldEvents) {
|
|
34343
|
+
if (hideOldEvents === void 0) { hideOldEvents = true; }
|
|
34344
|
+
if (!hideOldEvents) {
|
|
34345
|
+
return events;
|
|
34346
|
+
}
|
|
34347
|
+
var now = new Date();
|
|
34348
|
+
return events.filter(function (event) {
|
|
34349
|
+
// Use end date if available, otherwise use start date
|
|
34350
|
+
var eventEndDate = new Date(event.endDateTime || event.startDateTime);
|
|
34351
|
+
// Keep events that haven't ended yet
|
|
34352
|
+
return eventEndDate > now;
|
|
34353
|
+
});
|
|
34354
|
+
};
|
|
34355
|
+
/**
|
|
34356
|
+
* Filters events by month and year
|
|
34357
|
+
* @param events Array of events to filter
|
|
34358
|
+
* @param selectedMonth Month (1-12) or undefined for all months
|
|
34359
|
+
* @param selectedYear Year or undefined for all years
|
|
34360
|
+
* @returns Filtered array of events
|
|
34361
|
+
*/
|
|
34362
|
+
var filterEventsByDate = function (events, selectedMonth, selectedYear) {
|
|
34363
|
+
if (!selectedMonth && !selectedYear) {
|
|
34364
|
+
return events;
|
|
34365
|
+
}
|
|
34366
|
+
return events.filter(function (event) {
|
|
34367
|
+
var eventDate = new Date(event.startDateTime);
|
|
34368
|
+
var eventMonth = eventDate.getMonth() + 1; // JavaScript months are 0-indexed
|
|
34369
|
+
var eventYear = eventDate.getFullYear();
|
|
34370
|
+
var monthMatches = !selectedMonth || eventMonth === selectedMonth;
|
|
34371
|
+
var yearMatches = !selectedYear || eventYear === selectedYear;
|
|
34372
|
+
return monthMatches && yearMatches;
|
|
34373
|
+
});
|
|
34374
|
+
};
|
|
34375
|
+
/**
|
|
34376
|
+
* Filters events by event type
|
|
34377
|
+
* @param events Array of events to filter
|
|
34378
|
+
* @param selectedEventTypes Array of selected event type IDs
|
|
34379
|
+
* @returns Filtered array of events
|
|
34380
|
+
*/
|
|
34381
|
+
var filterEventsByType = function (events, selectedEventTypes) {
|
|
34382
|
+
if (selectedEventTypes.length === 0) {
|
|
34383
|
+
return events;
|
|
34384
|
+
}
|
|
34385
|
+
return events.filter(function (event) {
|
|
34386
|
+
if (!event.eventType) {
|
|
34387
|
+
return false;
|
|
34388
|
+
}
|
|
34389
|
+
return selectedEventTypes.includes(event.eventType);
|
|
34390
|
+
});
|
|
34391
|
+
};
|
|
34392
|
+
/**
|
|
34393
|
+
* Filters events by audience
|
|
34394
|
+
* @param events Array of events to filter
|
|
34395
|
+
* @param selectedAudiences Array of selected audience IDs
|
|
34396
|
+
* @returns Filtered array of events
|
|
34397
|
+
*/
|
|
34398
|
+
var filterEventsByAudience = function (events, selectedAudiences) {
|
|
34399
|
+
if (selectedAudiences.length === 0) {
|
|
34400
|
+
return events;
|
|
34401
|
+
}
|
|
34402
|
+
return events.filter(function (event) {
|
|
34403
|
+
if (!event.audience || event.audience.length === 0) {
|
|
34404
|
+
return false;
|
|
34405
|
+
}
|
|
34406
|
+
// Check if any of the event's audiences match the selected audiences
|
|
34407
|
+
return event.audience.some(function (audience) { return selectedAudiences.includes(audience); });
|
|
34408
|
+
});
|
|
34409
|
+
};
|
|
34410
|
+
/**
|
|
34411
|
+
* Filters events by search term (searches in name and description)
|
|
34412
|
+
* @param events Array of events to filter
|
|
34413
|
+
* @param searchTerm Search term to look for
|
|
34414
|
+
* @returns Filtered array of events
|
|
34415
|
+
*/
|
|
34416
|
+
var filterEventsBySearch = function (events, searchTerm) {
|
|
34417
|
+
if (!searchTerm.trim()) {
|
|
34418
|
+
return events;
|
|
34419
|
+
}
|
|
34420
|
+
var lowercaseSearch = searchTerm.toLowerCase();
|
|
34421
|
+
return events.filter(function (event) {
|
|
34422
|
+
var _a, _b;
|
|
34423
|
+
var nameMatch = event.name.toLowerCase().includes(lowercaseSearch);
|
|
34424
|
+
var descriptionMatch = event.description.toLowerCase().includes(lowercaseSearch);
|
|
34425
|
+
var organizationMatch = ((_b = (_a = event.organization) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes(lowercaseSearch)) || false;
|
|
34426
|
+
return nameMatch || descriptionMatch || organizationMatch;
|
|
34427
|
+
});
|
|
34428
|
+
};
|
|
34429
|
+
/**
|
|
34430
|
+
* Sorts events by date (earliest first)
|
|
34431
|
+
* @param events Array of events to sort
|
|
34432
|
+
* @returns Sorted array of events
|
|
34433
|
+
*/
|
|
34434
|
+
var sortEventsByDate = function (events) {
|
|
34435
|
+
return __spreadArray([], events, true).sort(function (a, b) {
|
|
34436
|
+
var dateA = new Date(a.startDateTime);
|
|
34437
|
+
var dateB = new Date(b.startDateTime);
|
|
34438
|
+
return dateA.getTime() - dateB.getTime();
|
|
34439
|
+
});
|
|
34440
|
+
};
|
|
34441
|
+
/**
|
|
34442
|
+
* Comprehensive filter function that applies all filters
|
|
34443
|
+
* @param events Array of events to filter
|
|
34444
|
+
* @param filters Object containing all filter criteria
|
|
34445
|
+
* @returns Filtered and sorted array of events
|
|
34446
|
+
*/
|
|
34447
|
+
var applyAllEventFilters = function (events, filters) {
|
|
34448
|
+
var filteredEvents = events;
|
|
34449
|
+
// Apply old events filter
|
|
34450
|
+
filteredEvents = filterOldEvents(filteredEvents, filters.hideOldEvents);
|
|
34451
|
+
// Apply date filter
|
|
34452
|
+
filteredEvents = filterEventsByDate(filteredEvents, filters.selectedMonth, filters.selectedYear);
|
|
34453
|
+
// Apply event type filter
|
|
34454
|
+
if (filters.selectedEventTypes && filters.selectedEventTypes.length > 0) {
|
|
34455
|
+
filteredEvents = filterEventsByType(filteredEvents, filters.selectedEventTypes);
|
|
34456
|
+
}
|
|
34457
|
+
// Apply audience filter
|
|
34458
|
+
if (filters.selectedAudiences && filters.selectedAudiences.length > 0) {
|
|
34459
|
+
filteredEvents = filterEventsByAudience(filteredEvents, filters.selectedAudiences);
|
|
34460
|
+
}
|
|
34461
|
+
// Apply search filter
|
|
34462
|
+
if (filters.searchTerm) {
|
|
34463
|
+
filteredEvents = filterEventsBySearch(filteredEvents, filters.searchTerm);
|
|
34464
|
+
}
|
|
34465
|
+
// Sort by date
|
|
34466
|
+
return sortEventsByDate(filteredEvents);
|
|
34467
|
+
};
|
|
34468
|
+
|
|
34469
|
+
var defaultBreadcrumbs = [
|
|
34470
|
+
{
|
|
34471
|
+
title: 'Home',
|
|
34472
|
+
url: '/',
|
|
34473
|
+
},
|
|
34474
|
+
{
|
|
34475
|
+
title: 'Events',
|
|
34476
|
+
url: '/events',
|
|
34477
|
+
},
|
|
34478
|
+
];
|
|
34479
|
+
var defaultFooterLinks = [
|
|
34480
|
+
{
|
|
34481
|
+
title: 'About',
|
|
34482
|
+
url: '/',
|
|
34483
|
+
},
|
|
34484
|
+
{
|
|
34485
|
+
title: 'Accessibility',
|
|
34486
|
+
url: '/',
|
|
34487
|
+
},
|
|
34488
|
+
{
|
|
34489
|
+
title: 'Cookies',
|
|
34490
|
+
url: '/',
|
|
34491
|
+
},
|
|
34492
|
+
{
|
|
34493
|
+
title: 'Contact us',
|
|
34494
|
+
url: '/',
|
|
34495
|
+
},
|
|
34496
|
+
{
|
|
34497
|
+
title: 'Jobs',
|
|
34498
|
+
url: '/',
|
|
34499
|
+
},
|
|
34500
|
+
{
|
|
34501
|
+
title: 'Newsletter',
|
|
34502
|
+
url: '/',
|
|
34503
|
+
},
|
|
34504
|
+
];
|
|
34505
|
+
var EventPage = function (_a) {
|
|
34506
|
+
var event = _a.event, _b = _a.breadcrumbs, breadcrumbs = _b === void 0 ? defaultBreadcrumbs : _b, _c = _a.footerLinks, footerLinks = _c === void 0 ? defaultFooterLinks : _c;
|
|
34507
|
+
return (React.createElement(React.Fragment, null,
|
|
34508
|
+
React.createElement(Header, null),
|
|
34509
|
+
React.createElement(MaxWidthContainer, null,
|
|
34510
|
+
React.createElement(PageMain, null,
|
|
34511
|
+
React.createElement(Breadcrumbs, { breadcrumbsArray: breadcrumbs, hasMargin: true }),
|
|
34512
|
+
React.createElement(DirectoryShortListProvider, null,
|
|
34513
|
+
React.createElement(Event, __assign$2({}, event))),
|
|
34514
|
+
event.updatedAt && (React.createElement("p", null,
|
|
34515
|
+
React.createElement(DisplayDate, { preText: "Last updated ", text: event.updatedAt, format: "YYYY-MM-DD" }))))),
|
|
34516
|
+
React.createElement(Footer, { footerLinksArray: footerLinks })));
|
|
34517
|
+
};
|
|
34518
|
+
|
|
34519
|
+
export { AccessibleLink as AccessibleLinks, Accordion$1 as Accordion, AlertBanner, AlertBannerService, Autocomplete, BackLink, BackToTop, BinCollection, BlockQuote, Breadcrumbs, Button$4 as Button, CallToAction, Cards, CheckboxListFilter, Contents$1 as Contents, ContentsNavigation, CookieBanner, CouncilTaxAlphabeticalDirectory, DirectoryDocumentList, DirectoryService, DirectoryServiceList, DirectoryShortList, DirectoryShortListProvider, DisplayDate, Divider, DownloadableFiles, DropDownFilter, DynamicIcon, Event, EventList, EventPage, Footer, FullWidthContainer, GDS_theme, GlobalStyleReset, GoogleMap, Header, Heading, HeadingWithIcon, HeroImage, HomeHero, Image$2 as Image, ImageAndText, InquestSchedule, Map$1 as Map, MapMarker, MaxWidthContainer, MemorialHero, NewsArticleDate, NewsArticleFeaturedBlock, NewsArticleFilterAccordion, NewsArticleImage, NewsArticleList, NewsArticleListHeader, NewsArticleOldBanner, PageMain, PageSidebar, PageTitle, PageWithSidebarContainer, PageWrapper, Pagination, PhaseBanner, PromoBanner, PromoBlock, PromotedLinks, Promotions, RoadworksList, SearchBox, SearchResultsList, Searchbar, SectionLinks, SectionLinksMobileContents, SectionLinksSidebar, ServiceLinksBoxed, ServicesLinksList, SignpostLinks, SkipToMainContent, StaticMap, Summary, TextInput, Video, WarningText, WarningTextDisclaimer, applyAllEventFilters, filterEventsByAudience, filterEventsByDate, filterEventsBySearch, filterEventsByType, filterOldEvents, lb_theme_north, lb_theme_west, north_theme, sortEventsByDate, useDirectoryShortListContext, west_theme };
|
|
33707
34520
|
//# sourceMappingURL=index.esm.js.map
|