diff --git a/src/author-invite-flow/author-invite.ts b/src/author-invite-flow/author-invite.ts index b7d60bdc1..a6d36d164 100644 --- a/src/author-invite-flow/author-invite.ts +++ b/src/author-invite-flow/author-invite.ts @@ -8,7 +8,7 @@ import type * as TE from 'fp-ts/lib/TaskEither.js' import { flow, pipe } from 'fp-ts/lib/function.js' import type { LanguageCode } from 'iso-639-1' import { type Orcid, Eq as eqOrcid } from 'orcid-id-ts' -import { getLangDir } from 'rtl-detect' +import rtlDetect from 'rtl-detect' import { P, match } from 'ts-pattern' import type { Uuid } from 'uuid-ts' import { type GetAuthorInviteEnv, getAuthorInvite } from '../author-invite.js' @@ -116,7 +116,7 @@ function startPage({ inviteId, review, user }: { inviteId: Uuid; review: Prerevi

${review.structured ? 'Structured ' : ''}PREreview of - ${review.preprint.title}

@@ -168,7 +168,7 @@ function startPage({ inviteId, review, user }: { inviteId: Uuid; review: Prerevi
-
+
${fixHeadingLevels(1, review.text)}
diff --git a/src/author-invite-flow/decline-page/decline-page.ts b/src/author-invite-flow/decline-page/decline-page.ts index 683f10dbd..4628218d7 100644 --- a/src/author-invite-flow/decline-page/decline-page.ts +++ b/src/author-invite-flow/decline-page/decline-page.ts @@ -3,7 +3,7 @@ import * as RNEA from 'fp-ts/lib/ReadonlyNonEmptyArray.js' import { flow, pipe } from 'fp-ts/lib/function.js' import { Status } from 'hyper-ts' import type { Orcid } from 'orcid-id-ts' -import { getLangDir } from 'rtl-detect' +import rtlDetect from 'rtl-detect' import { match } from 'ts-pattern' import type { Uuid } from 'uuid-ts' import { getClubName } from '../../club-details.js' @@ -26,7 +26,7 @@ export const declinePage = ({ inviteId, review }: { inviteId: Uuid; review: Prer

${review.structured ? 'Structured ' : ''}PREreview of - ${review.preprint.title}

@@ -80,7 +80,7 @@ export const declinePage = ({ inviteId, review }: { inviteId: Uuid; review: Prer
-
+
${fixHeadingLevels(1, review.text)}
diff --git a/src/club-profile-page/club-profile-page.ts b/src/club-profile-page/club-profile-page.ts index 8256f2408..90bbd9167 100644 --- a/src/club-profile-page/club-profile-page.ts +++ b/src/club-profile-page/club-profile-page.ts @@ -2,7 +2,7 @@ import { format } from 'fp-ts-routing' import * as RA from 'fp-ts/lib/ReadonlyArray.js' import * as RNEA from 'fp-ts/lib/ReadonlyNonEmptyArray.js' import { flow, pipe } from 'fp-ts/lib/function.js' -import { getLangDir } from 'rtl-detect' +import rtlDetect from 'rtl-detect' import { match } from 'ts-pattern' import type { Club } from '../club-details.js' import { type Html, html, plainText, rawHtml } from '../html.js' @@ -67,7 +67,9 @@ export function createPage({ club, id, prereviews }: { club: Club; id: ClubId; p formatList('en'), )} reviewed - ${prereview.preprint.title} diff --git a/src/home-page/home-page.ts b/src/home-page/home-page.ts index f90d32037..8913fb250 100644 --- a/src/home-page/home-page.ts +++ b/src/home-page/home-page.ts @@ -2,7 +2,7 @@ import { format } from 'fp-ts-routing' import * as RA from 'fp-ts/lib/ReadonlyArray.js' import * as RNEA from 'fp-ts/lib/ReadonlyNonEmptyArray.js' import { flow, pipe } from 'fp-ts/lib/function.js' -import { getLangDir } from 'rtl-detect' +import rtlDetect from 'rtl-detect' import { match } from 'ts-pattern' import { getClubName } from '../club-details.js' import { type Html, html, plainText, rawHtml } from '../html.js' @@ -118,7 +118,9 @@ export const createPage = ({

Review request for - ${request.preprint.title}

@@ -129,7 +131,9 @@ export const createPage = ({ })}" > A review was requested for - ${request.preprint.title} @@ -222,7 +226,9 @@ export const createPage = ({

PREreview of - ${prereview.preprint.title}

@@ -230,7 +236,9 @@ export const createPage = ({ ${formatList('en')(prereview.reviewers)} ${prereview.club ? html`of the ${getClubName(prereview.club)}` : ''} reviewed - ${prereview.preprint.title} diff --git a/src/legacy-routes/index.ts b/src/legacy-routes/index.ts index 47a2ff9af..f4964003b 100644 --- a/src/legacy-routes/index.ts +++ b/src/legacy-routes/index.ts @@ -6,7 +6,7 @@ import * as O from 'fp-ts/lib/Option.js' import * as RTE from 'fp-ts/lib/ReaderTaskEither.js' import type * as TE from 'fp-ts/lib/TaskEither.js' import { constant, flow, pipe, tuple } from 'fp-ts/lib/function.js' -import { NotFound } from 'http-errors' +import httpErrors from 'http-errors' import type { ResponseEnded, StatusOpen } from 'hyper-ts' import { route } from 'hyper-ts-routing' import * as RM from 'hyper-ts/lib/ReaderMiddleware.js' @@ -384,7 +384,11 @@ const legacyRouter: P.Parser( M.ichain(() => M.end()), ) -export const notFound = handleError(new NotFound()) +export const notFound = handleError(new httpErrors.NotFound()) -export const serviceUnavailable = handleError(new ServiceUnavailable()) +export const serviceUnavailable = handleError(new httpErrors.ServiceUnavailable()) export const getMethod = M.gets(c => c.getMethod()) diff --git a/src/my-prereviews-page/list-of-prereviews.ts b/src/my-prereviews-page/list-of-prereviews.ts index 7e522b855..6a132cc7e 100644 --- a/src/my-prereviews-page/list-of-prereviews.ts +++ b/src/my-prereviews-page/list-of-prereviews.ts @@ -2,7 +2,7 @@ import { format } from 'fp-ts-routing' import * as RNEA from 'fp-ts/lib/ReadonlyNonEmptyArray.js' import type { ReadonlyNonEmptyArray } from 'fp-ts/lib/ReadonlyNonEmptyArray.js' import { flow, pipe } from 'fp-ts/lib/function.js' -import { getLangDir } from 'rtl-detect' +import rtlDetect from 'rtl-detect' import { match } from 'ts-pattern' import { type Html, html, plainText, rawHtml } from '../html.js' import { PageResponse } from '../response.js' @@ -58,7 +58,7 @@ export const toResponse = ({ prereviews, user }: ListOfPrereviews) => formatList('en'), )} reviewed - ${prereview.preprint.title} diff --git a/src/preprint-reviews-page/preprint-reviews.ts b/src/preprint-reviews-page/preprint-reviews.ts index c7d8e908a..98c962f67 100644 --- a/src/preprint-reviews-page/preprint-reviews.ts +++ b/src/preprint-reviews-page/preprint-reviews.ts @@ -6,7 +6,7 @@ import type { ReadonlyNonEmptyArray } from 'fp-ts/lib/ReadonlyNonEmptyArray.js' import * as RNEA from 'fp-ts/lib/ReadonlyNonEmptyArray.js' import { flow, pipe } from 'fp-ts/lib/function.js' import type { Orcid } from 'orcid-id-ts' -import { getLangDir } from 'rtl-detect' +import rtlDetect from 'rtl-detect' import { get } from 'spectacles-ts' import textClipper from 'text-clipper' import { match, P as p } from 'ts-pattern' @@ -46,13 +46,17 @@ export const createPage = ({ } `, h1: html`PREreviews of - ${preprint.title.text}`, aside: html`
-

+

${preprint.title.text}

@@ -123,7 +127,7 @@ export const createPage = ({ ? html`

Abstract

-
+
${fixHeadingLevels(3, preprint.abstract.text)}
` @@ -185,7 +189,7 @@ function showReview(review: Prereview) {
-
+
${fixHeadingLevels( 3, rawHtml(textClipper(review.text.toString(), 300, { html: true, maxLines: 5, stripTags: ['a'] })), diff --git a/src/profile-page/render-list-of-prereviews.ts b/src/profile-page/render-list-of-prereviews.ts index fde55fc6c..9b271181b 100644 --- a/src/profile-page/render-list-of-prereviews.ts +++ b/src/profile-page/render-list-of-prereviews.ts @@ -2,7 +2,7 @@ import { format } from 'fp-ts-routing' import * as RA from 'fp-ts/lib/ReadonlyArray.js' import * as RNEA from 'fp-ts/lib/ReadonlyNonEmptyArray.js' import { flow, pipe } from 'fp-ts/lib/function.js' -import { getLangDir } from 'rtl-detect' +import rtlDetect from 'rtl-detect' import { match } from 'ts-pattern' import { getClubName } from '../club-details.js' import { type Html, html, rawHtml } from '../html.js' @@ -36,7 +36,9 @@ export function renderListOfPrereviews(prereviews: Prereviews, name: NonEmptyStr formatList('en'), )} ${prereview.club ? html`of the ${getClubName(prereview.club)}` : ''} reviewed - ${prereview.preprint.title} diff --git a/src/request-review-flow/request-review-page/request-review-page.ts b/src/request-review-flow/request-review-page/request-review-page.ts index 5839a9d97..bc16475bc 100644 --- a/src/request-review-flow/request-review-page/request-review-page.ts +++ b/src/request-review-flow/request-review-page/request-review-page.ts @@ -1,5 +1,5 @@ import { format } from 'fp-ts-routing' -import { getLangDir } from 'rtl-detect' +import rtlDetect from 'rtl-detect' import { html, plainText } from '../../html.js' import type { PreprintTitle } from '../../preprint.js' import { StreamlinePageResponse } from '../../response.js' @@ -17,9 +17,9 @@ export const requestReviewPage = ({ preprint, user }: { preprint: PreprintTitle;

You can request a PREreview of - ${preprint.title}. A PREreview - is a review of a preprint and can vary from a few sentences to a lengthy report, similar to a journal-organized - peer-review report. + ${preprint.title}. A + PREreview is a review of a preprint and can vary from a few sentences to a lengthy report, similar to a + journal-organized peer-review report.

${user diff --git a/src/review-page/review-page.ts b/src/review-page/review-page.ts index 33024bb0f..898be5226 100644 --- a/src/review-page/review-page.ts +++ b/src/review-page/review-page.ts @@ -3,7 +3,7 @@ import { format } from 'fp-ts-routing' import * as RNEA from 'fp-ts/lib/ReadonlyNonEmptyArray.js' import { flow, pipe } from 'fp-ts/lib/function.js' import type { Orcid } from 'orcid-id-ts' -import { getLangDir } from 'rtl-detect' +import rtlDetect from 'rtl-detect' import { match } from 'ts-pattern' import { getClubName } from '../club-details.js' import { type Html, fixHeadingLevels, html, plainText, rawHtml } from '../html.js' @@ -34,7 +34,7 @@ export const createPage = ({ id, review }: { id: number; review: Prereview }) =>

${review.structured ? 'Structured ' : ''}PREreview of - ${review.preprint.title}

@@ -86,7 +86,7 @@ export const createPage = ({ id, review }: { id: number; review: Prereview }) =>
-
+
${fixHeadingLevels(1, review.text)}
diff --git a/src/review-requests-page/review-requests-page.ts b/src/review-requests-page/review-requests-page.ts index b8b2a5ab1..23795e8ec 100644 --- a/src/review-requests-page/review-requests-page.ts +++ b/src/review-requests-page/review-requests-page.ts @@ -7,7 +7,7 @@ import { snd } from 'fp-ts/lib/ReadonlyTuple.js' import { flow, pipe } from 'fp-ts/lib/function.js' import { isString } from 'fp-ts/lib/string.js' import iso6391, { type LanguageCode } from 'iso-639-1' -import { getLangDir } from 'rtl-detect' +import rtlDetect from 'rtl-detect' import { match } from 'ts-pattern' import { type Html, html, plainText, rawHtml } from '../html.js' import { PageResponse } from '../response.js' @@ -33,7 +33,7 @@ export const createPage = ({ currentPage, totalPages, language, field, reviewReq

Review request for - ${request.preprint.title}

@@ -44,7 +44,7 @@ export const createPage = ({ currentPage, totalPages, language, field, reviewReq })}" > A review was requested for - ${request.preprint.title} diff --git a/src/reviews-page/reviews-page.ts b/src/reviews-page/reviews-page.ts index db9989ad2..ea61d5a21 100644 --- a/src/reviews-page/reviews-page.ts +++ b/src/reviews-page/reviews-page.ts @@ -7,7 +7,7 @@ import { snd } from 'fp-ts/lib/ReadonlyTuple.js' import { flow, pipe } from 'fp-ts/lib/function.js' import { isString } from 'fp-ts/lib/string.js' import iso6391, { type LanguageCode } from 'iso-639-1' -import { getLangDir } from 'rtl-detect' +import rtlDetect from 'rtl-detect' import { match } from 'ts-pattern' import { getClubName } from '../club-details.js' import { type Html, html, plainText, rawHtml } from '../html.js' @@ -41,7 +41,9 @@ export const createPage = ( ${formatList('en')(prereview.reviewers)} ${prereview.club ? html`of the ${getClubName(prereview.club)}` : ''} reviewed - ${prereview.preprint.title} diff --git a/src/router.ts b/src/router.ts index 4042aee5e..b2736406e 100644 --- a/src/router.ts +++ b/src/router.ts @@ -11,7 +11,7 @@ import * as RA from 'fp-ts/lib/ReadonlyArray.js' import * as T from 'fp-ts/lib/Task.js' import { constVoid, constant, flow, pipe } from 'fp-ts/lib/function.js' import { isString } from 'fp-ts/lib/string.js' -import { NotFound } from 'http-errors' +import httpErrors from 'http-errors' import type { ResponseEnded, StatusOpen } from 'hyper-ts' import { route } from 'hyper-ts-routing' import type { SessionEnv } from 'hyper-ts-session' @@ -1969,4 +1969,4 @@ const router: P.Parser
Title
- ${preprint.title} + ${preprint.title}
diff --git a/src/write-review/start-page/carry-on-page.ts b/src/write-review/start-page/carry-on-page.ts index 7cc109c60..1e535fb62 100644 --- a/src/write-review/start-page/carry-on-page.ts +++ b/src/write-review/start-page/carry-on-page.ts @@ -1,5 +1,5 @@ import { format } from 'fp-ts-routing' -import { getLangDir } from 'rtl-detect' +import rtlDetect from 'rtl-detect' import { html, plainText } from '../../html.js' import type { PreprintTitle } from '../../preprint.js' import { StreamlinePageResponse } from '../../response.js' @@ -17,8 +17,8 @@ export const carryOnPage = (preprint: PreprintTitle, form: Form) =>

As you’ve already started a PREreview of - ${preprint.title}, we’ll take - you to the next step so you can carry on. + ${preprint.title}, + we’ll take you to the next step so you can carry on.

-

+

${preprint.title.text}

@@ -96,7 +96,7 @@ export const startPage = (preprint: Preprint, user?: User) => ${ preprint.abstract ? html` -
+
${fixHeadingLevels(2, preprint.abstract.text)}
` @@ -106,7 +106,7 @@ export const startPage = (preprint: Preprint, user?: User) =>

You can write a PREreview of - ${preprint.title.text}. A PREreview is a review of a preprint and can vary from a few sentences to a lengthy report, similar to a journal-organized peer-review report. diff --git a/src/zenodo.ts b/src/zenodo.ts index f096899e2..2d2dfbe5d 100644 --- a/src/zenodo.ts +++ b/src/zenodo.ts @@ -17,7 +17,7 @@ import * as RNEA from 'fp-ts/lib/ReadonlyNonEmptyArray.js' import type * as T from 'fp-ts/lib/Task.js' import { constVoid, flow, identity, pipe } from 'fp-ts/lib/function.js' import { toUpperCase } from 'fp-ts/lib/string.js' -import { type HttpError, NotFound } from 'http-errors' +import httpErrors, { type HttpError } from 'http-errors' import { Status } from 'hyper-ts' import * as D from 'io-ts/lib/Decoder.js' import type { LanguageCode } from 'iso-639-1' @@ -562,7 +562,7 @@ function recordToPrereview( return pipe( RTE.Do, RTE.apS('preprintId', getReviewedPreprintId(record)), - RTE.apSW('reviewTextUrl', RTE.fromOption(() => new NotFound())(getReviewUrl(record))), + RTE.apSW('reviewTextUrl', RTE.fromOption(() => new httpErrors.NotFound())(getReviewUrl(record))), RTE.apSW( 'license', RTE.fromEither( @@ -609,7 +609,7 @@ function recordToPreprintPrereview( record: Record, ): RTE.ReaderTaskEither | 'text-unavailable', PreprintPrereview> { return pipe( - RTE.fromOption(() => new NotFound())(getReviewUrl(record)), + RTE.fromOption(() => new httpErrors.NotFound())(getReviewUrl(record)), RTE.chainW(reviewTextUrl => sequenceS(RTE.ApplyPar)({ authors: RTE.right(getAuthors(record)),