Skip to content

Commit

Permalink
fix(ui): Delete unneeded filters
Browse files Browse the repository at this point in the history
  • Loading branch information
annelhote committed Nov 10, 2023
1 parent ad48f67 commit 7815b2f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 24 deletions.
10 changes: 3 additions & 7 deletions client/src/pages/home/views/affiliations.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ import PropTypes from 'prop-types';
import { Column } from 'primereact/column';
import { DataTable } from 'primereact/datatable';

import {
nameTemplate,
statusFilterTemplate,
statusTemplate,
} from '../../../utils/templates';
import { nameTemplate, statusTemplate } from '../../../utils/templates';

export default function AffiliationsView({
allAffiliations,
Expand Down Expand Up @@ -37,8 +33,8 @@ export default function AffiliationsView({
value={allAffiliations}
>
<Column selectionMode="multiple" />
<Column field="status" header="Status" body={statusTemplate} filter showFilterMenu={false} filterElement={statusFilterTemplate} />
<Column field="nameHtml" header="Affiliation" body={nameTemplate} filter filterField="name" filterMatchMode="contains" filterPlaceholder="Search by affiliation" />
<Column field="status" header="Status" body={statusTemplate} />
<Column field="nameHtml" header="Affiliation" body={nameTemplate} />
<Column field="worksNumber" header="Number of works" sortable />
<Column field="matches" header="Number of unique matches" sortable />
</DataTable>
Expand Down
5 changes: 2 additions & 3 deletions client/src/pages/home/views/works.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
affiliationsTemplate,
allIdsTemplate,
authorsTemplate,
statusFilterTemplate,
statusTemplate,
} from '../../../utils/templates';

Expand Down Expand Up @@ -36,13 +35,13 @@ export default function WorksView({
value={works}
>
<Column selectionMode="multiple" />
<Column field="status" header="Status" body={statusTemplate} filter showFilterMenu={false} filterElement={statusFilterTemplate} style={{ minWidth: '10px' }} />
<Column field="status" header="Status" body={statusTemplate} />
<Column field="allIdsHtml" header="Ids" body={allIdsTemplate} filter filterMatchMode="contains" filterPlaceholder="Search by id" />
<Column field="datasource" header="Source" />
<Column field="type" header="Type" />
<Column field="year" header="Year" />
<Column field="journal_name" header="Journal" />
<Column field="affiliationsHtml" header="Affiliations" body={affiliationsTemplate} filter filterField="affiliationsTooltip" filterMatchMode="contains" filterPlaceholder="Search by affiliation" style={{ minWidth: '300px' }} />
<Column field="affiliationsHtml" header="Affiliations" body={affiliationsTemplate} />
<Column field="authorsHtml" header="Authors" body={authorsTemplate} filter filterField="authorsTooltip" filterMatchMode="contains" filterPlaceholder="Search by author" style={{ minWidth: '10px' }} />
<Column field="title" header="Title" filter filterMatchMode="contains" showFilterMenu={false} filterPlaceholder="Search by title" style={{ minWidth: '10px' }} />
</DataTable>
Expand Down
14 changes: 0 additions & 14 deletions client/src/utils/templates.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,6 @@ const nameTemplate = (rowData) => <span dangerouslySetInnerHTML={{ __html: rowDa

const statusTemplate = (rowData) => <Badge text={status[rowData?.status ?? rowData]?.label} type={status[rowData?.status ?? rowData]?.badgeType} />;

const statusFilterTemplate = (options) => (
<Dropdown
className="p-column-filter"
itemTemplate={statusTemplate}
onChange={(e) => options.filterApplyCallback(e.value)}
options={Object.keys(status)}
placeholder=""
style={{ width: '6rem' }}
showClear
value={options.value}
/>
);

export {
affiliationsTemplate,
allIdsTemplate,
Expand All @@ -115,6 +102,5 @@ export {
getAuthorsHtmlField,
getAuthorsTooltipField,
nameTemplate,
statusFilterTemplate,
statusTemplate,
};

0 comments on commit 7815b2f

Please sign in to comment.