setAddToCollectionOpen(false)}
+ concept={concept}
+ />
)
}
diff --git a/src/components/concepts/ConceptHeader.jsx b/src/components/concepts/ConceptHeader.jsx
index baae222f..5675db5f 100644
--- a/src/components/concepts/ConceptHeader.jsx
+++ b/src/components/concepts/ConceptHeader.jsx
@@ -5,16 +5,19 @@ import Typography from '@mui/material/Typography'
import Skeleton from '@mui/material/Skeleton';
import Button from '@mui/material/Button';
import DownIcon from '@mui/icons-material/ArrowDropDown';
+import AddIcon from '@mui/icons-material/PlaylistAddOutlined';
import CloseIconButton from '../common/CloseIconButton';
import { toOwnerURI, currentUserHasAccess } from '../../common/utils';
import Breadcrumbs from '../common/Breadcrumbs'
import { BLACK } from '../../common/colors'
import ConceptManagementList from './ConceptManagementList'
+import AddToCollectionDialog from '../common/AddToCollectionDialog'
const ConceptHeader = ({concept, repo, onClose, repoURL, onEdit, onRetire, nested, loading}) => {
const { t } = useTranslation()
const [menu, setMenu] = React.useState(false)
const [menuAnchorEl, setMenuAnchorEl] = React.useState(false)
+ const [addToCollectionOpen, setAddToCollectionOpen] = React.useState(false)
const onMenuOpen = event => {
setMenuAnchorEl(event.currentTarget)
setMenu(true)
@@ -69,17 +72,37 @@ const ConceptHeader = ({concept, repo, onClose, repoURL, onEdit, onRetire, neste
}
{
- currentUserHasAccess() && repo?.version === 'HEAD' && has(repo, 'source_type') && !loading &&
+ !loading &&
-
+
+ {currentUserHasAccess() && (
+ }
+ variant='text'
+ size='small'
+ color='primary'
+ sx={{textTransform: 'none'}}
+ onClick={() => setAddToCollectionOpen(true)}
+ >
+ Add to Collection
+
+ )}
+
+ {currentUserHasAccess() && repo?.version === 'HEAD' && has(repo, 'source_type') && (
} variant='text' sx={{textTransform: 'none', color: 'surface.contrastText'}} onClick={onMenuOpen} id='concept-actions'>
{t('common.actions')}
+ )}
}
+ setAddToCollectionOpen(false)}
+ concept={concept}
+ />
)
}
diff --git a/src/components/repos/RepoTooltip.jsx b/src/components/repos/RepoTooltip.jsx
index a63213f8..2ae7d4d6 100644
--- a/src/components/repos/RepoTooltip.jsx
+++ b/src/components/repos/RepoTooltip.jsx
@@ -121,7 +121,7 @@ const TooltipTitle = ({ repo }) => {
)
}
-const RepoTooltip = ({ repo, basicTooltip, children, spanStyle }) => {
+const RepoTooltip = ({ repo, basicTooltip, children, spanStyle, enterDelay, enterNextDelay }) => {
return basicTooltip ? (
@@ -135,6 +135,8 @@ const RepoTooltip = ({ repo, basicTooltip, children, spanStyle }) => {
maxWidth: 400
}
}}
+ enterDelay={enterDelay}
+ enterNextDelay={enterNextDelay}
title={
diff --git a/src/components/search/SearchResults.jsx b/src/components/search/SearchResults.jsx
index 2368c3a4..6021d618 100644
--- a/src/components/search/SearchResults.jsx
+++ b/src/components/search/SearchResults.jsx
@@ -7,7 +7,9 @@ import Badge from '@mui/material/Badge';
import Toolbar from '@mui/material/Toolbar';
import Typography from '@mui/material/Typography';
import IconButton from '@mui/material/IconButton';
+import Button from '@mui/material/Button';
import FilterListIcon from '@mui/icons-material/FilterList';
+import AddIcon from '@mui/icons-material/PlaylistAddOutlined';
import TablePagination from '@mui/material/TablePagination';
import Skeleton from '@mui/material/Skeleton';
import { isNumber, isNaN, flatten, values } from 'lodash'
@@ -15,10 +17,12 @@ import SearchControls from './SearchControls';
import NoResults from './NoResults';
import TableResults from './TableResults';
import CardResults from './CardResults';
+import AddToCollectionDialog from '../common/AddToCollectionDialog';
import { SORT_ATTRS } from './ResultConstants'
+import { isLoggedIn } from '../../common/utils';
const ResultsToolbar = props => {
- const { numSelected, title, onFiltersToggle, disabled, isFilterable, onDisplayChange, display, order, orderBy, onOrderByChange, sortableFields, noCardDisplay, toolbarControl, appliedFilters, openFilters } = props;
+ const { numSelected, title, onFiltersToggle, disabled, isFilterable, onDisplayChange, display, order, orderBy, onOrderByChange, sortableFields, noCardDisplay, toolbarControl, appliedFilters, openFilters, bulkActions } = props;
const filtersCount = flatten(values(appliedFilters).map(v => values(v))).length
return (
{
}
{numSelected > 0 ? (
{
)}
+ {numSelected > 0 && bulkActions && (
+
+ {bulkActions}
+
+ )}
{
const [cardDisplayAnimation, setCardDisplayAnimation] = React.useState('animation-disappear')
const [tableDisplayAnimation, setTableDisplayAnimation] = React.useState('animation-appear')
const [selected, setSelected] = React.useState(props.selected || []);
+ const [addToCollectionOpen, setAddToCollectionOpen] = React.useState(false);
const page = props.results?.page;
const rowsPerPage = props.results?.pageSize;
@@ -213,6 +223,21 @@ const SearchResults = props => {
const isCardDisplay = !noCardDisplay && display === 'card'
+ const selectedRows = rows.filter(row => selected.includes(row.version_url || row.url || row.id))
+
+ const addToCollectionBulkAction = props.resource === 'concepts' && isLoggedIn() && selected.length > 0
+ ? (
+ }
+ variant='contained'
+ size='small'
+ sx={{textTransform: 'none', whiteSpace: 'nowrap', borderRadius: '8px', bgcolor: 'primary.60', color: '#fff', '&:hover': {bgcolor: 'primary.50'}}}
+ onClick={() => setAddToCollectionOpen(true)}
+ >
+ {t('addToCollection.add_to_collection')}
+
+ ) : null
+
React.useEffect(() => {
setSelected(props.selected || [])
}, [props.selected])
@@ -239,6 +264,7 @@ const SearchResults = props => {
noCardDisplay={noCardDisplay}
toolbarControl={props.toolbarControl}
appliedFilters={props.appliedFilters}
+ bulkActions={addToCollectionBulkAction}
/>
}
{
@@ -276,6 +302,11 @@ const SearchResults = props => {
}
}
+ setAddToCollectionOpen(false)}
+ concepts={selectedRows}
+ />
);
}
diff --git a/src/components/search/TableResults.jsx b/src/components/search/TableResults.jsx
index 7939c355..881b81d2 100644
--- a/src/components/search/TableResults.jsx
+++ b/src/components/search/TableResults.jsx
@@ -139,6 +139,7 @@ const TableResults = ({selected, bgColor, handleClick, handleRowClick, handleSel
}
return (
+
+
)
}
diff --git a/src/i18n/locales/en/translations.json b/src/i18n/locales/en/translations.json
index 86fdebe4..00bce728 100644
--- a/src/i18n/locales/en/translations.json
+++ b/src/i18n/locales/en/translations.json
@@ -456,6 +456,20 @@
"target_owner": "Target Owner",
"view_canonical_url_registry": "View Canonical URL registry"
},
+ "addToCollection": {
+ "title": "Add to Collection",
+ "adding_single": "Adding: {{name}} from {{source}}",
+ "adding_multiple": "Adding {{count}} concepts",
+ "target_collection": "Target Collection",
+ "no_editable_collections": "No editable collections found",
+ "adding_reference": "Adding reference…",
+ "request_accepted": "Your request was accepted and references will be added shortly.",
+ "add_button": "Add Reference",
+ "reference_header": "Reference",
+ "error_header": "Error",
+ "no_references_added": "No references added",
+ "add_to_collection": "Add to Collection"
+ },
"import": {
"upload_file_tooltip": "Upload JSON/CSV/ZIP File",
"json_data_tooltip": "Submit JSON Data",