Skip to content

Commit

Permalink
refactor(openAlex): move internal actions
Browse files Browse the repository at this point in the history
  • Loading branch information
jerem1508 committed Nov 13, 2024
1 parent 08034da commit ca52795
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 125 deletions.
141 changes: 73 additions & 68 deletions client/src/pages/openalex-ror/openalexView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,75 +94,80 @@ export default function OpenalexView({
);

return (
<DataTable
currentPageReportTemplate="{first} to {last} of {totalRecords}"
dataKey="key"
editMode="row"
filterDisplay="row"
metaKeySelection
onRowEditComplete={onRowEditComplete}
onSelectionChange={(e) => setSelectedOpenAlex(e.value)}
paginator
paginatorLeft={paginatorLeft}
paginatorPosition="top bottom"
paginatorTemplate="RowsPerPageDropdown FirstPageLink PrevPageLink CurrentPageReport NextPageLink LastPageLink"
rows={50}
rowsPerPageOptions={[50, 100, 200, 500]}
scrollable
selection={selectedOpenAlex}
selectionPageOnly={selectionPageOnly}
size="small"
sortField="worksNumber"
sortOrder={-1}
stripedRows
style={{ fontSize: '14px', lineHeight: '13px' }}
tableStyle={{ minWidth: '50rem' }}
value={allAffiliations}
>
<Column selectionMode="multiple" />
<Column
body={nameTemplate}
field="nameHtml"
header="OpenAlex Raw affiliation"
style={{ maxWidth: '250px' }}
/>
<Column
body={rorTemplate}
field="rorHtml"
header="ROR computed by OpenAlex"
sortable
sortField="rorsNumber"
style={{ maxWidth: '200px' }}
/>
<Column
body={correctionTemplate}
editor={(options) => cellEditor(options)}
field="rorsToCorrect"
header="Click to improve / edit RORs"
style={{ maxWidth: '190px' }}
/>
<Column
bodyStyle={{ textAlign: 'center' }}
headerStyle={{ width: '10%', minWidth: '8rem' }}
rowEditor
style={{ maxWidth: '80px' }}
/>
<Column
body={(rowData) => hasCorrectionTemplate(rowData, undo)}
field="hasCorrection"
header="Modified by user?"
sortable
style={{ maxWidth: '115px' }}
/>
<Column
body={worksExampleTemplate}
field="worksExamples"
header="Works"
sortable
<>
<div className="wm-internal-actions">
actions relatives au tableau du dessous
</div>
<DataTable
currentPageReportTemplate="{first} to {last} of {totalRecords}"
dataKey="key"
editMode="row"
filterDisplay="row"
metaKeySelection
onRowEditComplete={onRowEditComplete}
onSelectionChange={(e) => setSelectedOpenAlex(e.value)}
paginator
paginatorLeft={paginatorLeft}
paginatorPosition="top bottom"
paginatorTemplate="RowsPerPageDropdown FirstPageLink PrevPageLink CurrentPageReport NextPageLink LastPageLink"
rows={50}
rowsPerPageOptions={[50, 100, 200, 500]}
scrollable
selection={selectedOpenAlex}
selectionPageOnly={selectionPageOnly}
size="small"
sortField="worksNumber"
style={{ maxWidth: '150px' }}
/>
</DataTable>
sortOrder={-1}
stripedRows
style={{ fontSize: '14px', lineHeight: '13px' }}
tableStyle={{ minWidth: '50rem' }}
value={allAffiliations}
>
<Column selectionMode="multiple" />
<Column
body={nameTemplate}
field="nameHtml"
header="OpenAlex Raw affiliation"
style={{ maxWidth: '250px' }}
/>
<Column
body={rorTemplate}
field="rorHtml"
header="ROR computed by OpenAlex"
sortable
sortField="rorsNumber"
style={{ maxWidth: '200px' }}
/>
<Column
body={correctionTemplate}
editor={(options) => cellEditor(options)}
field="rorsToCorrect"
header="Click to improve / edit RORs"
style={{ maxWidth: '190px' }}
/>
<Column
bodyStyle={{ textAlign: 'center' }}
headerStyle={{ width: '10%', minWidth: '8rem' }}
rowEditor
style={{ maxWidth: '80px' }}
/>
<Column
body={(rowData) => hasCorrectionTemplate(rowData, undo)}
field="hasCorrection"
header="Modified by user?"
sortable
style={{ maxWidth: '115px' }}
/>
<Column
body={worksExampleTemplate}
field="worksExamples"
header="Works"
sortable
sortField="worksNumber"
style={{ maxWidth: '150px' }}
/>
</DataTable>
</>
);
}

Expand Down
90 changes: 43 additions & 47 deletions client/src/pages/openalex-ror/results.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,54 +218,50 @@ export default function Affiliations() {
</Button>
</ModalFooter>
</Modal>
<div className="wm-actions">
<div className="wm-external-actions">
<span className="wm-text fr-mb-3w">
<span>{selectedOpenAlex.length}</span>
{` selected affiliation${selectedOpenAlex.length === 1 ? '' : 's'}`}
</span>
<Button
className="fr-ml-5w fr-mr-1w"
color="beige-gris-galet"
disabled={!selectedOpenAlex.length}
icon="add-circle-line"
key="add-ror"
onClick={() => {
setAction('add');
setIsModalOpen((prev) => !prev);
}}
size="sm"
title="Add ROR"
>
Add ROR
</Button>
<Button
className="fr-mr-1w"
color="beige-gris-galet"
disabled={!selectedOpenAlex.length}
icon="close-circle-line"
key="remove-ror"
onClick={() => {
setAction('remove');
setIsModalOpen((prev) => !prev);
}}
size="sm"
title="Remove ROR"
>
Remove ROR
</Button>
<ExportErrorsButton
allOpenalexCorrections={allOpenalexCorrections}
options={options}
/>
<SendFeedbackButton
allOpenalexCorrections={allOpenalexCorrections}
/>
</div>
<div className="wm-internal-actions">
actions relatives au tableau du dessous
</div>
<div className="wm-external-actions">
<span className="wm-text fr-mb-3w">
<span>{selectedOpenAlex.length}</span>
{` selected affiliation${selectedOpenAlex.length === 1 ? '' : 's'}`}
</span>
<Button
className="fr-ml-5w fr-mr-1w"
color="beige-gris-galet"
disabled={!selectedOpenAlex.length}
icon="add-circle-line"
key="add-ror"
onClick={() => {
setAction('add');
setIsModalOpen((prev) => !prev);
}}
size="sm"
title="Add ROR"
>
Add ROR
</Button>
<Button
className="fr-mr-1w"
color="beige-gris-galet"
disabled={!selectedOpenAlex.length}
icon="close-circle-line"
key="remove-ror"
onClick={() => {
setAction('remove');
setIsModalOpen((prev) => !prev);
}}
size="sm"
title="Remove ROR"
>
Remove ROR
</Button>
<ExportErrorsButton
allOpenalexCorrections={allOpenalexCorrections}
options={options}
/>
<SendFeedbackButton
allOpenalexCorrections={allOpenalexCorrections}
/>
</div>

<OpenalexView
allAffiliations={filteredAffiliations}
filteredAffiliationName={filteredAffiliationName}
Expand Down
18 changes: 8 additions & 10 deletions client/src/styles/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -157,19 +157,17 @@ html, body {
border-bottom-right-radius: 15px;
border-bottom-left-radius: 15px;

.wm-actions {
.wm-external-actions{
background-color: #eee;
margin-bottom: 5px;
padding: 10px;
padding: 10px 0 0 10px;
border-top-right-radius: 15px;
border-top-left-radius: 15px;
.wm-external-actions{
border-bottom: 1px solid #ddd;
padding-bottom: 10px;;
}
.wm-internal-actions{
padding-top: 10px;
}
border-bottom: 1px solid #ddd;
}
.wm-internal-actions{
padding: 10px;
margin-bottom: 5px;
background-color: #eee;
}
}

Expand Down

0 comments on commit ca52795

Please sign in to comment.