-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add organization filter to event and registration search pages
- Loading branch information
1 parent
5c245cb
commit 697a72a
Showing
37 changed files
with
448 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/common/components/filterTag/publisherFilterTag/PublisherFilterTag.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
import useOrganizationOptions from '../../../../domain/organization/hooks/useOrganizationOptions'; | ||
import getValue from '../../../../utils/getValue'; | ||
import FilterTag, { FilterTagProps } from '../FilterTag'; | ||
|
||
type Props = Omit<FilterTagProps, 'text' | 'type'>; | ||
|
||
const PublisherFilterTag: React.FC<Props> = ({ value, ...rest }) => { | ||
const { t } = useTranslation(); | ||
const { loading, options } = useOrganizationOptions(); | ||
|
||
const name = getValue(options.find((o) => o.value === value)?.label, ''); | ||
|
||
return ( | ||
<FilterTag | ||
{...rest} | ||
text={loading ? t('common.loading') : name} | ||
type="publisher" | ||
value={value} | ||
/> | ||
); | ||
}; | ||
|
||
export default PublisherFilterTag; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/domain/eventSearch/searchPanel/publisherSelector/PublisherSelector.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import React from 'react'; | ||
|
||
import MultiSelectDropdown, { | ||
MultiselectDropdownProps, | ||
} from '../../../../common/components/multiSelectDropdown/MultiSelectDropdown'; | ||
import skipFalsyType from '../../../../utils/skipFalsyType'; | ||
import useOrganizationOptions from '../../../organization/hooks/useOrganizationOptions'; | ||
|
||
export type PublisherSelectorProps = { value: string[] } & Omit< | ||
MultiselectDropdownProps, | ||
'options' | 'value' | ||
>; | ||
|
||
const PublisherSelector: React.FC<PublisherSelectorProps> = ({ | ||
id, | ||
toggleButtonLabel, | ||
value, | ||
...rest | ||
}) => { | ||
const [searchValue, setSearchValue] = React.useState(''); | ||
|
||
const { loading, options } = useOrganizationOptions(); | ||
|
||
return ( | ||
<MultiSelectDropdown | ||
{...rest} | ||
id={id} | ||
options={options} | ||
searchValue={searchValue} | ||
setSearchValue={setSearchValue} | ||
showSearch={true} | ||
showLoadingSpinner={loading} | ||
toggleButtonLabel={toggleButtonLabel} | ||
value={value | ||
.map((v) => options.find((o) => o.value === v)) | ||
.filter(skipFalsyType)} | ||
/> | ||
); | ||
}; | ||
|
||
export default PublisherSelector; |
Oops, something went wrong.