From b30c57947d256f2981c99b824035d2ee0d536c22 Mon Sep 17 00:00:00 2001 From: ekachxaidze98 Date: Fri, 6 Dec 2024 16:25:29 +0400 Subject: [PATCH 1/5] CORE-5076: creat sdg page --- data/sdg.yml | 43 ++++++++++++++ pages/labs/sdg.jsx | 13 +++++ public/images/services/goals.svg | 47 +++++++++++++++ public/images/services/openUniversity.svg | 30 ++++++++++ templates/sdg/index.jsx | 71 +++++++++++++++++++++++ templates/sdg/styles.module.scss | 58 ++++++++++++++++++ 6 files changed, 262 insertions(+) create mode 100644 data/sdg.yml create mode 100644 pages/labs/sdg.jsx create mode 100644 public/images/services/goals.svg create mode 100644 public/images/services/openUniversity.svg create mode 100644 templates/sdg/index.jsx create mode 100644 templates/sdg/styles.module.scss diff --git a/data/sdg.yml b/data/sdg.yml new file mode 100644 index 00000000..f84a819e --- /dev/null +++ b/data/sdg.yml @@ -0,0 +1,43 @@ +header: + title: Classification of research papers according to United Nations Sustainable Development Goals + image: /images/services/goals.svg + description: The Sustainable Development Goals or Global Goals are a collection of 17 interlinked global goals designed to be a "blueprint to achieve a better and more sustainable future for all". The SDGs were set up in 2015 by the United Nations General Assembly and are intended to be achieved by 2030. + subTitle: CORE labs + +upload: + default: + title: Identify SDG in your paper + subTitle: Drag and drop your file here + action: + title: Browse files + success: + title: SDG labels found + description: "Found SDG labels:" + image: /images/success.svg + action: + title: Upload new file + fail: + title: SDG labels not found + description: SDG labels not found in this paper. + image: /images/fail.svg + action: + title: Upload new file + noSupport: + title: This format is not supported + sizeTitle: File is too big + image: /images/fail.svg + action: Upload new file + subInfo: + format: | + Supported formats: pdf, doc + size: | + Maximum size: 10MB + + +purpose: + title: How it work + image: /images/services/openUniversity.svg + description: | + The new CORE SDG Dashboard module allows institutions to gain rapid insights into the current mapping of their research outputs to the 17 UN SDG goals, significantly reducing the manual effort required to map research outputs to global sustainability objectives. + + On the video below you can see how SDG insights tab in the CORE dashboard works (using the example of Open Research Online Repository (Open University). diff --git a/pages/labs/sdg.jsx b/pages/labs/sdg.jsx new file mode 100644 index 00000000..4cfd8ee0 --- /dev/null +++ b/pages/labs/sdg.jsx @@ -0,0 +1,13 @@ +import React from 'react' + +import textData from '../../data/sdg.yml' +import { Page } from '../../components' +import SdgPageTemplate from '../../templates/sdg' + +const SdgPage = () => ( + + + +) + +export default SdgPage diff --git a/public/images/services/goals.svg b/public/images/services/goals.svg new file mode 100644 index 00000000..2aebbefb --- /dev/null +++ b/public/images/services/goals.svg @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/images/services/openUniversity.svg b/public/images/services/openUniversity.svg new file mode 100644 index 00000000..451a09d3 --- /dev/null +++ b/public/images/services/openUniversity.svg @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/templates/sdg/index.jsx b/templates/sdg/index.jsx new file mode 100644 index 00000000..41f9bc23 --- /dev/null +++ b/templates/sdg/index.jsx @@ -0,0 +1,71 @@ +import React, { useState } from 'react' + +import { Layout, Section } from '../../design-v2/components' +import styles from './styles.module.scss' +import { Markdown } from '../../components' +import FileUpload from '../../components/pdf-upload' + +const SdgPageTemplate = ({ data }) => { + const [uloadResult, setUploadResult] = useState('') + const [rrsPdfLoading, setRrsPdfLoading] = useState(false) + const uploadPdf = async (file, dataProviderId) => { + setRrsPdfLoading(true) + try { + const url = new URL( + '/internal/data-providers/rights-retention-upload-file', + process.env.API_URL + ) + const fd = new FormData() + fd.set('file', file) + fd.set('dataProviderId', dataProviderId) + + const response = await fetch(url, { + method: 'POST', + credentials: 'same-origin', + body: fd, + }) + + if (!response.ok) throw new Error('Network response was not ok') + + const result = await response.json() + setUploadResult(result) + } catch (error) { + console.error(error) + } finally { + setRrsPdfLoading(false) + } + } + + return ( + + + +
+
+ {data.howItWorks?.title} +
+
+

{data.purpose?.title}

+ {data.purpose?.description} +
+
+
+ ) +} + +export default SdgPageTemplate diff --git a/templates/sdg/styles.module.scss b/templates/sdg/styles.module.scss new file mode 100644 index 00000000..efd3983d --- /dev/null +++ b/templates/sdg/styles.module.scss @@ -0,0 +1,58 @@ +$grid-responsive-for-sections: repeat(auto-fit, minmax(300px, 1fr)); + +.header { + display: flex; + justify-content: space-between; + gap: 20px; + .card-wrapper { + width: 70%; + } + .img-wrapper { + width: 400px; + img { + width: 100%; + height: 100%; + } + } + .description { + max-width: 70ch; + font-size: 1.3rem; + color: var(--gray-700); + margin-bottom: 3rem; + } + .title { + position: relative; + max-width: 25ch; + margin-top: 9px; + } + @media (max-width: 992px) { + flex-wrap: wrap-reverse; + justify-content: center; + } +} + +.demo { + border-radius: 2px; + background: #8bc34a; + padding: 3px 7px; + color: #fff; + font-size: 16px; + font-style: normal; + font-weight: 400; + line-height: 24px; + letter-spacing: 0.026px; +} + +.how-it-works { + display: grid; + grid-template-columns: $grid-responsive-for-sections; + align-items: center; + + .content { + .button { + float: right; + margin-top: 2rem; + margin-right: 10px; + } + } +} From 90fa98d95d37cb6dc4115558997dac338c76b11b Mon Sep 17 00:00:00 2001 From: ekachxaidze98 Date: Mon, 9 Dec 2024 14:30:11 +0400 Subject: [PATCH 2/5] CORE-5076: update upload url --- templates/sdg/index.jsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/templates/sdg/index.jsx b/templates/sdg/index.jsx index 41f9bc23..b1f13b55 100644 --- a/templates/sdg/index.jsx +++ b/templates/sdg/index.jsx @@ -2,7 +2,7 @@ import React, { useState } from 'react' import { Layout, Section } from '../../design-v2/components' import styles from './styles.module.scss' -import { Markdown } from '../../components' +import { Markdown, Video } from '../../components' import FileUpload from '../../components/pdf-upload' const SdgPageTemplate = ({ data }) => { @@ -11,10 +11,7 @@ const SdgPageTemplate = ({ data }) => { const uploadPdf = async (file, dataProviderId) => { setRrsPdfLoading(true) try { - const url = new URL( - '/internal/data-providers/rights-retention-upload-file', - process.env.API_URL - ) + const url = new URL('/internal/sdg-upload-file', process.env.API_URL) const fd = new FormData() fd.set('file', file) fd.set('dataProviderId', dataProviderId) @@ -64,6 +61,11 @@ const SdgPageTemplate = ({ data }) => { {data.purpose?.description} +