Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CORE-5013: FAIR base structure #702

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions components/application/activities.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ const config = new RouteConfig([
path: 'usrn',
icon: 'file-check',
},
// {
// test: /\/fair/,
// path: 'fair',
// icon: 'metadata-validator',
// },
{
test: /\/fair/,
path: 'fair',
icon: 'metadata-validator',
},
{
test: /\/plugins/,
path: 'plugins',
Expand Down
Binary file added components/upload/assets/certificate-bronze.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added components/upload/assets/certificate-gold.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added components/upload/assets/certificate-silver.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 37 additions & 20 deletions components/usrn-stat/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const StatUSRN = ({ className, content, usrnParams }) => {
const STATUS_NO = 0
const STATUS_YES = 1
const STATUS_DEVELOP = 2
const STATUS_OPEN_QUESTION = 3
const {
dataProviderId,
doiCount,
Expand Down Expand Up @@ -73,6 +74,18 @@ const StatUSRN = ({ className, content, usrnParams }) => {
let statTextCreated = ''
let statusClass = STATUS_NO
switch (content.id) {
case 'recordsProvideAccessibility':
statusClass = STATUS_OPEN_QUESTION
break
case 'isManageDeposits':
statusClass = STATUS_OPEN_QUESTION
break
case 'takeDownNotices':
statusClass = STATUS_OPEN_QUESTION
break
case 'preservationContentRepository':
statusClass = STATUS_OPEN_QUESTION
break
case 'accessibilityStatements':
statusClass = STATUS_DEVELOP
break
Expand Down Expand Up @@ -226,28 +239,32 @@ const StatUSRN = ({ className, content, usrnParams }) => {
<div
className={classNames.use(
styles.status,
// eslint-disable-next-line no-nested-ternary
statusClass === STATUS_NO
? styles.status0
: statusClass === STATUS_YES
? styles.status1
: styles.status2
statusClass === STATUS_NO ? styles.status0 : '',
statusClass === STATUS_YES ? styles.status1 : '',
statusClass === STATUS_DEVELOP ? styles.status2 : '',
statusClass === STATUS_OPEN_QUESTION ? styles.status3 : ''
)}
>
{
// eslint-disable-next-line no-nested-ternary
statusClass === STATUS_NO ? (
'No'
) : statusClass === STATUS_YES ? (
'Yes'
) : (
<Actions
description="This is in development right now"
hoverIcon={false}
hoverText="WIP"
/>
)
}
{statusClass === STATUS_NO ? 'No' : ''}
{statusClass === STATUS_YES ? 'Yes' : ''}
{statusClass === STATUS_DEVELOP ? (
<Actions
description="This is in development right now"
hoverIcon={false}
hoverText="WIP"
/>
) : (
''
)}
{statusClass === STATUS_OPEN_QUESTION ? (
<Actions
description="It needs extra info"
hoverIcon={false}
hoverText="Open question"
/>
) : (
''
)}
</div>
</div>
<div className={styles.statusRow}>
Expand Down
20 changes: 14 additions & 6 deletions components/usrn-stat/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,20 @@
text-align: left;
}

.status {
padding: 15px 5px;
font-size: 14px;
font-weight: 500;
}

.status-3 {
background: rgba(42, 81, 170, 0.1);
color: rgba(42, 81, 170, 1);
font-size: 12px;
font-weight: 400;
line-height: 12px;
}

.status-2 {
color: #939393;
background-color: #f5f5f5;
Expand All @@ -106,12 +120,6 @@
background-color: #fcc;
}

.status {
padding: 15px 5px;
font-size: 14px;
font-weight: 500;
}

/* ==== */
.chart-percent {
padding: 0 25px;
Expand Down
2 changes: 1 addition & 1 deletion components/usrn-text/linkDoc.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const LinkDoc = ({ content }) => {
alt="docs"
/>
<a href={content.linkDocumentation} target="_blank" rel="noreferrer">
Link to documentation
{content.textLinkDoc ?? 'Link to documentation'}
</a>
</div>
) : (
Expand Down
13 changes: 3 additions & 10 deletions pages/data-providers/[data-provider-id]/fair.jsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
import React from 'react'

import { withGlobalStore } from 'store'
import { USRNTemplateActivated, USRNTemplateDeactivated } from 'templates/usrn'
import * as texts from 'texts/usrn'

const USRNPage = ({ store: { dataProvider, organisation }, ...props }) => {
const isUSRNActivated =
Object.values(texts.status.usrnListDataProvider).indexOf(dataProvider?.id) >
-1

if (!isUSRNActivated) return <USRNTemplateDeactivated {...props} />
import { USRNTemplateActivated } from 'templates/usrn'

const FAIRPage = ({ store: { dataProvider, organisation }, ...props }) => {
const formattedDateReport = dataProvider?.usrn?.dateReportUpdate
? new Intl.DateTimeFormat('en-US', {
year: 'numeric',
Expand Down Expand Up @@ -46,4 +39,4 @@ const USRNPage = ({ store: { dataProvider, organisation }, ...props }) => {
return <USRNTemplateActivated usrnParams={usrnParams} {...props} />
}

export default withGlobalStore(USRNPage)
export default withGlobalStore(FAIRPage)
9 changes: 7 additions & 2 deletions pages/data-providers/[data-provider-id]/usrn.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ const USRNPage = ({ store: { dataProvider, organisation }, ...props }) => {
Object.values(texts.status.usrnListDataProvider).indexOf(dataProvider?.id) >
-1

if (!isUSRNActivated) return <USRNTemplateDeactivated {...props} />
let usrnParams = {
template: 'usrn',
}

if (!isUSRNActivated)
return <USRNTemplateDeactivated usrnParams={usrnParams} {...props} />

const formattedDateReport = dataProvider?.usrn?.dateReportUpdate
? new Intl.DateTimeFormat('en-US', {
Expand All @@ -23,7 +28,7 @@ const USRNPage = ({ store: { dataProvider, organisation }, ...props }) => {
const issueRestrictedAttachment =
issueAggregation?.countByType?.RESTRICTED_ATTACHMENT ?? null

const usrnParams = {
usrnParams = {
template: 'usrn',
dataProviderId: dataProvider.id,
dataProviderName: dataProvider.name,
Expand Down
76 changes: 76 additions & 0 deletions templates/usrn/cards/certificates-card.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import React from 'react'
import { classNames } from '@oacore/design/lib/utils'

import styles from './certificates.module.css'
import silver from '../../../components/upload/assets/certificate-silver.png'
import gold from '../../../components/upload/assets/certificate-gold.png'
import bronze from '../../../components/upload/assets/certificate-bronze.png'

import { Card } from 'design'
import * as textsFAIR from 'texts/fair'

const CertificatesCard = () => (
<Card tag="section">
<div className={styles.cardsWrapper}>
{Object.keys(textsFAIR.certificates.typeCertificates).map((key) => {
if (textsFAIR.certificates.typeCertificates[key].isEnable === 'yes') {
const isActiveCertificate =
textsFAIR.certificates.typeCertificates[key].id === 'bronze'
const dateCertified = '16.08.2024'
return (
<div
className={classNames.use(styles.card, {
[styles.certificateActive]: isActiveCertificate,
[styles.certificateNotActive]: !isActiveCertificate,
})}
>
<div className={styles.title}>
{textsFAIR.certificates.typeCertificates[key].title}
{isActiveCertificate && dateCertified && (
<div className={styles.certified}>
Certified {dateCertified}
</div>
)}
</div>
<div className={styles.descriptionWrapper}>
<img
className={styles.img}
src={
(textsFAIR.certificates.typeCertificates[key].id ===
'silver' &&
silver) ||
(textsFAIR.certificates.typeCertificates[key].id ===
'gold' &&
gold) ||
(textsFAIR.certificates.typeCertificates[key].id ===
'bronze' &&
bronze)
}
width="116"
alt={textsFAIR.certificates.typeCertificates[key].title}
/>
<div className={styles.description}>
{textsFAIR.certificates.typeCertificates[key].description}
</div>

{isActiveCertificate && (
<div className={styles.accessText}>
{textsFAIR.certificates.typeCertificates[key].accessText}
</div>
)}
{!isActiveCertificate && (
<a href="/" className={styles.getCertificate}>
Get certification
</a>
)}
</div>
</div>
)
}
return ''
})}
</div>
</Card>
)

export default CertificatesCard
Loading
Loading