Skip to content

Commit

Permalink
Merge branch 'master' into CORE-5090-logo-update
Browse files Browse the repository at this point in the history
  • Loading branch information
ekachxaidze98 committed Jan 24, 2025
2 parents 208f03d + 456513a commit ddaac14
Show file tree
Hide file tree
Showing 59 changed files with 72 additions and 3,293 deletions.
7 changes: 6 additions & 1 deletion components/pdf-upload/defaultUpload.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { useRouter } from 'next/router'
import text from '../../data/retention.yml'
import uploadSvg from '../../public/images/logos/upload.svg'
import styles from './styles.module.scss'
import sdgText from '../../data/sdg.yml'

const DefaultUploadView = ({
handleClick,
Expand Down Expand Up @@ -59,7 +60,11 @@ const DefaultUploadView = ({
</div>
)}
<div className={styles.uploadFooter}>
<span className={styles.footerText}>{text.upload.subInfo.format}</span>
<span className={styles.footerText}>
{router.pathname.includes('sdg')
? sdgText.upload.subInfo.format
: text.upload.subInfo.format}
</span>
<span className={styles.footerText}>{text.upload.subInfo.size}</span>
</div>
</div>
Expand Down
5 changes: 4 additions & 1 deletion components/pdf-upload/formatUpload.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ProgressSpinner } from '@oacore/design/lib/elements'
import { useRouter } from 'next/router'

import text from '../../data/retention.yml'
import sdgText from '../../data/sdg.yml'
import styles from './styles.module.scss'

const FormatUploadIssue = ({
Expand Down Expand Up @@ -42,7 +43,9 @@ const FormatUploadIssue = ({
) : (
<div className={styles.innerIssueWrapper}>
<span className={styles.innerIssueTitle}>
{text.upload.subInfo.format}
{router.pathname.includes('sdg')
? sdgText.upload.subInfo.format
: text.upload.subInfo.format}
</span>
<input
ref={uploadRef}
Expand Down
25 changes: 11 additions & 14 deletions components/pdf-upload/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,25 @@ const RrsCheckCard = ({
const router = useRouter()

const handleClick = () => {
uploadRef.current.click()
if (!rrsPdfLoading && uploadRef.current) uploadRef.current.click()
}

const handleDragOver = (event) => {
event.preventDefault()
}

useEffect(() => {
if (!uploadResults) return

const results = Array.isArray(uploadResults) ? uploadResults : []
if (results.some((result) => result.predictions)) setCurrentView('success')
if (uploadResults.rightsRetentionSentence) setCurrentView('success')
if (
else if (uploadResults.rightsRetentionSentence) setCurrentView('success')
else if (
!uploadResults.rightsRetentionSentence &&
uploadResults.confidence === 0
)
setCurrentView('fail')
if (results.some((result) => result.predictions === null))
else if (results.some((result) => result.predictions === null))
setCurrentView('fail')
}, [uploadResults])

Expand All @@ -52,22 +54,17 @@ const RrsCheckCard = ({
if (files && files.length) {
// eslint-disable-next-line prefer-destructuring
file = files[0]
uploadPdf(file)
setFileName(file.name)
if (file.size > 10 * 1024 * 1024) {
setCurrentView('sizeIssue')
return
}
const fileType = file.type
if (
!(
fileType === 'application/pdf' ||
fileType === 'application/msword' ||
fileType ===
'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
)
)
if (fileType !== 'application/pdf') {
setCurrentView('formatIssue')
return
}
uploadPdf(file)
setFileName(file.name)
}
}

Expand Down
2 changes: 1 addition & 1 deletion data/retention.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ upload:
action: Upload new file
subInfo:
format: |
Supported formats: pdf, doc
Supported formats: pdf
size: |
Maximum size: 10MB
Expand Down
2 changes: 1 addition & 1 deletion data/sdg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ upload:
action: Upload new file
subInfo:
format: |
Supported formats: pdf, doc
Supported formats: pdf
size: |
Maximum size: 10MB
Expand Down
28 changes: 14 additions & 14 deletions netlify-cms.config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1685,8 +1685,8 @@ collections:

- name: board-of-supporters

media_folder: '/images'
public_folder: '/images'
media_folder: '/images/community'
public_folder: '/images/community'

create: false
delete: false
Expand Down Expand Up @@ -1834,8 +1834,8 @@ collections:

- name: api

media_folder: '/images'
public_folder: '/images'
media_folder: '/images/services'
public_folder: '/images/services'

create: false
delete: false
Expand Down Expand Up @@ -2294,8 +2294,8 @@ collections:
- name: datasets

media_folder: '/images'
public_folder: '/images'
media_folder: '/images/services'
public_folder: '/images/services'

create: false
delete: false
Expand Down Expand Up @@ -2698,8 +2698,8 @@ collections:
- name: fastsync

media_folder: '/images'
public_folder: '/images'
media_folder: '/images/services'
public_folder: '/images/services'

create: false
delete: false
Expand Down Expand Up @@ -3041,8 +3041,8 @@ collections:
- name: recomender

media_folder: '/images'
public_folder: '/images'
media_folder: '/images/services'
public_folder: '/images/services'

create: false
delete: false
Expand Down Expand Up @@ -3349,8 +3349,8 @@ collections:
- name: discovery

media_folder: '/images'
public_folder: '/images'
media_folder: '/images/services'
public_folder: '/images/services'

create: false
delete: false
Expand Down Expand Up @@ -3697,8 +3697,8 @@ collections:
- name: dashboard

media_folder: '/images'
public_folder: '/images'
media_folder: '/images/services'
public_folder: '/images/services'

create: false
delete: false
Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions pages/governance/advisory.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,21 @@ import retrieveContent from 'content'

const ASSETS_BASE_URL = 'https://oacore.github.io/content/'

const setAssetsUrl = (object) =>
const setAssetsUrl = (object) => {
Object.entries(object).forEach(([key, value]) => {
if (typeof value === 'string' && value.includes('/images'))
object[key] = ASSETS_BASE_URL + value
else if (typeof value === 'object') setAssetsUrl(value) // Recursively process nested objects
})
}

const getSections = async ({ ref } = {}) => {
const content = await retrieveContent('advisory', {
ref,
transform: 'object',
})

Object.values(content).forEach((section) => {
setAssetsUrl(section)
if (section.table) setAssetsUrl(section.table)
})
setAssetsUrl(content)

return content
}
Expand Down
9 changes: 4 additions & 5 deletions pages/governance/supporters.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,21 @@ import apiRequest from 'api'

const ASSETS_BASE_URL = 'https://oacore.github.io/content/'

const setAssetsUrl = (object) =>
const setAssetsUrl = (object) => {
Object.entries(object).forEach(([key, value]) => {
if (typeof value === 'string' && value.includes('/images'))
object[key] = ASSETS_BASE_URL + value
else if (typeof value === 'object') setAssetsUrl(value) // Recursively process nested objects
})
}

const getSections = async ({ ref } = {}) => {
const content = await retrieveContent('board-supporters', {
ref,
transform: 'object',
})

Object.values(content).forEach((section) => {
setAssetsUrl(section)
if (section.items) setAssetsUrl(section.items)
})
setAssetsUrl(content)

return content
}
Expand Down
4 changes: 3 additions & 1 deletion pages/services/api.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ import retrieveContent from 'content'

const ASSETS_BASE_URL = 'https://oacore.github.io/content/'

const setAssetsUrl = (object) =>
const setAssetsUrl = (object) => {
Object.entries(object).forEach(([key, value]) => {
if (typeof value === 'string' && value.includes('/images'))
object[key] = ASSETS_BASE_URL + value
else if (typeof value === 'object') setAssetsUrl(value) // Recursively process nested objects
})
}

const getSections = async ({ ref } = {}) => {
const page = await retrieveContent('api', {
Expand Down
4 changes: 3 additions & 1 deletion pages/services/consultancy.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ import retrieveContent from 'content'

const ASSETS_BASE_URL = 'https://oacore.github.io/content/'

const setAssetsUrl = (object) =>
const setAssetsUrl = (object) => {
Object.entries(object).forEach(([key, value]) => {
if (typeof value === 'string' && value.includes('/images'))
object[key] = ASSETS_BASE_URL + value
else if (typeof value === 'object') setAssetsUrl(value) // Recursively process nested objects
})
}

const getSections = async ({ ref } = {}) => {
const content = await retrieveContent('consultancy', {
Expand Down
4 changes: 3 additions & 1 deletion pages/services/dataset.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ import retrieveContent from 'content'

const ASSETS_BASE_URL = 'https://oacore.github.io/content/'

const setAssetsUrl = (object) =>
const setAssetsUrl = (object) => {
Object.entries(object).forEach(([key, value]) => {
if (typeof value === 'string' && value.includes('/images'))
object[key] = ASSETS_BASE_URL + value
else if (typeof value === 'object') setAssetsUrl(value) // Recursively process nested objects
})
}

const getSections = async ({ ref } = {}) => {
const page = await retrieveContent('datasets', {
Expand Down
4 changes: 3 additions & 1 deletion pages/services/discovery.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ import retrieveContent from 'content'

const ASSETS_BASE_URL = 'https://oacore.github.io/content/'

const setAssetsUrl = (object) =>
const setAssetsUrl = (object) => {
Object.entries(object).forEach(([key, value]) => {
if (typeof value === 'string' && value.includes('/images'))
object[key] = ASSETS_BASE_URL + value
else if (typeof value === 'object') setAssetsUrl(value) // Recursively process nested objects
})
}

const getSections = async ({ ref } = {}) => {
const page = await retrieveContent('discovery', {
Expand Down
4 changes: 3 additions & 1 deletion pages/services/fastsync.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ import retrieveContent from 'content'

const ASSETS_BASE_URL = 'https://oacore.github.io/content/'

const setAssetsUrl = (object) =>
const setAssetsUrl = (object) => {
Object.entries(object).forEach(([key, value]) => {
if (typeof value === 'string' && value.includes('/images'))
object[key] = ASSETS_BASE_URL + value
else if (typeof value === 'object') setAssetsUrl(value) // Recursively process nested objects
})
}

const getSections = async ({ ref } = {}) => {
const page = await retrieveContent('fastsync', {
Expand Down
4 changes: 3 additions & 1 deletion pages/services/recommender.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ import retrieveContent from 'content'

const ASSETS_BASE_URL = 'https://oacore.github.io/content/'

const setAssetsUrl = (object) =>
const setAssetsUrl = (object) => {
Object.entries(object).forEach(([key, value]) => {
if (typeof value === 'string' && value.includes('/images'))
object[key] = ASSETS_BASE_URL + value
else if (typeof value === 'object') setAssetsUrl(value) // Recursively process nested objects
})
}

const getSections = async ({ ref } = {}) => {
const page = await retrieveContent('recomender', {
Expand Down
4 changes: 3 additions & 1 deletion pages/services/repository-dashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ import retrieveContent from 'content'

const ASSETS_BASE_URL = 'https://oacore.github.io/content/'

const setAssetsUrl = (object) =>
const setAssetsUrl = (object) => {
Object.entries(object).forEach(([key, value]) => {
if (typeof value === 'string' && value.includes('/images'))
object[key] = ASSETS_BASE_URL + value
else if (typeof value === 'object') setAssetsUrl(value) // Recursively process nested objects
})
}

const getSections = async ({ ref } = {}) => {
const page = await retrieveContent('dashboard', {
Expand Down
Loading

0 comments on commit ddaac14

Please sign in to comment.