Skip to content

Commit

Permalink
layout(
Browse files Browse the repository at this point in the history
  • Loading branch information
ericjeangirard committed Feb 23, 2024
1 parent e3f0b95 commit 47d99b1
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 18 deletions.
4 changes: 2 additions & 2 deletions client/src/pages/datasetsTab.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
import PropTypes from 'prop-types';
import { useEffect, useState } from 'react';

import WorksView from './worksView';
import DatasetsView from './datasetsView';
import Gauge from '../components/gauge';
import { datasources, status } from '../config';
import { normalizeName, renderButtons } from '../utils/works';
Expand Down Expand Up @@ -186,7 +186,7 @@ export default function DatasetsTab({ datasets, publishers, selectedDatasets, se
</CheckboxGroup>
</Col>
<Col n="10">
<WorksView
<DatasetsView
selectedWorks={selectedDatasets}
setSelectedWorks={setSelectedDatasets}
works={filteredDatasets}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
statusTemplate,
} from '../utils/templates';

export default function WorksView({
export default function DatasetsView({
selectedWorks,
setSelectedWorks,
works,
Expand All @@ -37,23 +37,20 @@ export default function WorksView({
value={works}
>
<Column selectionMode="multiple" />
<Column field="status" header="Status" body={statusTemplate} />
<Column field="allIds" header="Ids" body={allIdsTemplate} />
<Column field="datasource" header="Source" body={datasourceTemplate} />
<Column field="type" header="Type" />
<Column field="year" header="Year" />
<Column field="publisher" header="Publisher" />
<Column field="affiliationsHtml" header="Affiliations" body={affiliationsTemplate} />
<Column field="authors" header="Authors" body={authorsTemplate} style={{ minWidth: '200px' }} />
<Column field="title" header="Title" style={{ minWidth: '200px' }} />
<Column field="fr_publications_linked" header="Linked Article" body={linkedDOITemplate} />
<Column field="fr_authors_orcid" header="My institution author ORCID" />
<Column field="fr_authors_name" header="My institution author name" />
<Column field="status" header="Status" body={statusTemplate} style={{ maxWidth: '100px' }} />
<Column field="allIds" header="Ids" body={allIdsTemplate} style={{ maxWidth: '180px' }} />
<Column field="type" header="Type" style={{ maxWidth: '90px' }} />
<Column field="year" header="Year" style={{ maxWidth: '70px' }} />
<Column field="publisher" header="Publisher" style={{ maxWidth: '70px' }} />
<Column field="affiliationsHtml" header="Affiliations" body={affiliationsTemplate} style={{ maxWidth: '220px' }} />
<Column field="fr_publications_linked" header="Linked Article" body={linkedDOITemplate} style={{ maxWidth: '180px' }} />
<Column field="fr_authors_orcid" header="My institution author ORCID" style={{ maxWidth: '150px' }} />
<Column field="fr_authors_name" header="My institution author name" style={{ maxWidth: '150px' }} />
</DataTable>
);
}

WorksView.propTypes = {
DatasetsView.propTypes = {
selectedWorks: PropTypes.arrayOf(PropTypes.shape({
affiliations: PropTypes.arrayOf(PropTypes.object).isRequired,
allIds: PropTypes.arrayOf(PropTypes.object).isRequired,
Expand Down
4 changes: 2 additions & 2 deletions client/src/pages/publicationsTab.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
import PropTypes from 'prop-types';
import { useEffect, useState } from 'react';

import WorksView from './worksView';
import PublicationsView from './publicationsView';
import Gauge from '../components/gauge';
import { datasources, status } from '../config';
import { normalizeName, renderButtons } from '../utils/works';
Expand Down Expand Up @@ -186,7 +186,7 @@ export default function PublicationsTab({ publications, publishers, selectedPubl
</CheckboxGroup>
</Col>
<Col n="10">
<WorksView
<PublicationsView
selectedWorks={selectedPublications}
setSelectedWorks={setSelectedPublications}
works={filteredPublications}
Expand Down
75 changes: 75 additions & 0 deletions client/src/pages/publicationsView.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import { Column } from 'primereact/column';
import { DataTable } from 'primereact/datatable';
import PropTypes from 'prop-types';

import {
affiliationsTemplate,
allIdsTemplate,
authorsTemplate,
datasourceTemplate,
linkedDOITemplate,
statusTemplate,
} from '../utils/templates';

export default function PublicationsView({
selectedWorks,
setSelectedWorks,
works,
}) {
return (
<DataTable
currentPageReportTemplate="{first} to {last} of {totalRecords}"
dataKey="id"
filterDisplay="row"
metaKeySelection={false}
onSelectionChange={(e) => setSelectedWorks(e.value)}
paginator
paginatorPosition="bottom"
paginatorTemplate="CurrentPageReport FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink RowsPerPageDropdown"
rows={50}
rowsPerPageOptions={[50, 200, 1000, 5000]}
scrollable
selection={selectedWorks}
selectionPageOnly
size="small"
stripedRows
style={{ fontSize: '11px', lineHeight: '10px' }}
value={works}
>
<Column selectionMode="multiple" />
<Column field="status" header="Status" body={statusTemplate} style={{ maxWidth: '100px' }} />
<Column field="allIds" header="Ids" body={allIdsTemplate} style={{ maxWidth: '180px' }} />
<Column field="datasource" header="Source" body={datasourceTemplate} style={{ maxWidth: '80px' }} />
<Column field="type" header="Type" style={{ maxWidth: '90px' }} />
<Column field="year" header="Year" style={{ maxWidth: '70px' }} />
<Column field="publisher" header="Publisher" style={{ maxWidth: '70px' }} />
<Column field="affiliationsHtml" header="Affiliations" body={affiliationsTemplate} style={{ maxWidth: '220px' }} />
<Column field="authors" header="Authors" body={authorsTemplate} style={{ minWidth: '150px' }} />
<Column field="title" header="Title" style={{ minWidth: '150px' }} />
</DataTable>
);
}

PublicationsView.propTypes = {
selectedWorks: PropTypes.arrayOf(PropTypes.shape({
affiliations: PropTypes.arrayOf(PropTypes.object).isRequired,
allIds: PropTypes.arrayOf(PropTypes.object).isRequired,
authors: PropTypes.arrayOf(PropTypes.string).isRequired,
datasource: PropTypes.arrayOf(PropTypes.string).isRequired,
id: PropTypes.string.isRequired,
publisher: PropTypes.string.isRequired,
status: PropTypes.string.isRequired,
type: PropTypes.string.isRequired,
})).isRequired,
setSelectedWorks: PropTypes.func.isRequired,
works: PropTypes.arrayOf(PropTypes.shape({
affiliations: PropTypes.arrayOf(PropTypes.object).isRequired,
allIds: PropTypes.arrayOf(PropTypes.object).isRequired,
authors: PropTypes.arrayOf(PropTypes.string).isRequired,
datasource: PropTypes.arrayOf(PropTypes.string).isRequired,
id: PropTypes.string.isRequired,
publisher: PropTypes.string.isRequired,
status: PropTypes.string.isRequired,
type: PropTypes.string.isRequired,
})).isRequired,
};

0 comments on commit 47d99b1

Please sign in to comment.