Skip to content

Commit

Permalink
Merge branch 'staging'
Browse files Browse the repository at this point in the history
  • Loading branch information
annelhote committed Jan 21, 2025
2 parents 8326c68 + 8e70b3f commit 4fe9f92
Show file tree
Hide file tree
Showing 83 changed files with 6,467 additions and 2,768 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: 🏗️ Build app
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
- run: npm ci --silent && npm run build --mode=production

- name: 🤖 Delete robots.txt file for production
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: 🏗️ Build app
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
- run: npm ci --silent && npm run build --mode=staging

- name: 🐋 Build Docker image
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:18-alpine
FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
COPY server ./server
Expand Down
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
# Works magnet
# Works-magnet

[![Discord Follow](https://dcbadge.vercel.app/api/server/TudsqDqTqb?style=flat)](https://discord.gg/TudsqDqTqb)
![license](https://img.shields.io/github/license/dataesr/works-magnet)
![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/dataesr/works-magnet)
[![Production deployment](https://github.com/dataesr/works-magnet/actions/workflows/production.yml/badge.svg)](https://github.com/dataesr/works-magnet/actions/workflows/production.yml)
[![deployment](https://github.com/dataesr/works-magnet/actions/workflows/production.yml/badge.svg)](https://github.com/dataesr/works-magnet/actions/workflows/production.yml)
![website](https://img.shields.io/website?url=https%3A%2F%2Fworks-magnet.esr.gouv.fr)
[![SWH](https://archive.softwareheritage.org/badge/origin/https://github.com/dataesr/works-magnet)](https://archive.softwareheritage.org/browse/origin/?origin_url=https://github.com/dataesr/works-magnet)

Retrieve the scholarly works of your institution.
Retrieve and promote the scholarly works of your institution.

## Build for production

The react client app is served by the node server in production.

## Requirements

node >= 20

## Install and run app

Run
Expand Down
5 changes: 2 additions & 3 deletions client/.env
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
VITE_API=/api
VITE_APP_MATOMO_BASE_URL=https://piwik.enseignementsup-recherche.pro
VITE_APP_NAME="Works magnet 🧲"
VITE_APP_NAME="Works-magnet 🧲"
VITE_APP_TAG_LIMIT=3
VITE_DESCRIPTION="Retrieve the scholarly works of your institution"
VITE_GIT_REPOSITORY_URL=https://github.com/dataesr/works-magnet
VITE_HEADER_TAG=
VITE_HEADER_TAG_COLOR=new
VITE_MINISTER_NAME="Ministère<br>chargé<br>de l'enseignement<br>supérieur<br>et de la recherche"
VITE_VERSION=$npm_package_version
VITE_WS_HOST=wss://works-magnet.dataesr.ovh
VITE_WS_HOST=wss://works-magnet.esr.gouv.fr
2 changes: 1 addition & 1 deletion client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta name="google-site-verification" content="_w-F9sijoMQg6zOyO8yiJOAm_ZYxQ720ysRRq9K2psM" />
<meta name="google-site-verification" content="6hRuX0N3vV6ahdIot4Od8sI5aABG9Q1yYN-R8FpSy5w" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Works magnet</title>
<title>Works-magnet</title>
</head>

<body>
Expand Down
6 changes: 4 additions & 2 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,20 @@
"preview": "vite preview"
},
"dependencies": {
"@dataesr/dsfr-plus": "^0.3.2",
"@dataesr/dsfr-plus": "^0.5.1",
"@m4tt72/matomo-tracker-react": "^0.6.2",
"@tanstack/react-query": "^4.29.5",
"@tanstack/react-query-devtools": "^4.29.6",
"classnames": "^2.3.2",
"highcharts": "^11.4.0",
"highcharts": "^11.4.8",
"highcharts-react-official": "^3.2.1",
"intro.js": "^7.2.0",
"papaparse": "^5.4.1",
"primereact": "^9.6.0",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-intl": "^6.8.7",
"react-router-dom": "^6.11.1",
"react-tooltip": "^5.18.1",
"react-use-websocket": "^4.8.1",
Expand Down
6 changes: 5 additions & 1 deletion client/src/components/button-dropdown/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import PropTypes from 'prop-types';

import useToast from '../../hooks/useToast';
import { export2Csv, export2FosmCsv, export2jsonl } from '../../utils/files';
import { capitalize } from '../../utils/works';
import { capitalize } from '../../utils/strings';

import './index.scss';

Expand All @@ -31,6 +31,7 @@ export default function ButtonDropdown({ className, data, label, searchParams })
return (
<div className={_className}>
<Button
color="blue-ecume"
disabled={!data.length}
icon="save-line"
size="sm"
Expand All @@ -39,19 +40,22 @@ export default function ButtonDropdown({ className, data, label, searchParams })
</Button>
<div className="dropdown-content">
<Button
color="blue-ecume"
onClick={() => { export2Csv({ data, label, searchParams }); toastExport(); }}
size="sm"
>
Export in CSV (minimal data)
</Button>
<Button
color="blue-ecume"
onClick={() => { export2jsonl({ data, label, searchParams }); toastExport(); }}
size="sm"
>
Export in JSONL (complete data)
</Button>
{['publications', 'datasets'].includes(label) && (
<Button
color="blue-ecume"
onClick={() => {
const numberOfLines = export2FosmCsv({ data, label, searchParams });
toastExport(numberOfLines);
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/button-dropdown/index.scss
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
.dropdown {
display: inline-block;
position: relative;
z-index: 2;
z-index: 20;

.dropdown-content {
display: none;
min-width: 160px;
position: absolute;
z-index: 1;
z-index: 20;
}
}

Expand Down
115 changes: 115 additions & 0 deletions client/src/components/mention-list/item.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
import { Badge, Button, Col, Row, Text } from '@dataesr/dsfr-plus';
import PropTypes from 'prop-types';
import { useState } from 'react';

import { getIdLink } from '../../utils/works';

export default function MentionListItem({ mention }) {
const [expanded, setExpanded] = useState(false);

const getIdLinkDisplay = (idType, idValue) => {
const idLink = getIdLink(idType, idValue);
const html = idLink
? `<a href="${idLink}" target="_blank">${idValue}</a>`
: `<span>${idValue}</span>`;
return html;
};

return (
<li key={mention.id}>
<Row>
<Col>
<input type="checkbox" selected={mention.selected} />
</Col>
<Col md={8}>
<strong>
<span title="raw form">{mention.rawForm}</span>
</strong>
<Badge size="sm" color="blue-cumulus">{mention.type}</Badge>
<div style={{ maxWidth: '90%' }} className="fr-mt-1w">
<span className="fr-icon-quote-fill fr-icon--sm fr-mr-1w" aria-hidden="true" title="context" />
<span dangerouslySetInnerHTML={{ __html: mention.context }} />
</div>
{
!expanded && (
<Button onClick={() => setExpanded(!expanded)} variant="text">
view details
</Button>
)
}
{expanded && (
<div style={{ borderLeft: '2px solid #000', paddingLeft: '8px' }}>
<div className="fr-mt-1w">
<Text size="xs" className="fr-my-0">
<b>DOI</b>
<span
className="fr-ml-1w"
dangerouslySetInnerHTML={{ __html: getIdLinkDisplay('doi', mention.doi) }}
/>
</Text>
</div>
<div className="fr-mt-1w">
<span className="fr-icon-team-fill fr-icon--sm fr-mr-2w" aria-hidden="true" title="authors" />
<i>
{mention.authors.slice(0, 5).join(', ')}
{mention.authors.length > 5 ? '...' : ''}
</i>
</div>
{
mention.affiliations && mention.affiliations.length > 0 && (
<div className="fr-mt-1w">
<span className="fr-icon-building-fill fr-icon--sm fr-mr-2w" aria-hidden="true" title="authors" />
<i>
{mention.affiliations.slice(0, 5).join(', ')}
{mention.affiliations.length > 5 ? '...' : ''}
</i>
</div>
)
}
<Button onClick={() => setExpanded(!expanded)} variant="text">
hide details
</Button>
</div>
)}
</Col>
<Col className="text-center">
{(mention.mention_context.created) ? (
<Badge className="fr-mr-1w" size="" color="green-bourgeon">
created
</Badge>
) : (
<Badge className="fr-mr-1w" size="">
not created
</Badge>
)}
</Col>
<Col className="text-center">
{(mention.mention_context.used) ? (
<Badge className="fr-mr-1w" size="" color="green-bourgeon">
used
</Badge>
) : (
<Badge className="fr-mr-1w" size="">
not used
</Badge>
)}
</Col>
<Col className="text-center">
{(mention.mention_context.shared) ? (
<Badge className="fr-mr-1w" size="" color="green-bourgeon">
shared
</Badge>
) : (
<Badge className="fr-mr-1w" size="">
not shared
</Badge>
)}
</Col>
</Row>
</li>
);
}

MentionListItem.propTypes = {
mention: PropTypes.object.isRequired,
};
24 changes: 12 additions & 12 deletions client/src/components/ribbon/index.scss
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
.ribbon {
left: -60px;
left: -85px;
position: absolute;
top: 10px;
top: 2px;
z-index: calc(var(--ground) + 600);

.badge {
background: #e1000f;
box-shadow: inset 0px 0px 0px 4px rgba(255, 255, 255, 0.34);
color: #FFF;
font-family: sans-serif;
font-size: 20px;
height: 50px;
line-height: 50px;
font-size: 10px;
height: 25px;
line-height: 25px;
text-align: center;
transform: rotate(-45deg);
width: 200px;
}
}

.sticky {
.expanded {
.ribbon {
left: -80px;
top: 3px;
left: -60px;
top: 10px;

.badge {
font-size: 14px;
height: 30px;
line-height: 30px;
font-size: 20px;
height: 50px;
line-height: 50px;
}
}
}
}
Loading

0 comments on commit 4fe9f92

Please sign in to comment.