Skip to content

Commit

Permalink
Merge branch '25086-idra-news-events-split' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanbutura committed Jun 4, 2024
2 parents 0515777 + 9c674a1 commit 27ad408
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,7 @@ const FacetedSearch: React.FC<FacetedSearchProps> = ({ searchIndex }) => {
/>
)}
{total == 0 && appConfig.emptyText && (
<Flex>
{appConfig.emptyText}
</Flex>
<Flex>{appConfig.emptyText}</Flex>
)}
</Container>
{total > 0 && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ interface TabOption {

interface TabsFiltersProps {
ButtonOptionProps?: AntdButtonProps
hideShowAll?: boolean
id: string
onChange: (id: string, value: string) => void
options: TabOption[]
value: string[],
hideShowAll?: boolean,
value: string[]
}

const TabsFilters: React.FC<TabsFiltersProps> = ({
id,
ButtonOptionProps = {},
hideShowAll,
onChange,
options,
value,
hideShowAll,
}) => {
return (
<div className="search-tabs-filters">
Expand All @@ -50,7 +50,7 @@ const TabsFilters: React.FC<TabsFiltersProps> = ({
<Button
key={option.values.value}
className={classNames({
active: value.includes(option.values.value)
active: value.includes(option.values.value),
})}
shape="round"
onClick={() => onChange(id, option.values.value)}
Expand Down
12 changes: 6 additions & 6 deletions packages/next-drupal/src/hooks/useSearchApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,24 +129,24 @@ export const useSearchApp = (
// EVENTS SORT/FILTER
if (searchIndex === 'events') {
if (sort?.date?.field) {
let dateFilter = djap.getQueryObject()?.filter?.date;
let dateFilter = djap.getQueryObject()?.filter?.date

// If there is no date filter, default to showing upcoming events.
if (!dateFilter) {
// relative_date_facets module transforms a single date filter
// into a range.
// We need to set a future date so that the module will return
// all future events between now and +100 years.
let futureDate = new Date();
futureDate.setFullYear(futureDate.getFullYear() + 100);
dateFilter = futureDate.toISOString().split('T')[0];
const futureDate = new Date()
futureDate.setFullYear(futureDate.getFullYear() + 100)
dateFilter = futureDate.toISOString().split('T')[0]
djap.addFilter('date', dateFilter)
}

let sortField = sort.date.field;
let sortField = sort.date.field
// Upcoming events should be sorted chronologically.
if (dateFilter >= todayDate) {
sortField = sortField.replace('-', '');
sortField = sortField.replace('-', '')
}
djap.addSort(sortField)
}
Expand Down

0 comments on commit 27ad408

Please sign in to comment.