Skip to content

Commit

Permalink
feat(openAlex): init list view
Browse files Browse the repository at this point in the history
  • Loading branch information
jerem1508 committed Nov 15, 2024
1 parent f41116d commit a3885a3
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function ExportErrorsButton({
<ButtonDropdown
className="fr-mr-1w"
data={allOpenalexCorrections}
label="OpenAlex errors"
label="OpenAlex corrections"
searchParams={searchParams}
/>
);
Expand Down
67 changes: 63 additions & 4 deletions client/src/pages/openalex-ror/results/list-view.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,66 @@
export default function ListView() {
import { Badge, Col, Link, Row, Tag, TagGroup, Text } from '@dataesr/dsfr-plus';

export default function ListView({
onRowEditComplete,
setSelectedOpenAlex,
selectedOpenAlex,
allAffiliations,
}) {
console.log(allAffiliations);

return (
<div>
<p>ListView</p>
</div>
<ul className="wm-list">
{
allAffiliations.map((affiliation) => (
<li key={affiliation.key}>
<Row>
<Col>
<input type="checkbox" id={`affiliation-${affiliation.key}`} />
</Col>
<Col md={11}>
<Text as="label" htmlFor={`affiliation-${affiliation.key}`}>
<div dangerouslySetInnerHTML={{ __html: affiliation.nameHtml }} />
</Text>
<div>
ror list:
{affiliation.rors.map((ror) => (
<>
<Tag
color="blue-cumulus"
size="sm"
className="fr-mr-1w"
aria-describedby={`tooltip-${affiliation.key}-ror-${ror.rorId}`}
>
<Link className="fr-mr-1w" href={`https://ror.org/${ror.rorId}`} target="_blank">
{ror.rorId}
</Link>
</Tag>
<div
className="fr-tooltip fr-placement text-center"
id={`tooltip-${affiliation.key}-ror-${ror.rorId}`}
role="tooltip"
aria-hidden="true"
>
<img src={`https://flagsapi.com/${ror.rorCountry}/flat/48.png`} alt={`${ror.rorCountry} flag`} />
<br />
{ror.rorName}
</div>
</>
))}
</div>
<div>
openAlex works:
{affiliation.works.slice(0, 5).map((work) => (
<Link className="fr-mr-1w" href="http://toto.com" target="_blank">
{work}
</Link>
))}
</div>
</Col>
</Row>
</li>
))
}
</ul>
);
}
7 changes: 6 additions & 1 deletion client/src/pages/openalex-ror/results/views-selector.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,12 @@ export default function OpenalexView({
undo={undo}
/>
) : (
<ListView />
<ListView
onRowEditComplete={onRowEditComplete}
setSelectedOpenAlex={setSelectedOpenAlex}
selectedOpenAlex={selectedOpenAlex}
allAffiliations={allAffiliations}
/>
)}
</>
);
Expand Down
11 changes: 11 additions & 0 deletions client/src/styles/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,17 @@ html, body {
margin-bottom: 5px;
background-color: #eee;
}

.wm-list {
background-color: #eee;
list-style: none;

li {
padding: 10px;
border-bottom: 1px solid #ddd;
font-size: 0.9rem;
}
}
}

.loader{
Expand Down

0 comments on commit a3885a3

Please sign in to comment.