From c93e65d07e8c21852de903aebb5db4df4ea406db Mon Sep 17 00:00:00 2001 From: Scott Aubrey Date: Wed, 9 Oct 2024 11:58:47 +0100 Subject: [PATCH 1/9] Improve prod mode for changing global config between build and server start (#2166) When using prod mode, it becomes impossible to test what happens in the real scenario that: - the next build is run without any environment/config - the server is started with environment/config With this change we can run `yarn build` in your checkout, without config, and then restart the app (`docker compose restart app`) to see the effects --- docker-compose.prod.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docker-compose.prod.yaml b/docker-compose.prod.yaml index 3c489548b..8e2b82e47 100644 --- a/docker-compose.prod.yaml +++ b/docker-compose.prod.yaml @@ -1,7 +1,9 @@ # overrides that make the app behave like a production build services: app: - command: sh -c 'yarn build; yarn start' + build: + context: . + target: prod healthcheck: test: ["CMD-SHELL", "sh -c 'apk add curl; curl -X POST http://app:3000/'"] interval: 5s From 5a33b952cff6aeb6dea85a5433c14d26f7aa45a9 Mon Sep 17 00:00:00 2001 From: Scott Aubrey Date: Wed, 9 Oct 2024 15:13:25 +0100 Subject: [PATCH 2/9] set default namespace during page render to namespace sent with pageProps.siteName (#2165) --- src/pages/_app.page.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pages/_app.page.tsx b/src/pages/_app.page.tsx index eec5f1156..6615d22f0 100644 --- a/src/pages/_app.page.tsx +++ b/src/pages/_app.page.tsx @@ -4,6 +4,7 @@ import { ReactNode } from 'react'; import { DefaultLayout } from '../components/layouts/default'; import { config } from '../config'; import { BiophysicsColabLayout } from '../components/layouts/biophysics-colab'; +import { i18n } from '../i18n'; const LayoutSelector = ({ siteName, children }: { siteName?: string, children: ReactNode }) => { switch (siteName) { @@ -43,6 +44,10 @@ const notoSans = Noto_Sans({ }); export default function MyApp({ Component, pageProps }: any) { + const namespace = pageProps.siteName?.replace('-', '_'); + if (namespace && i18n.hasLoadedNamespace(namespace)) { + i18n.setDefaultNamespace(namespace); + } return ( <> From 315c9cce430a9a24ae489b1d722af8e51c570f13 Mon Sep 17 00:00:00 2001 From: Nathan Lisgo Date: Thu, 10 Oct 2024 10:03:51 +0100 Subject: [PATCH 3/9] Introduce I18nextProvider (#2167) * Introduce I18nextProvider [elifesciences/enhanced-preprints-issues#1173] * Remove i18n include in components but include in stories and tests [elifesciences/enhanced-preprints-issues#1173] --- .../atoms/assessment/assessment.stories.tsx | 1 + src/components/atoms/assessment/assessment.test.tsx | 1 + src/components/atoms/assessment/assessment.tsx | 1 - .../atoms/review-content/review-content.stories.tsx | 1 + .../atoms/review-content/review-content.test.tsx | 1 + .../atoms/review-content/review-content.tsx | 1 - .../atoms/review-process/review-process.stories.tsx | 1 + .../atoms/review-process/review-process.test.tsx | 1 + .../atoms/review-process/review-process.tsx | 1 - src/components/atoms/socials/socials.stories.tsx | 1 + src/components/atoms/socials/socials.tsx | 1 - .../article-status/article-status.stories.tsx | 1 + .../article-status/article-status.test.tsx | 1 + .../molecules/article-status/article-status.tsx | 1 - .../molecules/timeline/timeline.stories.tsx | 1 + src/components/molecules/timeline/timeline.test.tsx | 1 + src/components/molecules/timeline/timeline.tsx | 1 - .../pages/article/article-page.stories.tsx | 1 + src/components/pages/article/article-page.test.tsx | 1 + src/components/pages/article/article-page.tsx | 6 ++---- .../pages/article/tabs/fulltext-tab.test.tsx | 1 + src/components/pages/article/tabs/fulltext-tab.tsx | 1 - src/pages/_app.page.tsx | 13 ++++++------- src/pages/reviewed-preprints/[...path].page.tsx | 1 - 24 files changed, 22 insertions(+), 19 deletions(-) diff --git a/src/components/atoms/assessment/assessment.stories.tsx b/src/components/atoms/assessment/assessment.stories.tsx index 772adce0d..a1b9202a4 100644 --- a/src/components/atoms/assessment/assessment.stories.tsx +++ b/src/components/atoms/assessment/assessment.stories.tsx @@ -1,6 +1,7 @@ import { Meta, StoryObj } from '@storybook/react'; import { within, userEvent, expect } from '@storybook/test'; import { Assessment } from './assessment'; +import '../../../i18n'; const meta: Meta = { title: 'Atoms/Assessment', diff --git a/src/components/atoms/assessment/assessment.test.tsx b/src/components/atoms/assessment/assessment.test.tsx index 0806cb31d..308884707 100644 --- a/src/components/atoms/assessment/assessment.test.tsx +++ b/src/components/atoms/assessment/assessment.test.tsx @@ -1,6 +1,7 @@ import { fireEvent, render, screen } from '@testing-library/react'; import { significanceTerms, strengthTerms } from '../../../utils/terms'; import { Assessment } from './assessment'; +import '../../../i18n'; let mockPathName = ''; jest.mock('next/navigation', () => ({ diff --git a/src/components/atoms/assessment/assessment.tsx b/src/components/atoms/assessment/assessment.tsx index 968820512..6f0bbe6c2 100644 --- a/src/components/atoms/assessment/assessment.tsx +++ b/src/components/atoms/assessment/assessment.tsx @@ -1,5 +1,4 @@ import './assessment.scss'; -import '../../../i18n'; import { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { TermsList } from '../terms-list/terms-list'; diff --git a/src/components/atoms/review-content/review-content.stories.tsx b/src/components/atoms/review-content/review-content.stories.tsx index 9e6b76c9b..cb3bb43e7 100644 --- a/src/components/atoms/review-content/review-content.stories.tsx +++ b/src/components/atoms/review-content/review-content.stories.tsx @@ -1,5 +1,6 @@ import { Meta, StoryObj } from '@storybook/react'; import { ReviewContent } from './review-content'; +import '../../../i18n'; const meta: Meta = { title: 'Atoms/Review Content', diff --git a/src/components/atoms/review-content/review-content.test.tsx b/src/components/atoms/review-content/review-content.test.tsx index 964dbfb56..9bd8bb656 100644 --- a/src/components/atoms/review-content/review-content.test.tsx +++ b/src/components/atoms/review-content/review-content.test.tsx @@ -1,5 +1,6 @@ import { render, screen } from '@testing-library/react'; import { ReviewContent } from './review-content'; +import '../../../i18n'; describe('ReviewContent', () => { it('renders with a simple string content', async () => { diff --git a/src/components/atoms/review-content/review-content.tsx b/src/components/atoms/review-content/review-content.tsx index ff225d418..6a17f816e 100644 --- a/src/components/atoms/review-content/review-content.tsx +++ b/src/components/atoms/review-content/review-content.tsx @@ -1,5 +1,4 @@ import './review-content.scss'; -import '../../../i18n'; import { Descriptors } from '../descriptors/descriptors'; type Props = { content: string, id?: string, peerReviewUrl?: string, doi?: string }; diff --git a/src/components/atoms/review-process/review-process.stories.tsx b/src/components/atoms/review-process/review-process.stories.tsx index 45e8013e5..4d805b6ca 100644 --- a/src/components/atoms/review-process/review-process.stories.tsx +++ b/src/components/atoms/review-process/review-process.stories.tsx @@ -1,5 +1,6 @@ import { Meta, StoryObj } from '@storybook/react'; import { ReviewProcess } from './review-process'; +import '../../../i18n'; const meta: Meta = { title: 'Atoms/Review Process', diff --git a/src/components/atoms/review-process/review-process.test.tsx b/src/components/atoms/review-process/review-process.test.tsx index 10245c22c..4d9fb0312 100644 --- a/src/components/atoms/review-process/review-process.test.tsx +++ b/src/components/atoms/review-process/review-process.test.tsx @@ -1,5 +1,6 @@ import { render, screen } from '@testing-library/react'; import { ReviewProcess } from './review-process'; +import '../../../i18n'; describe('Review Process', () => { it('renders review process', () => { diff --git a/src/components/atoms/review-process/review-process.tsx b/src/components/atoms/review-process/review-process.tsx index d0eca94f2..31331e626 100644 --- a/src/components/atoms/review-process/review-process.tsx +++ b/src/components/atoms/review-process/review-process.tsx @@ -1,5 +1,4 @@ import './review-process.scss'; -import '../../../i18n'; import { useTranslation } from 'react-i18next'; import parse from 'html-react-parser'; diff --git a/src/components/atoms/socials/socials.stories.tsx b/src/components/atoms/socials/socials.stories.tsx index 6d0d40228..0e452ba0a 100644 --- a/src/components/atoms/socials/socials.stories.tsx +++ b/src/components/atoms/socials/socials.stories.tsx @@ -1,5 +1,6 @@ import { Meta, StoryObj } from '@storybook/react'; import { Socials } from './socials'; +import '../../../i18n'; const meta: Meta = { title: 'Atoms/Socials', diff --git a/src/components/atoms/socials/socials.tsx b/src/components/atoms/socials/socials.tsx index 2c1fc9bbf..96505c785 100644 --- a/src/components/atoms/socials/socials.tsx +++ b/src/components/atoms/socials/socials.tsx @@ -1,6 +1,5 @@ import { useTranslation } from 'react-i18next'; import './socials.scss'; -import '../../../i18n'; type SocialsProps = { doi: string, diff --git a/src/components/molecules/article-status/article-status.stories.tsx b/src/components/molecules/article-status/article-status.stories.tsx index aeda85a97..3da6d337a 100644 --- a/src/components/molecules/article-status/article-status.stories.tsx +++ b/src/components/molecules/article-status/article-status.stories.tsx @@ -1,6 +1,7 @@ import { Meta, StoryObj } from '@storybook/react'; import { citation, metrics } from '../../../utils/mocks'; import { ArticleStatus } from './article-status'; +import '../../../i18n'; const meta: Meta = { title: 'Molecules/ArticleStatus', diff --git a/src/components/molecules/article-status/article-status.test.tsx b/src/components/molecules/article-status/article-status.test.tsx index d31f29f45..9afe58289 100644 --- a/src/components/molecules/article-status/article-status.test.tsx +++ b/src/components/molecules/article-status/article-status.test.tsx @@ -1,6 +1,7 @@ import { render, screen } from '@testing-library/react'; import { citation } from '../../../utils/mocks'; import { ArticleStatus } from './article-status'; +import '../../../i18n'; describe('ArticleStatus', () => { it('renders the article status and type if passed in', () => { diff --git a/src/components/molecules/article-status/article-status.tsx b/src/components/molecules/article-status/article-status.tsx index 0afaab92a..3c49a5890 100644 --- a/src/components/molecules/article-status/article-status.tsx +++ b/src/components/molecules/article-status/article-status.tsx @@ -5,7 +5,6 @@ import { Socials } from '../../atoms/socials/socials'; import { Modal } from '../modal/modal'; import './article-status.scss'; import { Citation, CitationData } from '../../atoms/citation/citation'; -import '../../../i18n'; import { ContextualData, ContextualDataProps } from '../../atoms/contextual-data/contextual-data'; import { Timeline, TimelineProps } from '../timeline/timeline'; diff --git a/src/components/molecules/timeline/timeline.stories.tsx b/src/components/molecules/timeline/timeline.stories.tsx index 267973c01..50a15fbae 100644 --- a/src/components/molecules/timeline/timeline.stories.tsx +++ b/src/components/molecules/timeline/timeline.stories.tsx @@ -1,6 +1,7 @@ import { Meta, StoryObj } from '@storybook/react'; import { expect, userEvent, within } from '@storybook/test'; import { Timeline } from './timeline'; +import '../../../i18n'; const meta: Meta = { title: 'Molecules/Timeline', diff --git a/src/components/molecules/timeline/timeline.test.tsx b/src/components/molecules/timeline/timeline.test.tsx index f34c2dff1..238de0198 100644 --- a/src/components/molecules/timeline/timeline.test.tsx +++ b/src/components/molecules/timeline/timeline.test.tsx @@ -1,5 +1,6 @@ import { fireEvent, render, screen } from '@testing-library/react'; import { Timeline } from './timeline'; +import '../../../i18n'; describe('Timeline', () => { it('renders a single timeline item', () => { diff --git a/src/components/molecules/timeline/timeline.tsx b/src/components/molecules/timeline/timeline.tsx index 58118d99d..02c6bfc1d 100644 --- a/src/components/molecules/timeline/timeline.tsx +++ b/src/components/molecules/timeline/timeline.tsx @@ -1,5 +1,4 @@ import { Fragment, useEffect, useState } from 'react'; -import '../../../i18n'; import './timeline.scss'; import { formatDate } from '../../../utils/formatters'; import { TimelineEvent } from '../../../types'; diff --git a/src/components/pages/article/article-page.stories.tsx b/src/components/pages/article/article-page.stories.tsx index e9deb4dd1..621bc52ee 100644 --- a/src/components/pages/article/article-page.stories.tsx +++ b/src/components/pages/article/article-page.stories.tsx @@ -8,6 +8,7 @@ import { ArticleFullTextTab, ArticleFiguresTab, ArticleReviewsTab } from './tabs import { DefaultLayout } from '../../layouts/default'; import { ErrorMessages } from '../../atoms/error-messages/error-messages'; import { contentToHeadings, contentToJsx } from '../../../utils/content'; +import '../../../i18n'; const meta: Meta = { title: 'Pages/Article Page', diff --git a/src/components/pages/article/article-page.test.tsx b/src/components/pages/article/article-page.test.tsx index fef73fc12..36d738347 100644 --- a/src/components/pages/article/article-page.test.tsx +++ b/src/components/pages/article/article-page.test.tsx @@ -8,6 +8,7 @@ import { } from '../../../utils/mocks'; import { ArticleFiguresTab, ArticleFullTextTab, ArticleReviewsTab } from './tabs'; import { contentToText } from '../../../utils/content'; +import '../../../i18n'; jest.mock('next/navigation', () => ({ usePathname: () => '', diff --git a/src/components/pages/article/article-page.tsx b/src/components/pages/article/article-page.tsx index 196eb19a4..c252b1178 100644 --- a/src/components/pages/article/article-page.tsx +++ b/src/components/pages/article/article-page.tsx @@ -3,13 +3,11 @@ import { useTranslation } from 'react-i18next'; import { ArticleStatus } from '../../molecules/article-status/article-status'; import { ContentHeader } from '../../molecules/content-header/content-header'; import './article-page.scss'; -import { MetaData, TimelineEvent } from '../../../types'; +import { MetaData, Metrics, TimelineEvent } from '../../../types'; import { ArticleFiguresTab, ArticleFullTextTab, ArticleReviewsTab } from './tabs'; -import { contentToText } from '../../../utils/content/content-to-text'; +import { contentToText } from '../../../utils/content'; import { CitationData } from '../../atoms/citation/citation'; -import '../../../i18n'; import { RelatedContentData, RelatedContent } from '../../atoms/related-content/related-content'; -import { Metrics } from '../../../types/enhanced-article'; import { PreviousVersionWarning } from '../../atoms/previous-version-warning/previous-version-warning'; export type ArticleStatusProps = { diff --git a/src/components/pages/article/tabs/fulltext-tab.test.tsx b/src/components/pages/article/tabs/fulltext-tab.test.tsx index c1d88f2c3..87d76873f 100644 --- a/src/components/pages/article/tabs/fulltext-tab.test.tsx +++ b/src/components/pages/article/tabs/fulltext-tab.test.tsx @@ -2,6 +2,7 @@ import { render } from '@testing-library/react'; import { metaData, peerReview, content } from '../../../../utils/mocks'; import { ArticleFullTextTab } from './fulltext-tab'; import { contentToJsx } from '../../../../utils/content'; +import '../../../../i18n'; jest.mock('next/navigation', () => ({ usePathname: () => '', diff --git a/src/components/pages/article/tabs/fulltext-tab.tsx b/src/components/pages/article/tabs/fulltext-tab.tsx index c92db17c5..c9b85602b 100644 --- a/src/components/pages/article/tabs/fulltext-tab.tsx +++ b/src/components/pages/article/tabs/fulltext-tab.tsx @@ -7,7 +7,6 @@ import { ReferenceList } from '../../../atoms/reference-list/reference-list'; import { ArticleAndAuthorInformation } from '../../../molecules/article-and-author-information/article-and-author-information'; import { MetaData, PeerReview } from '../../../../types'; import { JSXContent } from '../../../../utils/content'; -import '../../../../i18n'; import { Metrics as MetricsType } from '../../../../types/enhanced-article'; import { Metrics } from '../../../atoms/metrics/metrics'; import { Assessment } from '../../../atoms/assessment/assessment'; diff --git a/src/pages/_app.page.tsx b/src/pages/_app.page.tsx index 6615d22f0..46ea75ca4 100644 --- a/src/pages/_app.page.tsx +++ b/src/pages/_app.page.tsx @@ -1,6 +1,7 @@ import Head from 'next/head'; import { Noto_Serif, Noto_Sans } from 'next/font/google'; import { ReactNode } from 'react'; +import { I18nextProvider } from 'react-i18next'; import { DefaultLayout } from '../components/layouts/default'; import { config } from '../config'; import { BiophysicsColabLayout } from '../components/layouts/biophysics-colab'; @@ -44,10 +45,6 @@ const notoSans = Noto_Sans({ }); export default function MyApp({ Component, pageProps }: any) { - const namespace = pageProps.siteName?.replace('-', '_'); - if (namespace && i18n.hasLoadedNamespace(namespace)) { - i18n.setDefaultNamespace(namespace); - } return ( <> @@ -79,9 +76,11 @@ export default function MyApp({ Component, pageProps }: any) { }}> } - - - + + + + + ); } diff --git a/src/pages/reviewed-preprints/[...path].page.tsx b/src/pages/reviewed-preprints/[...path].page.tsx index b73638ad2..e579b3d4b 100644 --- a/src/pages/reviewed-preprints/[...path].page.tsx +++ b/src/pages/reviewed-preprints/[...path].page.tsx @@ -21,7 +21,6 @@ import { import { generateStatus, generateTimeline, generateVersionHistory } from '../../utils/generators'; import { ErrorMessages } from '../../components/atoms/error-messages/error-messages'; import { formatAuthorName } from '../../utils/formatters'; -import '../../i18n'; import { makeNullableOptional } from '../../utils/make-nullable-optional'; import { SerialisedTimelineEvent } from '../../types/article-timeline'; From ff4651a2e66a0ab1cb61e32c8f86ea1ebd150ccc Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 11 Oct 2024 01:33:26 +0000 Subject: [PATCH 4/9] chore(deps): update dependency sass to v1.79.5 --- yarn.lock | 161 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 157 insertions(+), 4 deletions(-) diff --git a/yarn.lock b/yarn.lock index 577b2d078..a6a461e01 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4263,6 +4263,140 @@ __metadata: languageName: node linkType: hard +"@parcel/watcher-android-arm64@npm:2.4.1": + version: 2.4.1 + resolution: "@parcel/watcher-android-arm64@npm:2.4.1" + conditions: os=android & cpu=arm64 + languageName: node + linkType: hard + +"@parcel/watcher-darwin-arm64@npm:2.4.1": + version: 2.4.1 + resolution: "@parcel/watcher-darwin-arm64@npm:2.4.1" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@parcel/watcher-darwin-x64@npm:2.4.1": + version: 2.4.1 + resolution: "@parcel/watcher-darwin-x64@npm:2.4.1" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@parcel/watcher-freebsd-x64@npm:2.4.1": + version: 2.4.1 + resolution: "@parcel/watcher-freebsd-x64@npm:2.4.1" + conditions: os=freebsd & cpu=x64 + languageName: node + linkType: hard + +"@parcel/watcher-linux-arm-glibc@npm:2.4.1": + version: 2.4.1 + resolution: "@parcel/watcher-linux-arm-glibc@npm:2.4.1" + conditions: os=linux & cpu=arm & libc=glibc + languageName: node + linkType: hard + +"@parcel/watcher-linux-arm64-glibc@npm:2.4.1": + version: 2.4.1 + resolution: "@parcel/watcher-linux-arm64-glibc@npm:2.4.1" + conditions: os=linux & cpu=arm64 & libc=glibc + languageName: node + linkType: hard + +"@parcel/watcher-linux-arm64-musl@npm:2.4.1": + version: 2.4.1 + resolution: "@parcel/watcher-linux-arm64-musl@npm:2.4.1" + conditions: os=linux & cpu=arm64 & libc=musl + languageName: node + linkType: hard + +"@parcel/watcher-linux-x64-glibc@npm:2.4.1": + version: 2.4.1 + resolution: "@parcel/watcher-linux-x64-glibc@npm:2.4.1" + conditions: os=linux & cpu=x64 & libc=glibc + languageName: node + linkType: hard + +"@parcel/watcher-linux-x64-musl@npm:2.4.1": + version: 2.4.1 + resolution: "@parcel/watcher-linux-x64-musl@npm:2.4.1" + conditions: os=linux & cpu=x64 & libc=musl + languageName: node + linkType: hard + +"@parcel/watcher-win32-arm64@npm:2.4.1": + version: 2.4.1 + resolution: "@parcel/watcher-win32-arm64@npm:2.4.1" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"@parcel/watcher-win32-ia32@npm:2.4.1": + version: 2.4.1 + resolution: "@parcel/watcher-win32-ia32@npm:2.4.1" + conditions: os=win32 & cpu=ia32 + languageName: node + linkType: hard + +"@parcel/watcher-win32-x64@npm:2.4.1": + version: 2.4.1 + resolution: "@parcel/watcher-win32-x64@npm:2.4.1" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + +"@parcel/watcher@npm:^2.4.1": + version: 2.4.1 + resolution: "@parcel/watcher@npm:2.4.1" + dependencies: + "@parcel/watcher-android-arm64": "npm:2.4.1" + "@parcel/watcher-darwin-arm64": "npm:2.4.1" + "@parcel/watcher-darwin-x64": "npm:2.4.1" + "@parcel/watcher-freebsd-x64": "npm:2.4.1" + "@parcel/watcher-linux-arm-glibc": "npm:2.4.1" + "@parcel/watcher-linux-arm64-glibc": "npm:2.4.1" + "@parcel/watcher-linux-arm64-musl": "npm:2.4.1" + "@parcel/watcher-linux-x64-glibc": "npm:2.4.1" + "@parcel/watcher-linux-x64-musl": "npm:2.4.1" + "@parcel/watcher-win32-arm64": "npm:2.4.1" + "@parcel/watcher-win32-ia32": "npm:2.4.1" + "@parcel/watcher-win32-x64": "npm:2.4.1" + detect-libc: "npm:^1.0.3" + is-glob: "npm:^4.0.3" + micromatch: "npm:^4.0.5" + node-addon-api: "npm:^7.0.0" + node-gyp: "npm:latest" + dependenciesMeta: + "@parcel/watcher-android-arm64": + optional: true + "@parcel/watcher-darwin-arm64": + optional: true + "@parcel/watcher-darwin-x64": + optional: true + "@parcel/watcher-freebsd-x64": + optional: true + "@parcel/watcher-linux-arm-glibc": + optional: true + "@parcel/watcher-linux-arm64-glibc": + optional: true + "@parcel/watcher-linux-arm64-musl": + optional: true + "@parcel/watcher-linux-x64-glibc": + optional: true + "@parcel/watcher-linux-x64-musl": + optional: true + "@parcel/watcher-win32-arm64": + optional: true + "@parcel/watcher-win32-ia32": + optional: true + "@parcel/watcher-win32-x64": + optional: true + checksum: 10c0/33b7112094b9eb46c234d824953967435b628d3d93a0553255e9910829b84cab3da870153c3a870c31db186dc58f3b2db81382fcaee3451438aeec4d786a6211 + languageName: node + linkType: hard + "@pkgjs/parseargs@npm:^0.11.0": version: 0.11.0 resolution: "@pkgjs/parseargs@npm:0.11.0" @@ -8988,6 +9122,15 @@ __metadata: languageName: node linkType: hard +"detect-libc@npm:^1.0.3": + version: 1.0.3 + resolution: "detect-libc@npm:1.0.3" + bin: + detect-libc: ./bin/detect-libc.js + checksum: 10c0/4da0deae9f69e13bc37a0902d78bf7169480004b1fed3c19722d56cff578d16f0e11633b7fbf5fb6249181236c72e90024cbd68f0b9558ae06e281f47326d50d + languageName: node + linkType: hard + "detect-libc@npm:^2.0.3": version: 2.0.3 resolution: "detect-libc@npm:2.0.3" @@ -14090,7 +14233,7 @@ __metadata: languageName: node linkType: hard -"micromatch@npm:^4.0.8": +"micromatch@npm:^4.0.5, micromatch@npm:^4.0.8": version: 4.0.8 resolution: "micromatch@npm:4.0.8" dependencies: @@ -14438,6 +14581,15 @@ __metadata: languageName: node linkType: hard +"node-addon-api@npm:^7.0.0": + version: 7.1.1 + resolution: "node-addon-api@npm:7.1.1" + dependencies: + node-gyp: "npm:latest" + checksum: 10c0/fb32a206276d608037fa1bcd7e9921e177fe992fc610d098aa3128baca3c0050fc1e014fa007e9b3874cf865ddb4f5bd9f43ccb7cbbbe4efaff6a83e920b17e9 + languageName: node + linkType: hard + "node-dir@npm:^0.1.17": version: 0.1.17 resolution: "node-dir@npm:0.1.17" @@ -16635,15 +16787,16 @@ __metadata: linkType: hard "sass@npm:^1.54.5": - version: 1.79.4 - resolution: "sass@npm:1.79.4" + version: 1.79.5 + resolution: "sass@npm:1.79.5" dependencies: + "@parcel/watcher": "npm:^2.4.1" chokidar: "npm:^4.0.0" immutable: "npm:^4.0.0" source-map-js: "npm:>=0.6.2 <2.0.0" bin: sass: sass.js - checksum: 10c0/505ff0d9267d0fb990971e617acfeabf7c060c55d4cef68fe8a4bc693e7ea88ae7d7caeca3975e4b453459ba4a707b6e5b6979fc9395a7e08f0a43ca6aed06b8 + checksum: 10c0/7331865fd1d0c03e6e180a4fe0e175ac1bf1214f6c77f0d99ad72fbe2ed9ede3fab8a64c0c41471cb8a358a9d11624ec59a49283f9b6070eb99c522b34b814bf languageName: node linkType: hard From dea4e8de2e34718739f5b721971df0beea719eb7 Mon Sep 17 00:00:00 2001 From: Nathan Lisgo Date: Fri, 11 Oct 2024 12:40:05 +0100 Subject: [PATCH 5/9] Move eLife assessment above abstract [elifesciences/enhanced-preprints-issues#1165] (#2157) -------- Co-authored-by: Will Byrne --- .../atoms/assessment/assessment.scss | 16 ++++++----- .../pages/article/article-page.scss | 13 +++++++-- .../pages/article/tabs/figures-tab.tsx | 2 +- .../pages/article/tabs/fulltext-tab.test.tsx | 6 +---- .../pages/article/tabs/fulltext-tab.tsx | 27 +++++++++---------- .../pages/article/tabs/reviews-tab.tsx | 2 +- 6 files changed, 35 insertions(+), 31 deletions(-) diff --git a/src/components/atoms/assessment/assessment.scss b/src/components/atoms/assessment/assessment.scss index c70d30c21..e2c8c5e49 100644 --- a/src/components/atoms/assessment/assessment.scss +++ b/src/components/atoms/assessment/assessment.scss @@ -3,8 +3,8 @@ @use "../../../sass/mixins"; .assessment { - @include mixins.margin(0 -24); - @include mixins.padding(24); + @include mixins.margin(0 -24 36); + @include mixins.padding(36 24); @include typography.assessment-body(); .highlighted-term { @@ -41,14 +41,12 @@ } @media only all and (min-width: settings.$breakpoint-small) { - @include mixins.margin(0 -48); - @include mixins.padding(36 48); + @include mixins.margin(0 -48 36); + @include mixins.padding(48); } @media only all and (min-width: settings.$breakpoint-medium) { - @include mixins.padding(24 36); - - margin: 0; + @include mixins.margin(0 0 36); } background-color: var(--color-background); @@ -61,6 +59,10 @@ .assessment__body { @include mixins.margin(12, "bottom"); + p:first-of-type { + @include mixins.margin(0, "top"); + } + p:last-of-type { @include mixins.margin(0, "bottom"); } diff --git a/src/components/pages/article/article-page.scss b/src/components/pages/article/article-page.scss index 3ca00deb3..fdcca596a 100644 --- a/src/components/pages/article/article-page.scss +++ b/src/components/pages/article/article-page.scss @@ -27,7 +27,7 @@ } .tabbed-navigation { - @include mixins.margin(0 -24 24); + @include mixins.margin(0 -24); @include mixins.z-index(1); background-color: #fff; @@ -39,7 +39,7 @@ top: 0; @media only screen and (min-width: settings.$breakpoint-small) { - @include mixins.margin(0 -48 36); + @include mixins.margin(0 -48); } @media only screen and (min-width: settings.$breakpoint-medium) { @@ -127,4 +127,13 @@ @media only all and (min-width: settings.$breakpoint-large) { display: flex; } + + &.tabbed-navigation__content--reviews, + &.tabbed-navigation__content--figures { + @include mixins.margin(36, "top"); + + @media only all and (min-width: settings.$breakpoint-medium) { + @include mixins.margin(0, "top"); + } + } } diff --git a/src/components/pages/article/tabs/figures-tab.tsx b/src/components/pages/article/tabs/figures-tab.tsx index 42a2e1ebb..907e13b0c 100644 --- a/src/components/pages/article/tabs/figures-tab.tsx +++ b/src/components/pages/article/tabs/figures-tab.tsx @@ -4,7 +4,7 @@ import { ArticleContent } from '../../../atoms/article-content/article-content'; import { JSXContent } from '../../../../utils/content'; export const ArticleFiguresTab = ({ content }: { content: JSXContent }) => ( -
+
diff --git a/src/components/pages/article/tabs/fulltext-tab.test.tsx b/src/components/pages/article/tabs/fulltext-tab.test.tsx index 87d76873f..6529ec848 100644 --- a/src/components/pages/article/tabs/fulltext-tab.test.tsx +++ b/src/components/pages/article/tabs/fulltext-tab.test.tsx @@ -99,10 +99,6 @@ describe('FulltextTab', () => { href: '#abstract', text: 'Abstract', }, - { - href: '#assessment', - text: 'eLife assessment', - }, { href: '#s1', text: 'Introduction', @@ -149,7 +145,7 @@ describe('FulltextTab', () => { it('uses the heading ids for the hrefs in jump-to-menu', () => { const { container } = render(); - const headings = Array.from(container.querySelectorAll('section[id], h1, .heading-1')); + const headings = Array.from(container.querySelectorAll('.article-body-container section[id], h1, .heading-1')); const ids = headings.map(({ id }) => id); const links = Array.from(container.querySelectorAll('.jump-menu-list__link')); diff --git a/src/components/pages/article/tabs/fulltext-tab.tsx b/src/components/pages/article/tabs/fulltext-tab.tsx index c9b85602b..49a5f93d5 100644 --- a/src/components/pages/article/tabs/fulltext-tab.tsx +++ b/src/components/pages/article/tabs/fulltext-tab.tsx @@ -1,5 +1,4 @@ import '../article-page.scss'; -import { useTranslation } from 'react-i18next'; import { ArticleContent } from '../../../atoms/article-content/article-content'; import { Heading, JumpToMenu } from '../../../atoms/jump-to-menu/jump-to-menu'; import { Abstract } from '../../../atoms/abstract/abstract'; @@ -21,7 +20,6 @@ type Props = { }; export const ArticleFullTextTab = (props: Props) => { - const { t } = useTranslation(); const headings = [ { id: 'abstract', text: 'Abstract' }, ...props.headings, @@ -29,24 +27,23 @@ export const ArticleFullTextTab = (props: Props) => { { id: 'article-and-author-information', text: 'Article and Author Information' }, ]; - if (props.peerReview !== undefined) { - headings.splice(1, 0, { id: 'assessment', text: t('heading_assessment') }); - } if (props.metrics) { headings.push({ id: 'metrics', text: 'Metrics' }); } return ( -
- -
- - { props.peerReview && } - - - - { props.metrics && } + <> + { props.peerReview && } +
+ +
+ + + + + { props.metrics && } +
-
+ ); }; diff --git a/src/components/pages/article/tabs/reviews-tab.tsx b/src/components/pages/article/tabs/reviews-tab.tsx index 67f6cd825..1b163a70a 100644 --- a/src/components/pages/article/tabs/reviews-tab.tsx +++ b/src/components/pages/article/tabs/reviews-tab.tsx @@ -16,7 +16,7 @@ export const ArticleReviewsTab = ({ peerReview, currentVersion }: { peerReview: ]; return ( -
+
From 1a45c1e3af82f2f25649f406b3f16d1a59f2514f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 11 Oct 2024 16:26:33 +0000 Subject: [PATCH 6/9] chore(deps): update dependency @types/react-dom to v18.3.1 --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index a6a461e01..d667e98b4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6124,11 +6124,11 @@ __metadata: linkType: hard "@types/react-dom@npm:^18.0.0, @types/react-dom@npm:^18.2.18": - version: 18.3.0 - resolution: "@types/react-dom@npm:18.3.0" + version: 18.3.1 + resolution: "@types/react-dom@npm:18.3.1" dependencies: "@types/react": "npm:*" - checksum: 10c0/6c90d2ed72c5a0e440d2c75d99287e4b5df3e7b011838cdc03ae5cd518ab52164d86990e73246b9d812eaf02ec351d74e3b4f5bd325bf341e13bf980392fd53b + checksum: 10c0/8b416551c60bb6bd8ec10e198c957910cfb271bc3922463040b0d57cf4739cdcd24b13224f8d68f10318926e1ec3cd69af0af79f0291b599a992f8c80d47f1eb languageName: node linkType: hard From 971c332da91fa59e38e82958a083559ce819a7fb Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 11 Oct 2024 22:45:56 +0000 Subject: [PATCH 7/9] chore(deps): update dependency stylelint to v16.10.0 --- yarn.lock | 111 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 62 insertions(+), 49 deletions(-) diff --git a/yarn.lock b/yarn.lock index d667e98b4..cef33872e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8737,10 +8737,10 @@ __metadata: languageName: node linkType: hard -"css-functions-list@npm:^3.2.2": - version: 3.2.2 - resolution: "css-functions-list@npm:3.2.2" - checksum: 10c0/8638a63d0cf1bdc50d4a752ec1c94a57e9953c3b03eace4f5526db20bec3c061e95089f905dbb4999c44b9780ce777ba856967560f6d15119a303f6030901c10 +"css-functions-list@npm:^3.2.3": + version: 3.2.3 + resolution: "css-functions-list@npm:3.2.3" + checksum: 10c0/03f9ed34eeed310d2b1cf0e524eea02bc5f87854a4de85f8957ea432ab1036841a3fb00879590519f7bb8fda40d992ce7a72fa9b61696ca1dc53b90064858f96 languageName: node linkType: hard @@ -8775,13 +8775,13 @@ __metadata: languageName: node linkType: hard -"css-tree@npm:^2.3.1": - version: 2.3.1 - resolution: "css-tree@npm:2.3.1" +"css-tree@npm:^3.0.0": + version: 3.0.0 + resolution: "css-tree@npm:3.0.0" dependencies: - mdn-data: "npm:2.0.30" + mdn-data: "npm:2.10.0" source-map-js: "npm:^1.0.1" - checksum: 10c0/6f8c1a11d5e9b14bf02d10717fc0351b66ba12594166f65abfbd8eb8b5b490dd367f5c7721db241a3c792d935fc6751fbc09f7e1598d421477ad9fadc30f4f24 + checksum: 10c0/43d44fdf7004ae91d73d486f17894fef77efa33747a6752b9241cf0f5fb47fabc16ec34a96a993651d9014dfdeee803d7c5fcd3548214252ee19f4e5c98999b2 languageName: node linkType: hard @@ -8929,15 +8929,15 @@ __metadata: languageName: node linkType: hard -"debug@npm:^4.3.6": - version: 4.3.6 - resolution: "debug@npm:4.3.6" +"debug@npm:^4.3.7": + version: 4.3.7 + resolution: "debug@npm:4.3.7" dependencies: - ms: "npm:2.1.2" + ms: "npm:^2.1.3" peerDependenciesMeta: supports-color: optional: true - checksum: 10c0/3293416bff072389c101697d4611c402a6bacd1900ac20c0492f61a9cdd6b3b29750fc7f5e299f8058469ef60ff8fb79b86395a30374fbd2490113c1c7112285 + checksum: 10c0/1471db19c3b06d485a622d62f65947a19a23fbd0dd73f7fd3eafb697eec5360cde447fb075919987899b1a2096e85d35d4eb5a4de09a57600ac9cf7e6c8e768b languageName: node linkType: hard @@ -10911,12 +10911,12 @@ __metadata: languageName: node linkType: hard -"file-entry-cache@npm:^9.0.0": - version: 9.0.0 - resolution: "file-entry-cache@npm:9.0.0" +"file-entry-cache@npm:^9.1.0": + version: 9.1.0 + resolution: "file-entry-cache@npm:9.1.0" dependencies: flat-cache: "npm:^5.0.0" - checksum: 10c0/07b0a4f062dc0aa258f3e1b06ac083ea25313f5e289943e146fafdaf3315dcc031635545eea7fe98fe5598b91d6c7f48dba7a251dd7ac20108a6ebf7d00b0b1c + checksum: 10c0/4b4dbc1e972f50202b1a4430d30fd99378ef6e2a64857176abdc65c5e4730a948fb37e274478520a7bacbc70f3abba455a4b9d2c1915c53f30d11dc85d3fef5e languageName: node linkType: hard @@ -12153,10 +12153,10 @@ __metadata: languageName: node linkType: hard -"ignore@npm:^5.3.2": - version: 5.3.2 - resolution: "ignore@npm:5.3.2" - checksum: 10c0/f9f652c957983634ded1e7f02da3b559a0d4cc210fca3792cb67f1b153623c9c42efdc1c4121af171e295444459fc4a9201101fb041b1104a3c000bccb188337 +"ignore@npm:^6.0.2": + version: 6.0.2 + resolution: "ignore@npm:6.0.2" + checksum: 10c0/9a38feac1861906a78ba0f03e8ef3cd6b0526dce2a1a84e1009324b557763afeb9c3ebcc04666b21f7bbf71adda45e76781bb9e2eaa0903d45dcaded634454f5 languageName: node linkType: hard @@ -14149,10 +14149,10 @@ __metadata: languageName: node linkType: hard -"mdn-data@npm:2.0.30": - version: 2.0.30 - resolution: "mdn-data@npm:2.0.30" - checksum: 10c0/a2c472ea16cee3911ae742593715aa4c634eb3d4b9f1e6ada0902aa90df13dcbb7285d19435f3ff213ebaa3b2e0c0265c1eb0e3fb278fda7f8919f046a410cd9 +"mdn-data@npm:2.10.0": + version: 2.10.0 + resolution: "mdn-data@npm:2.10.0" + checksum: 10c0/f6f1a6a6eb092bab250d06f6f6c7cb1733a77a17e7119aac829ad67d4322bbf6a30df3c6d88686e71942e66bd49274b2ddfede22a1d3df0d6c49a56fbd09eb7c languageName: node linkType: hard @@ -14463,7 +14463,7 @@ __metadata: languageName: node linkType: hard -"ms@npm:2.1.3, ms@npm:^2.0.0, ms@npm:^2.1.1": +"ms@npm:2.1.3, ms@npm:^2.0.0, ms@npm:^2.1.1, ms@npm:^2.1.3": version: 2.1.3 resolution: "ms@npm:2.1.3" checksum: 10c0/d924b57e7312b3b63ad21fc5b3dc0af5e78d61a1fc7cfb5457edaf26326bf62be5307cc87ffb6862ef1c2b33b0233cdb5d4f01c4c958cc0d660948b65a287a48 @@ -15384,6 +15384,13 @@ __metadata: languageName: node linkType: hard +"picocolors@npm:^1.1.0": + version: 1.1.0 + resolution: "picocolors@npm:1.1.0" + checksum: 10c0/86946f6032148801ef09c051c6fb13b5cf942eaf147e30ea79edb91dd32d700934edebe782a1078ff859fb2b816792e97ef4dab03d7f0b804f6b01a0df35e023 + languageName: node + linkType: hard + "picomatch@npm:^2.0.4, picomatch@npm:^2.2.1, picomatch@npm:^2.2.3, picomatch@npm:^2.3.0, picomatch@npm:^2.3.1": version: 2.3.1 resolution: "picomatch@npm:2.3.1" @@ -15618,12 +15625,12 @@ __metadata: languageName: node linkType: hard -"postcss-safe-parser@npm:^7.0.0": - version: 7.0.0 - resolution: "postcss-safe-parser@npm:7.0.0" +"postcss-safe-parser@npm:^7.0.1": + version: 7.0.1 + resolution: "postcss-safe-parser@npm:7.0.1" peerDependencies: postcss: ^8.4.31 - checksum: 10c0/4217afd8ce2809e959dc365e4675f499303cc6b91f94db06c8164422822db2d3b3124df701ee2234db4127ad05619b016bfb9c2bccae9bf9cf898a396f1632c9 + checksum: 10c0/6957b10b818bd8d4664ec0e548af967f7549abedfb37f844d389571d36af681340f41f9477b9ccf34bcc7599bdef222d1d72e79c64373001fae77089fba6d965 languageName: node linkType: hard @@ -15715,14 +15722,14 @@ __metadata: languageName: node linkType: hard -"postcss@npm:^8.4.41": - version: 8.4.41 - resolution: "postcss@npm:8.4.41" +"postcss@npm:^8.4.47": + version: 8.4.47 + resolution: "postcss@npm:8.4.47" dependencies: nanoid: "npm:^3.3.7" - picocolors: "npm:^1.0.1" - source-map-js: "npm:^1.2.0" - checksum: 10c0/c1828fc59e7ec1a3bf52b3a42f615dba53c67960ed82a81df6441b485fe43c20aba7f4e7c55425762fd99c594ecabbaaba8cf5b30fd79dfec5b52a9f63a2d690 + picocolors: "npm:^1.1.0" + source-map-js: "npm:^1.2.1" + checksum: 10c0/929f68b5081b7202709456532cee2a145c1843d391508c5a09de2517e8c4791638f71dd63b1898dba6712f8839d7a6da046c72a5e44c162e908f5911f57b5f44 languageName: node linkType: hard @@ -17228,6 +17235,13 @@ __metadata: languageName: node linkType: hard +"source-map-js@npm:^1.2.1": + version: 1.2.1 + resolution: "source-map-js@npm:1.2.1" + checksum: 10c0/7bda1fc4c197e3c6ff17de1b8b2c20e60af81b63a52cb32ec5a5d67a20a7d42651e2cb34ebe93833c5a2a084377e17455854fee3e21e7925c64a51b6a52b0faf + languageName: node + linkType: hard + "source-map-support@npm:0.5.13": version: 0.5.13 resolution: "source-map-support@npm:0.5.13" @@ -17589,7 +17603,7 @@ __metadata: languageName: node linkType: hard -"strip-ansi@npm:^7.0.1, strip-ansi@npm:^7.1.0": +"strip-ansi@npm:^7.0.1": version: 7.1.0 resolution: "strip-ansi@npm:7.1.0" dependencies: @@ -17818,8 +17832,8 @@ __metadata: linkType: hard "stylelint@npm:^16.2.0": - version: 16.9.0 - resolution: "stylelint@npm:16.9.0" + version: 16.10.0 + resolution: "stylelint@npm:16.10.0" dependencies: "@csstools/css-parser-algorithms": "npm:^3.0.1" "@csstools/css-tokenizer": "npm:^3.0.1" @@ -17829,17 +17843,17 @@ __metadata: balanced-match: "npm:^2.0.0" colord: "npm:^2.9.3" cosmiconfig: "npm:^9.0.0" - css-functions-list: "npm:^3.2.2" - css-tree: "npm:^2.3.1" - debug: "npm:^4.3.6" + css-functions-list: "npm:^3.2.3" + css-tree: "npm:^3.0.0" + debug: "npm:^4.3.7" fast-glob: "npm:^3.3.2" fastest-levenshtein: "npm:^1.0.16" - file-entry-cache: "npm:^9.0.0" + file-entry-cache: "npm:^9.1.0" global-modules: "npm:^2.0.0" globby: "npm:^11.1.0" globjoin: "npm:^0.1.4" html-tags: "npm:^3.3.1" - ignore: "npm:^5.3.2" + ignore: "npm:^6.0.2" imurmurhash: "npm:^0.1.4" is-plain-object: "npm:^5.0.0" known-css-properties: "npm:^0.34.0" @@ -17848,21 +17862,20 @@ __metadata: micromatch: "npm:^4.0.8" normalize-path: "npm:^3.0.0" picocolors: "npm:^1.0.1" - postcss: "npm:^8.4.41" + postcss: "npm:^8.4.47" postcss-resolve-nested-selector: "npm:^0.1.6" - postcss-safe-parser: "npm:^7.0.0" + postcss-safe-parser: "npm:^7.0.1" postcss-selector-parser: "npm:^6.1.2" postcss-value-parser: "npm:^4.2.0" resolve-from: "npm:^5.0.0" string-width: "npm:^4.2.3" - strip-ansi: "npm:^7.1.0" supports-hyperlinks: "npm:^3.1.0" svg-tags: "npm:^1.0.0" table: "npm:^6.8.2" write-file-atomic: "npm:^5.0.1" bin: stylelint: bin/stylelint.mjs - checksum: 10c0/d3ff9c8945c56b04a2fa16ec33d163325496d5db94b6fcb5adf74c76f7f794ac992888273f9a3317652ba8b6195168b2ffff382ca2a667a241e2ace8c9505ae2 + checksum: 10c0/d07dd156c225d16c740995daacd78090f7fc317602e87bda2fca323a4ae427a8526d724f3089df3b2185df4520f987547668ceea9b30985988ccbc514034aa21 languageName: node linkType: hard From 0ffe710dd8c1fb10a4a94ef4a8c462e3ae9e8969 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 13 Oct 2024 15:14:08 +0000 Subject: [PATCH 8/9] fix(deps): update dependency i18next to v23.16.0 --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index cef33872e..58edff2c1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12097,11 +12097,11 @@ __metadata: linkType: hard "i18next@npm:*, i18next@npm:^23.7.19": - version: 23.15.2 - resolution: "i18next@npm:23.15.2" + version: 23.16.0 + resolution: "i18next@npm:23.16.0" dependencies: "@babel/runtime": "npm:^7.23.2" - checksum: 10c0/6e079bf486ac24440c2e01f1852b518c3c7f2cf9754ab98c25c78e4bc50f5af936b7cbb3c566f60fbbc093ec14d7432d5320016376038bc23fc1167a03cdb6bc + checksum: 10c0/17b40d125befec02e2c8069e658ea54d36ee46fab9e05bbeed93bb5ec75fab8bd334139372652d5df491147a124447a8ee1b78ccba726b7d61b1c03e84c7b6c5 languageName: node linkType: hard From 539516902a8443d009689757952c0347d9124226 Mon Sep 17 00:00:00 2001 From: Nathan Lisgo Date: Mon, 14 Oct 2024 18:10:51 +0100 Subject: [PATCH 9/9] Add support for optional id in ImageObject [elifesciences/enhanced-preprints-issues#654] --- src/types/content.ts | 1 + src/utils/content/content-to-jsx.test.tsx | 3 ++- src/utils/content/content-to-jsx.tsx | 5 ++--- wiremock/files/preprints/85111v2.json | 1 + 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/types/content.ts b/src/types/content.ts index 255d31fd2..97c03806b 100644 --- a/src/types/content.ts +++ b/src/types/content.ts @@ -49,6 +49,7 @@ export type FigureContent = DecoratedContent & { export type ImageObjectContent = { type: 'ImageObject', + id?: string, contentUrl?: string, content?: Content meta: { diff --git a/src/utils/content/content-to-jsx.test.tsx b/src/utils/content/content-to-jsx.test.tsx index 5313d2927..504b8dcf9 100644 --- a/src/utils/content/content-to-jsx.test.tsx +++ b/src/utils/content/content-to-jsx.test.tsx @@ -147,6 +147,7 @@ describe('Content to JSX', () => { it('generates the expected html when passed a ImageObject', () => { const result = contentToJsx({ type: 'ImageObject', + id: 'id', contentUrl: 'https://placekitten.com/500/300', content: [], meta: { @@ -156,7 +157,7 @@ describe('Content to JSX', () => { // eslint-disable-next-line @next/next/no-img-element expect(result).toStrictEqual( - + ; @@ -114,7 +113,7 @@ export const contentToJsx = (content?: Content, options?: Options, index?: numbe return image; } - return + return {image} ; diff --git a/wiremock/files/preprints/85111v2.json b/wiremock/files/preprints/85111v2.json index 4bb2ee7e4..056ffab4b 100644 --- a/wiremock/files/preprints/85111v2.json +++ b/wiremock/files/preprints/85111v2.json @@ -4165,6 +4165,7 @@ "content": [ { "type": "ImageObject", + "id": "uequ1", "contentUrl": "85111/v2/content/515698v3_ueqn1.gif", "meta": { "inline": false