Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
8e77f34
2927: Started work on upgrading poster component to work with v2 api
tuj Nov 22, 2024
0e9f0e6
Merge branch 'develop' into feature/eventdatabasen-v2
tuj Jan 23, 2025
4aae53d
2927: Created v2 of poster selector
tuj Jan 27, 2025
8b041a9
2927: Code cleanup
tuj Jan 27, 2025
b10f6d4
2927: Started work on fixing data flow
tuj Jan 28, 2025
829e8fc
2927: Fixed single
tuj Jan 28, 2025
4bab571
2927: Fixes to subscription
tuj Jan 28, 2025
46c3cfa
2927: Added debounce to options
tuj Jan 29, 2025
58f6e72
2927: Use options endpoint
tuj Jan 31, 2025
d616446
2927: Fixed options endpoint
tuj Feb 1, 2025
d1b738c
2927: Fixed reload of options
tuj Feb 1, 2025
72bc6e3
2927: Fixed multiple occurrences case
tuj Feb 3, 2025
57fdd17
2927: Fixed linting issues
tuj Feb 3, 2025
e2dfc98
2927: Changed to upload artifact v4
tuj Feb 3, 2025
a703581
2927: Updated changelog
tuj Feb 3, 2025
cf83ea9
2927: Fixed warning
tuj Feb 3, 2025
b962b64
2927: Fixed occurences issue
tuj Feb 3, 2025
0c19ab2
2927: Styling
tuj Feb 3, 2025
d9cec03
2927: Fixed styling and texts
tuj Feb 3, 2025
30cac60
2927: Applied coding standards
tuj Feb 3, 2025
02e15a6
2927: Fixed issues raised in code review
tuj Feb 4, 2025
8dc65b0
2927: Deconstruct props
tuj Feb 4, 2025
65a6eed
2927: Fixed bugs introduced by deconstruction
tuj Feb 4, 2025
36fc7ba
2927: Moved options to helper
tuj Feb 4, 2025
05f9ce3
2927: Moved overrides to own component
tuj Feb 5, 2025
bf3214f
2927: Refactored poster single component
tuj Feb 5, 2025
195cbe9
2927: Split poster single up into components
tuj Feb 5, 2025
fabfbd4
2927: Applied coding standards
tuj Feb 5, 2025
aa91a52
2927: Removed url from search options
tuj Feb 5, 2025
40e3d1f
2927: Added placeholder text
tuj Feb 5, 2025
da98eaf
2927: Refactored poster subscription
tuj Feb 5, 2025
53e8abd
2927: Added alert with information
tuj Feb 5, 2025
3874ef9
2927: Added placeholders
tuj Feb 5, 2025
ac12491
Merge branch 'develop' into feature/eventdatabasen-v2
tuj Mar 18, 2025
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
6 changes: 3 additions & 3 deletions src/components/slide/content/feed-selector.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ function FeedSelector({
}

if (targets !== null) {
for (let i = 0; i < targets.length; i += 1) {
set(configuration, targets[i].id, targets[i].value);
}
targets.forEach(({ id, value: targetValue }) => {
set(configuration, id, targetValue);
});
}

const newValue = { ...value, configuration };
Expand Down
138 changes: 78 additions & 60 deletions src/components/slide/content/poster/poster-single.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,38 +80,36 @@ function PosterSingle({ configurationChange, feedSource, configuration }) {
},
];

const handleSelectEvent = (singleEvent) => {
if (!singleEvent) {
const handleSelectEvent = (eventId, occurrenceIds = []) => {
if (!eventId) {
return;
}

const numberOfOccurrences = singleEvent.occurrences?.length ?? 0;

const configChange = {
targets: [
{
id: "singleSelectedEvent",
value: singleEvent.entityId,
value: eventId,
},
],
};

if (numberOfOccurrences === 1) {
if (occurrenceIds.length === 1) {
configChange.targets.push({
id: "singleSelectedOccurrence",
value: singleEvent.occurrences[0].entityId,
value: occurrenceIds[0].entityId,
});
}

configurationChange(configChange);
};

const handleSelectOccurrence = (occurrence) => {
const handleSelectOccurrence = (occurrenceId) => {
const configChange = {
targets: [
{
id: "singleSelectedOccurrence",
value: occurrence.entityId,
value: occurrenceId,
},
],
};
Expand Down Expand Up @@ -229,7 +227,6 @@ function PosterSingle({ configurationChange, feedSource, configuration }) {
setSingleSearchTypeValue("");
}, [singleSearchType]);

/* eslint-disable jsx-a11y/control-has-associated-label */
return (
<>
<h5>{t("selected-type-single")}</h5>
Expand All @@ -240,14 +237,13 @@ function PosterSingle({ configurationChange, feedSource, configuration }) {
<>
{singleSelectedEvent && (
<div>
<strong>Valgt begivenhed:</strong>{" "}
{singleSelectedEvent.title} (
<b>Valgt begivenhed:</b> {singleSelectedEvent.title} (
{singleSelectedEvent?.organizer?.name})
</div>
)}
{singleSelectedOccurrence && (
<div>
<strong>{t("chosen-occurrence")}:</strong>{" "}
<b>{t("chosen-occurrence")}:</b>{" "}
{formatDate(singleSelectedOccurrence.startDate)}
{singleSelectedOccurrence?.ticketPriceRange &&
` - ${singleSelectedOccurrence.ticketPriceRange}`}
Expand Down Expand Up @@ -355,7 +351,10 @@ function PosterSingle({ configurationChange, feedSource, configuration }) {
)}
{singleSearchType === "locations" && (
<Col>
<label className="form-label" htmlFor="single-search-select">
<label
className="form-label"
htmlFor="single-search-select-locations"
>
{t("single-search-select")}
</label>
<AsyncSelect
Expand All @@ -373,7 +372,10 @@ function PosterSingle({ configurationChange, feedSource, configuration }) {
)}
{singleSearchType === "organizations" && (
<Col>
<label className="form-label" htmlFor="single-search-select">
<label
className="form-label"
htmlFor="single-search-select-organizations"
>
{t("single-search-select")}
</label>
<AsyncSelect
Expand All @@ -391,7 +393,10 @@ function PosterSingle({ configurationChange, feedSource, configuration }) {
)}
{singleSearchType === "tags" && (
<Col>
<label className="form-label" htmlFor="single-search-select">
<label
className="form-label"
htmlFor="single-search-select-tags"
>
{t("single-search-select")}
</label>
<AsyncSelect
Expand Down Expand Up @@ -426,38 +431,50 @@ function PosterSingle({ configurationChange, feedSource, configuration }) {
<th scope="col">{t("table-image")}</th>
<th scope="col">{t("table-event")}</th>
<th scope="col">{t("table-date")}</th>
<th scope="col" aria-label={t("table-actions")} />
</tr>
</thead>
<tbody>
{singleSearchEvents?.map((searchEvent) => (
<tr
style={{ cursor: "pointer" }}
key={searchEvent.entityId}
onClick={() => handleSelectEvent(searchEvent)}
>
<td>
{searchEvent?.imageUrls?.small && (
<img
src={searchEvent?.imageUrls?.small}
alt={searchEvent?.title}
style={{ maxWidth: "80px" }}
/>
)}
</td>
<td>
<strong>{searchEvent.title}</strong>
<br />
{searchEvent.organizer.name}
</td>
<td>
{searchEvent?.occurrences?.length > 0 &&
formatDate(searchEvent?.occurrences[0]?.start)}
{searchEvent?.occurrences?.length > 1 && (
<span>, ...</span>
)}
</td>
</tr>
))}
{singleSearchEvents?.map(
(entityId, title, imageUrls, organizer, occurrences) => (
<tr key={entityId}>
<td>
{imageUrls?.small && (
<img
src={imageUrls?.small}
alt={t("search-result-image")}
style={{ maxWidth: "80px" }}
/>
)}
</td>
<td>
<b>{title}</b>
<br />
{organizer.name}
</td>
<td>
{occurrences?.length > 0 &&
formatDate(occurrences[0]?.start)}
{occurrences?.length > 1 && <span>, ...</span>}
</td>
<td>
<Button
onClick={() =>
handleSelectEvent(
entityId,
occurrences.map(
({ entityId: occurrenceEntityId }) =>
occurrenceEntityId
)
)
}
>
{t("choose-event")}
</Button>
</td>
</tr>
)
)}
{singleSearchEvents?.length === 0 && (
<tr>
<td colSpan="3">{t("no-results")}</td>
Expand All @@ -483,23 +500,25 @@ function PosterSingle({ configurationChange, feedSource, configuration }) {
<tr>
<th scope="col">{t("table-date")}</th>
<th scope="col">{t("table-price")}</th>
<th scope="col" />
<th scope="col" aria-label={t("table-actions")} />
</tr>
</thead>
<tbody>
{singleSelectedEvent?.occurrences?.map((occurrence) => (
<tr key={occurrence.entityId}>
<td>{formatDate(occurrence.start)}</td>
<td>{occurrence.ticketPriceRange}</td>
<td>
<Button
onClick={() => handleSelectOccurrence(occurrence)}
>
{t("choose-occurrence")}
</Button>
</td>
</tr>
))}
{singleSelectedEvent.occurrences.map(
({ entityId, start, ticketPriceRange }) => (
<tr key={entityId}>
<td>{formatDate(start)}</td>
<td>{ticketPriceRange}</td>
<td>
<Button
onClick={() => handleSelectOccurrence(entityId)}
>
{t("choose-occurrence")}
</Button>
</td>
</tr>
)
)}
</tbody>
</table>
)}
Expand All @@ -510,7 +529,6 @@ function PosterSingle({ configurationChange, feedSource, configuration }) {
)}
</>
);
/* eslint-enable jsx-a11y/control-has-associated-label */
}

PosterSingle.propTypes = {
Expand Down
7 changes: 4 additions & 3 deletions src/components/slide/content/poster/poster-subscription.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ function PosterSubscription({

const optionsEndpoint = feedSource.admin[0].endpointOption ?? null;

// The user can choose between 1-10 entries to display.
const numberOptions = Array.from(Array(10).keys());

useEffect(() => {
Expand Down Expand Up @@ -92,19 +93,19 @@ function PosterSubscription({
itemsPerPage: subscriptionNumberValue,
});

const places = subscriptionPlaceValue.map((option) => option.value);
const places = subscriptionPlaceValue.map(({ value }) => value);

places.forEach((place) => {
query.append("location", place);
});

const organizers = subscriptionOrganizerValue.map((option) => option.value);
const organizers = subscriptionOrganizerValue.map(({ value }) => value);

organizers.forEach((organizer) => {
query.append("organization", organizer);
});

const tags = subscriptionTagValue.map((option) => option.value);
const tags = subscriptionTagValue.map(({ value }) => value);

tags.forEach((tag) => {
query.append("tag", tag);
Expand Down
3 changes: 3 additions & 0 deletions src/translations/da/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1092,11 +1092,14 @@
"table-date": "Dato",
"table-price": "Pris",
"table-place": "Sted",
"table-actions": "Handlinger",
"number-of-slides": "Antal slides",
"number-of-slides-helptext": "Vælg op til 10 begivenheder som vil blive vist på hvert sit slide",
"choose-an-occurrence": "Vælg en forekomst",
"choose-occurrence": "Vælg",
"choose-event": "Vælg",
"search-for-event": "Søg efter arrangement",
"search-result-image": "Billede på begivenheden",
"chosen-occurrence": "Valgt forekomst",
"single-search-type": "Søgekriterium",
"single-search-text": "Søgetekst",
Expand Down