Skip to content

Commit

Permalink
refactor(navigation): Clean code and remove unneeded stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
annelhote committed Nov 8, 2024
1 parent 8f0299b commit e4f5543
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 152 deletions.
23 changes: 0 additions & 23 deletions client/src/pages/datasets/results.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,29 +199,6 @@ export default function Affiliations() {
))} */}
</TagGroup>
</Col>
<Col className="text-right">
<SegmentedControl
id="segSelector"
name="segSelector"
// onChangeValue={(view) => setSearchParams({ ...options, view })}
>
<SegmentedElement
checked={options.view === 'openalex'}
label="Improve OpenAlex (RORs)"
value="openalex"
/>
<SegmentedElement
checked={options.view === 'publications'}
label="Publications corpus"
value="publications"
/>
<SegmentedElement
checked={options.view === 'datasets'}
label="Datasets corpus"
value="datasets"
/>
</SegmentedControl>
</Col>
</Row>
</Col>
</Row>
Expand Down
28 changes: 2 additions & 26 deletions client/src/pages/datasets/search.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
Button,
Checkbox,
Col,
Container,
Modal,
Expand Down Expand Up @@ -47,7 +46,6 @@ export default function Search() {
// Set default params values
const searchParamsTmp = {
affiliations: searchParams.getAll('affiliations') ?? [],
datasets: searchParams.get('datasets') ?? false,
deletedAffiliations: searchParams.getAll('deletedAffiliations') ?? [],
endYear: searchParams.get('endYear') ?? '2023',
startYear: searchParams.get('startYear') ?? '2023',
Expand All @@ -62,7 +60,6 @@ export default function Search() {

setCurrentSearchParams({
affiliations,
datasets: searchParams.get('datasets') === 'true',
deletedAffiliations: deletedAffiliations1,
endYear: searchParams.get('endYear', '2023'),
startYear: searchParams.get('startYear', '2023'),
Expand Down Expand Up @@ -208,7 +205,8 @@ export default function Search() {
}
setMessageType('');
setMessage('');
navigate(`/${pathname.split('/')[1]}/results${search}`);
const queryParams = search.length === 0 ? '?datasets=true' : `${search}&datasets=true`;
navigate(`/${pathname.split('/')[1]}/results${queryParams}`);
};

const NB_TAGS_STICKY = 2;
Expand Down Expand Up @@ -266,16 +264,6 @@ export default function Search() {
))}
</Select>
</Col>
<Col>
<Checkbox
checked={currentSearchParams?.datasets ?? false}
label="Search for datasets only"
onChange={(e) => setSearchParams({
...currentSearchParams,
datasets: e.target.checked,
})}
/>
</Col>
</Row>
</Col>
<Col xs="12">
Expand Down Expand Up @@ -376,18 +364,6 @@ export default function Search() {
</Select>
</Col>
</Row>
<Row className="fr-mt-2w" gutters verticalAlign="bottom">
<Col>
<Checkbox
checked={currentSearchParams?.datasets ?? false}
label="Search for datasets only"
onChange={(e) => setSearchParams({
...currentSearchParams,
datasets: e.target.checked,
})}
/>
</Col>
</Row>
</Col>
</Row>
<Row className="fr-pt-0 fr-pr-2w fr-pb-2w fr-pl-2w">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ import { useEffect, useState } from 'react';
import { useSearchParams } from 'react-router-dom';
import useWebSocket from 'react-use-websocket';

import useToast from '../hooks/useToast';
import { getMentionsCorrections } from '../utils/curations';
import MentionListItem from '../../components/mention-list/item';
import useToast from '../../hooks/useToast';
import { getMentionsCorrections } from '../../utils/curations';
import {
affiliations2Template,
authorsTemplate,
doiTemplate,
hasCorrectionTemplate,
} from '../utils/templates';
import { capitalize, getMentions } from '../utils/works';
import MentionListItem from '../components/mention-list/item';
} from '../../utils/templates';
import { capitalize, getMentions } from '../../utils/works';

const { VITE_WS_HOST } = import.meta.env;

Expand Down
23 changes: 0 additions & 23 deletions client/src/pages/openalex-ror/results.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,29 +199,6 @@ export default function Affiliations() {
))} */}
</TagGroup>
</Col>
<Col className="text-right">
<SegmentedControl
id="segSelector"
name="segSelector"
// onChangeValue={(view) => setSearchParams({ ...options, view })}
>
<SegmentedElement
checked={options.view === 'openalex'}
label="Improve OpenAlex (RORs)"
value="openalex"
/>
<SegmentedElement
checked={options.view === 'publications'}
label="Publications corpus"
value="publications"
/>
<SegmentedElement
checked={options.view === 'datasets'}
label="Datasets corpus"
value="datasets"
/>
</SegmentedControl>
</Col>
</Row>
</Col>
</Row>
Expand Down
25 changes: 0 additions & 25 deletions client/src/pages/openalex-ror/search.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
Button,
Checkbox,
Col,
Container,
Modal,
Expand Down Expand Up @@ -47,7 +46,6 @@ export default function Search() {
// Set default params values
const searchParamsTmp = {
affiliations: searchParams.getAll('affiliations') ?? [],
datasets: searchParams.get('datasets') ?? false,
deletedAffiliations: searchParams.getAll('deletedAffiliations') ?? [],
endYear: searchParams.get('endYear') ?? '2023',
startYear: searchParams.get('startYear') ?? '2023',
Expand All @@ -62,7 +60,6 @@ export default function Search() {

setCurrentSearchParams({
affiliations,
datasets: searchParams.get('datasets') === 'true',
deletedAffiliations: deletedAffiliations1,
endYear: searchParams.get('endYear', '2023'),
startYear: searchParams.get('startYear', '2023'),
Expand Down Expand Up @@ -266,16 +263,6 @@ export default function Search() {
))}
</Select>
</Col>
<Col>
<Checkbox
checked={currentSearchParams?.datasets ?? false}
label="Search for datasets only"
onChange={(e) => setSearchParams({
...currentSearchParams,
datasets: e.target.checked,
})}
/>
</Col>
</Row>
</Col>
<Col xs="12">
Expand Down Expand Up @@ -376,18 +363,6 @@ export default function Search() {
</Select>
</Col>
</Row>
<Row className="fr-mt-2w" gutters verticalAlign="bottom">
<Col>
<Checkbox
checked={currentSearchParams?.datasets ?? false}
label="Search for datasets only"
onChange={(e) => setSearchParams({
...currentSearchParams,
datasets: e.target.checked,
})}
/>
</Col>
</Row>
</Col>
</Row>
<Row className="fr-pt-0 fr-pr-2w fr-pb-2w fr-pl-2w">
Expand Down
25 changes: 0 additions & 25 deletions client/src/pages/publications/results.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import {
Col,
Container,
Row,
SegmentedControl,
SegmentedElement,
Spinner,
Tag,
TagGroup,
Expand Down Expand Up @@ -199,29 +197,6 @@ export default function Affiliations() {
))} */}
</TagGroup>
</Col>
<Col className="text-right">
<SegmentedControl
id="segSelector"
name="segSelector"
// onChangeValue={(view) => setSearchParams({ ...options, view })}
>
<SegmentedElement
checked={options.view === 'openalex'}
label="Improve OpenAlex (RORs)"
value="openalex"
/>
<SegmentedElement
checked={options.view === 'publications'}
label="Publications corpus"
value="publications"
/>
<SegmentedElement
checked={options.view === 'datasets'}
label="Datasets corpus"
value="datasets"
/>
</SegmentedControl>
</Col>
</Row>
</Col>
</Row>
Expand Down
25 changes: 0 additions & 25 deletions client/src/pages/publications/search.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
Button,
Checkbox,
Col,
Container,
Modal,
Expand Down Expand Up @@ -47,7 +46,6 @@ export default function Search() {
// Set default params values
const searchParamsTmp = {
affiliations: searchParams.getAll('affiliations') ?? [],
datasets: searchParams.get('datasets') ?? false,
deletedAffiliations: searchParams.getAll('deletedAffiliations') ?? [],
endYear: searchParams.get('endYear') ?? '2023',
startYear: searchParams.get('startYear') ?? '2023',
Expand All @@ -62,7 +60,6 @@ export default function Search() {

setCurrentSearchParams({
affiliations,
datasets: searchParams.get('datasets') === 'true',
deletedAffiliations: deletedAffiliations1,
endYear: searchParams.get('endYear', '2023'),
startYear: searchParams.get('startYear', '2023'),
Expand Down Expand Up @@ -266,16 +263,6 @@ export default function Search() {
))}
</Select>
</Col>
<Col>
<Checkbox
checked={currentSearchParams?.datasets ?? false}
label="Search for datasets only"
onChange={(e) => setSearchParams({
...currentSearchParams,
datasets: e.target.checked,
})}
/>
</Col>
</Row>
</Col>
<Col xs="12">
Expand Down Expand Up @@ -376,18 +363,6 @@ export default function Search() {
</Select>
</Col>
</Row>
<Row className="fr-mt-2w" gutters verticalAlign="bottom">
<Col>
<Checkbox
checked={currentSearchParams?.datasets ?? false}
label="Search for datasets only"
onChange={(e) => setSearchParams({
...currentSearchParams,
datasets: e.target.checked,
})}
/>
</Col>
</Row>
</Col>
</Row>
<Row className="fr-pt-0 fr-pr-2w fr-pb-2w fr-pl-2w">
Expand Down

0 comments on commit e4f5543

Please sign in to comment.