Skip to content

Commit

Permalink
fix(tag-input): No need to clear tag input, should clear complete sea…
Browse files Browse the repository at this point in the history
…rch instead
  • Loading branch information
annelhote committed Mar 5, 2025
1 parent 9b658db commit b135e89
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 50 deletions.
18 changes: 1 addition & 17 deletions client/src/components/tag-input/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export default function TagInput({
onInputHandler,
onTagsChange,
placeholder,
removeAllAffiliations,
seeMoreAction,
seeMoreAfter,
switchGetRorChildren,
Expand Down Expand Up @@ -102,21 +101,7 @@ export default function TagInput({
<Col className="fr-pb-2w">
<TextInput
hint={hint}
label={(
<>
{label}
<Button
aria-label="Remove all affiliations"
className="fr-ml-1w"
color="yellow-tournesol"
icon="delete-line"
onClick={() => removeAllAffiliations()}
size="sm"
title="Remove all affiliations"
variant="text"
/>
</>
)}
label={label}
message={message}
messageType={messageType}
onChange={(e) => setInput(e.target.value)}
Expand Down Expand Up @@ -212,7 +197,6 @@ TagInput.propTypes = {
onInputHandler: PropTypes.func,
onTagsChange: PropTypes.func.isRequired,
placeholder: PropTypes.string,
removeAllAffiliations: PropTypes.func.isRequired,
seeMoreAction: PropTypes.func,
seeMoreAfter: PropTypes.number,
switchGetRorChildren: PropTypes.func,
Expand Down
11 changes: 0 additions & 11 deletions client/src/pages/datasets/search.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,6 @@ export default function DatasetsSearch() {
navigate(`/${pathname.split('/')[1]}/results${search}`);
};

const removeAllAffiliations = () => {
setSearchParams({
...currentSearchParams,
affiliations: [],
deletedAffiliations: [],
});
setSearchedAffiliations([]);
};

const switchGetRorChildren = () => setSearchParams({ ...currentSearchParams, getRorChildren: currentSearchParams.getRorChildren === '1' ? '0' : '1' });

const NB_TAGS_STICKY = 2;
Expand Down Expand Up @@ -269,7 +260,6 @@ export default function DatasetsSearch() {
messageType={messageType}
onInputHandler={setOnInputAffiliationsHandler}
onTagsChange={onTagsChange}
removeAllAffiliations={removeAllAffiliations}
seeMoreAfter={0}
switchGetRorChildren={switchGetRorChildren}
tags={tags}
Expand Down Expand Up @@ -312,7 +302,6 @@ export default function DatasetsSearch() {
messageType={messageType}
onInputHandler={setOnInputAffiliationsHandler}
onTagsChange={onTagsChange}
removeAllAffiliations={removeAllAffiliations}
seeMoreAction={(e) => {
setIsOpen(true);
e.preventDefault();
Expand Down
11 changes: 0 additions & 11 deletions client/src/pages/openalex-affiliations/search.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,6 @@ export default function Search() {
});
};

const removeAllAffiliations = () => {
setSearchParams({
...currentSearchParams,
affiliations: [],
deletedAffiliations: [],
});
setSearchedAffiliations([]);
};

const switchGetRorChildren = () => setSearchParams({ ...currentSearchParams, getRorChildren: currentSearchParams.getRorChildren === '1' ? '0' : '1' });

const NB_TAGS_STICKY = 2;
Expand Down Expand Up @@ -310,7 +301,6 @@ export default function Search() {
messageType={messageType}
onInputHandler={setOnInputAffiliationsHandler}
onTagsChange={onTagsChange}
removeAllAffiliations={removeAllAffiliations}
seeMoreAfter={0}
switchGetRorChildren={switchGetRorChildren}
tags={tags}
Expand Down Expand Up @@ -361,7 +351,6 @@ export default function Search() {
messageType={messageType}
onInputHandler={setOnInputAffiliationsHandler}
onTagsChange={onTagsChange}
removeAllAffiliations={removeAllAffiliations}
seeMoreAction={(e) => {
setIsOpen(true);
e.preventDefault();
Expand Down
11 changes: 0 additions & 11 deletions client/src/pages/publications/search.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,6 @@ export default function PublicationsSearch() {
navigate(`/${pathname.split('/')[1]}/results${search}`);
};

const removeAllAffiliations = () => {
setSearchParams({
...currentSearchParams,
affiliations: [],
deletedAffiliations: [],
});
setSearchedAffiliations([]);
};

const switchGetRorChildren = () => setSearchParams({ ...currentSearchParams, getRorChildren: currentSearchParams.getRorChildren === '1' ? '0' : '1' });

const NB_TAGS_STICKY = 2;
Expand Down Expand Up @@ -269,7 +260,6 @@ export default function PublicationsSearch() {
messageType={messageType}
onInputHandler={setOnInputAffiliationsHandler}
onTagsChange={onTagsChange}
removeAllAffiliations={removeAllAffiliations}
seeMoreAfter={0}
switchGetRorChildren={switchGetRorChildren}
tags={tags}
Expand Down Expand Up @@ -312,7 +302,6 @@ export default function PublicationsSearch() {
messageType={messageType}
onInputHandler={setOnInputAffiliationsHandler}
onTagsChange={onTagsChange}
removeAllAffiliations={removeAllAffiliations}
seeMoreAction={(e) => {
setIsOpen(true);
e.preventDefault();
Expand Down

0 comments on commit b135e89

Please sign in to comment.