Skip to content

Commit

Permalink
2927: Fixed reload of options
Browse files Browse the repository at this point in the history
  • Loading branch information
tuj committed Feb 1, 2025
1 parent d616446 commit d1b738c
Showing 1 changed file with 46 additions and 15 deletions.
61 changes: 46 additions & 15 deletions src/components/slide/content/poster/poster-single.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,16 +181,6 @@ function PosterSingle({ configurationChange, feedSource, configuration }) {
}
}, [configuration?.singleSelectedEvent]);

useEffect(() => {
if (
singleSearchType === "tags" ||
singleSearchType === "locations" ||
singleSearchType === "organizations"
) {
// TODO: Refresh dropdown results.
}
}, [singleSearchType]);

const timeoutRef = useRef(null);

const debounceOptions = (inputValue) => {
Expand Down Expand Up @@ -336,15 +326,49 @@ function PosterSingle({ configurationChange, feedSource, configuration }) {
/>
</Col>
)}
{(singleSearchType === "tags" ||
singleSearchType === "locations" ||
singleSearchType === "organizations") && (
{(singleSearchType === "locations") && (
<Col>
<label className="form-label" htmlFor="single-search-select">
{t("single-search-select")}
</label>
<AsyncSelect
id="single-search-select-locations"
isClearable
isSearchable
defaultOptions
loadOptions={debounceOptions}
defaultInputValue={singleSearchTypeValue}
onChange={(newValue) => {
setSingleSearchTypeValue(newValue);
}}
/>
</Col>
)}
{(singleSearchType === "organizations") && (
<Col>
<label className="form-label" htmlFor="single-search-select">
{t("single-search-select")}
</label>
<AsyncSelect
id="single-search-select-organizations"
isClearable
isSearchable
defaultOptions
loadOptions={debounceOptions}
defaultInputValue={singleSearchTypeValue}
onChange={(newValue) => {
setSingleSearchTypeValue(newValue);
}}
/>
</Col>
)}
{(singleSearchType === "tags") && (
<Col>
<label className="form-label" htmlFor="single-search-select">
{t("single-search-select")}
</label>
<AsyncSelect
id="single-search-select"
id="single-search-select-tags"
isClearable
isSearchable
defaultOptions
Expand Down Expand Up @@ -381,7 +405,7 @@ function PosterSingle({ configurationChange, feedSource, configuration }) {
{singleSearchEvents?.map((searchEvent) => (
<tr
style={{ cursor: "pointer" }}
key={searchEvent["@id"]}
key={searchEvent.entityId}
onClick={() => handleSelectEvent(searchEvent)}
>
<td>
Expand Down Expand Up @@ -469,12 +493,19 @@ PosterSingle.propTypes = {
configuration: PropTypes.shape({
singleSelectedEvent: PropTypes.number,
singleSelectedOccurrence: PropTypes.number,
overrideTitle: PropTypes.string,
overrideSubTitle: PropTypes.string,
overrideTicketPrice: PropTypes.string,
readMoreText: PropTypes.string,
overrideReadMoreUrl: PropTypes.string,
hideTime: PropTypes.bool,
}).isRequired,
feedSource: PropTypes.shape({
admin: PropTypes.arrayOf(
PropTypes.shape({
endpointEntity: PropTypes.string,
endpointSearch: PropTypes.string,
endpointOption: PropTypes.string,
})
),
}).isRequired,
Expand Down

0 comments on commit d1b738c

Please sign in to comment.