diff --git a/.eslintrc.js b/.eslintrc.js index 3e56475cc5..09923a9758 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -28,6 +28,10 @@ const sharedRules = { ], 'react-hooks/rules-of-hooks': 'error', 'prettier/prettier': 'error', + 'no-restricted-imports': [ + 'error', + { patterns: ['../*'] }, // Should only import relatively from same directory + ], 'no-restricted-syntax': [ 'error', "JSXElement.children > [expression.callee.property.name='stringify']", @@ -42,6 +46,7 @@ module.exports = { }, extends: sharedExtends, rules: sharedRules, + reportUnusedDisableDirectives: true, parserOptions: { ecmaFeatures: { jsx: true, @@ -87,5 +92,13 @@ module.exports = { 'react/prop-types': 'off', }, }, + // Some directories don't have an absolute import equivalent so ignoring + // import rules for them. + { + files: ['dash/**'], + rules: { + 'no-restricted-imports': 'off', + }, + }, ], }; diff --git a/cardigan/stories/components/Cards/Cards.stories.tsx b/cardigan/stories/components/Cards/Cards.stories.tsx index df19d6215b..3cd6241b20 100644 --- a/cardigan/stories/components/Cards/Cards.stories.tsx +++ b/cardigan/stories/components/Cards/Cards.stories.tsx @@ -108,7 +108,7 @@ export const guideStopCard = GuideStopCardTemplate.bind({}); guideStopCard.args = { link: '/stop-1', totalStops: 3, - duration: 3.5, + duration: '03:30', number: 1, title: 'Exhibition guide stop', type: 'audio', diff --git a/common/data/errors.tsx b/common/data/errors.tsx index f720ba7b45..d36fbee41c 100644 --- a/common/data/errors.tsx +++ b/common/data/errors.tsx @@ -1,6 +1,6 @@ import { FunctionComponent } from 'react'; import { prismicPageIds } from './hardcoded-ids'; -import Space from '../views/components/styled/Space'; +import Space from '@weco/common/views/components/styled/Space'; import Layout, { gridSize8 } from '@weco/common/views/components/Layout'; export const errorMessages = { diff --git a/common/data/microcopy.tsx b/common/data/microcopy.tsx index 46392d20bb..e81db03dac 100644 --- a/common/data/microcopy.tsx +++ b/common/data/microcopy.tsx @@ -10,7 +10,7 @@ // able to edit it themselves, using the GitHub web interface. // -import { createScreenreaderLabel } from '../utils/telephone-numbers'; +import { createScreenreaderLabel } from '@weco/common/utils/telephone-numbers'; export const pageDescriptions = { articles: diff --git a/common/data/organization.ts b/common/data/organization.ts index 0754f0399f..540e0bf216 100644 --- a/common/data/organization.ts +++ b/common/data/organization.ts @@ -1,5 +1,5 @@ -import { objToJsonLd } from '../utils/json-ld'; -import { Organization } from '../model/organization'; +import { objToJsonLd } from '@weco/common/utils/json-ld'; +import { Organization } from '@weco/common/model/organization'; export const wellcomeCollectionAddress = { addressLocality: 'London', diff --git a/common/model/opening-hours.ts b/common/model/opening-hours.ts index a0ab496c74..4f2237a212 100644 --- a/common/model/opening-hours.ts +++ b/common/model/opening-hours.ts @@ -1,4 +1,4 @@ -import { DayOfWeek } from '../utils/format-date'; +import { DayOfWeek } from '@weco/common/utils/format-date'; import { ImageType } from './image'; export type OverrideType = diff --git a/common/model/user.ts b/common/model/user.ts index 4907e11862..a74cd9472a 100644 --- a/common/model/user.ts +++ b/common/model/user.ts @@ -8,7 +8,6 @@ export type UserInfo = { }; // This is the type returned by the Auth0 profile endpoint -/* eslint-disable camelcase */ export type Auth0UserProfile = { sub: string; email: string; @@ -21,7 +20,6 @@ export type Auth0UserProfile = { nickname: string; 'https://wellcomecollection.org/patron_barcode': string; }; -/* eslint-enable camelcase */ // Auth0 subject claims (aka user IDs) are prefixed with `auth0|`, plus // the `p` prefix for Sierra patrons. diff --git a/common/prismicio-types.d.ts b/common/prismicio-types.d.ts index cefcd9f4d9..dc2a146a51 100644 --- a/common/prismicio-types.d.ts +++ b/common/prismicio-types.d.ts @@ -6405,14 +6405,14 @@ export interface GuideStopSliceDefaultPrimary { transcript: prismic.RichTextField; /** - * Audio duration (in minutes) field in *GuideStop → Primary* + * Audio duration (mm:ss) field in *GuideStop → Default → Primary* * - * - **Field Type**: Number - * - **Placeholder**: approximate time in minutes, e.g. 3.5 - * - **API ID Path**: guide_stop.primary.audio_duration - * - **Documentation**: https://prismic.io/docs/field#number + * - **Field Type**: Text + * - **Placeholder**: e.g. 03:30 + * - **API ID Path**: guide_stop.default.primary.audio_duration + * - **Documentation**: https://prismic.io/docs/field#key-text */ - audio_duration: prismic.NumberField; + audio_duration: prismic.KeyTextField; /** * BSL video (Youtube) field in *GuideStop → Primary* @@ -6435,14 +6435,14 @@ export interface GuideStopSliceDefaultPrimary { subtitles: prismic.RichTextField; /** - * Video duration (in minutes) field in *GuideStop → Primary* + * Video duration (mm:ss) field in *GuideStop → Default → Primary* * - * - **Field Type**: Number - * - **Placeholder**: approximate time in minutes, e.g. 3.5 - * - **API ID Path**: guide_stop.primary.video_duration - * - **Documentation**: https://prismic.io/docs/field#number + * - **Field Type**: Text + * - **Placeholder**: e.g. 03:30 + * - **API ID Path**: guide_stop.default.primary.video_duration + * - **Documentation**: https://prismic.io/docs/field#key-text */ - video_duration: prismic.NumberField; + video_duration: prismic.KeyTextField; /** * Image field in *GuideStop → Primary* diff --git a/common/server-data/__mocks__/index.ts b/common/server-data/__mocks__/index.ts index 50f17e94c5..641331497f 100644 --- a/common/server-data/__mocks__/index.ts +++ b/common/server-data/__mocks__/index.ts @@ -2,8 +2,8 @@ import { emptyGlobalAlert, emptyPopupDialog, emptyPrismicQuery, -} from '../../services/prismic/documents'; -import { ServerData } from '../types'; +} from '@weco/common/services/prismic/documents'; +import { ServerData } from '@weco/common/server-data/types'; import { CollectionVenueDocument as RawCollectionVenueDocument } from '@weco/common/prismicio-types'; export async function init(): Promise { diff --git a/common/server-data/index.ts b/common/server-data/index.ts index 3348815b7a..3747442ff8 100644 --- a/common/server-data/index.ts +++ b/common/server-data/index.ts @@ -18,7 +18,7 @@ import { promises as fs } from 'fs'; import { GetServerSidePropsContext } from 'next'; import togglesHandler, { getTogglesFromContext } from './toggles'; import prismicHandler from './prismic'; -import { simplifyServerData } from '../services/prismic/transformers/server-data'; +import { simplifyServerData } from '@weco/common/services/prismic/transformers/server-data'; import { SimplifiedServerData } from './types'; import { getAllConsentStates } from '@weco/common/services/app/civic-uk'; diff --git a/common/server-data/prismic.ts b/common/server-data/prismic.ts index bdcc2bbb94..20a78b5d48 100644 --- a/common/server-data/prismic.ts +++ b/common/server-data/prismic.ts @@ -6,7 +6,7 @@ import { } from '@weco/common/prismicio-types'; import { Handler } from './'; import * as prismic from '@prismicio/client'; -import { InferDataInterface } from '../services/prismic/types'; +import { InferDataInterface } from '@weco/common/services/prismic/types'; import { createClient as createPrismicClient } from '@weco/common/services/prismic/fetch'; export type RawCollectionVenueDocumentLite = { diff --git a/common/server-data/types.ts b/common/server-data/types.ts index 63c8e28f5f..29b8ba2e12 100644 --- a/common/server-data/types.ts +++ b/common/server-data/types.ts @@ -3,7 +3,7 @@ import { defaultValue as prismicDefaultValue, PrismicData, SimplifiedPrismicData, -} from '../server-data/prismic'; +} from '@weco/common/server-data/prismic'; /** * The type is stored here rather than with the service because diff --git a/common/services/app/usePrismicPreview.ts b/common/services/app/usePrismicPreview.ts index 05703f2f68..5c47706212 100644 --- a/common/services/app/usePrismicPreview.ts +++ b/common/services/app/usePrismicPreview.ts @@ -1,5 +1,8 @@ import { useEffect } from 'react'; -import { PrismicData, SimplifiedPrismicData } from '../../server-data/prismic'; +import { + PrismicData, + SimplifiedPrismicData, +} from '@weco/common/server-data/prismic'; declare global { interface Window { diff --git a/common/services/prismic/opening-times.ts b/common/services/prismic/opening-times.ts index 6eca4e71dd..59c8b83f00 100644 --- a/common/services/prismic/opening-times.ts +++ b/common/services/prismic/opening-times.ts @@ -1,4 +1,4 @@ -import { formatDayName } from '../../utils/format-date'; +import { formatDayName } from '@weco/common/utils/format-date'; import { OverrideType, ExceptionalPeriod, @@ -7,7 +7,7 @@ import { OpeningHoursDay, ExceptionalOpeningHoursDay, HasOverrideDate, -} from '../../model/opening-hours'; +} from '@weco/common/model/opening-hours'; import { isNotUndefined } from '@weco/common/utils/type-guards'; import { addDays, @@ -16,7 +16,7 @@ import { isSameDay, isSameDayOrBefore, today, -} from '../../utils/dates'; +} from '@weco/common/utils/dates'; const ONE_WEEK = 7; diff --git a/common/services/prismic/transformers/collection-venues.ts b/common/services/prismic/transformers/collection-venues.ts index 927b0a328b..9a35bc4ba7 100644 --- a/common/services/prismic/transformers/collection-venues.ts +++ b/common/services/prismic/transformers/collection-venues.ts @@ -1,10 +1,13 @@ import { ResultsLite, RawCollectionVenueDocumentLite, -} from '../../../server-data/prismic'; +} from '@weco/common/server-data/prismic'; import { DayOfWeek, formatTime } from '@weco/common/utils/format-date'; import { Venue, OpeningHoursDay } from '@weco/common/model/opening-hours'; -import { DayField, ModifiedDayOpeningTime } from '../documents'; +import { + DayField, + ModifiedDayOpeningTime, +} from '@weco/common/services/prismic/documents'; import { isNotUndefined } from '@weco/common/utils/type-guards'; import * as prismic from '@prismicio/client'; import { transformImage } from './images'; diff --git a/common/services/prismic/transformers/images.ts b/common/services/prismic/transformers/images.ts index 953088e8be..444f2b76b6 100644 --- a/common/services/prismic/transformers/images.ts +++ b/common/services/prismic/transformers/images.ts @@ -43,9 +43,8 @@ function transformFilledImage(image: prismic.FilledImageFieldImage): ImageType { acc[key] = image; return acc; }, {}); - /* eslint-disable @typescript-eslint/no-non-null-assertion */ + const alt = image.alt!; - /* eslint-enable @typescript-eslint/no-non-null-assertion */ const simpleCrops = Object.keys(crops) .filter(key => { diff --git a/common/services/prismic/transformers/index.ts b/common/services/prismic/transformers/index.ts index c4eaa6881a..ec9fdf047b 100644 --- a/common/services/prismic/transformers/index.ts +++ b/common/services/prismic/transformers/index.ts @@ -1,11 +1,11 @@ -import { Tasl } from '../../../model/tasl'; -import { licenseTypeArray } from '../../../model/license'; -import linkResolver from '../link-resolver'; +import { Tasl } from '@weco/common/model/tasl'; +import { licenseTypeArray } from '@weco/common/model/license'; +import linkResolver from '@weco/common/services/prismic/link-resolver'; import { isFilledLinkToDocument, isFilledLinkToMediaField, isFilledLinkToWebField, -} from '../types'; +} from '@weco/common/services/prismic/types'; import * as prismic from '@prismicio/client'; export function transformTaslFromString(pipedString: string | null): Tasl { diff --git a/common/services/prismic/transformers/server-data.ts b/common/services/prismic/transformers/server-data.ts index 9ca39d3873..7af39371cb 100644 --- a/common/services/prismic/transformers/server-data.ts +++ b/common/services/prismic/transformers/server-data.ts @@ -3,7 +3,7 @@ import { ServerData, SimplifiedServerData, } from '@weco/common/server-data/types'; -import { InferDataInterface } from '../types'; +import { InferDataInterface } from '@weco/common/services/prismic/types'; import { PopupDialogDocument as RawPopupDialogDocument, GlobalAlertDocument as RawGlobalAlertDocument, diff --git a/common/test/fixtures/identity/user.ts b/common/test/fixtures/identity/user.ts index 245b9b9b8a..c04694ba20 100644 --- a/common/test/fixtures/identity/user.ts +++ b/common/test/fixtures/identity/user.ts @@ -1,5 +1,5 @@ -import { UserInfo, Auth0UserProfile } from '../../../model/user'; -import { RequestsList } from '../../../model/requesting'; +import { UserInfo, Auth0UserProfile } from '@weco/common/model/user'; +import { RequestsList } from '@weco/common/model/requesting'; export const mockUser: UserInfo = { userId: '7654321', diff --git a/common/test/fixtures/test-helpers.tsx b/common/test/fixtures/test-helpers.tsx index 49f1ddc153..03c407b7a8 100644 --- a/common/test/fixtures/test-helpers.tsx +++ b/common/test/fixtures/test-helpers.tsx @@ -7,7 +7,7 @@ import { RenderOptions, MatcherFunction, } from '@testing-library/react'; -import theme from '../../views/themes/default'; +import theme from '@weco/common/views/themes/default'; const ProvidersWrapper: FunctionComponent = ({ children, diff --git a/common/types/styled-components.d.ts b/common/types/styled-components.d.ts index 1d75dd7534..6bd930a786 100644 --- a/common/types/styled-components.d.ts +++ b/common/types/styled-components.d.ts @@ -3,6 +3,5 @@ import theme from '@weco/common/views/themes/default'; type ThemeInterface = typeof theme; declare module 'styled-components' { - // eslint-disable-next-line @typescript-eslint/no-empty-interface interface DefaultTheme extends ThemeInterface {} } diff --git a/common/utils/convert-url-to-string.ts b/common/utils/convert-url-to-string.ts index b29390f4f8..4c9e405624 100644 --- a/common/utils/convert-url-to-string.ts +++ b/common/utils/convert-url-to-string.ts @@ -1,4 +1,4 @@ -import { Url } from '../model/link-props'; +import { Url } from '@weco/common/model/link-props'; export default function convertUrlToString(url: Url): string { const { query = {} } = url; diff --git a/common/utils/dates.ts b/common/utils/dates.ts index 3df33176cd..319e0887da 100644 --- a/common/utils/dates.ts +++ b/common/utils/dates.ts @@ -1,4 +1,4 @@ -import { DateRange } from '../model/date-range'; +import { DateRange } from '@weco/common/model/date-range'; import { formatDayDate } from './format-date'; /** Returns the current date/time. diff --git a/common/utils/format-time.test.ts b/common/utils/format-time.test.ts deleted file mode 100644 index f6f73f2eb7..0000000000 --- a/common/utils/format-time.test.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { secondsToHoursMinutesAndSeconds } from './format-time'; - -it('formats seconds as [hh:]mm:ss', () => { - const result1 = secondsToHoursMinutesAndSeconds(10); - const result2 = secondsToHoursMinutesAndSeconds(100); - const result3 = secondsToHoursMinutesAndSeconds(1000); - const result4 = secondsToHoursMinutesAndSeconds(10000); - - expect(result1).toEqual('00:10'); - expect(result2).toEqual('01:40'); - expect(result3).toEqual('16:40'); - expect(result4).toEqual('02:46:40'); -}); diff --git a/common/utils/format-time.ts b/common/utils/format-time.ts deleted file mode 100644 index 9891208d30..0000000000 --- a/common/utils/format-time.ts +++ /dev/null @@ -1,11 +0,0 @@ -export function secondsToHoursMinutesAndSeconds(s: number): string { - const m = Math.floor(s / 60); - const hours = Math.floor(m / 60); - const seconds = s % 60; - const minutes = m % 60; - const padSeconds = seconds < 10 ? `0${seconds}` : seconds; - const padMinutes = minutes < 10 ? `0${minutes}:` : `${minutes}:`; - const padHours = hours === 0 ? '' : hours < 10 ? `0${hours}:` : `${hours}:`; - - return `${padHours}${padMinutes}${padSeconds}`; -} diff --git a/common/utils/json-ld.ts b/common/utils/json-ld.ts index 9981c84300..dd3bc6f747 100644 --- a/common/utils/json-ld.ts +++ b/common/utils/json-ld.ts @@ -1,12 +1,12 @@ import { convertImageUri } from './convert-image-uri'; -import { Organization } from '../model/organization'; -import { BreadcrumbItems } from '../model/breadcrumbs'; +import { Organization } from '@weco/common/model/organization'; +import { BreadcrumbItems } from '@weco/common/model/breadcrumbs'; import { JsonLdObj } from '@weco/common/views/components/JsonLd/JsonLd'; import type { OpeningHours, OpeningHoursDay, SpecialOpeningHours, -} from '../model/opening-hours'; +} from '@weco/common/model/opening-hours'; import { formatDate } from './format-date'; type ObjToJsonLdProps = { type: string; root?: boolean }; @@ -83,9 +83,8 @@ function imageLd(image: Image) { image && objToJsonLd( { - /* eslint-disable @typescript-eslint/no-non-null-assertion */ url: convertImageUri((image.contentUrl || image.url)!, 1200), - /* eslint-enable @typescript-eslint/no-non-null-assertion */ + width: image.width, height: image.height, }, diff --git a/common/views/components/Buttons/Buttons.Dropdown.tsx b/common/views/components/Buttons/Buttons.Dropdown.tsx index 25db0fb5e0..a5bdf607a5 100644 --- a/common/views/components/Buttons/Buttons.Dropdown.tsx +++ b/common/views/components/Buttons/Buttons.Dropdown.tsx @@ -17,7 +17,7 @@ import Button, { ButtonTypes } from '@weco/common/views/components/Buttons'; import { AppContext } from '@weco/common/views/components/AppContext/AppContext'; import { chevron, IconSvg } from '@weco/common/icons'; import { themeValues } from '@weco/common/views/themes/config'; -import { BorderlessButton } from '../BorderlessClickable'; +import { BorderlessButton } from '@weco/common/views/components/BorderlessClickable'; const DropdownWrapper = styled.div` display: inline-flex; diff --git a/common/views/components/Buttons/Buttons.SolidLink.tsx b/common/views/components/Buttons/Buttons.SolidLink.tsx index aaa2ff7807..a8e835d4b4 100644 --- a/common/views/components/Buttons/Buttons.SolidLink.tsx +++ b/common/views/components/Buttons/Buttons.SolidLink.tsx @@ -2,7 +2,7 @@ import { FunctionComponent, SyntheticEvent } from 'react'; import NextLink, { LinkProps } from 'next/link'; import { classNames } from '@weco/common/utils/classnames'; import Icon from '@weco/common/views/components/Icon/Icon'; -import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper'; +import ConditionalWrapper from '@weco/common/views/components/ConditionalWrapper/ConditionalWrapper'; import { BaseButtonInner, ButtonIconWrapper, diff --git a/common/views/components/ErrorPage/ErrorPage.tsx b/common/views/components/ErrorPage/ErrorPage.tsx index bb6526262e..ca9c64f27f 100644 --- a/common/views/components/ErrorPage/ErrorPage.tsx +++ b/common/views/components/ErrorPage/ErrorPage.tsx @@ -12,13 +12,15 @@ import { import { headerBackgroundLs } from '@weco/common/utils/backgrounds'; import { underConstruction } from '@weco/common/icons'; import Icon from '@weco/common/views/components/Icon/Icon'; -import PageHeader, { headerSpaceSize } from '../PageHeader/PageHeader'; -import PageLayout from '../PageLayout/PageLayout'; -import SpacingSection from '../styled/SpacingSection'; -import SpacingComponent from '../styled/SpacingComponent'; +import PageHeader, { + headerSpaceSize, +} from '@weco/common/views/components/PageHeader/PageHeader'; +import PageLayout from '@weco/common/views/components/PageLayout/PageLayout'; +import SpacingSection from '@weco/common/views/components/styled/SpacingSection'; +import SpacingComponent from '@weco/common/views/components/styled/SpacingComponent'; import Space from '@weco/common/views/components/styled/Space'; import { dangerouslyGetEnabledToggles } from '@weco/common/utils/cookies'; -import Layout, { gridSize8 } from '../Layout'; +import Layout, { gridSize8 } from '@weco/common/views/components/Layout'; import togglesList from '@weco/toggles/toggles'; const MessageBar = styled(Space).attrs({ diff --git a/common/views/components/Footer/index.tsx b/common/views/components/Footer/index.tsx index baf7b354e6..1c68374362 100644 --- a/common/views/components/Footer/index.tsx +++ b/common/views/components/Footer/index.tsx @@ -5,7 +5,7 @@ import styled from 'styled-components'; import Space from '@weco/common/views/components/styled/Space'; import OpeningTimes from '@weco/common/views/components/OpeningTimes/OpeningTimes'; import Divider from '@weco/common/views/components/Divider/Divider'; -import FindUs from '../FindUs/FindUs'; +import FindUs from '@weco/common/views/components/FindUs/FindUs'; import FooterNav from './Footer.Nav'; import FooterSocial from './Footer.Social'; import FooterWellcomeLogo from './Footer.WellcomeLogo'; diff --git a/common/views/components/Header/DesktopSignIn.tsx b/common/views/components/Header/DesktopSignIn.tsx index b4ff7e4840..26aab2f37e 100644 --- a/common/views/components/Header/DesktopSignIn.tsx +++ b/common/views/components/Header/DesktopSignIn.tsx @@ -5,7 +5,7 @@ import { useUser } from '@weco/common/views/components/UserProvider/UserProvider import Button from '@weco/common/views/components/Buttons'; import Space from '@weco/common/views/components/styled/Space'; import { user as userIcon } from '@weco/common/icons'; -import { BorderlessLink } from '../BorderlessClickable'; +import { BorderlessLink } from '@weco/common/views/components/BorderlessClickable'; type AccountAProps = { $last?: true; diff --git a/common/views/components/Header/Header.styles.ts b/common/views/components/Header/Header.styles.ts index b33744b989..60ba0e98c1 100644 --- a/common/views/components/Header/Header.styles.ts +++ b/common/views/components/Header/Header.styles.ts @@ -1,6 +1,6 @@ import styled from 'styled-components'; import { Container } from '@weco/common/views/components/styled/Container'; -import { BorderlessButton } from '../BorderlessClickable'; +import { BorderlessButton } from '@weco/common/views/components/BorderlessClickable'; export const NavLoginWrapper = styled.div` display: flex; diff --git a/common/views/components/Header/Header.tsx b/common/views/components/Header/Header.tsx index da103a02b8..ecf86d415f 100644 --- a/common/views/components/Header/Header.tsx +++ b/common/views/components/Header/Header.tsx @@ -33,7 +33,7 @@ import DesktopSignIn from './DesktopSignIn'; import MobileSignIn from './MobileSignIn'; import HeaderSearch from './HeaderSearch'; import { searchLabelText } from '@weco/common/data/microcopy'; -import { SiteSection } from '../PageLayout/PageLayout'; +import { SiteSection } from '@weco/common/views/components/PageLayout/PageLayout'; const NoJSIconWrapper = styled.div` padding: 5px 8px 0; diff --git a/common/views/components/HeaderBackground/HeaderBackground.tsx b/common/views/components/HeaderBackground/HeaderBackground.tsx index 210f2b4d08..3a418b1478 100644 --- a/common/views/components/HeaderBackground/HeaderBackground.tsx +++ b/common/views/components/HeaderBackground/HeaderBackground.tsx @@ -1,7 +1,7 @@ import { FunctionComponent } from 'react'; import styled from 'styled-components'; import { landingHeaderBackgroundLs } from '@weco/common/utils/backgrounds'; -import { WobblyEdge } from '../WobblyEdge'; +import { WobblyEdge } from '@weco/common/views/components/WobblyEdge'; type Props = { backgroundTexture?: string; diff --git a/common/views/components/Label/Label.tsx b/common/views/components/Label/Label.tsx index 0349b6e694..e7997620d5 100644 --- a/common/views/components/Label/Label.tsx +++ b/common/views/components/Label/Label.tsx @@ -1,6 +1,6 @@ import { FunctionComponent } from 'react'; import styled from 'styled-components'; -import { Label as LabelType, LabelColor } from '../../../model/labels'; +import { Label as LabelType, LabelColor } from '@weco/common/model/labels'; import { font } from '@weco/common/utils/classnames'; import Space from '@weco/common/views/components/styled/Space'; import { PaletteColor } from '@weco/common/views/themes/config'; diff --git a/common/views/components/LabelsList/LabelsList.tsx b/common/views/components/LabelsList/LabelsList.tsx index 3d633d7b7d..f8d7f910ea 100644 --- a/common/views/components/LabelsList/LabelsList.tsx +++ b/common/views/components/LabelsList/LabelsList.tsx @@ -1,6 +1,6 @@ import { FunctionComponent } from 'react'; -import { Label as LabelType, LabelColor } from '../../../model/labels'; -import Label from '../../components/Label/Label'; +import { Label as LabelType, LabelColor } from '@weco/common/model/labels'; +import Label from '@weco/common/views/components/Label/Label'; import Space from '@weco/common/views/components/styled/Space'; import styled from 'styled-components'; diff --git a/common/views/components/Modal/Modal.test.tsx b/common/views/components/Modal/Modal.test.tsx index 4afa00bd95..81ecf99ac2 100644 --- a/common/views/components/Modal/Modal.test.tsx +++ b/common/views/components/Modal/Modal.test.tsx @@ -1,11 +1,11 @@ -import Modal from '@weco/common/views/components/Modal/Modal'; +import { act } from 'react-dom/test-utils'; import { useState, useRef } from 'react'; import { render, screen } from '@testing-library/react'; import { ThemeProvider } from 'styled-components'; +import Modal from '@weco/common/views/components/Modal/Modal'; import theme from '@weco/common/views/themes/default'; import userEvent from '@testing-library/user-event'; -import { act } from 'react-dom/test-utils'; -import { AppContextProvider } from '../AppContext/AppContext'; +import { AppContextProvider } from '@weco/common/views/components/AppContext/AppContext'; const renderComponent = () => { const ModalExample = () => { diff --git a/common/views/components/Modal/Modal.tsx b/common/views/components/Modal/Modal.tsx index c8beab99fa..1653e4f3cd 100644 --- a/common/views/components/Modal/Modal.tsx +++ b/common/views/components/Modal/Modal.tsx @@ -8,12 +8,12 @@ import { useContext, } from 'react'; import styled from 'styled-components'; +import FocusTrap from 'focus-trap-react'; import Space from '@weco/common/views/components/styled/Space'; import Icon from '@weco/common/views/components/Icon/Icon'; import { CSSTransition } from 'react-transition-group'; import { cross } from '@weco/common/icons'; -import FocusTrap from 'focus-trap-react'; -import { AppContext } from '../AppContext/AppContext'; +import { AppContext } from '@weco/common/views/components/AppContext/AppContext'; import { ACTIVE_COOKIE_BANNER_ID } from '@weco/common/services/app/civic-uk'; type BaseModalProps = { diff --git a/common/views/components/NewsletterPromo/NewsletterPromo.tsx b/common/views/components/NewsletterPromo/NewsletterPromo.tsx index a0d10b7f52..d60c051215 100644 --- a/common/views/components/NewsletterPromo/NewsletterPromo.tsx +++ b/common/views/components/NewsletterPromo/NewsletterPromo.tsx @@ -3,14 +3,14 @@ import styled from 'styled-components'; import { AppContext } from '@weco/common/views/components/AppContext/AppContext'; import { font } from '@weco/common/utils/classnames'; import Space from '@weco/common/views/components/styled/Space'; -import TextInput from '../TextInput'; +import TextInput from '@weco/common/views/components/TextInput'; import useValidation from '@weco/common/hooks/useValidation'; import Button from '@weco/common/views/components/Buttons'; import { newsletterAddressBook } from '@weco/common/data/dotdigital'; import { Container } from '@weco/common/views/components/styled/Container'; import CheckboxRadio from '@weco/common/views/components/CheckboxRadio/CheckboxRadio'; import theme from '@weco/common/views/themes/default'; -import Layout, { gridSize8 } from '../Layout'; +import Layout, { gridSize8 } from '@weco/common/views/components/Layout'; const NewsletterForm = styled.form.attrs({ name: 'newsletter-signup', diff --git a/common/views/components/OpeningTimes/OpeningTimes.test.tsx b/common/views/components/OpeningTimes/OpeningTimes.test.tsx index c136a68779..fbbecd181a 100644 --- a/common/views/components/OpeningTimes/OpeningTimes.test.tsx +++ b/common/views/components/OpeningTimes/OpeningTimes.test.tsx @@ -2,7 +2,7 @@ import { screen } from '@testing-library/react'; import { renderWithTheme } from '@weco/common/test/fixtures/test-helpers'; import OpeningTimes from './OpeningTimes'; import * as serviceOpeningTimes from '@weco/common/services/prismic/opening-times'; -import { shopVenue } from '../../../test/fixtures/components/shop-venue'; +import { shopVenue } from '@weco/common/test/fixtures/components/shop-venue'; describe('OpeningTimes', () => { const spyOnGetTodaysVenueHours = jest.spyOn( diff --git a/common/views/components/PageLayout/PageLayout.tsx b/common/views/components/PageLayout/PageLayout.tsx index c5a8c17e0a..e4f24acbe0 100644 --- a/common/views/components/PageLayout/PageLayout.tsx +++ b/common/views/components/PageLayout/PageLayout.tsx @@ -2,13 +2,16 @@ import { useContext, FunctionComponent, PropsWithChildren } from 'react'; import Script from 'next/script'; import Head from 'next/head'; import { Url } from '@weco/common/model/link-props'; -import { JsonLdObj } from '../JsonLd/JsonLd'; +import { JsonLdObj } from '@weco/common/views/components/JsonLd/JsonLd'; import convertUrlToString from '@weco/common/utils/convert-url-to-string'; -import Header, { NavLink } from '../Header/Header'; -import { InfoBanner, WebsiteIssuesBanner } from '../InfoBanners'; -import NewsletterPromo from '../NewsletterPromo/NewsletterPromo'; -import Footer from '../Footer'; -import PopupDialog from '../PopupDialog/PopupDialog'; +import Header, { NavLink } from '@weco/common/views/components/Header/Header'; +import { + InfoBanner, + WebsiteIssuesBanner, +} from '@weco/common/views/components/InfoBanners'; +import NewsletterPromo from '@weco/common/views/components/NewsletterPromo/NewsletterPromo'; +import Footer from '@weco/common/views/components/Footer'; +import PopupDialog from '@weco/common/views/components/PopupDialog/PopupDialog'; import { museumLd, libraryLd, @@ -20,8 +23,10 @@ import { getVenueById } from '@weco/common/services/prismic/opening-times'; import { wellcomeCollectionGallery } from '@weco/common/data/organization'; import GlobalInfoBarContext, { GlobalInfoBarContextProvider, -} from '../GlobalInfoBarContext/GlobalInfoBarContext'; -import ApiToolbar, { ApiToolbarLink } from '../ApiToolbar'; +} from '@weco/common/views/components/GlobalInfoBarContext/GlobalInfoBarContext'; +import ApiToolbar, { + ApiToolbarLink, +} from '@weco/common/views/components/ApiToolbar'; import { usePrismicData, useToggles } from '@weco/common/server-data/Context'; import { defaultPageTitle } from '@weco/common/data/microcopy'; import { getCrop, ImageType } from '@weco/common/model/image'; diff --git a/common/views/components/Picture/Picture.tsx b/common/views/components/Picture/Picture.tsx index a0aad20de3..c27c571d1b 100644 --- a/common/views/components/Picture/Picture.tsx +++ b/common/views/components/Picture/Picture.tsx @@ -1,9 +1,9 @@ -import Tasl from '../Tasl/Tasl'; +import { FunctionComponent } from 'react'; +import styled from 'styled-components'; +import Tasl from '@weco/common/views/components/Tasl/Tasl'; import { imageSizes } from '@weco/common/utils/image-sizes'; import { convertImageUri } from '@weco/common/utils/convert-image-uri'; import { Picture as PictureProps } from '@weco/common/model/picture'; -import { FunctionComponent } from 'react'; -import styled from 'styled-components'; const Figure = styled.figure` position: relative; diff --git a/common/views/components/PopupDialog/PopupDialog.tsx b/common/views/components/PopupDialog/PopupDialog.tsx index c5cfbc2bc5..ba4ba9376b 100644 --- a/common/views/components/PopupDialog/PopupDialog.tsx +++ b/common/views/components/PopupDialog/PopupDialog.tsx @@ -15,8 +15,8 @@ import getFocusableElements from '@weco/common/utils/get-focusable-elements'; import { PopupDialogDocument as RawPopupDialogDocument } from '@weco/common/prismicio-types'; import PrismicHtmlBlock from '@weco/common/views/components/PrismicHtmlBlock/PrismicHtmlBlock'; import { chat, clear } from '@weco/common/icons'; -import { InferDataInterface } from '../../../services/prismic/types'; -import { transformLink } from '../../../services/prismic/transformers'; +import { InferDataInterface } from '@weco/common/services/prismic/types'; +import { transformLink } from '@weco/common/services/prismic/transformers'; type PopupDialogOpenProps = { $shouldStartAnimation: boolean; diff --git a/common/views/components/StackingTable/StackingTable.tsx b/common/views/components/StackingTable/StackingTable.tsx index 41e1f776d5..db3b488ec9 100644 --- a/common/views/components/StackingTable/StackingTable.tsx +++ b/common/views/components/StackingTable/StackingTable.tsx @@ -1,7 +1,7 @@ import styled from 'styled-components'; import Space from '@weco/common/views/components/styled/Space'; import { font } from '@weco/common/utils/classnames'; -import { fontFamilyMixin } from '../../themes/typography'; +import { fontFamilyMixin } from '@weco/common/views/themes/typography'; import { ReactElement, FunctionComponent, ReactNode } from 'react'; type TableProps = { diff --git a/common/views/components/Tasl/Tasl.tsx b/common/views/components/Tasl/Tasl.tsx index d75ac11d1c..5347a4170c 100644 --- a/common/views/components/Tasl/Tasl.tsx +++ b/common/views/components/Tasl/Tasl.tsx @@ -5,7 +5,7 @@ import { getPrismicLicenseData } from '@weco/common/utils/licenses'; import { AppContext } from '@weco/common/views/components/AppContext/AppContext'; import { cross, information } from '@weco/common/icons'; import { dasherizeShorten } from '@weco/common/utils/grammar'; -import Icon from '../Icon/Icon'; +import Icon from '@weco/common/views/components/Icon/Icon'; import Space from '@weco/common/views/components/styled/Space'; type StyledTaslProps = { diff --git a/common/views/components/TextInput/index.tsx b/common/views/components/TextInput/index.tsx index d0fe394f1a..290b8d18ea 100644 --- a/common/views/components/TextInput/index.tsx +++ b/common/views/components/TextInput/index.tsx @@ -11,8 +11,8 @@ import Icon from '@weco/common/views/components/Icon/Icon'; import { exclamation, tickCircle } from '@weco/common/icons'; import { font } from '@weco/common/utils/classnames'; import ClearInput from '@weco/common/views/components/TextInput/TextInput.Clear'; -import Space from '../styled/Space'; -import { AppContext } from '../AppContext/AppContext'; +import Space from '@weco/common/views/components/styled/Space'; +import { AppContext } from '@weco/common/views/components/AppContext/AppContext'; export const TextInputLabel = styled.label.attrs({ className: font('intb', 5), diff --git a/common/views/components/UserProvider/UserProvider.tsx b/common/views/components/UserProvider/UserProvider.tsx index e36ade7741..10877ccf2c 100644 --- a/common/views/components/UserProvider/UserProvider.tsx +++ b/common/views/components/UserProvider/UserProvider.tsx @@ -9,8 +9,8 @@ import { auth0UserProfileToUserInfo, isFullAuth0Profile, UserInfo, -} from '../../../model/user'; -import { useAbortSignalEffect } from '../../../hooks/useAbortSignalEffect'; +} from '@weco/common/model/user'; +import { useAbortSignalEffect } from '@weco/common/hooks/useAbortSignalEffect'; export type State = 'initial' | 'loading' | 'signedin' | 'signedout' | 'failed'; diff --git a/common/views/components/VideoEmbed/VideoEmbed.tsx b/common/views/components/VideoEmbed/VideoEmbed.tsx index 21fa1daa18..80cf0b6482 100644 --- a/common/views/components/VideoEmbed/VideoEmbed.tsx +++ b/common/views/components/VideoEmbed/VideoEmbed.tsx @@ -2,8 +2,8 @@ import { FunctionComponent, useState, useEffect } from 'react'; import styled from 'styled-components'; import * as prismic from '@prismicio/client'; -import Caption from '../Caption/Caption'; -import { IframeContainer } from '../Iframe/Iframe'; +import Caption from '@weco/common/views/components/Caption/Caption'; +import { IframeContainer } from '@weco/common/views/components/Iframe/Iframe'; import CollapsibleContent from '@weco/common/views/components/CollapsibleContent'; import PrismicHtmlBlock from '@weco/common/views/components/PrismicHtmlBlock/PrismicHtmlBlock'; import { getConsentState } from '@weco/common/services/app/civic-uk'; diff --git a/common/views/pages/_app.tsx b/common/views/pages/_app.tsx index 8495be6876..9911ad604e 100644 --- a/common/views/pages/_app.tsx +++ b/common/views/pages/_app.tsx @@ -39,7 +39,7 @@ import { deserialiseProps } from '@weco/common/utils/json'; import { SearchContextProvider } from '@weco/common/views/components/SearchContext/SearchContext'; import CivicUK from '@weco/common/views/components/CivicUK'; import { prismicPageIds } from '@weco/common/data/hardcoded-ids'; -import { getConsentState } from '../../services/app/civic-uk'; +import { getConsentState } from '@weco/common/services/app/civic-uk'; // Error pages can't send anything via the data fetching methods as // the page needs to be rendered as soon as the error happens. diff --git a/common/views/slices/AudioPlayer/index.tsx b/common/views/slices/AudioPlayer/index.tsx index dc69969c2f..8d507a4933 100644 --- a/common/views/slices/AudioPlayer/index.tsx +++ b/common/views/slices/AudioPlayer/index.tsx @@ -1,7 +1,7 @@ import { AudioPlayerSlice as RawAudioPlayerSlice } from '@weco/common/prismicio-types'; import { FunctionComponent } from 'react'; import { SliceComponentProps } from '@prismicio/react'; -import SpacingComponent from '../../components/styled/SpacingComponent'; +import SpacingComponent from '@weco/common/views/components/styled/SpacingComponent'; import { LayoutWidth, SliceZoneContext, diff --git a/common/views/slices/ContentList/index.tsx b/common/views/slices/ContentList/index.tsx index 0469e3081d..bf43815dd5 100644 --- a/common/views/slices/ContentList/index.tsx +++ b/common/views/slices/ContentList/index.tsx @@ -1,7 +1,7 @@ import { ContentListSlice as RawContentListSlice } from '@weco/common/prismicio-types'; import { FunctionComponent } from 'react'; import { SliceComponentProps } from '@prismicio/react'; -import SpacingComponent from '../../components/styled/SpacingComponent'; +import SpacingComponent from '@weco/common/views/components/styled/SpacingComponent'; import { LayoutWidth, defaultContext, diff --git a/common/views/slices/EditorialImage/index.tsx b/common/views/slices/EditorialImage/index.tsx index 8a7d83c5da..49f095f931 100644 --- a/common/views/slices/EditorialImage/index.tsx +++ b/common/views/slices/EditorialImage/index.tsx @@ -1,7 +1,7 @@ import { EditorialImageSlice as RawEditorialImageSlice } from '@weco/common/prismicio-types'; import { FunctionComponent } from 'react'; import { SliceComponentProps } from '@prismicio/react'; -import SpacingComponent from '../../components/styled/SpacingComponent'; +import SpacingComponent from '@weco/common/views/components/styled/SpacingComponent'; import { LayoutWidth, defaultContext, diff --git a/common/views/slices/EditorialImageGallery/index.tsx b/common/views/slices/EditorialImageGallery/index.tsx index 8b5c8f9e6b..04b744ea57 100644 --- a/common/views/slices/EditorialImageGallery/index.tsx +++ b/common/views/slices/EditorialImageGallery/index.tsx @@ -2,7 +2,7 @@ import { EditorialImageGallerySlice as RawEditorialImageGallerySlice } from '@we import { FunctionComponent } from 'react'; import ImageGallery from '@weco/content/components/ImageGallery'; import { SliceComponentProps } from '@prismicio/react'; -import SpacingComponent from '../../components/styled/SpacingComponent'; +import SpacingComponent from '@weco/common/views/components/styled/SpacingComponent'; import { transformEditorialImageGallerySlice } from '@weco/content/services/prismic/transformers/body'; import { defaultContext, diff --git a/common/views/slices/GuideStop/model.json b/common/views/slices/GuideStop/model.json index 3ecdf1652b..5407caec7e 100644 --- a/common/views/slices/GuideStop/model.json +++ b/common/views/slices/GuideStop/model.json @@ -46,10 +46,10 @@ } }, "audio_duration": { - "type": "Number", + "type": "Text", "config": { - "label": "Audio duration (in minutes)", - "placeholder": "approximate time in minutes, e.g. 3.5" + "label": "Audio duration (mm:ss)", + "placeholder": "e.g. 03:30" } }, "bsl_video": { @@ -69,10 +69,10 @@ } }, "video_duration": { - "type": "Number", + "type": "Text", "config": { - "label": "Video duration (in minutes)", - "placeholder": "approximate time in minutes, e.g. 3.5" + "label": "Video duration (mm:ss)", + "placeholder": "e.g. 03:30" } }, "image": { diff --git a/common/views/themes/base/fonts.ts b/common/views/themes/base/fonts.ts index cd53d3df18..96795ce4e9 100644 --- a/common/views/themes/base/fonts.ts +++ b/common/views/themes/base/fonts.ts @@ -1,5 +1,5 @@ import { css } from 'styled-components'; -import { GlobalStyleProps } from '../default'; +import { GlobalStyleProps } from '@weco/common/views/themes/default'; export const fonts = css` @font-face { diff --git a/common/views/themes/base/layout.ts b/common/views/themes/base/layout.ts index 7fa7e872c0..2d45d38ab0 100644 --- a/common/views/themes/base/layout.ts +++ b/common/views/themes/base/layout.ts @@ -1,4 +1,4 @@ -import { themeValues } from '../config'; +import { themeValues } from '@weco/common/views/themes/config'; export const layout = ` * { diff --git a/common/views/themes/base/row.ts b/common/views/themes/base/row.ts index e76cd086b4..89800d1118 100644 --- a/common/views/themes/base/row.ts +++ b/common/views/themes/base/row.ts @@ -1,4 +1,4 @@ -import { themeValues } from '../config'; +import { themeValues } from '@weco/common/views/themes/config'; export const row = ` .row--has-wobbly-background { diff --git a/common/views/themes/base/wellcome-normalize.ts b/common/views/themes/base/wellcome-normalize.ts index bc14148a0f..6713013185 100644 --- a/common/views/themes/base/wellcome-normalize.ts +++ b/common/views/themes/base/wellcome-normalize.ts @@ -1,4 +1,4 @@ -import { themeValues } from '../config'; +import { themeValues } from '@weco/common/views/themes/config'; export const wellcomeNormalize = ` input, diff --git a/common/views/themes/default.ts b/common/views/themes/default.ts index e64e9910db..89530f8543 100644 --- a/common/views/themes/default.ts +++ b/common/views/themes/default.ts @@ -1,5 +1,6 @@ import { css, createGlobalStyle } from 'styled-components'; -import { SpaceOverrides } from '../components/styled/Space'; +import { SpaceOverrides } from '@weco/common/views/components/styled/Space'; +import { Toggles } from '@weco/toggles'; import { typography, makeFontSizeClasses, @@ -14,7 +15,6 @@ import { inlineFonts } from './base/inline-fonts'; import { fonts } from './base/fonts'; import { themeValues, spacingUnits, Size } from './config'; import { grid } from './grid'; -import { Toggles } from '@weco/toggles'; type SpaceSize = 'xs' | 's' | 'm' | 'l' | 'xl'; type SpaceProperty = diff --git a/common/views/themes/grid/grid-base.ts b/common/views/themes/grid/grid-base.ts index 30cc536e6d..000e456eea 100644 --- a/common/views/themes/grid/grid-base.ts +++ b/common/views/themes/grid/grid-base.ts @@ -1,4 +1,4 @@ -import { themeValues } from '../config'; +import { themeValues } from '@weco/common/views/themes/config'; export const gridBase = ` .grid { diff --git a/common/views/themes/grid/grid-scroll.ts b/common/views/themes/grid/grid-scroll.ts index b8756af53f..6bb05e59b6 100644 --- a/common/views/themes/grid/grid-scroll.ts +++ b/common/views/themes/grid/grid-scroll.ts @@ -1,4 +1,4 @@ -import { themeValues } from '../config'; +import { themeValues } from '@weco/common/views/themes/config'; export const gridScroll = ` .css-grid__scroll-container, diff --git a/common/views/themes/grid/grid-size.ts b/common/views/themes/grid/grid-size.ts index 69f3688f27..2c978aa41c 100644 --- a/common/views/themes/grid/grid-size.ts +++ b/common/views/themes/grid/grid-size.ts @@ -1,5 +1,5 @@ -import { gridCells } from '../mixins'; -import { themeValues, ColumnKey } from '../config'; +import { gridCells } from '@weco/common/views/themes/mixins'; +import { themeValues, ColumnKey } from '@weco/common/views/themes/config'; export const gridSize = ` ${Object.entries(themeValues.grid) diff --git a/common/views/themes/grid/grid-theme.ts b/common/views/themes/grid/grid-theme.ts index 23dbf45c9a..2c30e61297 100644 --- a/common/views/themes/grid/grid-theme.ts +++ b/common/views/themes/grid/grid-theme.ts @@ -1,4 +1,4 @@ -import { themeValues } from '../config'; +import { themeValues } from '@weco/common/views/themes/config'; export const gridTheme = ` .grid__cell { diff --git a/content/webapp/__mocks__/uiTree.ts b/content/webapp/__mocks__/uiTree.ts index 78a775c5e4..52a04af81b 100644 --- a/content/webapp/__mocks__/uiTree.ts +++ b/content/webapp/__mocks__/uiTree.ts @@ -1,4 +1,4 @@ -import { UiTree } from '../components/ArchiveTree/ArchiveTree.helpers'; +import { UiTree } from '@weco/content/components/ArchiveTree/ArchiveTree.helpers'; export const uiTree: UiTree = [ { diff --git a/content/webapp/__mocks__/whats-on.ts b/content/webapp/__mocks__/whats-on.ts index e8ad871cad..45d652e7a4 100644 --- a/content/webapp/__mocks__/whats-on.ts +++ b/content/webapp/__mocks__/whats-on.ts @@ -1,5 +1,5 @@ -import { Exhibition } from '../types/exhibitions'; -import { Props as WhatsOnProps } from '../pages/whats-on'; +import { Exhibition } from '@weco/content/types/exhibitions'; +import { Props as WhatsOnProps } from '@weco/content/pages/whats-on'; const beingHuman: Exhibition = { id: 'XNFfsxAAANwqbNWD', diff --git a/content/webapp/components/ArchiveBreadcrumb/ArchiveBreadcrumb.test.tsx b/content/webapp/components/ArchiveBreadcrumb/ArchiveBreadcrumb.test.tsx index f0c37c31ef..de8d832654 100644 --- a/content/webapp/components/ArchiveBreadcrumb/ArchiveBreadcrumb.test.tsx +++ b/content/webapp/components/ArchiveBreadcrumb/ArchiveBreadcrumb.test.tsx @@ -1,5 +1,5 @@ import ArchiveBreadcrumb from './ArchiveBreadcrumb'; -import IsArchiveContext from '../IsArchiveContext/IsArchiveContext'; +import IsArchiveContext from '@weco/content/components/IsArchiveContext/IsArchiveContext'; import { Work } from '@weco/content/services/wellcome/catalogue/types'; import { renderWithTheme } from '@weco/common/test/fixtures/test-helpers'; diff --git a/content/webapp/components/ArchiveBreadcrumb/ArchiveBreadcrumb.tsx b/content/webapp/components/ArchiveBreadcrumb/ArchiveBreadcrumb.tsx index 18627f9ad5..344911a698 100644 --- a/content/webapp/components/ArchiveBreadcrumb/ArchiveBreadcrumb.tsx +++ b/content/webapp/components/ArchiveBreadcrumb/ArchiveBreadcrumb.tsx @@ -1,12 +1,12 @@ -import { Work } from '@weco/content/services/wellcome/catalogue/types'; +import { FunctionComponent, PropsWithChildren, useContext } from 'react'; import styled from 'styled-components'; +import { Work } from '@weco/content/services/wellcome/catalogue/types'; import Button from '@weco/common/views/components/Buttons'; import Icon from '@weco/common/views/components/Icon/Icon'; -import WorkTitle from '../WorkTitle/WorkTitle'; +import WorkTitle from '@weco/content/components/WorkTitle/WorkTitle'; import { getArchiveAncestorArray } from '@weco/content/utils/works'; -import { FunctionComponent, PropsWithChildren, useContext } from 'react'; -import WorkLink from '../WorkLink'; -import IsArchiveContext from '../IsArchiveContext/IsArchiveContext'; +import WorkLink from '@weco/content/components/WorkLink'; +import IsArchiveContext from '@weco/content/components/IsArchiveContext/IsArchiveContext'; import { archive, folder } from '@weco/common/icons'; const ArchiveBreadcrumbNav = styled.nav` diff --git a/content/webapp/components/ArchiveTree/ArchiveTree.WorkItemRenderer.tsx b/content/webapp/components/ArchiveTree/ArchiveTree.WorkItemRenderer.tsx index 66ef34fbe0..06fe46e309 100644 --- a/content/webapp/components/ArchiveTree/ArchiveTree.WorkItemRenderer.tsx +++ b/content/webapp/components/ArchiveTree/ArchiveTree.WorkItemRenderer.tsx @@ -5,8 +5,8 @@ import { UiTreeNode, isRelatedWork, } from '@weco/content/components/ArchiveTree/ArchiveTree.helpers'; -import WorkTitle from '../WorkTitle/WorkTitle'; -import WorkLink from '../WorkLink'; +import WorkTitle from '@weco/content/components/WorkTitle/WorkTitle'; +import WorkLink from '@weco/content/components/WorkLink'; import { StyledLink } from './ArchiveTree.styles'; import { AppContext } from '@weco/common/views/components/AppContext/AppContext'; import { TreeControl } from '@weco/content/components/ArchiveTree/ArchiveTree.styles'; diff --git a/content/webapp/components/ArchiveTree/index.tsx b/content/webapp/components/ArchiveTree/index.tsx index 0212c5698a..b5dddbe883 100644 --- a/content/webapp/components/ArchiveTree/index.tsx +++ b/content/webapp/components/ArchiveTree/index.tsx @@ -9,14 +9,14 @@ import { font } from '@weco/common/utils/classnames'; import { getWorkClientSide } from '@weco/content/services/wellcome/catalogue/works'; import { AppContext } from '@weco/common/views/components/AppContext/AppContext'; import Space from '@weco/common/views/components/styled/Space'; -import { getArchiveAncestorArray } from '../../utils/works'; +import { getArchiveAncestorArray } from '@weco/content/utils/works'; import { RelatedWork, Work, } from '@weco/content/services/wellcome/catalogue/types'; import Modal from '@weco/common/views/components/Modal/Modal'; import Button from '@weco/common/views/components/Buttons'; -import IsArchiveContext from '../IsArchiveContext/IsArchiveContext'; +import IsArchiveContext from '@weco/content/components/IsArchiveContext/IsArchiveContext'; import { tree } from '@weco/common/icons'; import NestedList from './ArchiveTree.NestedList'; import { UiTree, UiTreeNode, updateChildren } from './ArchiveTree.helpers'; diff --git a/content/webapp/components/ArticleCard/ArticleCard.tsx b/content/webapp/components/ArticleCard/ArticleCard.tsx index 36f64fd8e8..54249f19e6 100644 --- a/content/webapp/components/ArticleCard/ArticleCard.tsx +++ b/content/webapp/components/ArticleCard/ArticleCard.tsx @@ -1,15 +1,18 @@ -import CompactCard from '../CompactCard/CompactCard'; import { FunctionComponent } from 'react'; +import CompactCard from '@weco/content/components/CompactCard/CompactCard'; import { ArticleFormatIds } from '@weco/content/data/content-format-ids'; import { HTMLDate } from '@weco/common/views/components/HTMLDateAndTime'; import Space from '@weco/common/views/components/styled/Space'; import WatchLabel from '@weco/content/components/WatchLabel/WatchLabel'; import { isNotUndefined, isUndefined } from '@weco/common/utils/type-guards'; import PrismicImage from '@weco/common/views/components/PrismicImage/PrismicImage'; -import { ArticleBasic, getArticleColor } from '../../types/articles'; +import { + ArticleBasic, + getArticleColor, + getPartNumberInSeries, +} from '@weco/content/types/articles'; import linkResolver from '@weco/common/services/prismic/link-resolver'; import { getCrop } from '@weco/common/model/image'; -import { getPartNumberInSeries } from '@weco/content/types/articles'; type Props = { article: ArticleBasic; diff --git a/content/webapp/components/ArticleScheduleItemCard/index.tsx b/content/webapp/components/ArticleScheduleItemCard/index.tsx index 8853c5e1e1..3634730beb 100644 --- a/content/webapp/components/ArticleScheduleItemCard/index.tsx +++ b/content/webapp/components/ArticleScheduleItemCard/index.tsx @@ -1,8 +1,8 @@ -import { ArticleScheduleItem } from '@weco/content/types/article-schedule-items'; -import CompactCard from '../CompactCard/CompactCard'; import { FunctionComponent } from 'react'; +import { ArticleScheduleItem } from '@weco/content/types/article-schedule-items'; +import CompactCard from '@weco/content/components/CompactCard/CompactCard'; import { formatDate } from '@weco/common/utils/format-date'; -import ImagePlaceholder from '../ImagePlaceholder/ImagePlaceholder'; +import ImagePlaceholder from '@weco/content/components/ImagePlaceholder/ImagePlaceholder'; type Props = { item: ArticleScheduleItem; diff --git a/content/webapp/components/Body/Body.tsx b/content/webapp/components/Body/Body.tsx index abd4aeebc0..00f8696897 100644 --- a/content/webapp/components/Body/Body.tsx +++ b/content/webapp/components/Body/Body.tsx @@ -4,34 +4,34 @@ import { Fragment, PropsWithChildren, } from 'react'; -import { ContentListSlice as RawContentListSlice } from '@weco/common/prismicio-types'; import styled from 'styled-components'; +import * as prismic from '@prismicio/client'; +import { SliceZone } from '@prismicio/react'; +import { ContentListSlice as RawContentListSlice } from '@weco/common/prismicio-types'; import { classNames, font } from '@weco/common/utils/classnames'; -import { Link } from '../../types/link'; -import { defaultSerializer } from '../HTMLSerializers/HTMLSerializers'; +import { Link } from '@weco/content/types/link'; +import { defaultSerializer } from '@weco/content/components/HTMLSerializers/HTMLSerializers'; import SpacingComponent from '@weco/common/views/components/styled/SpacingComponent'; import SectionHeader from '@weco/content/components/SectionHeader/SectionHeader'; import Space from '@weco/common/views/components/styled/Space'; -import FeaturedText from '../FeaturedText/FeaturedText'; +import FeaturedText from '@weco/content/components/FeaturedText/FeaturedText'; import Layout, { gridSize12, gridSize10, gridSize8, } from '@weco/common/views/components/Layout'; -import OnThisPageAnchors from '../OnThisPageAnchors/OnThisPageAnchors'; +import OnThisPageAnchors from '@weco/content/components/OnThisPageAnchors/OnThisPageAnchors'; import { WobblyEdge } from '@weco/common/views/components/WobblyEdge'; import GridFactory, { sectionLevelPageGrid } from './GridFactory'; -import Card from '../Card/Card'; -import { convertItemToCardProps } from '../../types/card'; -import { isContentList } from '../../types/body'; +import Card from '@weco/content/components/Card/Card'; +import { convertItemToCardProps } from '@weco/content/types/card'; +import { isContentList } from '@weco/content/types/body'; import FeaturedCard, { convertItemToFeaturedCardProps, convertCardToFeaturedCardProps, -} from '../FeaturedCard/FeaturedCard'; -import * as prismic from '@prismicio/client'; -import { Props as ComicPreviousNextProps } from '../ComicPreviousNext/ComicPreviousNext'; +} from '@weco/content/components/FeaturedCard/FeaturedCard'; +import { Props as ComicPreviousNextProps } from '@weco/content/components/ComicPreviousNext/ComicPreviousNext'; import { PaletteColor } from '@weco/common/views/themes/config'; -import { SliceZone } from '@prismicio/react'; import { components } from '@weco/common/views/slices'; import { transformContentListSlice } from '@weco/content/services/prismic/transformers/body'; diff --git a/content/webapp/components/CalendarSelect/CalendarSelect.tsx b/content/webapp/components/CalendarSelect/CalendarSelect.tsx index 0156eeec14..9cfca77a36 100644 --- a/content/webapp/components/CalendarSelect/CalendarSelect.tsx +++ b/content/webapp/components/CalendarSelect/CalendarSelect.tsx @@ -1,6 +1,6 @@ import { FunctionComponent } from 'react'; import Select from '@weco/content/components/Select'; -import { dateAsValue } from '../ItemRequestModal/format-date'; +import { dateAsValue } from '@weco/content/components/ItemRequestModal/format-date'; import { AvailabilitySlot } from '@weco/content/services/wellcome/catalogue/types'; import { formatDayName, formatDayMonth } from '@weco/common/utils/format-date'; diff --git a/content/webapp/components/CaptionedImage/CaptionedImage.tsx b/content/webapp/components/CaptionedImage/CaptionedImage.tsx index f587c183a5..0f96b9af19 100644 --- a/content/webapp/components/CaptionedImage/CaptionedImage.tsx +++ b/content/webapp/components/CaptionedImage/CaptionedImage.tsx @@ -1,11 +1,11 @@ import { FunctionComponent, ReactNode } from 'react'; -import Caption from '@weco/common/views/components/Caption/Caption'; import styled from 'styled-components'; +import Caption from '@weco/common/views/components/Caption/Caption'; import { CaptionedImage as CaptionedImageType } from '@weco/common/model/captioned-image'; -import ImageWithTasl from '../ImageWithTasl/ImageWithTasl'; +import ImageWithTasl from '@weco/content/components/ImageWithTasl/ImageWithTasl'; import HeightRestrictedPrismicImage from '@weco/content/components/HeightRestrictedPrismicImage/HeightRestrictedPrismicImage'; import { dasherizeShorten } from '@weco/common/utils/grammar'; -import ZoomedPrismicImage from '../ZoomedPrismicImage/ZoomedPrismicImage'; +import ZoomedPrismicImage from '@weco/content/components/ZoomedPrismicImage/ZoomedPrismicImage'; type CaptionedImageFigureProps = { $isBody?: boolean; diff --git a/content/webapp/components/Card/Card.tsx b/content/webapp/components/Card/Card.tsx index b29baa440e..be306cfd43 100644 --- a/content/webapp/components/Card/Card.tsx +++ b/content/webapp/components/Card/Card.tsx @@ -4,7 +4,7 @@ import { Card as CardType } from '@weco/content/types/card'; import { font } from '@weco/common/utils/classnames'; import LabelsList from '@weco/common/views/components/LabelsList/LabelsList'; import Space from '@weco/common/views/components/styled/Space'; -import PartNumberIndicator from '../PartNumberIndicator/PartNumberIndicator'; +import PartNumberIndicator from '@weco/content/components/PartNumberIndicator/PartNumberIndicator'; import { getCrop } from '@weco/common/model/image'; import PrismicImage from '@weco/common/views/components/PrismicImage/PrismicImage'; import { Label as LabelType } from '@weco/common/model/labels'; diff --git a/content/webapp/components/CardGrid/CardGrid.test.tsx b/content/webapp/components/CardGrid/CardGrid.test.tsx index 7707f42990..098aebe581 100644 --- a/content/webapp/components/CardGrid/CardGrid.test.tsx +++ b/content/webapp/components/CardGrid/CardGrid.test.tsx @@ -1,7 +1,7 @@ import CardGrid from './CardGrid'; -import { MultiContent } from '../../types/multi-content'; +import { MultiContent } from '@weco/content/types/multi-content'; import { renderWithTheme } from '@weco/common/test/fixtures/test-helpers'; -import { placeHolderImage } from '../../services/prismic/transformers/images'; +import { placeHolderImage } from '@weco/content/services/prismic/transformers/images'; import '@testing-library/jest-dom'; describe('CardGrid', () => { diff --git a/content/webapp/components/CardGrid/CardGrid.tsx b/content/webapp/components/CardGrid/CardGrid.tsx index 0e996461fa..0fccafe11f 100644 --- a/content/webapp/components/CardGrid/CardGrid.tsx +++ b/content/webapp/components/CardGrid/CardGrid.tsx @@ -1,20 +1,20 @@ import { FunctionComponent } from 'react'; import { classNames, cssGrid } from '@weco/common/utils/classnames'; -import { Link } from '../../types/link'; -import { convertItemToCardProps } from '../../types/card'; -import BookPromo from '../BookPromo/BookPromo'; +import { Link } from '@weco/content/types/link'; +import { convertItemToCardProps } from '@weco/content/types/card'; +import BookPromo from '@weco/content/components/BookPromo/BookPromo'; import Layout, { gridSize12 } from '@weco/common/views/components/Layout'; import MoreLink from '@weco/content/components/MoreLink/MoreLink'; import Space from '@weco/common/views/components/styled/Space'; import CssGridContainer from '@weco/common/views/components/styled/CssGridContainer'; -import Card from '../Card/Card'; -import EventPromo from '../EventPromo/EventPromo'; -import ExhibitionPromo from '../ExhibitionPromo/ExhibitionPromo'; -import StoryPromo from '../StoryPromo/StoryPromo'; +import Card from '@weco/content/components/Card/Card'; +import EventPromo from '@weco/content/components/EventPromo/EventPromo'; +import ExhibitionPromo from '@weco/content/components/ExhibitionPromo/ExhibitionPromo'; +import StoryPromo from '@weco/content/components/StoryPromo/StoryPromo'; import DailyTourPromo from './DailyTourPromo'; -import { MultiContent } from '../../types/multi-content'; -import ExhibitionGuidePromo from '../ExhibitionGuidePromo/ExhibitionGuidePromo'; -import ExhibitionGuideLinksPromo from '../ExhibitionGuideLinksPromo/ExhibitionGuideLinksPromo'; +import { MultiContent } from '@weco/content/types/multi-content'; +import ExhibitionGuidePromo from '@weco/content/components/ExhibitionGuidePromo/ExhibitionGuidePromo'; +import ExhibitionGuideLinksPromo from '@weco/content/components/ExhibitionGuideLinksPromo/ExhibitionGuideLinksPromo'; type Props = { items: readonly MultiContent[]; diff --git a/content/webapp/components/CardGrid/DailyTourPromo.tsx b/content/webapp/components/CardGrid/DailyTourPromo.tsx index ae6b3fd076..16cae6e2a8 100644 --- a/content/webapp/components/CardGrid/DailyTourPromo.tsx +++ b/content/webapp/components/CardGrid/DailyTourPromo.tsx @@ -1,7 +1,7 @@ +import { FunctionComponent } from 'react'; import { EventBasic } from '@weco/content/types/events'; import { prismicPageIds } from '@weco/common/data/hardcoded-ids'; -import EventPromo from '../EventPromo/EventPromo'; -import { FunctionComponent } from 'react'; +import EventPromo from '@weco/content/components/EventPromo/EventPromo'; const image = { contentUrl: diff --git a/content/webapp/components/ComicPreviousNext/ComicPreviousNext.tsx b/content/webapp/components/ComicPreviousNext/ComicPreviousNext.tsx index 9ef59f673a..6e5a54b721 100644 --- a/content/webapp/components/ComicPreviousNext/ComicPreviousNext.tsx +++ b/content/webapp/components/ComicPreviousNext/ComicPreviousNext.tsx @@ -1,5 +1,5 @@ import { FunctionComponent } from 'react'; -import { ArticleBasic } from '../../types/articles'; +import { ArticleBasic } from '@weco/content/types/articles'; import styled from 'styled-components'; import Icon from '@weco/common/views/components/Icon/Icon'; import { chevron } from '@weco/common/icons'; diff --git a/content/webapp/components/CompactCard/CompactCard.tsx b/content/webapp/components/CompactCard/CompactCard.tsx index 8a47b1b71e..7a72aaa960 100644 --- a/content/webapp/components/CompactCard/CompactCard.tsx +++ b/content/webapp/components/CompactCard/CompactCard.tsx @@ -1,7 +1,7 @@ import { FunctionComponent } from 'react'; import MediaObjectBase, { Props as MediaObjectBaseProps, -} from '../MediaObjectBase/MediaObjectBase'; +} from '@weco/content/components/MediaObjectBase/MediaObjectBase'; const CompactCard: FunctionComponent = props => ( diff --git a/content/webapp/components/ContentPage/ContentPage.tsx b/content/webapp/components/ContentPage/ContentPage.tsx index 49015ca6c1..b6218828d3 100644 --- a/content/webapp/components/ContentPage/ContentPage.tsx +++ b/content/webapp/components/ContentPage/ContentPage.tsx @@ -14,7 +14,7 @@ import SpacingSection from '@weco/common/views/components/styled/SpacingSection' import SpacingComponent from '@weco/common/views/components/styled/SpacingComponent'; import Space from '@weco/common/views/components/styled/Space'; import BannerCard from '@weco/content/components/BannerCard/BannerCard'; -import Contributors from '../Contributors/Contributors'; +import Contributors from '@weco/content/components/Contributors/Contributors'; import { Contributor } from '@weco/content/types/contributors'; import { Props as BodyProps } from '@weco/content/components/Body/Body'; diff --git a/content/webapp/components/DateAndStatusIndicator/DateAndStatusIndicator.tsx b/content/webapp/components/DateAndStatusIndicator/DateAndStatusIndicator.tsx index 7ed97de152..86f5e60a6c 100644 --- a/content/webapp/components/DateAndStatusIndicator/DateAndStatusIndicator.tsx +++ b/content/webapp/components/DateAndStatusIndicator/DateAndStatusIndicator.tsx @@ -1,7 +1,7 @@ import { FunctionComponent } from 'react'; import DateRange from '@weco/content/components/DateRange/DateRange'; import { HTMLDate } from '@weco/common/views/components/HTMLDateAndTime'; -import StatusIndicator from '../../components/StatusIndicator/StatusIndicator'; +import StatusIndicator from '@weco/content/components/StatusIndicator/StatusIndicator'; import Space from '@weco/common/views/components/styled/Space'; type Props = { diff --git a/content/webapp/components/Download/Download.tsx b/content/webapp/components/Download/Download.tsx index 3198d33942..00fd5af72c 100644 --- a/content/webapp/components/Download/Download.tsx +++ b/content/webapp/components/Download/Download.tsx @@ -1,5 +1,5 @@ import { AppContext } from '@weco/common/views/components/AppContext/AppContext'; -import { DownloadOption } from '../../types/manifest'; +import { DownloadOption } from '@weco/content/types/manifest'; import { FunctionComponent, useContext, useRef } from 'react'; import styled from 'styled-components'; import { font } from '@weco/common/utils/classnames'; diff --git a/content/webapp/components/EventCard/EventCard.tsx b/content/webapp/components/EventCard/EventCard.tsx index 2bef7b3161..c455331f00 100644 --- a/content/webapp/components/EventCard/EventCard.tsx +++ b/content/webapp/components/EventCard/EventCard.tsx @@ -1,9 +1,9 @@ import { FunctionComponent } from 'react'; import { EventBasic } from '@weco/content/types/events'; -import CompactCard from '../CompactCard/CompactCard'; +import CompactCard from '@weco/content/components/CompactCard/CompactCard'; import PrismicImage from '@weco/common/views/components/PrismicImage/PrismicImage'; -import StatusIndicator from '../../components/StatusIndicator/StatusIndicator'; -import EventDateRange from '../EventDateRange'; +import StatusIndicator from '@weco/content/components/StatusIndicator/StatusIndicator'; +import EventDateRange from '@weco/content/components/EventDateRange'; import { font } from '@weco/common/utils/classnames'; import { getCrop } from '@weco/common/model/image'; import Space from '@weco/common/views/components/styled/Space'; diff --git a/content/webapp/components/EventDateList/index.tsx b/content/webapp/components/EventDateList/index.tsx index 97ae8aa5d2..abfc2c9290 100644 --- a/content/webapp/components/EventDateList/index.tsx +++ b/content/webapp/components/EventDateList/index.tsx @@ -3,7 +3,7 @@ import styled from 'styled-components'; import DateRange from '@weco/content/components/DateRange/DateRange'; import { HasTimes } from '@weco/content/types/events'; -import EventStatus from '../EventStatus'; +import EventStatus from '@weco/content/components/EventStatus'; import Space from '@weco/common/views/components/styled/Space'; import { isPast } from '@weco/common/utils/dates'; diff --git a/content/webapp/components/EventPromo/EventPromo.test.tsx b/content/webapp/components/EventPromo/EventPromo.test.tsx index 946d9a6c86..1ddc37e73e 100644 --- a/content/webapp/components/EventPromo/EventPromo.test.tsx +++ b/content/webapp/components/EventPromo/EventPromo.test.tsx @@ -12,7 +12,7 @@ import { eventWithOneLocationOnline, eventWithMultipleLocations, eventFullyBooked, -} from '../../__mocks__/events'; +} from '@weco/content/__mocks__/events'; jest .spyOn(Context, 'usePrismicData') diff --git a/content/webapp/components/EventPromo/EventPromo.tsx b/content/webapp/components/EventPromo/EventPromo.tsx index 9a8e71121f..1f00e11e34 100644 --- a/content/webapp/components/EventPromo/EventPromo.tsx +++ b/content/webapp/components/EventPromo/EventPromo.tsx @@ -3,7 +3,7 @@ import { FunctionComponent } from 'react'; import { font } from '@weco/common/utils/classnames'; import LabelsList from '@weco/common/views/components/LabelsList/LabelsList'; import TextWithDot from '@weco/content/components/TextWithDot'; -import EventDateRange from '../EventDateRange'; +import EventDateRange from '@weco/content/components/EventDateRange'; import { EventBasic } from '@weco/content/types/events'; import { upcomingDatesFullyBooked } from '@weco/content/services/prismic/events'; import Space from '@weco/common/views/components/styled/Space'; @@ -14,7 +14,7 @@ import { CardLabels, CardImageWrapper, CardTitle, -} from '../Card/Card'; +} from '@weco/content/components/Card/Card'; import Divider from '@weco/common/views/components/Divider/Divider'; import WatchLabel from '@weco/content/components/WatchLabel/WatchLabel'; import Icon from '@weco/common/views/components/Icon/Icon'; diff --git a/content/webapp/components/EventSchedule/EventSchedule.tsx b/content/webapp/components/EventSchedule/EventSchedule.tsx index 39f8fe64bf..ef4d5b96e4 100644 --- a/content/webapp/components/EventSchedule/EventSchedule.tsx +++ b/content/webapp/components/EventSchedule/EventSchedule.tsx @@ -4,7 +4,10 @@ import type { Event as EventType, } from '@weco/content/types/events'; import EventScheduleItem from './EventScheduleItem'; -import { EventsGroup, groupEventsByDay } from '../../services/prismic/events'; +import { + EventsGroup, + groupEventsByDay, +} from '@weco/content/services/prismic/events'; import Space from '@weco/common/views/components/styled/Space'; import { isPast } from '@weco/common/utils/dates'; import { font } from '@weco/common/utils/classnames'; diff --git a/content/webapp/components/EventSchedule/EventScheduleItem.tsx b/content/webapp/components/EventSchedule/EventScheduleItem.tsx index 5a4e22c6ac..8e3b805a46 100644 --- a/content/webapp/components/EventSchedule/EventScheduleItem.tsx +++ b/content/webapp/components/EventSchedule/EventScheduleItem.tsx @@ -1,14 +1,14 @@ import { Fragment, FunctionComponent } from 'react'; +import styled from 'styled-components'; import { grid, font } from '@weco/common/utils/classnames'; import EventBookingButton from './EventBookingButton'; -import EventbriteButtons from '../EventbriteButtons/EventbriteButtons'; +import EventbriteButtons from '@weco/content/components/EventbriteButtons/EventbriteButtons'; import LabelsList from '@weco/common/views/components/LabelsList/LabelsList'; import Message from '@weco/content/components/Message/Message'; import { formatTime, formatDayDate } from '@weco/common/utils/format-date'; import { Event } from '@weco/content/types/events'; import Space from '@weco/common/views/components/styled/Space'; -import styled from 'styled-components'; -import { isEventPast } from '../../services/prismic/events'; +import { isEventPast } from '@weco/content/services/prismic/events'; import { isPast } from '@weco/common/utils/dates'; import { HTMLTime } from '@weco/common/views/components/HTMLDateAndTime'; import { Place } from '@weco/content/types/places'; diff --git a/content/webapp/components/EventsByMonth/EventsByMonth.tsx b/content/webapp/components/EventsByMonth/EventsByMonth.tsx index cda2ece747..eed39ce4a6 100644 --- a/content/webapp/components/EventsByMonth/EventsByMonth.tsx +++ b/content/webapp/components/EventsByMonth/EventsByMonth.tsx @@ -3,7 +3,7 @@ import { AppContext } from '@weco/common/views/components/AppContext/AppContext' import { cssGrid, classNames } from '@weco/common/utils/classnames'; import { gridSize12 } from '@weco/common/views/components/Layout'; import { groupEventsByMonth, startOf } from './group-event-utils'; -import CardGrid from '../CardGrid/CardGrid'; +import CardGrid from '@weco/content/components/CardGrid/CardGrid'; import CssGridContainer from '@weco/common/views/components/styled/CssGridContainer'; import Space from '@weco/common/views/components/styled/Space'; import { Container } from '@weco/common/views/components/styled/Container'; diff --git a/content/webapp/components/Exhibition/Exhibition.tsx b/content/webapp/components/Exhibition/Exhibition.tsx index 7a23a045e5..1cf2c4688f 100644 --- a/content/webapp/components/Exhibition/Exhibition.tsx +++ b/content/webapp/components/Exhibition/Exhibition.tsx @@ -2,15 +2,18 @@ import { Fragment, useState, useEffect, FunctionComponent } from 'react'; import { isPast, isFuture } from '@weco/common/utils/dates'; import { formatDate } from '@weco/common/utils/format-date'; import PageHeader from '@weco/common/views/components/PageHeader/PageHeader'; -import { getFeaturedMedia, getHeroPicture } from '../../utils/page-header'; +import { + getFeaturedMedia, + getHeroPicture, +} from '@weco/content/utils/page-header'; import DateRange from '@weco/content/components/DateRange/DateRange'; import { HTMLDate } from '@weco/common/views/components/HTMLDateAndTime'; import { defaultSerializer } from '@weco/content/components/HTMLSerializers/HTMLSerializers'; import PrismicHtmlBlock from '@weco/common/views/components/PrismicHtmlBlock/PrismicHtmlBlock'; -import StatusIndicator from '../../components/StatusIndicator/StatusIndicator'; -import InfoBox from '../InfoBox/InfoBox'; +import StatusIndicator from '@weco/content/components/StatusIndicator/StatusIndicator'; +import InfoBox from '@weco/content/components/InfoBox/InfoBox'; import { font } from '@weco/common/utils/classnames'; -import { Page as PageType } from '../../types/pages'; +import { Page as PageType } from '@weco/content/types/pages'; import Space from '@weco/common/views/components/styled/Space'; import { LabelField } from '@weco/content/model/label-field'; import { @@ -24,18 +27,18 @@ import { download, arrow, } from '@weco/common/icons'; -import Body from '../Body/Body'; -import SearchResults from '../SearchResults/SearchResults'; -import ContentPage from '../ContentPage/ContentPage'; -import Contributors from '../Contributors/Contributors'; +import Body from '@weco/content/components/Body/Body'; +import SearchResults from '@weco/content/components/SearchResults/SearchResults'; +import ContentPage from '@weco/content/components/ContentPage/ContentPage'; +import Contributors from '@weco/content/components/Contributors/Contributors'; import { isNotUndefined } from '@weco/common/utils/type-guards'; import { a11y } from '@weco/common/data/microcopy'; -import { fetchExhibitionRelatedContentClientSide } from '../../services/prismic/fetch/exhibitions'; +import { fetchExhibitionRelatedContentClientSide } from '@weco/content/services/prismic/fetch/exhibitions'; import { Exhibition as ExhibitionType, ExhibitionAbout, -} from '../../types/exhibitions'; -import { Link } from '../../types/link'; +} from '@weco/content/types/exhibitions'; +import { Link } from '@weco/content/types/link'; import { EventBasic } from '@weco/content/types/events'; import * as prismic from '@prismicio/client'; import styled from 'styled-components'; diff --git a/content/webapp/components/ExhibitionGuideLinksPromo/ExhibitionGuideLinksPromo.tsx b/content/webapp/components/ExhibitionGuideLinksPromo/ExhibitionGuideLinksPromo.tsx index c0459bcc5a..89ccb1858d 100644 --- a/content/webapp/components/ExhibitionGuideLinksPromo/ExhibitionGuideLinksPromo.tsx +++ b/content/webapp/components/ExhibitionGuideLinksPromo/ExhibitionGuideLinksPromo.tsx @@ -1,6 +1,6 @@ import { FunctionComponent } from 'react'; import { font } from '@weco/common/utils/classnames'; -import { ExhibitionGuideBasic } from '../../types/exhibition-guides'; +import { ExhibitionGuideBasic } from '@weco/content/types/exhibition-guides'; import PlainList from '@weco/common/views/components/styled/PlainList'; import Space from '@weco/common/views/components/styled/Space'; import PrismicImage from '@weco/common/views/components/PrismicImage/PrismicImage'; diff --git a/content/webapp/components/ExhibitionGuidePromo/ExhibitionGuidePromo.tsx b/content/webapp/components/ExhibitionGuidePromo/ExhibitionGuidePromo.tsx index fd4c4b3bf2..8019b55b5c 100644 --- a/content/webapp/components/ExhibitionGuidePromo/ExhibitionGuidePromo.tsx +++ b/content/webapp/components/ExhibitionGuidePromo/ExhibitionGuidePromo.tsx @@ -5,7 +5,12 @@ import { ExhibitionGuideType, } from '@weco/content/types/exhibition-guides'; import Space from '@weco/common/views/components/styled/Space'; -import { CardOuter, CardBody, CardImageWrapper, CardTitle } from '../Card/Card'; +import { + CardOuter, + CardBody, + CardImageWrapper, + CardTitle, +} from '@weco/content/components/Card/Card'; import PrismicImage from '@weco/common/views/components/PrismicImage/PrismicImage'; import { useToggles } from '@weco/common/server-data/Context'; import RelevantGuideIcons from '@weco/content/components/ExhibitionGuideRelevantIcons'; diff --git a/content/webapp/components/ExhibitionGuideStops/ExhibitionGuideStops.tsx b/content/webapp/components/ExhibitionGuideStops/ExhibitionGuideStops.tsx index 544006371c..177f54985d 100644 --- a/content/webapp/components/ExhibitionGuideStops/ExhibitionGuideStops.tsx +++ b/content/webapp/components/ExhibitionGuideStops/ExhibitionGuideStops.tsx @@ -1,11 +1,11 @@ +import { ReactElement, FunctionComponent } from 'react'; +import styled from 'styled-components'; import { ExhibitionGuideComponent, ExhibitionGuideType, -} from '../../types/exhibition-guides'; -import { ReactElement, FunctionComponent } from 'react'; +} from '@weco/content/types/exhibition-guides'; import Space from '@weco/common/views/components/styled/Space'; -import ExhibitionCaptions from '../ExhibitionCaptions/ExhibitionCaptions'; -import styled from 'styled-components'; +import ExhibitionCaptions from '@weco/content/components/ExhibitionCaptions/ExhibitionCaptions'; import AudioPlayer from '@weco/content/components/AudioPlayer/AudioPlayer'; import VideoEmbed from '@weco/common/views/components/VideoEmbed/VideoEmbed'; import GridFactory, { diff --git a/content/webapp/components/ExhibitionPromo/ExhibitionPromo.tsx b/content/webapp/components/ExhibitionPromo/ExhibitionPromo.tsx index 07d935023a..be2c016dcb 100644 --- a/content/webapp/components/ExhibitionPromo/ExhibitionPromo.tsx +++ b/content/webapp/components/ExhibitionPromo/ExhibitionPromo.tsx @@ -9,7 +9,7 @@ import { CardLabels, CardImageWrapper, CardTitle, -} from '../Card/Card'; +} from '@weco/content/components/Card/Card'; import PrismicImage from '@weco/common/views/components/PrismicImage/PrismicImage'; import { ExhibitionBasic } from '@weco/content/types/exhibitions'; import linkResolver from '@weco/common/services/prismic/link-resolver'; diff --git a/content/webapp/components/ExhibitionsAndEvents/ExhibitionsAndEvents.tsx b/content/webapp/components/ExhibitionsAndEvents/ExhibitionsAndEvents.tsx index cce6ee5643..4f48506955 100644 --- a/content/webapp/components/ExhibitionsAndEvents/ExhibitionsAndEvents.tsx +++ b/content/webapp/components/ExhibitionsAndEvents/ExhibitionsAndEvents.tsx @@ -1,8 +1,8 @@ -import { ExhibitionBasic } from '../../types/exhibitions'; -import { EventBasic } from '@weco/content/types/events'; -import { Link } from '../../types/link'; -import CardGrid from '../CardGrid/CardGrid'; import { FunctionComponent } from 'react'; +import { ExhibitionBasic } from '@weco/content/types/exhibitions'; +import { EventBasic } from '@weco/content/types/events'; +import { Link } from '@weco/content/types/link'; +import CardGrid from '@weco/content/components/CardGrid/CardGrid'; type Props = { exhibitions: ExhibitionBasic[]; diff --git a/content/webapp/components/ExpandedImage/ExpandedImage.tsx b/content/webapp/components/ExpandedImage/ExpandedImage.tsx index d22828bd71..a538ab1010 100644 --- a/content/webapp/components/ExpandedImage/ExpandedImage.tsx +++ b/content/webapp/components/ExpandedImage/ExpandedImage.tsx @@ -1,6 +1,7 @@ import { useEffect, useState, FunctionComponent } from 'react'; import styled from 'styled-components'; import NextLink from 'next/link'; +import { usePathname } from 'next/navigation'; import { font } from '@weco/common/utils/classnames'; import { getDigitalLocationOfType, @@ -21,10 +22,9 @@ import Button from '@weco/common/views/components/Buttons'; import VisuallySimilarImagesFromApi from '@weco/content/components/VisuallySimilarImagesFromApi/VisuallySimilarImagesFromApi'; import IIIFImage from '@weco/content/components/IIIFImage/IIIFImage'; import LL from '@weco/common/views/components/styled/LL'; -import { toLink as itemLink } from '../ItemLink'; -import { toLink as imageLink } from '../ImageLink'; +import { toLink as itemLink } from '@weco/content/components/ItemLink'; +import { toLink as imageLink } from '@weco/content/components/ImageLink'; import { trackSegmentEvent } from '@weco/common/services/conversion/track'; -import { usePathname } from 'next/navigation'; type Props = { image: ImageType | undefined; diff --git a/content/webapp/components/FacilityPromo/FacilityPromo.tsx b/content/webapp/components/FacilityPromo/FacilityPromo.tsx index a237946303..4f7c48d559 100644 --- a/content/webapp/components/FacilityPromo/FacilityPromo.tsx +++ b/content/webapp/components/FacilityPromo/FacilityPromo.tsx @@ -1,11 +1,11 @@ +import { FunctionComponent } from 'react'; +import styled from 'styled-components'; import { font } from '@weco/common/utils/classnames'; import Icon from '@weco/common/views/components/Icon/Icon'; import PrismicImage from '@weco/common/views/components/PrismicImage/PrismicImage'; import Space from '@weco/common/views/components/styled/Space'; -import { CardOuter, CardBody } from '../Card/Card'; -import { FacilityPromo as FacilityPromoType } from '../../types/facility-promo'; -import { FunctionComponent } from 'react'; -import styled from 'styled-components'; +import { CardOuter, CardBody } from '@weco/content/components/Card/Card'; +import { FacilityPromo as FacilityPromoType } from '@weco/content/types/facility-promo'; const ImageWrapper = styled.div` border-radius: ${props => props.theme.borderRadiusUnit}px; diff --git a/content/webapp/components/FeaturedCard/FeaturedCard.tsx b/content/webapp/components/FeaturedCard/FeaturedCard.tsx index bcf08c66c5..d73e313e9d 100644 --- a/content/webapp/components/FeaturedCard/FeaturedCard.tsx +++ b/content/webapp/components/FeaturedCard/FeaturedCard.tsx @@ -11,11 +11,11 @@ import { Season } from '@weco/content/types/seasons'; import { Card } from '@weco/content/types/card'; import { Label } from '@weco/common/model/labels'; import { Link } from '@weco/content/types/link'; -import PartNumberIndicator from '../PartNumberIndicator/PartNumberIndicator'; +import PartNumberIndicator from '@weco/content/components/PartNumberIndicator/PartNumberIndicator'; import { grid, font } from '@weco/common/utils/classnames'; import Space from '@weco/common/views/components/styled/Space'; import LabelsList from '@weco/common/views/components/LabelsList/LabelsList'; -import StatusIndicator from '../StatusIndicator/StatusIndicator'; +import StatusIndicator from '@weco/content/components/StatusIndicator/StatusIndicator'; import linkResolver from '@weco/common/services/prismic/link-resolver'; import { Page } from '@weco/content/types/pages'; import { EventSeries } from '@weco/content/types/event-series'; diff --git a/content/webapp/components/GuideStopCard/index.tsx b/content/webapp/components/GuideStopCard/index.tsx index 65c80222e8..1cb9da9cd0 100644 --- a/content/webapp/components/GuideStopCard/index.tsx +++ b/content/webapp/components/GuideStopCard/index.tsx @@ -9,7 +9,6 @@ import { threeUpGridSizesMap } from '@weco/content/components/Body/GridFactory'; import ImagePlaceholder, { placeholderBackgroundColor, } from '@weco/content/components/ImagePlaceholder/ImagePlaceholder'; -import { secondsToHoursMinutesAndSeconds } from '@weco/common/utils/format-time'; import { map, duration as durationIcon } from '@weco/common/icons'; import { CardOuter, @@ -34,7 +33,7 @@ type Props = { number?: number; totalStops: number; title: string; - duration?: number; + duration?: string; type: 'audio' | 'video'; image?: ImageType; }; @@ -48,10 +47,6 @@ const GuideStopCard: FunctionComponent = ({ type, image, }) => { - const durationInSeconds = duration && Math.round(duration * 60); - const durationInMinutesAndSeconds = durationInSeconds - ? secondsToHoursMinutesAndSeconds(durationInSeconds) - : undefined; const croppedImage = getCrop(image, '16:9'); return ( = ({ )} - - - - - {durationInMinutesAndSeconds && ( + {duration && ( + + + + - {durationInMinutesAndSeconds} minutes{' '} - {type === 'audio' ? 'listen' : 'watch'} time + {duration} minutes {type === 'audio' ? 'listen' : 'watch'} time - )} - + + )} diff --git a/content/webapp/components/IIIFClickthrough/IIIFClickthrough.tsx b/content/webapp/components/IIIFClickthrough/IIIFClickthrough.tsx index fc70bd554e..ef61fc7073 100644 --- a/content/webapp/components/IIIFClickthrough/IIIFClickthrough.tsx +++ b/content/webapp/components/IIIFClickthrough/IIIFClickthrough.tsx @@ -8,7 +8,7 @@ import { font } from '@weco/common/utils/classnames'; import Button from '@weco/common/views/components/Buttons'; import Space from '@weco/common/views/components/styled/Space'; import styled from 'styled-components'; -import useShowClickthrough from '../../hooks/useShowClickthrough'; +import useShowClickthrough from '@weco/content/hooks/useShowClickthrough'; import { TransformedAuthService } from '@weco/content/utils/iiif/v3'; const IframeAuthMessage = styled.iframe` diff --git a/content/webapp/components/IIIFItem/IIIFItem.tsx b/content/webapp/components/IIIFItem/IIIFItem.tsx index 3df1ba3463..4bf90dc5c9 100644 --- a/content/webapp/components/IIIFItem/IIIFItem.tsx +++ b/content/webapp/components/IIIFItem/IIIFItem.tsx @@ -1,3 +1,5 @@ +import styled from 'styled-components'; +import { FunctionComponent } from 'react'; import { ChoiceBody, ContentResource, @@ -7,15 +9,13 @@ import { TransformedCanvas, CustomContentResource, } from '@weco/content/types/manifest'; -import styled from 'styled-components'; -import { FunctionComponent } from 'react'; import { getLabelString } from '@weco/content/utils/iiif/v3'; import Layout, { gridSize12 } from '@weco/common/views/components/Layout'; import Space from '@weco/common/views/components/styled/Space'; import VideoPlayer from '@weco/content/components/VideoPlayer/VideoPlayer'; import BetaMessage from '@weco/content/components/BetaMessage/BetaMessage'; import AudioPlayer from '@weco/content/components/AudioPlayer/AudioPlayer'; -import VideoTranscript from '../VideoTranscript/VideoTranscript'; +import VideoTranscript from '@weco/content/components/VideoTranscript/VideoTranscript'; import { unavailableContentMessage } from '@weco/common/data/microcopy'; const IframePdfViewer = styled(Space)` diff --git a/content/webapp/components/IIIFSearchWithin/IIIFSearchWithin.tsx b/content/webapp/components/IIIFSearchWithin/IIIFSearchWithin.tsx index be9e81b121..b8d531cd49 100644 --- a/content/webapp/components/IIIFSearchWithin/IIIFSearchWithin.tsx +++ b/content/webapp/components/IIIFSearchWithin/IIIFSearchWithin.tsx @@ -13,7 +13,7 @@ import { font } from '@weco/common/utils/classnames'; import Button from '@weco/common/views/components/Buttons'; import ItemViewerContext, { results, -} from '../ItemViewerContext/ItemViewerContext'; +} from '@weco/content/components/ItemViewerContext/ItemViewerContext'; import Space from '@weco/common/views/components/styled/Space'; import LL from '@weco/common/views/components/styled/LL'; import { search } from '@weco/common/icons'; diff --git a/content/webapp/components/IIIFViewer/GridViewer.tsx b/content/webapp/components/IIIFViewer/GridViewer.tsx index 74f68879e6..05a4046ca7 100644 --- a/content/webapp/components/IIIFViewer/GridViewer.tsx +++ b/content/webapp/components/IIIFViewer/GridViewer.tsx @@ -8,6 +8,7 @@ import { FunctionComponent, CSSProperties, } from 'react'; +import NextLink from 'next/link'; import { FixedSizeGrid, areEqual } from 'react-window'; import useScrollVelocity from '@weco/content/hooks/useScrollVelocity'; import LL from '@weco/common/views/components/styled/LL'; @@ -16,10 +17,9 @@ import Space from '@weco/common/views/components/styled/Space'; import { SearchResults } from '@weco/content/services/iiif/types/search/v3'; import ItemViewerContext, { Query, -} from '../ItemViewerContext/ItemViewerContext'; +} from '@weco/content/components/ItemViewerContext/ItemViewerContext'; import { AppContext } from '@weco/common/views/components/AppContext/AppContext'; import { TransformedCanvas } from '@weco/content/types/manifest'; -import NextLink from 'next/link'; import { toLink as itemLink } from '@weco/content/components/ItemLink'; import { arrayIndexToQueryParam, queryParamToArrayIndex } from '.'; diff --git a/content/webapp/components/IIIFViewer/IIIFCanvasThumbnail.tsx b/content/webapp/components/IIIFViewer/IIIFCanvasThumbnail.tsx index 2139af5331..712da457f6 100644 --- a/content/webapp/components/IIIFViewer/IIIFCanvasThumbnail.tsx +++ b/content/webapp/components/IIIFViewer/IIIFCanvasThumbnail.tsx @@ -1,5 +1,5 @@ import { FunctionComponent, useState } from 'react'; -import { TransformedCanvas } from '../../types/manifest'; +import { TransformedCanvas } from '@weco/content/types/manifest'; import { font } from '@weco/common/utils/classnames'; import styled from 'styled-components'; import IIIFViewerImage from './IIIFViewerImage'; diff --git a/content/webapp/components/IIIFViewer/IIIFViewer.tsx b/content/webapp/components/IIIFViewer/IIIFViewer.tsx index 6052d88d2f..8b8b9ff43f 100644 --- a/content/webapp/components/IIIFViewer/IIIFViewer.tsx +++ b/content/webapp/components/IIIFViewer/IIIFViewer.tsx @@ -6,6 +6,8 @@ import { useContext, } from 'react'; import styled from 'styled-components'; +import { useRouter } from 'next/router'; +import dynamic from 'next/dynamic'; import { DigitalLocation } from '@weco/common/model/catalogue'; import { Work, @@ -17,11 +19,9 @@ import ViewerTopBar from './ViewerTopBar'; import ItemViewerContext, { ParentManifest, RotatedImage, -} from '../ItemViewerContext/ItemViewerContext'; -import { useRouter } from 'next/router'; +} from '@weco/content/components/ItemViewerContext/ItemViewerContext'; import GridViewer from './GridViewer'; import { iiifImageTemplate } from '@weco/common/utils/convert-image-uri'; -import dynamic from 'next/dynamic'; import LL from '@weco/common/views/components/styled/LL'; import ImageViewer from './ImageViewer'; import ImageViewerControls from './ImageViewerControls'; diff --git a/content/webapp/components/IIIFViewer/ImageViewer.tsx b/content/webapp/components/IIIFViewer/ImageViewer.tsx index 535aa59781..f9ce0d8a8c 100644 --- a/content/webapp/components/IIIFViewer/ImageViewer.tsx +++ b/content/webapp/components/IIIFViewer/ImageViewer.tsx @@ -6,12 +6,12 @@ import { FunctionComponent, } from 'react'; import styled from 'styled-components'; +import Router from 'next/router'; import { IIIFUriProps } from '@weco/common/utils/convert-image-uri'; import { imageSizes } from '@weco/common/utils/image-sizes'; import IIIFViewerImage from './IIIFViewerImage'; import useOnScreen from '@weco/content/hooks/useOnScreen'; -import ItemViewerContext from '../ItemViewerContext/ItemViewerContext'; -import Router from 'next/router'; +import ItemViewerContext from '@weco/content/components/ItemViewerContext/ItemViewerContext'; import { toLink as itemLink } from '@weco/content/components/ItemLink'; import useSkipInitialEffect from '@weco/content/hooks/useSkipInitialEffect'; import { arrayIndexToQueryParam, queryParamToArrayIndex } from '.'; diff --git a/content/webapp/components/IIIFViewer/ImageViewerControls.tsx b/content/webapp/components/IIIFViewer/ImageViewerControls.tsx index 9a42c3a7c4..9aeeb6bd96 100644 --- a/content/webapp/components/IIIFViewer/ImageViewerControls.tsx +++ b/content/webapp/components/IIIFViewer/ImageViewerControls.tsx @@ -1,10 +1,10 @@ +import { useContext, FunctionComponent } from 'react'; +import styled from 'styled-components'; import ItemViewerContext, { RotatedImage, -} from '../ItemViewerContext/ItemViewerContext'; -import { useContext, FunctionComponent } from 'react'; +} from '@weco/content/components/ItemViewerContext/ItemViewerContext'; import Space from '@weco/common/views/components/styled/Space'; import Control from '@weco/common/views/components/Control'; -import styled from 'styled-components'; import { rotateRight, zoomIn } from '@weco/common/icons'; const ImageViewerControlsEl = styled.div<{ $showControls?: boolean }>` diff --git a/content/webapp/components/IIIFViewer/MainViewer.tsx b/content/webapp/components/IIIFViewer/MainViewer.tsx index 3c53303bb4..6cb90015c8 100644 --- a/content/webapp/components/IIIFViewer/MainViewer.tsx +++ b/content/webapp/components/IIIFViewer/MainViewer.tsx @@ -19,7 +19,7 @@ import { font } from '@weco/common/utils/classnames'; import { SearchResults } from '@weco/content/services/iiif/types/search/v3'; import ItemViewerContext, { RotatedImage, -} from '../ItemViewerContext/ItemViewerContext'; +} from '@weco/content/components/ItemViewerContext/ItemViewerContext'; import ImageViewer from './ImageViewer'; import { TransformedCanvas } from '@weco/content/types/manifest'; import { fetchCanvasOcr } from '@weco/content/services/iiif/fetch/canvasOcr'; diff --git a/content/webapp/components/IIIFViewer/MultipleManifestList.tsx b/content/webapp/components/IIIFViewer/MultipleManifestList.tsx index 32ec9aedd3..2c164d78ed 100644 --- a/content/webapp/components/IIIFViewer/MultipleManifestList.tsx +++ b/content/webapp/components/IIIFViewer/MultipleManifestList.tsx @@ -1,7 +1,7 @@ import { useContext, FunctionComponent } from 'react'; import NextLink from 'next/link'; -import { toLink as itemLink } from '../ItemLink'; -import ItemViewerContext from '../ItemViewerContext/ItemViewerContext'; +import { toLink as itemLink } from '@weco/content/components/ItemLink'; +import ItemViewerContext from '@weco/content/components/ItemViewerContext/ItemViewerContext'; import { volumesNavigationLabel } from '@weco/content/text/aria-labels'; import { getMultiVolumeLabel } from '@weco/content/utils/iiif/v3'; import { queryParamToArrayIndex } from '.'; diff --git a/content/webapp/components/IIIFViewer/NoScriptImage.tsx b/content/webapp/components/IIIFViewer/NoScriptImage.tsx index cb7dbb0e57..17ee8a7820 100644 --- a/content/webapp/components/IIIFViewer/NoScriptImage.tsx +++ b/content/webapp/components/IIIFViewer/NoScriptImage.tsx @@ -1,6 +1,6 @@ import { useContext } from 'react'; import styled from 'styled-components'; -import ItemViewerContext from '../ItemViewerContext/ItemViewerContext'; +import ItemViewerContext from '@weco/content/components/ItemViewerContext/ItemViewerContext'; import IIIFViewerImage from './IIIFViewerImage'; import { Thumbnails } from '@weco/content/components/IIIFViewer/Thumbnails'; import { diff --git a/content/webapp/components/IIIFViewer/Paginators.tsx b/content/webapp/components/IIIFViewer/Paginators.tsx index 13e4632333..823bfeef43 100644 --- a/content/webapp/components/IIIFViewer/Paginators.tsx +++ b/content/webapp/components/IIIFViewer/Paginators.tsx @@ -1,7 +1,7 @@ import { useContext } from 'react'; import styled from 'styled-components'; import { toLink as itemLink } from '@weco/content/components/ItemLink'; -import ItemViewerContext from '../ItemViewerContext/ItemViewerContext'; +import ItemViewerContext from '@weco/content/components/ItemViewerContext/ItemViewerContext'; import Space from '@weco/common/views/components/styled/Space'; import Rotator from '@weco/common/views/components/styled/Rotator'; import Control from '@weco/common/views/components/Control'; @@ -61,7 +61,6 @@ const PaginatorButtons = ({ ); }; -/* eslint-enable react/display-name */ export const thumbnailsPageSize = 6; diff --git a/content/webapp/components/IIIFViewer/Thumbnails.tsx b/content/webapp/components/IIIFViewer/Thumbnails.tsx index e6176290be..b16020f4c7 100644 --- a/content/webapp/components/IIIFViewer/Thumbnails.tsx +++ b/content/webapp/components/IIIFViewer/Thumbnails.tsx @@ -1,11 +1,11 @@ import NextLink from 'next/link'; import { useContext } from 'react'; -import ItemViewerContext from '../ItemViewerContext/ItemViewerContext'; +import styled from 'styled-components'; +import ItemViewerContext from '@weco/content/components/ItemViewerContext/ItemViewerContext'; import { toLink as itemLink } from '@weco/content/components/ItemLink'; import { thumbnailsPageSize } from './Paginators'; import { queryParamToArrayIndex } from '.'; import IIIFCanvasThumbnail from './IIIFCanvasThumbnail'; -import styled from 'styled-components'; const ThumbnailsContainer = styled.div` display: flex; diff --git a/content/webapp/components/IIIFViewer/ViewerBottomBar.tsx b/content/webapp/components/IIIFViewer/ViewerBottomBar.tsx index 06bc2e05ff..aad666a0c5 100644 --- a/content/webapp/components/IIIFViewer/ViewerBottomBar.tsx +++ b/content/webapp/components/IIIFViewer/ViewerBottomBar.tsx @@ -1,11 +1,11 @@ // https://stackoverflow.com/questions/25993861/how-do-i-get-typescript-to-stop-complaining-about-functions-it-doesnt-know-abou /* eslint-disable dot-notation */ +import { FunctionComponent, useContext } from 'react'; import styled from 'styled-components'; import Icon from '@weco/common/views/components/Icon/Icon'; import Space from '@weco/common/views/components/styled/Space'; -import { FunctionComponent, useContext } from 'react'; import { AppContext } from '@weco/common/views/components/AppContext/AppContext'; -import ItemViewerContext from '../ItemViewerContext/ItemViewerContext'; +import ItemViewerContext from '@weco/content/components/ItemViewerContext/ItemViewerContext'; import useIsFullscreenEnabled from '@weco/content/hooks/useIsFullscreenEnabled'; import ToolbarSegmentedControl from '@weco/content/components/ToolbarSegmentedControl/ToolbarSegmentedControl'; import { ShameButton } from './ViewerTopBar'; diff --git a/content/webapp/components/IIIFViewer/ViewerSidebar.tsx b/content/webapp/components/IIIFViewer/ViewerSidebar.tsx index de00a387e9..9a041fad31 100644 --- a/content/webapp/components/IIIFViewer/ViewerSidebar.tsx +++ b/content/webapp/components/IIIFViewer/ViewerSidebar.tsx @@ -7,18 +7,18 @@ import { } from 'react'; import { DigitalLocation } from '@weco/common/model/catalogue'; import NextLink from 'next/link'; -import WorkLink from '../WorkLink'; -import Icon from '@weco/common/views/components/Icon/Icon'; import styled from 'styled-components'; +import WorkLink from '@weco/content/components/WorkLink'; +import Icon from '@weco/common/views/components/Icon/Icon'; import Space from '@weco/common/views/components/styled/Space'; import { classNames, font } from '@weco/common/utils/classnames'; import LinkLabels from '@weco/content/components/LinkLabels/LinkLabels'; import { getCatalogueLicenseData } from '@weco/common/utils/licenses'; import ViewerStructures from './ViewerStructures'; -import ItemViewerContext from '../ItemViewerContext/ItemViewerContext'; +import ItemViewerContext from '@weco/content/components/ItemViewerContext/ItemViewerContext'; import MultipleManifestList from './MultipleManifestList'; -import IIIFSearchWithin from '../IIIFSearchWithin/IIIFSearchWithin'; -import WorkTitle from '../WorkTitle/WorkTitle'; +import IIIFSearchWithin from '@weco/content/components/IIIFSearchWithin/IIIFSearchWithin'; +import WorkTitle from '@weco/content/components/WorkTitle/WorkTitle'; import { removeTrailingFullStop, toHtmlId } from '@weco/content/utils/string'; import { arrow, chevron } from '@weco/common/icons'; import { getMultiVolumeLabel } from '@weco/content/utils/iiif/v3'; diff --git a/content/webapp/components/IIIFViewer/ViewerStructures.tsx b/content/webapp/components/IIIFViewer/ViewerStructures.tsx index d4dacf4a08..460a6c9a1c 100644 --- a/content/webapp/components/IIIFViewer/ViewerStructures.tsx +++ b/content/webapp/components/IIIFViewer/ViewerStructures.tsx @@ -1,10 +1,12 @@ import { useContext, FunctionComponent } from 'react'; +import styled from 'styled-components'; +import NextLink from 'next/link'; +import { Manifest } from '@iiif/presentation-3'; import ItemViewerContext, { Query, -} from '../ItemViewerContext/ItemViewerContext'; +} from '@weco/content/components/ItemViewerContext/ItemViewerContext'; import { font } from '@weco/common/utils/classnames'; import Space from '@weco/common/views/components/styled/Space'; -import styled from 'styled-components'; import { getEnFromInternationalString, isCanvas, @@ -12,7 +14,6 @@ import { } from '@weco/content/utils/iiif/v3'; import PlainList from '@weco/common/views/components/styled/PlainList'; import { toLink as itemLink } from '@weco/content/components/ItemLink'; -import NextLink from 'next/link'; import { arrayIndexToQueryParam } from '.'; import { thumbnailsPageSize } from '@weco/content/components/IIIFViewer/Paginators'; import { @@ -20,7 +21,6 @@ import { WorkBasic, } from '@weco/content/services/wellcome/catalogue/types'; import ConditionalWrapper from '@weco/common/views/components/ConditionalWrapper/ConditionalWrapper'; -import { Manifest } from '@iiif/presentation-3'; import { TransformedCanvas } from '@weco/content/types/manifest'; export const List = styled(PlainList)` diff --git a/content/webapp/components/IIIFViewer/ViewerTopBar.tsx b/content/webapp/components/IIIFViewer/ViewerTopBar.tsx index 96e9d623a7..adbfc5fb98 100644 --- a/content/webapp/components/IIIFViewer/ViewerTopBar.tsx +++ b/content/webapp/components/IIIFViewer/ViewerTopBar.tsx @@ -1,13 +1,13 @@ // https://stackoverflow.com/questions/25993861/how-do-i-get-typescript-to-stop-complaining-about-functions-it-doesnt-know-abou /* eslint-disable dot-notation */ import styled from 'styled-components'; +import { FunctionComponent, useContext } from 'react'; import { font } from '@weco/common/utils/classnames'; import Download from '@weco/content/components/Download/Download'; import Icon from '@weco/common/views/components/Icon/Icon'; import Space from '@weco/common/views/components/styled/Space'; -import { FunctionComponent, useContext } from 'react'; import { AppContext } from '@weco/common/views/components/AppContext/AppContext'; -import ItemViewerContext from '../ItemViewerContext/ItemViewerContext'; +import ItemViewerContext from '@weco/content/components/ItemViewerContext/ItemViewerContext'; import { DigitalLocation } from '@weco/common/model/catalogue'; import useIsFullscreenEnabled from '@weco/content/hooks/useIsFullscreenEnabled'; import ToolbarSegmentedControl from '@weco/content/components/ToolbarSegmentedControl/ToolbarSegmentedControl'; diff --git a/content/webapp/components/IIIFViewer/ZoomedImage.tsx b/content/webapp/components/IIIFViewer/ZoomedImage.tsx index a855878089..43753b4e1b 100644 --- a/content/webapp/components/IIIFViewer/ZoomedImage.tsx +++ b/content/webapp/components/IIIFViewer/ZoomedImage.tsx @@ -11,7 +11,7 @@ import styled from 'styled-components'; import { DigitalLocation } from '@weco/common/model/catalogue'; import Control from '@weco/common/views/components/Control'; import Space from '@weco/common/views/components/styled/Space'; -import ItemViewerContext from '../ItemViewerContext/ItemViewerContext'; +import ItemViewerContext from '@weco/content/components/ItemViewerContext/ItemViewerContext'; import { cross, minus, plus, rotateRight } from '@weco/common/icons'; import { convertRequestUriToInfoUri } from '@weco/content/utils/iiif/convert-iiif-uri'; import { queryParamToArrayIndex } from '.'; diff --git a/content/webapp/components/ImageCard/ImageCard.tsx b/content/webapp/components/ImageCard/ImageCard.tsx index f9d863c2e7..fa09efbcd2 100644 --- a/content/webapp/components/ImageCard/ImageCard.tsx +++ b/content/webapp/components/ImageCard/ImageCard.tsx @@ -2,12 +2,10 @@ import { FunctionComponent, SyntheticEvent, useContext } from 'react'; import NextLink from 'next/link'; import styled from 'styled-components'; import { usePathname } from 'next/navigation'; - import { ImageType } from '@weco/common/model/image'; - -import IIIFImage from '../IIIFImage/IIIFImage'; +import IIIFImage from '@weco/content/components/IIIFImage/IIIFImage'; import { AppContext } from '@weco/common/views/components/AppContext/AppContext'; -import { toLink as imageLink } from '../ImageLink'; +import { toLink as imageLink } from '@weco/content/components/ImageLink'; type Props = { id: string; diff --git a/content/webapp/components/ImageEndpointSearchResults/ImageEndpointSearchResults.tsx b/content/webapp/components/ImageEndpointSearchResults/ImageEndpointSearchResults.tsx index 4ce2d50060..83c0aa19c8 100644 --- a/content/webapp/components/ImageEndpointSearchResults/ImageEndpointSearchResults.tsx +++ b/content/webapp/components/ImageEndpointSearchResults/ImageEndpointSearchResults.tsx @@ -10,13 +10,11 @@ import PhotoAlbum, { RenderRowContainer, } from 'react-photo-album'; import styled from 'styled-components'; - import { hexToRgb } from '@weco/content/utils/convert-colors'; import { Image } from '@weco/content/services/wellcome/catalogue/types'; import { AppContext } from '@weco/common/views/components/AppContext/AppContext'; - -import ExpandedImage from '../ExpandedImage/ExpandedImage'; -import ImageCard from '../ImageCard/ImageCard'; +import ExpandedImage from '@weco/content/components/ExpandedImage/ExpandedImage'; +import ImageCard from '@weco/content/components/ImageCard/ImageCard'; import Modal from '@weco/common/views/components/Modal/Modal'; import PlainList from '@weco/common/views/components/styled/PlainList'; import Space from '@weco/common/views/components/styled/Space'; diff --git a/content/webapp/components/ImageGallery/index.tsx b/content/webapp/components/ImageGallery/index.tsx index 1bc2d033f6..3359b0e8cc 100644 --- a/content/webapp/components/ImageGallery/index.tsx +++ b/content/webapp/components/ImageGallery/index.tsx @@ -8,7 +8,7 @@ import { import { font } from '@weco/common/utils/classnames'; import { CaptionedImage as CaptionedImageProps } from '@weco/common/model/captioned-image'; import { repeatingLsBlack } from '@weco/common/utils/backgrounds'; -import CaptionedImage from '../CaptionedImage/CaptionedImage'; +import CaptionedImage from '@weco/content/components/CaptionedImage/CaptionedImage'; import { WobblyEdge } from '@weco/common/views/components/WobblyEdge'; import Button from '@weco/common/views/components/Buttons'; import Control from '@weco/common/views/components/Control'; @@ -20,11 +20,11 @@ import Layout, { } from '@weco/common/views/components/Layout'; import Space from '@weco/common/views/components/styled/Space'; import { cross, gallery } from '@weco/common/icons'; -import { PageBackgroundContext } from '../ContentPage/ContentPage'; +import { PageBackgroundContext } from '@weco/content/components/ContentPage/ContentPage'; import Tasl from '@weco/common/views/components/Tasl/Tasl'; import ComicPreviousNext, { Props as ComicPreviousNextProps, -} from '../ComicPreviousNext/ComicPreviousNext'; +} from '@weco/content/components/ComicPreviousNext/ComicPreviousNext'; import PrismicImage from '@weco/common/views/components/PrismicImage/PrismicImage'; import { sizes } from '@weco/common/views/themes/config'; import { diff --git a/content/webapp/components/ImagePlaceholder/ImagePlaceholder.tsx b/content/webapp/components/ImagePlaceholder/ImagePlaceholder.tsx index a4313a1a55..ec1032d7f1 100644 --- a/content/webapp/components/ImagePlaceholder/ImagePlaceholder.tsx +++ b/content/webapp/components/ImagePlaceholder/ImagePlaceholder.tsx @@ -1,5 +1,5 @@ import { FunctionComponent } from 'react'; -import type { ColorSelection } from '../../types/color-selections'; +import type { ColorSelection } from '@weco/content/types/color-selections'; import { transparentGif, repeatingLs } from '@weco/common/utils/backgrounds'; import styled from 'styled-components'; diff --git a/content/webapp/components/Installation/Installation.tsx b/content/webapp/components/Installation/Installation.tsx index 4ebe43b011..e5c700b422 100644 --- a/content/webapp/components/Installation/Installation.tsx +++ b/content/webapp/components/Installation/Installation.tsx @@ -1,17 +1,20 @@ import { FunctionComponent, useEffect, useState } from 'react'; -import DateAndStatusIndicator from '../DateAndStatusIndicator/DateAndStatusIndicator'; -import StatusIndicator from '../../components/StatusIndicator/StatusIndicator'; +import DateAndStatusIndicator from '@weco/content/components/DateAndStatusIndicator/DateAndStatusIndicator'; +import StatusIndicator from '@weco/content/components/StatusIndicator/StatusIndicator'; import HeaderBackground from '@weco/common/views/components/HeaderBackground/HeaderBackground'; import PageHeader from '@weco/common/views/components/PageHeader/PageHeader'; -import { getFeaturedMedia } from '../../utils/page-header'; -import { Exhibition as InstallationType } from '../../types/exhibitions'; -import { AccessibilityServices, getInfoItems } from '../Exhibition/Exhibition'; -import InfoBox from '../InfoBox/InfoBox'; +import { getFeaturedMedia } from '@weco/content/utils/page-header'; +import { Exhibition as InstallationType } from '@weco/content/types/exhibitions'; +import { + AccessibilityServices, + getInfoItems, +} from '@weco/content/components/Exhibition/Exhibition'; +import InfoBox from '@weco/content/components/InfoBox/InfoBox'; import { isPast } from '@weco/common/utils/dates'; -import Body from '../Body/Body'; -import ContentPage from '../ContentPage/ContentPage'; +import Body from '@weco/content/components/Body/Body'; +import ContentPage from '@weco/content/components/ContentPage/ContentPage'; import { isNotUndefined } from '@weco/common/utils/type-guards'; -import { fetchExhibitExhibition } from '../../services/prismic/fetch/exhibitions'; +import { fetchExhibitExhibition } from '@weco/content/services/prismic/fetch/exhibitions'; import { createScreenreaderLabel } from '@weco/common/utils/telephone-numbers'; type Props = { diff --git a/content/webapp/components/ItemRequestModal/RequestDialog.tsx b/content/webapp/components/ItemRequestModal/RequestDialog.tsx index b39173a674..c5267d70ce 100644 --- a/content/webapp/components/ItemRequestModal/RequestDialog.tsx +++ b/content/webapp/components/ItemRequestModal/RequestDialog.tsx @@ -1,14 +1,14 @@ import { FunctionComponent, FormEvent, useEffect } from 'react'; +import styled from 'styled-components'; import { allowedRequests } from '@weco/common/values/requests'; import { font } from '@weco/common/utils/classnames'; import Space from '@weco/common/views/components/styled/Space'; -import RequestingDayPicker from '../RequestingDayPicker/RequestingDayPicker'; +import RequestingDayPicker from '@weco/content/components/RequestingDayPicker/RequestingDayPicker'; import Button, { ButtonTypes } from '@weco/common/views/components/Buttons'; import { PhysicalItem, Work, } from '@weco/content/services/wellcome/catalogue/types'; -import styled from 'styled-components'; import { CTAs, CurrentRequests, Header } from './common'; import { themeValues } from '@weco/common/views/themes/config'; import { dateAsValue, dateFromValue } from './format-date'; diff --git a/content/webapp/components/ItemViewerContext/ItemViewerContext.tsx b/content/webapp/components/ItemViewerContext/ItemViewerContext.tsx index 28d8a0607e..6a1583db94 100644 --- a/content/webapp/components/ItemViewerContext/ItemViewerContext.tsx +++ b/content/webapp/components/ItemViewerContext/ItemViewerContext.tsx @@ -5,7 +5,7 @@ import { } from '@weco/content/services/wellcome/catalogue/types'; import { SearchResults } from '@weco/content/services/iiif/types/search/v3'; import { Canvas, Manifest } from '@iiif/presentation-3'; -import { TransformedManifest } from '../../types/manifest'; +import { TransformedManifest } from '@weco/content/types/manifest'; export type RotatedImage = { canvas: number; rotation: number }; diff --git a/content/webapp/components/MediaObject/MediaObject.tsx b/content/webapp/components/MediaObject/MediaObject.tsx index 3afca34f36..3c9d6bd312 100644 --- a/content/webapp/components/MediaObject/MediaObject.tsx +++ b/content/webapp/components/MediaObject/MediaObject.tsx @@ -1,13 +1,13 @@ import { FunctionComponent } from 'react'; +import styled from 'styled-components'; +import * as prismic from '@prismicio/client'; import PrismicImage from '@weco/common/views/components/PrismicImage/PrismicImage'; import MediaObjectBase, { HasImageProps, -} from '../MediaObjectBase/MediaObjectBase'; +} from '@weco/content/components/MediaObjectBase/MediaObjectBase'; import { getCrop, ImageType } from '@weco/common/model/image'; import PrismicHtmlBlock from '@weco/common/views/components/PrismicHtmlBlock/PrismicHtmlBlock'; -import styled from 'styled-components'; import { grid, font } from '@weco/common/utils/classnames'; -import * as prismic from '@prismicio/client'; import { gridSize12 } from '@weco/common/views/components/Layout'; export type Props = { diff --git a/content/webapp/components/MediaObjectBase/MediaObjectBase.test.tsx b/content/webapp/components/MediaObjectBase/MediaObjectBase.test.tsx index 4a72772a4e..afe144f4b0 100644 --- a/content/webapp/components/MediaObjectBase/MediaObjectBase.test.tsx +++ b/content/webapp/components/MediaObjectBase/MediaObjectBase.test.tsx @@ -157,9 +157,7 @@ describe('MediaObjectBase', () => { /> ); expect( - /* eslint-disable @typescript-eslint/no-non-null-assertion */ component.container.textContent!.includes( - /* eslint-enable @typescript-eslint/no-non-null-assertion */ 'Keep your nose and mouth covered, unless you’re exempt' ) ); diff --git a/content/webapp/components/MediaObjectBase/MediaObjectBase.tsx b/content/webapp/components/MediaObjectBase/MediaObjectBase.tsx index 0e7f9528ea..7501bc89fa 100644 --- a/content/webapp/components/MediaObjectBase/MediaObjectBase.tsx +++ b/content/webapp/components/MediaObjectBase/MediaObjectBase.tsx @@ -4,17 +4,17 @@ import { ReactElement, ReactNode, } from 'react'; +import styled from 'styled-components'; import { grid, font, classNames } from '@weco/common/utils/classnames'; -import EventDateRange from '../EventDateRange'; -import StatusIndicator from '../StatusIndicator/StatusIndicator'; +import EventDateRange from '@weco/content/components/EventDateRange'; +import StatusIndicator from '@weco/content/components/StatusIndicator/StatusIndicator'; import LabelsList from '@weco/common/views/components/LabelsList/LabelsList'; -import ImagePlaceholder from '../ImagePlaceholder/ImagePlaceholder'; -import PartNumberIndicator from '../PartNumberIndicator/PartNumberIndicator'; +import ImagePlaceholder from '@weco/content/components/ImagePlaceholder/ImagePlaceholder'; +import PartNumberIndicator from '@weco/content/components/PartNumberIndicator/PartNumberIndicator'; import ImageType from '@weco/common/views/components/PrismicImage/PrismicImage'; -import { ColorSelection } from '../../types/color-selections'; +import { ColorSelection } from '@weco/content/types/color-selections'; import Space from '@weco/common/views/components/styled/Space'; import { Label } from '@weco/common/model/labels'; -import styled from 'styled-components'; import { gridSize12 } from '@weco/common/views/components/Layout'; export type Props = { diff --git a/content/webapp/components/OnThisPageAnchors/OnThisPageAnchors.tsx b/content/webapp/components/OnThisPageAnchors/OnThisPageAnchors.tsx index bf2388fa31..3b97a853e3 100644 --- a/content/webapp/components/OnThisPageAnchors/OnThisPageAnchors.tsx +++ b/content/webapp/components/OnThisPageAnchors/OnThisPageAnchors.tsx @@ -1,7 +1,7 @@ import PlainList from '@weco/common/views/components/styled/PlainList'; import Space from '@weco/common/views/components/styled/Space'; import styled from 'styled-components'; -import { Link } from '../../types/link'; +import { Link } from '@weco/content/types/link'; import { font } from '@weco/common/utils/classnames'; import { FunctionComponent } from 'react'; diff --git a/content/webapp/components/PhysicalItemDetails/PhysicalItemDetails.tsx b/content/webapp/components/PhysicalItemDetails/PhysicalItemDetails.tsx index 1af819cc09..a0817efbe6 100644 --- a/content/webapp/components/PhysicalItemDetails/PhysicalItemDetails.tsx +++ b/content/webapp/components/PhysicalItemDetails/PhysicalItemDetails.tsx @@ -8,7 +8,7 @@ import { import styled from 'styled-components'; import Space from '@weco/common/views/components/styled/Space'; import { font } from '@weco/common/utils/classnames'; -import IsArchiveContext from '../IsArchiveContext/IsArchiveContext'; +import IsArchiveContext from '@weco/content/components/IsArchiveContext/IsArchiveContext'; import { PhysicalItem, Work, @@ -18,11 +18,11 @@ import { getLocationShelfmark, getFirstPhysicalLocation, getFirstAccessCondition, -} from '../../utils/works'; -import ItemRequestModal from '../ItemRequestModal/ItemRequestModal'; +} from '@weco/content/utils/works'; +import ItemRequestModal from '@weco/content/components/ItemRequestModal/ItemRequestModal'; import StackingTable from '@weco/common/views/components/StackingTable/StackingTable'; import { useUser } from '@weco/common/views/components/UserProvider/UserProvider'; -import { itemIsRequestable } from '../../utils/requesting'; +import { itemIsRequestable } from '@weco/content/utils/requesting'; import Placeholder from '@weco/content/components/Placeholder/Placeholder'; import Button from '@weco/common/views/components/Buttons'; import { sierraAccessMethodtoNewLabel } from '@weco/common/data/microcopy'; diff --git a/content/webapp/components/PhysicalItems/PhysicalItems.tsx b/content/webapp/components/PhysicalItems/PhysicalItems.tsx index 85fb996f33..d4bb27e785 100644 --- a/content/webapp/components/PhysicalItems/PhysicalItems.tsx +++ b/content/webapp/components/PhysicalItems/PhysicalItems.tsx @@ -1,5 +1,5 @@ import { FunctionComponent, useEffect, useState } from 'react'; -import PhysicalItemDetails from '../PhysicalItemDetails/PhysicalItemDetails'; +import PhysicalItemDetails from '@weco/content/components/PhysicalItemDetails/PhysicalItemDetails'; import { PhysicalItem, Work, @@ -10,11 +10,11 @@ import { abortErrorHandler, } from '@weco/common/hooks/useAbortSignalEffect'; import { useUser } from '@weco/common/views/components/UserProvider/UserProvider'; -import { getItemsWithPhysicalLocation } from '../../utils/works'; +import { getItemsWithPhysicalLocation } from '@weco/content/utils/works'; import { itemIsRequestable, itemIsTemporarilyUnavailable, -} from '../../utils/requesting'; +} from '@weco/content/utils/requesting'; import { getWorkItemsClientSide } from '@weco/content/services/wellcome/catalogue/works'; type Props = { diff --git a/content/webapp/components/RequestingDayPicker/RequestingDayPicker.tsx b/content/webapp/components/RequestingDayPicker/RequestingDayPicker.tsx index 432e42df8c..9283e9f544 100644 --- a/content/webapp/components/RequestingDayPicker/RequestingDayPicker.tsx +++ b/content/webapp/components/RequestingDayPicker/RequestingDayPicker.tsx @@ -1,5 +1,5 @@ import { FunctionComponent } from 'react'; -import CalendarSelect from '../CalendarSelect/CalendarSelect'; +import CalendarSelect from '@weco/content/components/CalendarSelect/CalendarSelect'; import { AvailabilitySlot } from '@weco/content/services/wellcome/catalogue/types'; type Props = { diff --git a/content/webapp/components/SearchFilters/SearchFilters.Desktop.Modal.tsx b/content/webapp/components/SearchFilters/SearchFilters.Desktop.Modal.tsx index cf0a306db8..1a949f687d 100644 --- a/content/webapp/components/SearchFilters/SearchFilters.Desktop.Modal.tsx +++ b/content/webapp/components/SearchFilters/SearchFilters.Desktop.Modal.tsx @@ -15,7 +15,7 @@ import CheckboxRadio from '@weco/common/views/components/CheckboxRadio/CheckboxR import PlainList from '@weco/common/views/components/styled/PlainList'; import { LinkProps } from '@weco/common/model/link-props'; import DateRangeFilter from './SearchFilters.DateRangeFilter'; -import PaletteColorPicker from '../PaletteColorPicker'; +import PaletteColorPicker from '@weco/content/components/PaletteColorPicker'; import { font } from '@weco/common/utils/classnames'; import { BooleanFilter } from '@weco/content/components/SearchFilters/SearchFilters.BooleanFilter'; diff --git a/content/webapp/components/SearchResults/AsyncSearchResults.tsx b/content/webapp/components/SearchResults/AsyncSearchResults.tsx index 65cc01aaf7..4139864067 100644 --- a/content/webapp/components/SearchResults/AsyncSearchResults.tsx +++ b/content/webapp/components/SearchResults/AsyncSearchResults.tsx @@ -2,8 +2,8 @@ import { Component, ReactElement } from 'react'; import SearchResults from './SearchResults'; import { font, grid } from '@weco/common/utils/classnames'; import Space from '@weco/common/views/components/styled/Space'; -import { fetchMultiContentClientSide } from '../../services/prismic/fetch/multi-content'; -import { MultiContent } from '../../types/multi-content'; +import { fetchMultiContentClientSide } from '@weco/content/services/prismic/fetch/multi-content'; +import { MultiContent } from '@weco/content/types/multi-content'; export type Props = { title?: string; diff --git a/content/webapp/components/SearchResults/SearchResults.tsx b/content/webapp/components/SearchResults/SearchResults.tsx index b48488b120..b2bdea9a05 100644 --- a/content/webapp/components/SearchResults/SearchResults.tsx +++ b/content/webapp/components/SearchResults/SearchResults.tsx @@ -1,14 +1,14 @@ import { FunctionComponent } from 'react'; import styled from 'styled-components'; -import { MultiContent } from '../../types/multi-content'; +import { MultiContent } from '@weco/content/types/multi-content'; import { font, grid } from '@weco/common/utils/classnames'; import PrismicImage from '@weco/common/views/components/PrismicImage/PrismicImage'; -import CompactCard from '../CompactCard/CompactCard'; -import EventCard from '../EventCard/EventCard'; +import CompactCard from '@weco/content/components/CompactCard/CompactCard'; +import EventCard from '@weco/content/components/EventCard/EventCard'; import Space from '@weco/common/views/components/styled/Space'; -import ArticleCard from '../ArticleCard/ArticleCard'; +import ArticleCard from '@weco/content/components/ArticleCard/ArticleCard'; import { getCrop } from '@weco/common/model/image'; -import { Card } from '../../types/card'; +import { Card } from '@weco/content/types/card'; import PlainList from '@weco/common/views/components/styled/PlainList'; const Result = styled.li` @@ -64,9 +64,7 @@ const SearchResults: FunctionComponent = ({ // title of the item in the list. // // See https://github.com/wellcomecollection/wellcomecollection.org/issues/6007 - /* eslint-disable @typescript-eslint/no-non-null-assertion */ ...getCrop(item.image, 'square')!, - /* eslint-enable @typescript-eslint/no-non-null-assertion */ alt: '', }} sizes={{ @@ -98,9 +96,7 @@ const SearchResults: FunctionComponent = ({ // title of the item in the list. // // See https://github.com/wellcomecollection/wellcomecollection.org/issues/6007 - /* eslint-disable @typescript-eslint/no-non-null-assertion */ ...getCrop(item.image, 'square')!, - /* eslint-enable @typescript-eslint/no-non-null-assertion */ alt: '', }} sizes={{ @@ -133,9 +129,7 @@ const SearchResults: FunctionComponent = ({ // title of the item in the list. // // See https://github.com/wellcomecollection/wellcomecollection.org/issues/6007 - /* eslint-disable @typescript-eslint/no-non-null-assertion */ ...getCrop(item.image, 'square')!, - /* eslint-enable @typescript-eslint/no-non-null-assertion */ alt: '', }} sizes={{ @@ -168,9 +162,7 @@ const SearchResults: FunctionComponent = ({ // title of the item in the list. // // See https://github.com/wellcomecollection/wellcomecollection.org/issues/6007 - /* eslint-disable @typescript-eslint/no-non-null-assertion */ ...getCrop(item.cover, 'square')!, - /* eslint-enable @typescript-eslint/no-non-null-assertion */ alt: '', }} sizes={{ @@ -210,9 +202,7 @@ const SearchResults: FunctionComponent = ({ // title of the item in the list. // // See https://github.com/wellcomecollection/wellcomecollection.org/issues/6007 - /* eslint-disable @typescript-eslint/no-non-null-assertion */ ...getCrop(item.image, 'square')!, - /* eslint-enable @typescript-eslint/no-non-null-assertion */ alt: '', }} sizes={{ @@ -250,9 +240,7 @@ const SearchResults: FunctionComponent = ({ // title of the item in the list. // // See https://github.com/wellcomecollection/wellcomecollection.org/issues/6007 - /* eslint-disable @typescript-eslint/no-non-null-assertion */ ...getCrop(item.image, 'square')!, - /* eslint-enable @typescript-eslint/no-non-null-assertion */ alt: '', }} sizes={{ diff --git a/content/webapp/components/SeriesNavigation/SeriesNavigation.tsx b/content/webapp/components/SeriesNavigation/SeriesNavigation.tsx index 4e10944f68..a2058a12ca 100644 --- a/content/webapp/components/SeriesNavigation/SeriesNavigation.tsx +++ b/content/webapp/components/SeriesNavigation/SeriesNavigation.tsx @@ -1,10 +1,10 @@ import { FunctionComponent } from 'react'; import MoreLink from '@weco/content/components/MoreLink/MoreLink'; import SpacingComponent from '@weco/common/views/components/styled/SpacingComponent'; -import { Series } from '../../types/series'; -import { ArticleBasic } from '../../types/articles'; +import { Series } from '@weco/content/types/series'; +import { ArticleBasic } from '@weco/content/types/articles'; import Space from '@weco/common/views/components/styled/Space'; -import SearchResults from '../SearchResults/SearchResults'; +import SearchResults from '@weco/content/components/SearchResults/SearchResults'; import Layout, { gridSize8 } from '@weco/common/views/components/Layout'; type Props = { diff --git a/content/webapp/components/SimpleCardGrid/SimpleCardGrid.tsx b/content/webapp/components/SimpleCardGrid/SimpleCardGrid.tsx index 2a4f368805..c7182a40f9 100644 --- a/content/webapp/components/SimpleCardGrid/SimpleCardGrid.tsx +++ b/content/webapp/components/SimpleCardGrid/SimpleCardGrid.tsx @@ -1,12 +1,12 @@ +import { FunctionComponent } from 'react'; import { cssGrid, font } from '@weco/common/utils/classnames'; -import { Card as CardType } from '../../types/card'; -import Card from '../Card/Card'; +import { Card as CardType } from '@weco/content/types/card'; +import Card from '@weco/content/components/Card/Card'; import Layout, { gridSize12 } from '@weco/common/views/components/Layout'; import Space from '@weco/common/views/components/styled/Space'; import CssGridContainer from '@weco/common/views/components/styled/CssGridContainer'; -import FeaturedCard from '../FeaturedCard/FeaturedCard'; +import FeaturedCard from '@weco/content/components/FeaturedCard/FeaturedCard'; import { getCrop } from '@weco/common/model/image'; -import { FunctionComponent } from 'react'; type Props = { items: readonly CardType[]; diff --git a/content/webapp/components/StoryPromo/StoryPromo.tsx b/content/webapp/components/StoryPromo/StoryPromo.tsx index 2b86438df5..4cf80f0510 100644 --- a/content/webapp/components/StoryPromo/StoryPromo.tsx +++ b/content/webapp/components/StoryPromo/StoryPromo.tsx @@ -1,7 +1,7 @@ import { FunctionComponent } from 'react'; import styled from 'styled-components'; import { font } from '@weco/common/utils/classnames'; -import PartNumberIndicator from '../PartNumberIndicator/PartNumberIndicator'; +import PartNumberIndicator from '@weco/content/components/PartNumberIndicator/PartNumberIndicator'; import { CardOuter, CardBody, @@ -9,7 +9,7 @@ import { CardLabels, CardImageWrapper, CardTitle, -} from '../Card/Card'; +} from '@weco/content/components/Card/Card'; import PrismicImage from '@weco/common/views/components/PrismicImage/PrismicImage'; import { ArticleBasic, diff --git a/content/webapp/components/TagsGroup/TagsGroup.tsx b/content/webapp/components/TagsGroup/TagsGroup.tsx index 1df1d535b8..dd4b7971c7 100644 --- a/content/webapp/components/TagsGroup/TagsGroup.tsx +++ b/content/webapp/components/TagsGroup/TagsGroup.tsx @@ -1,7 +1,7 @@ import { FunctionComponent } from 'react'; import { font } from '@weco/common/utils/classnames'; import Space from '@weco/common/views/components/styled/Space'; -import Tags, { TagType } from '../Tags/Tags'; +import Tags, { TagType } from '@weco/content/components/Tags/Tags'; export type Props = { title: string | undefined; diff --git a/content/webapp/components/TextAndImageOrIcons/index.tsx b/content/webapp/components/TextAndImageOrIcons/index.tsx index 586fcea48d..9e04f7a8dc 100644 --- a/content/webapp/components/TextAndImageOrIcons/index.tsx +++ b/content/webapp/components/TextAndImageOrIcons/index.tsx @@ -1,11 +1,11 @@ import { FunctionComponent } from 'react'; import styled from 'styled-components'; +import * as prismic from '@prismicio/client'; import { ImageType } from '@weco/common/model/image'; -import CaptionedImage from '../CaptionedImage/CaptionedImage'; +import CaptionedImage from '@weco/content/components/CaptionedImage/CaptionedImage'; import PrismicHtmlBlock from '@weco/common/views/components/PrismicHtmlBlock/PrismicHtmlBlock'; -import * as prismic from '@prismicio/client'; import PrismicImage from '@weco/common/views/components/PrismicImage/PrismicImage'; -import { defaultSerializer } from '../HTMLSerializers/HTMLSerializers'; +import { defaultSerializer } from '@weco/content/components/HTMLSerializers/HTMLSerializers'; import Space from '@weco/common/views/components/styled/Space'; const MediaAndTextWrap = styled(Space).attrs({ diff --git a/content/webapp/components/WorkDetails/WorkDetails.Section.tsx b/content/webapp/components/WorkDetails/WorkDetails.Section.tsx index cc73a2cf67..4b37c4af60 100644 --- a/content/webapp/components/WorkDetails/WorkDetails.Section.tsx +++ b/content/webapp/components/WorkDetails/WorkDetails.Section.tsx @@ -3,7 +3,7 @@ import styled from 'styled-components'; import SpacingSection from '@weco/common/views/components/styled/SpacingSection'; import { font } from '@weco/common/utils/classnames'; import Space from '@weco/common/views/components/styled/Space'; -import IsArchiveContext from '../IsArchiveContext/IsArchiveContext'; +import IsArchiveContext from '@weco/content/components/IsArchiveContext/IsArchiveContext'; type Props = PropsWithChildren<{ headingText?: string; diff --git a/content/webapp/components/WorkDetails/index.tsx b/content/webapp/components/WorkDetails/index.tsx index 2f313d9b65..b0d6ed2aa2 100644 --- a/content/webapp/components/WorkDetails/index.tsx +++ b/content/webapp/components/WorkDetails/index.tsx @@ -1,8 +1,8 @@ import { FunctionComponent, useContext } from 'react'; import { usePathname } from 'next/navigation'; import { font } from '@weco/common/utils/classnames'; -import { toLink as worksLink } from '../SearchPagesLink/Works'; -import { toLink as imagesLink } from '../SearchPagesLink/Images'; +import { toLink as worksLink } from '@weco/content/components/SearchPagesLink/Works'; +import { toLink as imagesLink } from '@weco/content/components/SearchPagesLink/Images'; import { DigitalLocationInfo, getDownloadOptionsFromImageUrl, @@ -17,8 +17,8 @@ import WorkDetailsTags from './WorkDetails.Tags'; import WhereToFindIt from './WorkDetails.WhereToFind'; import WorkDetailsHoldings from './WorkDetails.Holdings'; import Button from '@weco/common/views/components/Buttons'; -import { toLink as itemLink } from '../ItemLink'; -import { toLink as conceptLink } from '../ConceptLink'; +import { toLink as itemLink } from '@weco/content/components/ItemLink'; +import { toLink as conceptLink } from '@weco/content/components/ConceptLink'; import Layout, { gridSize10 } from '@weco/common/views/components/Layout'; import { DigitalLocation } from '@weco/common/model/catalogue'; import { diff --git a/content/webapp/components/WorkHeader/WorkHeader.tsx b/content/webapp/components/WorkHeader/WorkHeader.tsx index e1f88eab42..854b3b39d8 100644 --- a/content/webapp/components/WorkHeader/WorkHeader.tsx +++ b/content/webapp/components/WorkHeader/WorkHeader.tsx @@ -1,15 +1,15 @@ import { FunctionComponent, useContext } from 'react'; +import styled from 'styled-components'; import { WorkBasic } from '@weco/content/services/wellcome/catalogue/types'; import { font, grid } from '@weco/common/utils/classnames'; import SpacingComponent from '@weco/common/views/components/styled/SpacingComponent'; import LinkLabels from '@weco/content/components/LinkLabels/LinkLabels'; import Space from '@weco/common/views/components/styled/Space'; import Number from '@weco/content/components/Number/Number'; -import styled from 'styled-components'; -import WorkTitle from '../WorkTitle/WorkTitle'; +import WorkTitle from '@weco/content/components/WorkTitle/WorkTitle'; import LabelsList from '@weco/common/views/components/LabelsList/LabelsList'; import Divider from '@weco/common/views/components/Divider/Divider'; -import IsArchiveContext from '../IsArchiveContext/IsArchiveContext'; +import IsArchiveContext from '@weco/content/components/IsArchiveContext/IsArchiveContext'; const WorkHeaderContainer = styled.div` display: flex; diff --git a/content/webapp/components/WorksSearchResult/WorksSearchResult.tsx b/content/webapp/components/WorksSearchResult/WorksSearchResult.tsx index 7665f97dad..9cc0cb83d0 100644 --- a/content/webapp/components/WorksSearchResult/WorksSearchResult.tsx +++ b/content/webapp/components/WorksSearchResult/WorksSearchResult.tsx @@ -1,17 +1,11 @@ import { FunctionComponent } from 'react'; - -// Types +import { usePathname } from 'next/navigation'; import { DigitalLocation } from '@weco/common/model/catalogue'; import { WorkBasic } from '@weco/content/services/wellcome/catalogue/types'; - -// Helpers/Utils import { convertIiifImageUri } from '@weco/common/utils/convert-image-uri'; -import { usePathname } from 'next/navigation'; - -// Components import Space from '@weco/common/views/components/styled/Space'; -import WorkTitle from '../WorkTitle/WorkTitle'; -import WorkLink from '../WorkLink'; +import WorkTitle from '@weco/content/components/WorkTitle/WorkTitle'; +import WorkLink from '@weco/content/components/WorkLink'; import LabelsList from '@weco/common/views/components/LabelsList/LabelsList'; import { Container, diff --git a/content/webapp/components/WorksSearchResults/WorksSearchResults.tsx b/content/webapp/components/WorksSearchResults/WorksSearchResults.tsx index 14fb7a235f..ef3a268ca2 100644 --- a/content/webapp/components/WorksSearchResults/WorksSearchResults.tsx +++ b/content/webapp/components/WorksSearchResults/WorksSearchResults.tsx @@ -1,6 +1,6 @@ import { FunctionComponent } from 'react'; import styled from 'styled-components'; -import WorksSearchResult from '../WorksSearchResult/WorksSearchResult'; +import WorksSearchResult from '@weco/content/components/WorksSearchResult/WorksSearchResult'; import { WorkBasic } from '@weco/content/services/wellcome/catalogue/types'; import PlainList from '@weco/common/views/components/styled/PlainList'; diff --git a/content/webapp/hooks/useInterval.ts b/content/webapp/hooks/useInterval.ts index 5057808a79..c1167d1b45 100644 --- a/content/webapp/hooks/useInterval.ts +++ b/content/webapp/hooks/useInterval.ts @@ -15,9 +15,7 @@ const useInterval = (callback: Callback, delay: number | undefined) => { useEffect(() => { function tick() { if (savedCallback.current) { - /* eslint-disable @typescript-eslint/no-non-null-assertion */ savedCallback.current!(); - /* eslint-enable @typescript-eslint/no-non-null-assertion */ } } if (isNotUndefined(delay)) { diff --git a/content/webapp/hooks/useOnScreen.ts b/content/webapp/hooks/useOnScreen.ts index 3e830e8390..8f4b4b37a7 100644 --- a/content/webapp/hooks/useOnScreen.ts +++ b/content/webapp/hooks/useOnScreen.ts @@ -17,9 +17,7 @@ export default function useOnScreen({ ([entry]) => { if (entry.isIntersecting) { const midPointOfRoot = - /* eslint-disable @typescript-eslint/no-non-null-assertion */ entry.rootBounds!.top + entry.rootBounds!.height / 2; - /* eslint-enable @typescript-eslint/no-non-null-assertion */ const targetTop = entry.boundingClientRect.top; const targetBottom = entry.boundingClientRect.bottom; const topPassedMidPoint = targetTop < midPointOfRoot; diff --git a/content/webapp/hooks/useTransformedIIIFImage.ts b/content/webapp/hooks/useTransformedIIIFImage.ts index 82c27e1972..607419d881 100644 --- a/content/webapp/hooks/useTransformedIIIFImage.ts +++ b/content/webapp/hooks/useTransformedIIIFImage.ts @@ -1,9 +1,9 @@ import { useEffect, useState } from 'react'; import { WorkBasic } from '@weco/content/services/wellcome/catalogue/types'; -import { TransformedImageJSON } from '../types/image'; -import { IIIFImage } from '../services/iiif/types/image/v2'; -import { fetchIIIFImageJson } from '../services/iiif/fetch/image'; -import { transformImageJSON } from '../services/iiif/transformers/image'; +import { TransformedImageJSON } from '@weco/content/types/image'; +import { IIIFImage } from '@weco/content/services/iiif/types/image/v2'; +import { fetchIIIFImageJson } from '@weco/content/services/iiif/fetch/image'; +import { transformImageJSON } from '@weco/content/services/iiif/transformers/image'; import { DigitalLocation } from '@weco/common/model/catalogue'; const imagePromises: Map> = new Map(); diff --git a/content/webapp/pages/guides/[guideId].tsx b/content/webapp/pages/guides/[guideId].tsx index 82df2f0447..aa7aa63bf1 100644 --- a/content/webapp/pages/guides/[guideId].tsx +++ b/content/webapp/pages/guides/[guideId].tsx @@ -26,7 +26,7 @@ import { transformGuide } from '@weco/content/services/prismic/transformers/guid import { makeLabels } from '@weco/common/views/components/LabelsList/LabelsList'; import { Guide as GuideType } from '@weco/content/types/guides'; import { fetchGuide } from '@weco/content/services/prismic/fetch/guides'; -import { getFeaturedPictureWithTasl } from '../pages/[pageId]'; +import { getFeaturedPictureWithTasl } from '@weco/content/pages/pages/[pageId]'; import { getBreadcrumbItems } from '@weco/common/views/components/Breadcrumb/Breadcrumb'; import { isVanityUrl } from '@weco/content/utils/urls'; diff --git a/content/webapp/pages/projects/[projectId].tsx b/content/webapp/pages/projects/[projectId].tsx index 281bde4602..2dcbf55e39 100644 --- a/content/webapp/pages/projects/[projectId].tsx +++ b/content/webapp/pages/projects/[projectId].tsx @@ -1,6 +1,6 @@ import { GetServerSideProps } from 'next'; import { FunctionComponent, ReactElement } from 'react'; -import { getFeaturedPictureWithTasl } from '../pages/[pageId]'; +import { getFeaturedPictureWithTasl } from '@weco/content/pages/pages/[pageId]'; import { AppErrorProps } from '@weco/common/services/app'; import { setCacheControl } from '@weco/content/utils/setCacheControl'; import { looksLikePrismicId } from '@weco/common/services/prismic'; diff --git a/content/webapp/pages/series/[seriesId].tsx b/content/webapp/pages/series/[seriesId].tsx index 99893d62a4..75ed47fb3d 100644 --- a/content/webapp/pages/series/[seriesId].tsx +++ b/content/webapp/pages/series/[seriesId].tsx @@ -41,7 +41,7 @@ import ArticleCard from '@weco/content/components/ArticleCard/ArticleCard'; import ArticleScheduleItemCard from '@weco/content/components/ArticleScheduleItemCard'; import { setCacheControl } from '@weco/content/utils/setCacheControl'; import Standfirst from '@weco/common/views/slices/Standfirst'; -import { fetchSeriesById } from '../../services/prismic/fetch/series'; +import { fetchSeriesById } from '@weco/content/services/prismic/fetch/series'; const SeriesItem = styled.div<{ $isFirst: boolean }>` border-top: ${props => diff --git a/content/webapp/services/iiif/fetch/canvasOcr.ts b/content/webapp/services/iiif/fetch/canvasOcr.ts index 21bc846a8a..84e88b9ce5 100644 --- a/content/webapp/services/iiif/fetch/canvasOcr.ts +++ b/content/webapp/services/iiif/fetch/canvasOcr.ts @@ -1,5 +1,5 @@ import { fetchJson } from '@weco/content/utils/http'; -import { TransformedCanvas } from '../../../types/manifest'; +import { TransformedCanvas } from '@weco/content/types/manifest'; export type TextJson = { items?: { diff --git a/content/webapp/services/iiif/fetch/image.ts b/content/webapp/services/iiif/fetch/image.ts index ef3dea5de9..928cd3c709 100644 --- a/content/webapp/services/iiif/fetch/image.ts +++ b/content/webapp/services/iiif/fetch/image.ts @@ -1,5 +1,5 @@ import { fetchJson } from '@weco/content/utils/http'; -import { IIIFImage } from '../types/image/v2'; +import { IIIFImage } from '@weco/content/services/iiif/types/image/v2'; export async function fetchIIIFImageJson( location: string diff --git a/content/webapp/services/iiif/transformers/canvasOcr.ts b/content/webapp/services/iiif/transformers/canvasOcr.ts index 950ae8588a..5d4d0e813e 100644 --- a/content/webapp/services/iiif/transformers/canvasOcr.ts +++ b/content/webapp/services/iiif/transformers/canvasOcr.ts @@ -1,5 +1,5 @@ import { missingAltTextMessage } from '@weco/content/services/wellcome/catalogue/works'; -import { TextJson } from '../fetch/canvasOcr'; +import { TextJson } from '@weco/content/services/iiif/fetch/canvasOcr'; export function transformCanvasOcr( textJson: TextJson | undefined diff --git a/content/webapp/services/iiif/transformers/image.ts b/content/webapp/services/iiif/transformers/image.ts index fae7c654da..4e085c687f 100644 --- a/content/webapp/services/iiif/transformers/image.ts +++ b/content/webapp/services/iiif/transformers/image.ts @@ -1,5 +1,5 @@ -import { IIIFImage } from '../types/image/v2'; -import { TransformedImageJSON } from '../../../types/image'; +import { IIIFImage } from '@weco/content/services/iiif/types/image/v2'; +import { TransformedImageJSON } from '@weco/content/types/image'; export function transformImageJSON(imageJSON: IIIFImage): TransformedImageJSON { return { width: imageJSON.width, diff --git a/content/webapp/services/prismic/fetch/events.ts b/content/webapp/services/prismic/fetch/events.ts index 6de2c24fa2..b1089d336d 100644 --- a/content/webapp/services/prismic/fetch/events.ts +++ b/content/webapp/services/prismic/fetch/events.ts @@ -1,10 +1,10 @@ +import * as prismic from '@prismicio/client'; import { clientSideFetcher, fetcher, GetServerSidePropsPrismicClient } from '.'; import { EventsDocument as RawEventsDocument, VisualStoriesDocument as RawVisualStoriesDocument, } from '@weco/common/prismicio-types'; -import { getEventFilters } from '../types/filters'; -import * as prismic from '@prismicio/client'; +import { getEventFilters } from '@weco/content/services/prismic/types/filters'; import { EventBasic } from '@weco/content/types/events'; import { fetchVisualStories } from '@weco/content/services/prismic/fetch/visual-stories'; import { diff --git a/content/webapp/services/prismic/fetch/exhibition-guides.ts b/content/webapp/services/prismic/fetch/exhibition-guides.ts index 1fae94584b..3f17734905 100644 --- a/content/webapp/services/prismic/fetch/exhibition-guides.ts +++ b/content/webapp/services/prismic/fetch/exhibition-guides.ts @@ -1,7 +1,10 @@ import * as prismic from '@prismicio/client'; import { fetcher, GetByTypeParams, GetServerSidePropsPrismicClient } from '.'; import { ExhibitionGuidesDocument as RawExhibitionGuidesDocument } from '@weco/common/prismicio-types'; -import { exhibitionsFetchLinks, contributorFetchLinks } from '../types'; +import { + exhibitionsFetchLinks, + contributorFetchLinks, +} from '@weco/content/services/prismic/types'; const fetchLinks = [...exhibitionsFetchLinks, ...contributorFetchLinks]; diff --git a/content/webapp/services/prismic/fetch/exhibition-highlight-tours.ts b/content/webapp/services/prismic/fetch/exhibition-highlight-tours.ts index 16dad47e59..7b2ca61102 100644 --- a/content/webapp/services/prismic/fetch/exhibition-highlight-tours.ts +++ b/content/webapp/services/prismic/fetch/exhibition-highlight-tours.ts @@ -1,7 +1,7 @@ import * as prismic from '@prismicio/client'; import { fetcher, GetByTypeParams, GetServerSidePropsPrismicClient } from '.'; import { ExhibitionHighlightToursDocument as RawExhibitionHighlightToursDocument } from '@weco/common/prismicio-types'; -import { exhibitionsFetchLinks } from '../types'; +import { exhibitionsFetchLinks } from '@weco/content/services/prismic/types'; const exhibitionHighlightToursFetcher = fetcher( diff --git a/content/webapp/services/prismic/fetch/exhibition-texts.ts b/content/webapp/services/prismic/fetch/exhibition-texts.ts index fb83f45e43..5ccd27e2e5 100644 --- a/content/webapp/services/prismic/fetch/exhibition-texts.ts +++ b/content/webapp/services/prismic/fetch/exhibition-texts.ts @@ -1,7 +1,7 @@ import * as prismic from '@prismicio/client'; import { fetcher, GetByTypeParams, GetServerSidePropsPrismicClient } from '.'; import { ExhibitionTextsDocument as RawExhibitionTextsDocument } from '@weco/common/prismicio-types'; -import { exhibitionsFetchLinks } from '../types'; +import { exhibitionsFetchLinks } from '@weco/content/services/prismic/types'; const exhibitionTextsFetcher = fetcher( 'exhibition-texts', diff --git a/content/webapp/services/prismic/fetch/exhibitions.test.ts b/content/webapp/services/prismic/fetch/exhibitions.test.ts index 2ba13d6247..f22f709a9b 100644 --- a/content/webapp/services/prismic/fetch/exhibitions.test.ts +++ b/content/webapp/services/prismic/fetch/exhibitions.test.ts @@ -1,7 +1,7 @@ import { createClient as createPrismicClient } from '@weco/common/services/prismic/fetch'; import { GetServerSidePropsPrismicClient } from '.'; import { fetchExhibitions } from './exhibitions'; -import { asText } from '../transformers'; +import { asText } from '@weco/content/services/prismic/transformers'; import mockToday from '@weco/common/test/utils/date-mocks'; const client: GetServerSidePropsPrismicClient = { diff --git a/content/webapp/services/prismic/fetch/exhibitions.ts b/content/webapp/services/prismic/fetch/exhibitions.ts index 06c41008d4..cb90720c0b 100644 --- a/content/webapp/services/prismic/fetch/exhibitions.ts +++ b/content/webapp/services/prismic/fetch/exhibitions.ts @@ -1,29 +1,12 @@ +import * as prismic from '@prismicio/client'; import { clientSideFetcher, fetcher, fetchFromClientSide, GetServerSidePropsPrismicClient, } from '.'; -import { ExhibitionRelatedContentPrismicDocument } from '@weco/content/services/prismic/types'; -import { - ExhibitionsDocument as RawExhibitionsDocument, - PagesDocument as RawPagesDocument, - VisualStoriesDocument as RawVisualStoriesDocument, -} from '@weco/common/prismicio-types'; -import { fetchPages } from './pages'; -import { fetchVisualStories } from './visual-stories'; -import { fetchExhibitionGuides } from '@weco/content/services/prismic/fetch/exhibition-guides'; -import { fetchExhibitionTexts } from '@weco/content/services/prismic/fetch/exhibition-texts'; -import { fetchExhibitionHighlightTours } from '@weco/content/services/prismic/fetch/exhibition-highlight-tours'; -import * as prismic from '@prismicio/client'; -import { eventAccessOptionsFields } from '../fetch-links'; -import { Period } from '@weco/common/types/periods'; -import { getExhibitionPeriodFilters } from '../types/filters'; -import { - Exhibition, - ExhibitionRelatedContent, -} from '@weco/content/types/exhibitions'; import { + ExhibitionRelatedContentPrismicDocument, articleFormatsFetchLinks, audienceFetchLinks, contributorFetchLinks, @@ -39,7 +22,24 @@ import { interpretationTypeFetchLinks, teamsFetchLinks, placesFetchLinks, -} from '../types'; +} from '@weco/content/services/prismic/types'; +import { + ExhibitionsDocument as RawExhibitionsDocument, + PagesDocument as RawPagesDocument, + VisualStoriesDocument as RawVisualStoriesDocument, +} from '@weco/common/prismicio-types'; +import { fetchPages } from './pages'; +import { fetchVisualStories } from './visual-stories'; +import { fetchExhibitionGuides } from '@weco/content/services/prismic/fetch/exhibition-guides'; +import { fetchExhibitionTexts } from '@weco/content/services/prismic/fetch/exhibition-texts'; +import { fetchExhibitionHighlightTours } from '@weco/content/services/prismic/fetch/exhibition-highlight-tours'; +import { eventAccessOptionsFields } from '@weco/content/services/prismic/fetch-links'; +import { Period } from '@weco/common/types/periods'; +import { getExhibitionPeriodFilters } from '@weco/content/services/prismic/types/filters'; +import { + Exhibition, + ExhibitionRelatedContent, +} from '@weco/content/types/exhibitions'; import { isFilledLinkToDocument } from '@weco/common/services/prismic/types'; const fetchLinks = [ diff --git a/content/webapp/services/prismic/fetch/series.ts b/content/webapp/services/prismic/fetch/series.ts index d721a7b9dd..f61ab48d16 100644 --- a/content/webapp/services/prismic/fetch/series.ts +++ b/content/webapp/services/prismic/fetch/series.ts @@ -4,7 +4,7 @@ import { contributorFetchLinks, seasonsFetchLinks, seriesFetchLinks, -} from '../types'; +} from '@weco/content/services/prismic/types'; import { SeriesDocument as RawSeriesDocument, WebcomicSeriesDocument as RawWebcomicSeriesDocument, diff --git a/content/webapp/services/prismic/transformers/articles.ts b/content/webapp/services/prismic/transformers/articles.ts index 76bfb6e709..7a8ed53993 100644 --- a/content/webapp/services/prismic/transformers/articles.ts +++ b/content/webapp/services/prismic/transformers/articles.ts @@ -1,4 +1,4 @@ -import { Article, ArticleBasic } from '../../../types/articles'; +import { Article, ArticleBasic } from '@weco/content/types/articles'; import { ArticlesDocument as RawArticlesDocument, SeriesDocument as RawSeriesDocument, @@ -13,10 +13,10 @@ import { } from '.'; import { isNotUndefined } from '@weco/common/utils/type-guards'; import { Label } from '@weco/common/model/labels'; -import { Series } from '../../../types/series'; +import { Series } from '@weco/content/types/series'; import { transformSeason } from './seasons'; import { transformSeries, transformSeriesToSeriesBasic } from './series'; -import { Format } from '../../../types/format'; +import { Format } from '@weco/content/types/format'; import { ArticleFormatId } from '@weco/content/data/content-format-ids'; import { transformContributors } from './contributors'; import { noAltTextBecausePromo } from './images'; diff --git a/content/webapp/services/prismic/transformers/books.ts b/content/webapp/services/prismic/transformers/books.ts index 4c25c7bd90..2772dde12b 100644 --- a/content/webapp/services/prismic/transformers/books.ts +++ b/content/webapp/services/prismic/transformers/books.ts @@ -1,4 +1,4 @@ -import { Book, BookBasic } from '../../../types/books'; +import { Book, BookBasic } from '@weco/content/types/books'; import { BooksDocument as RawBooksDocument, SeasonsDocument as RawSeasonsDocument, diff --git a/content/webapp/services/prismic/transformers/contributors.ts b/content/webapp/services/prismic/transformers/contributors.ts index 22bf1ea92f..397a99e9eb 100644 --- a/content/webapp/services/prismic/transformers/contributors.ts +++ b/content/webapp/services/prismic/transformers/contributors.ts @@ -3,7 +3,7 @@ import { WithContributors, isFilledLinkToOrganisationField, isFilledLinkToPersonField, -} from '../types'; +} from '@weco/content/services/prismic/types'; import { isFilledLinkToDocumentWithData, InferDataInterface, diff --git a/content/webapp/services/prismic/transformers/embeds.ts b/content/webapp/services/prismic/transformers/embeds.ts index b6c9ec3ab4..b34d133f89 100644 --- a/content/webapp/services/prismic/transformers/embeds.ts +++ b/content/webapp/services/prismic/transformers/embeds.ts @@ -1,17 +1,14 @@ import * as prismic from '@prismicio/client'; export function getVimeoEmbedUrl(embed: prismic.EmbedField): string { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const embedUrl = embed.html?.match(/src="([-a-zA-Z0-9://.?=_]+)?/)![1]; return `${embedUrl}?rel=0&dnt=1`; } export function getSoundCloudEmbedUrl(embed: prismic.EmbedField): string { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const apiUrl = embed.html!.match(/url=([^&]*)&/)!; - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const secretToken = embed.html!.match(/secret_token=([^"]*)"/); const secretTokenString = secretToken && secretToken[1] ? `%3Fsecret_token%3D${secretToken[1]}` : ''; @@ -26,7 +23,6 @@ export function getYouTubeEmbedUrl(embed: prismic.EmbedField): string { // // We want to add the query parameter ?rel=0 - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const embedUrl = embed.html!.match(/src="([^"]+)"?/)![1]; const embedUrlWithEnhancedPrivacy = embedUrl.replace( diff --git a/content/webapp/services/prismic/transformers/event-series.ts b/content/webapp/services/prismic/transformers/event-series.ts index 27fb43ca47..22189d4018 100644 --- a/content/webapp/services/prismic/transformers/event-series.ts +++ b/content/webapp/services/prismic/transformers/event-series.ts @@ -1,4 +1,7 @@ -import { EventSeries, EventSeriesBasic } from '../../../types/event-series'; +import { + EventSeries, + EventSeriesBasic, +} from '@weco/content/types/event-series'; import { EventSeriesDocument as RawEventSeriesDocument } from '@weco/common/prismicio-types'; import { transformGenericFields /*, asText */ } from '.'; // import { BackgroundTexture } from '@weco/common/model/background-texture'; diff --git a/content/webapp/services/prismic/transformers/events.test.ts b/content/webapp/services/prismic/transformers/events.test.ts index e12b582d7f..c6b8c07d72 100644 --- a/content/webapp/services/prismic/transformers/events.test.ts +++ b/content/webapp/services/prismic/transformers/events.test.ts @@ -1,10 +1,10 @@ -import { groupEventsByDay } from '../../../services/prismic/events'; +import { groupEventsByDay } from '@weco/content/services/prismic/events'; import { getLastEndTime, getEventbriteId, transformEventBasicTimes, } from './events'; -import { data as uiEventData } from '../../../components/CardGrid/DailyTourPromo'; +import { data as uiEventData } from '@weco/content/components/CardGrid/DailyTourPromo'; import { EventTime } from '@weco/content/types/events'; import { transformTimestamp } from '@weco/common/services/prismic/transformers'; diff --git a/content/webapp/services/prismic/transformers/exhibition-guides.ts b/content/webapp/services/prismic/transformers/exhibition-guides.ts index dc38c7e02c..59ce81d9e8 100644 --- a/content/webapp/services/prismic/transformers/exhibition-guides.ts +++ b/content/webapp/services/prismic/transformers/exhibition-guides.ts @@ -4,7 +4,7 @@ import { ExhibitionGuideComponent, ExhibitionGuideType, RelatedExhibition, -} from '../../../types/exhibition-guides'; +} from '@weco/content/types/exhibition-guides'; import { asRichText, asTitle } from '.'; import { ExhibitionGuidesDocument as RawExhibitionGuidesDocument, diff --git a/content/webapp/services/prismic/transformers/images.ts b/content/webapp/services/prismic/transformers/images.ts index fdda88e127..eaf67f2e4e 100644 --- a/content/webapp/services/prismic/transformers/images.ts +++ b/content/webapp/services/prismic/transformers/images.ts @@ -1,10 +1,10 @@ -import { Image, PromoSliceZone } from '../types'; +import * as prismic from '@prismicio/client'; +import { Image, PromoSliceZone } from '@weco/content/services/prismic/types'; import { CaptionedImage } from '@weco/common/model/captioned-image'; import isEmptyObj from '@weco/content/utils/is-empty-object'; import { Crop, ImageType } from '@weco/common/model/image'; -import { ImagePromo } from '../../../types/image-promo'; +import { ImagePromo } from '@weco/content/types/image-promo'; import { asRichText, asText } from '.'; -import * as prismic from '@prismicio/client'; import { transformImage } from '@weco/common/services/prismic/transformers/images'; export const placeHolderImage: ImageType = { @@ -53,9 +53,7 @@ export function transformPromoToCaptionedImage( ): CaptionedImage | undefined { // We could do more complicated checking here, but this is what we always use. if (frag.length > 0) { - /* eslint-disable @typescript-eslint/no-non-null-assertion */ const promo = frag[0]!; - /* eslint-enable @typescript-eslint/no-non-null-assertion */ return transformCaptionedImage(promo.primary, crop); } else { return undefined; diff --git a/content/webapp/services/prismic/transformers/json-ld.ts b/content/webapp/services/prismic/transformers/json-ld.ts index 8b52916efc..2affc90253 100644 --- a/content/webapp/services/prismic/transformers/json-ld.ts +++ b/content/webapp/services/prismic/transformers/json-ld.ts @@ -5,7 +5,7 @@ import { wellcomeCollectionGallery, } from '@weco/common/data/organization'; import { Organization } from '@weco/common/model/organization'; -import { getImageUrlAtSize } from '../types/images'; +import { getImageUrlAtSize } from '@weco/content/services/prismic/types/images'; import { Article } from '@weco/content/types/articles'; import { Contributor } from '@weco/content/types/contributors'; import { JsonLdObj } from '@weco/common/views/components/JsonLd/JsonLd'; diff --git a/content/webapp/services/prismic/transformers/multi-content.ts b/content/webapp/services/prismic/transformers/multi-content.ts index b8f0914b55..9fa1e0cbab 100644 --- a/content/webapp/services/prismic/transformers/multi-content.ts +++ b/content/webapp/services/prismic/transformers/multi-content.ts @@ -10,7 +10,7 @@ import { transformEventSeries } from './event-series'; import { transformEventBasic } from './events'; import { transformExhibition } from './exhibitions'; import { transformPage } from './pages'; -import { MultiContent } from '../../../types/multi-content'; +import { MultiContent } from '@weco/content/types/multi-content'; import { transformCard } from './card'; export function parseQuery(query: string): StructuredSearchQuery { diff --git a/content/webapp/services/prismic/transformers/pages.ts b/content/webapp/services/prismic/transformers/pages.ts index ca576f68fe..dbd6b61445 100644 --- a/content/webapp/services/prismic/transformers/pages.ts +++ b/content/webapp/services/prismic/transformers/pages.ts @@ -14,7 +14,7 @@ import { import { transformSeason } from './seasons'; import { dasherize } from '@weco/common/utils/grammar'; import flattenDeep from 'lodash.flattendeep'; -import { Link } from '../../../types/link'; +import { Link } from '@weco/content/types/link'; import { transformContributors } from './contributors'; import { isNotUndefined, isUndefined } from '@weco/common/utils/type-guards'; import { transformTimestamp } from '@weco/common/services/prismic/transformers'; diff --git a/content/webapp/services/prismic/transformers/places.ts b/content/webapp/services/prismic/transformers/places.ts index 4e9e4e59ff..e4fd0d6395 100644 --- a/content/webapp/services/prismic/transformers/places.ts +++ b/content/webapp/services/prismic/transformers/places.ts @@ -1,4 +1,4 @@ -import { Place } from '../../../types/places'; +import { Place } from '@weco/content/types/places'; import { transformGenericFields } from '.'; import { PlacesDocument as RawPlacesDocument } from '@weco/common/prismicio-types'; diff --git a/content/webapp/services/prismic/transformers/seasons.ts b/content/webapp/services/prismic/transformers/seasons.ts index 06a02c7361..d6f12ce708 100644 --- a/content/webapp/services/prismic/transformers/seasons.ts +++ b/content/webapp/services/prismic/transformers/seasons.ts @@ -1,6 +1,6 @@ import { transformTimestamp } from '@weco/common/services/prismic/transformers'; import { transformGenericFields } from '.'; -import { Season } from '../../../types/seasons'; +import { Season } from '@weco/content/types/seasons'; import { SeasonsDocument as RawSeasonsDocument } from '@weco/common/prismicio-types'; export function transformSeason(document: RawSeasonsDocument): Season { diff --git a/content/webapp/services/prismic/transformers/series.ts b/content/webapp/services/prismic/transformers/series.ts index 74993a8457..e74b322c67 100644 --- a/content/webapp/services/prismic/transformers/series.ts +++ b/content/webapp/services/prismic/transformers/series.ts @@ -1,5 +1,5 @@ import * as prismic from '@prismicio/client'; -import { Series, SeriesBasic } from '../../../types/series'; +import { Series, SeriesBasic } from '@weco/content/types/series'; import { StandfirstSlice as RawStandfirstSlice, SeriesDocument as RawSeriesDocument, @@ -7,7 +7,7 @@ import { } from '@weco/common/prismicio-types'; import { asTitle, transformGenericFields, transformSingleLevelGroup } from '.'; import { transformSeason } from './seasons'; -import { ArticleScheduleItem } from '../../../types/article-schedule-items'; +import { ArticleScheduleItem } from '@weco/content/types/article-schedule-items'; import { isNotUndefined } from '@weco/common/utils/type-guards'; import { transformContributors } from './contributors'; import { transformTimestamp } from '@weco/common/services/prismic/transformers'; diff --git a/content/webapp/services/prismic/transformers/stories-landing.ts b/content/webapp/services/prismic/transformers/stories-landing.ts index 38dd959c30..4ecb3b9a13 100644 --- a/content/webapp/services/prismic/transformers/stories-landing.ts +++ b/content/webapp/services/prismic/transformers/stories-landing.ts @@ -1,15 +1,18 @@ import { isNotUndefined } from '@weco/common/utils/type-guards'; import { StoriesLandingDocument as RawStoriesLandingDocument } from '@weco/common/prismicio-types'; import { StoriesLanding } from '@weco/content/types/stories-landing'; -import { transformBook, transformBookToBookBasic } from '../transformers/books'; +import { + transformBook, + transformBookToBookBasic, +} from '@weco/content/services/prismic/transformers/books'; import { transformSeries, transformSeriesToSeriesBasic, -} from '../transformers/series'; +} from '@weco/content/services/prismic/transformers/series'; import { transformArticle, transformArticleToArticleBasic, -} from '../transformers/articles'; +} from '@weco/content/services/prismic/transformers/articles'; import { isFilledLinkToDocumentWithData } from '@weco/common/services/prismic/types'; import { asRichText, asText } from '.'; diff --git a/content/webapp/services/prismic/transformers/whats-on.ts b/content/webapp/services/prismic/transformers/whats-on.ts index ea6f794e2a..0dd6d20a9a 100644 --- a/content/webapp/services/prismic/transformers/whats-on.ts +++ b/content/webapp/services/prismic/transformers/whats-on.ts @@ -1,10 +1,9 @@ import { clock } from '@weco/common/icons'; import { isNotUndefined } from '@weco/common/utils/type-guards'; import { collectionVenueId } from '@weco/common/data/hardcoded-ids'; - -import { isContentList } from '../../../types/body'; -import { FacilityPromo as FacilityPromoType } from '../../../types/facility-promo'; -import { Page as PageType } from '../../../types/pages'; +import { isContentList } from '@weco/content/types/body'; +import { FacilityPromo as FacilityPromoType } from '@weco/content/types/facility-promo'; +import { Page as PageType } from '@weco/content/types/pages'; import { transformContentListSlice } from '@weco/content/services/prismic/transformers/body'; /** The What's On page in Prismic includes a content list which is used to pick diff --git a/content/webapp/services/wellcome/catalogue/fixtures/works-aggregations.ts b/content/webapp/services/wellcome/catalogue/fixtures/works-aggregations.ts index 107a2eac34..8315f636a2 100644 --- a/content/webapp/services/wellcome/catalogue/fixtures/works-aggregations.ts +++ b/content/webapp/services/wellcome/catalogue/fixtures/works-aggregations.ts @@ -1,4 +1,4 @@ -import { WorkAggregations } from '../types'; +import { WorkAggregations } from '@weco/content/services/wellcome/catalogue/types'; const aggregations: { aggregations?: WorkAggregations } = { aggregations: { diff --git a/content/webapp/services/wellcome/catalogue/types/index.ts b/content/webapp/services/wellcome/catalogue/types/index.ts index 9b6a649233..8712757eb4 100644 --- a/content/webapp/services/wellcome/catalogue/types/index.ts +++ b/content/webapp/services/wellcome/catalogue/types/index.ts @@ -16,7 +16,7 @@ import { ImageAggregations, WorkAggregations, } from './aggregations'; -import { WellcomeResultList } from '../../index'; +import { WellcomeResultList } from '@weco/content/services/wellcome'; import { WorkBasic, toWorkBasic } from './work'; export type { diff --git a/content/webapp/services/wellcome/common/filters.test.ts b/content/webapp/services/wellcome/common/filters.test.ts index d84dcec1a8..fbe99c8729 100644 --- a/content/webapp/services/wellcome/common/filters.test.ts +++ b/content/webapp/services/wellcome/common/filters.test.ts @@ -1,5 +1,5 @@ -import worksAggregations from '../catalogue/fixtures/works-aggregations'; -import imagesAggregations from '../catalogue/fixtures/images-aggregations'; +import worksAggregations from '@weco/content/services/wellcome/catalogue/fixtures/works-aggregations'; +import imagesAggregations from '@weco/content/services/wellcome/catalogue/fixtures/images-aggregations'; import { CheckboxFilter, imagesFilters, worksFilters } from './filters'; import { fromQuery as fromWorksQuery } from '@weco/content/components/SearchPagesLink/Works'; import { diff --git a/content/webapp/services/wellcome/common/filters.ts b/content/webapp/services/wellcome/common/filters.ts index 3fe6bf6601..b3efd5dbef 100644 --- a/content/webapp/services/wellcome/common/filters.ts +++ b/content/webapp/services/wellcome/common/filters.ts @@ -3,7 +3,10 @@ import { ImageAggregations, WorkAggregations, } from '@weco/content/services/wellcome/catalogue/types'; -import { ArticleAggregations } from '@weco/content/services/wellcome/content/types'; +import { + ArticleAggregations, + EventAggregations, +} from '@weco/content/services/wellcome/content/types'; import { quoteVal } from '@weco/common/utils/csv'; import { toHtmlId } from '@weco/content/utils/string'; import { ImagesProps } from '@weco/content/components/SearchPagesLink/Images'; @@ -12,7 +15,6 @@ import { StoriesProps } from '@weco/content/components/SearchPagesLink/Stories'; import { isNotUndefined, isString } from '@weco/common/utils/type-guards'; import { formatNumber } from '@weco/common/utils/grammar'; import { EventsProps } from '@weco/content/components/SearchPagesLink/Events'; -import { EventAggregations } from '../content/types'; export type DateRangeFilter = { type: 'dateRange'; diff --git a/content/webapp/test/components/ItemRequestModal.test.tsx b/content/webapp/test/components/ItemRequestModal.test.tsx index 5673ccb496..7c1471490f 100644 --- a/content/webapp/test/components/ItemRequestModal.test.tsx +++ b/content/webapp/test/components/ItemRequestModal.test.tsx @@ -3,8 +3,8 @@ import { act } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { workWithPartOf } from '@weco/content/test/fixtures/catalogueApi/work'; import prismicData from '@weco/common/test/fixtures/prismicData/prismic-data'; -import ItemRequestModal from '../../components/ItemRequestModal/ItemRequestModal'; -import { getItemsWithPhysicalLocation } from '../../utils/works'; +import ItemRequestModal from '@weco/content/components/ItemRequestModal/ItemRequestModal'; +import { getItemsWithPhysicalLocation } from '@weco/content/utils/works'; import * as Context from '@weco/common/server-data/Context'; import { renderWithTheme } from '@weco/common/test/fixtures/test-helpers'; import { itemRequestDialog } from '@weco/common/data/microcopy'; diff --git a/content/webapp/test/pages/whats-on.test.tsx b/content/webapp/test/pages/whats-on.test.tsx index 18c18bd8a1..0952a768cc 100644 --- a/content/webapp/test/pages/whats-on.test.tsx +++ b/content/webapp/test/pages/whats-on.test.tsx @@ -1,8 +1,8 @@ -import { whatsOn } from '../../__mocks__/whats-on'; +import { whatsOn } from '@weco/content/__mocks__/whats-on'; import { renderWithTheme } from '@weco/common/test/fixtures/test-helpers'; // We pull in the page after we've set the config -import WhatsOnPage from '../../pages/whats-on'; +import WhatsOnPage from '@weco/content/pages/whats-on'; /** * with the upgrades to jest, this import needs to be mocked else diff --git a/content/webapp/test/utils/iiif.test.ts b/content/webapp/test/utils/iiif.test.ts index c1095670e9..ee6a2dea58 100644 --- a/content/webapp/test/utils/iiif.test.ts +++ b/content/webapp/test/utils/iiif.test.ts @@ -7,7 +7,7 @@ import { getMultiVolumeLabel, getBornDigitalStatus, groupRanges, -} from '../../utils/iiif/v3'; +} from '@weco/content/utils/iiif/v3'; import { manifest, manifestWithTranscript, diff --git a/content/webapp/test/utils/query-params.test.ts b/content/webapp/test/utils/query-params.test.ts index 75d0c039f2..5f53aff050 100644 --- a/content/webapp/test/utils/query-params.test.ts +++ b/content/webapp/test/utils/query-params.test.ts @@ -1,4 +1,4 @@ -import { getPage } from '../../utils/query-params'; +import { getPage } from '@weco/content/utils/query-params'; it('returns 1 if no page parameter is supplied', () => { expect(getPage({})).toEqual(1); diff --git a/content/webapp/test/utils/remove-idiomatic-text-tags.test.ts b/content/webapp/test/utils/remove-idiomatic-text-tags.test.ts index 2c959c9c0d..5abbe3320d 100644 --- a/content/webapp/test/utils/remove-idiomatic-text-tags.test.ts +++ b/content/webapp/test/utils/remove-idiomatic-text-tags.test.ts @@ -1,4 +1,4 @@ -import { removeIdiomaticTextTags } from '../../utils/string'; +import { removeIdiomaticTextTags } from '@weco/content/utils/string'; describe('Removes idiomatic text tags from strings', () => { it('ignores dates contained within angled brackets', () => { diff --git a/content/webapp/test/works.test.ts b/content/webapp/test/works.test.ts index 2039600e8d..eabb4dcf96 100644 --- a/content/webapp/test/works.test.ts +++ b/content/webapp/test/works.test.ts @@ -5,15 +5,15 @@ import { getArchiveAncestorArray, getDigitalLocationOfType, getAccessConditionForDigitalLocation, -} from '../utils/works'; -import { getTabbableIds } from '../components/ArchiveTree/ArchiveTree.helpers'; +} from '@weco/content/utils/works'; +import { getTabbableIds } from '@weco/content/components/ArchiveTree/ArchiveTree.helpers'; import { workFixture, workWithPartOf, workWithLibrarySeriesPartOf, workWithMixedPartOf, } from '@weco/content/test/fixtures/catalogueApi/work'; -import { uiTree, idArray } from '../__mocks__/uiTree'; +import { uiTree, idArray } from '@weco/content/__mocks__/uiTree'; describe('getProductionDates', () => { it('extracts date labels from a work', () => { diff --git a/content/webapp/types/compressed-manifest.ts b/content/webapp/types/compressed-manifest.ts index 7c0b4edad9..1902443e3f 100644 --- a/content/webapp/types/compressed-manifest.ts +++ b/content/webapp/types/compressed-manifest.ts @@ -109,10 +109,8 @@ export function fromCompressedManifest( thumbnailImage: thumbnailImageUrl[index] && thumbnailImageWidth[index] ? { - /* eslint-disable @typescript-eslint/no-non-null-assertion */ url: thumbnailImageUrl[index]!, width: thumbnailImageWidth[index]!, - /* eslint-enable @typescript-eslint/no-non-null-assertion */ } : undefined, painting: painting[index], diff --git a/content/webapp/types/exhibition-guides.ts b/content/webapp/types/exhibition-guides.ts index 2bb0a9b2b4..2e54e674d2 100644 --- a/content/webapp/types/exhibition-guides.ts +++ b/content/webapp/types/exhibition-guides.ts @@ -20,10 +20,10 @@ export type GuideHighlightTour = { title: string; audio?: string; transcript?: prismic.RichTextField; - audioDuration?: number; + audioDuration?: string; video?: string; subtitles?: prismic.RichTextField; - videoDuration?: number; + videoDuration?: string; image?: ImageType; }; diff --git a/content/webapp/types/styled-components.d.ts b/content/webapp/types/styled-components.d.ts index 1d75dd7534..6bd930a786 100644 --- a/content/webapp/types/styled-components.d.ts +++ b/content/webapp/types/styled-components.d.ts @@ -3,6 +3,5 @@ import theme from '@weco/common/views/themes/default'; type ThemeInterface = typeof theme; declare module 'styled-components' { - // eslint-disable-next-line @typescript-eslint/no-empty-interface interface DefaultTheme extends ThemeInterface {} } diff --git a/content/webapp/utils/colors.ts b/content/webapp/utils/colors.ts index 053de9aa34..b2d0686585 100644 --- a/content/webapp/utils/colors.ts +++ b/content/webapp/utils/colors.ts @@ -1,4 +1,4 @@ -import { ColorSelection } from '../types/color-selections'; +import { ColorSelection } from '@weco/content/types/color-selections'; export const getSeriesColor = ( prismicColor: diff --git a/content/webapp/utils/iiif/v3/index.ts b/content/webapp/utils/iiif/v3/index.ts index a02433fb56..3ffe549478 100644 --- a/content/webapp/utils/iiif/v3/index.ts +++ b/content/webapp/utils/iiif/v3/index.ts @@ -220,8 +220,8 @@ function getImageAuthCookieService( return Array.isArray(imageService?.service) ? imageService?.service?.find(s => s['@type'] === 'AuthCookieService1') : imageService?.service?.['@type'] === 'AuthCookieService1' - ? imageService?.service - : undefined; + ? imageService?.service + : undefined; } function getImageAuthProbeService( @@ -230,8 +230,8 @@ function getImageAuthProbeService( return Array.isArray(service) ? service?.find(s => s.type === 'AuthProbeService2') : service?.type === 'AuthProbeService2' - ? service - : undefined; + ? service + : undefined; } // We don't know at the top-level of a manifest whether any of the canvases contain images that are open access. @@ -593,8 +593,8 @@ export function getOriginalFiles( canvas.original.length > 0 ? canvas.original : canvas.painting.length > 0 - ? canvas.painting - : canvas.supplementing; + ? canvas.painting + : canvas.supplementing; return downloadData || []; } diff --git a/content/webapp/utils/page-header.tsx b/content/webapp/utils/page-header.tsx index 0ccc0d6ca7..a13bf13369 100644 --- a/content/webapp/utils/page-header.tsx +++ b/content/webapp/utils/page-header.tsx @@ -1,13 +1,13 @@ import { ReactElement } from 'react'; import { getCrop } from '@weco/common/model/image'; import { breakpoints } from '@weco/content/utils/breakpoints'; -import ImageWithTasl from '../components/ImageWithTasl/ImageWithTasl'; +import ImageWithTasl from '@weco/content/components/ImageWithTasl/ImageWithTasl'; import PrismicImage from '@weco/common/views/components/PrismicImage/PrismicImage'; import { FeaturedMedia } from '@weco/common/views/components/PageHeader/PageHeader'; import Picture from '@weco/common/views/components/Picture/Picture'; import VideoEmbed from '@weco/common/views/components/VideoEmbed/VideoEmbed'; import { isVideoEmbed } from '@weco/content/types/body'; -import { GenericContentFields } from '../types/generic-content-fields'; +import { GenericContentFields } from '@weco/content/types/generic-content-fields'; import { transformEmbedSlice } from '@weco/content/services/prismic/transformers/body'; export function getFeaturedMedia( diff --git a/content/webapp/utils/works.ts b/content/webapp/utils/works.ts index b2046b5174..fd7ee40441 100644 --- a/content/webapp/utils/works.ts +++ b/content/webapp/utils/works.ts @@ -13,19 +13,18 @@ import { RelatedWork, Work as WorkType, } from '@weco/content/services/wellcome/catalogue/types'; -import { DownloadOption } from '../types/manifest'; +import { + DownloadOption, + BornDigitalStatus, + TransformedCanvas, +} from '@weco/content/types/manifest'; import { convertIiifImageUri } from '@weco/common/utils/convert-image-uri'; import { Label } from '@weco/common/model/labels'; import { getCatalogueLicenseData, LicenseData, } from '@weco/common/utils/licenses'; - import { ApiToolbarLink } from '@weco/common/views/components/ApiToolbar'; -import { - BornDigitalStatus, - TransformedCanvas, -} from '@weco/content/types/manifest'; import { hasItemType } from '@weco/content/utils/iiif/v3'; export function getProductionDates(work: Work): string[] { diff --git a/identity/webapp/pages/_app.tsx b/identity/webapp/pages/_app.tsx index 563071ea6e..d61836417d 100644 --- a/identity/webapp/pages/_app.tsx +++ b/identity/webapp/pages/_app.tsx @@ -1,7 +1,6 @@ import NextApp, { AppContext, AppProps } from 'next/app'; import App from '@weco/common/views/pages/_app'; -// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types export default function IdentityApp(props: AppProps) { return ; } diff --git a/identity/webapp/pages/index.tsx b/identity/webapp/pages/index.tsx index fc214bb4cb..e09657291e 100644 --- a/identity/webapp/pages/index.tsx +++ b/identity/webapp/pages/index.tsx @@ -4,8 +4,9 @@ import { ComponentPropsWithoutRef, PropsWithChildren, } from 'react'; -import Icon from '@weco/common/views/components/Icon/Icon'; import { GetServerSideProps, NextPage } from 'next'; +import { useRouter } from 'next/router'; +import Icon from '@weco/common/views/components/Icon/Icon'; import auth0, { withPageAuthRequiredSSR, } from '@weco/identity/src/utility/auth0'; @@ -17,7 +18,7 @@ import { Title, Header, SectionHeading, -} from '../src/frontend/components/Layout.style'; +} from '@weco/identity/src/frontend/components/Layout.style'; import { StatusAlert, StyledDl, @@ -29,12 +30,12 @@ import { ItemPickup, ButtonWrapper, StatusAlertProps, -} from '../src/frontend/MyAccount/MyAccount.style'; -import { InlineLoading } from '../src/frontend/MyAccount/Loading'; -import { ChangeEmail } from '../src/frontend/MyAccount/ChangeEmail'; -import { ChangePassword } from '../src/frontend/MyAccount/ChangePassword'; -import { DeleteAccount } from '../src/frontend/MyAccount/DeleteAccount'; -import { useRequestedItems } from '../src/frontend/hooks/useRequestedItems'; +} from '@weco/identity/src/frontend/MyAccount/MyAccount.style'; +import { InlineLoading } from '@weco/identity/src/frontend/MyAccount/Loading'; +import { ChangeEmail } from '@weco/identity/src/frontend/MyAccount/ChangeEmail'; +import { ChangePassword } from '@weco/identity/src/frontend/MyAccount/ChangePassword'; +import { DeleteAccount } from '@weco/identity/src/frontend/MyAccount/DeleteAccount'; +import { useRequestedItems } from '@weco/identity/src/frontend/hooks/useRequestedItems'; import Layout, { gridSize10, gridSize12, @@ -51,7 +52,6 @@ import { getServerData } from '@weco/common/server-data'; import { serialiseProps } from '@weco/common/utils/json'; import { SimplifiedServerData } from '@weco/common/server-data/types'; import { AppErrorProps } from '@weco/common/services/app'; -import { useRouter } from 'next/router'; import { Auth0UserProfile, auth0UserProfileToUserInfo, @@ -59,8 +59,8 @@ import { import { Claims } from '@auth0/nextjs-auth0'; import { sierraStatusCodeToLabel } from '@weco/common/data/microcopy'; import { URLSearchParams } from 'url'; -import { useSendVerificationEmail } from '../src/frontend/hooks/useSendVerificationEmail'; -import { UnverifiedEmail } from '../src/frontend/MyAccount/UnverifiedEmail'; +import { useSendVerificationEmail } from '@weco/identity/src/frontend/hooks/useSendVerificationEmail'; +import { UnverifiedEmail } from '@weco/identity/src/frontend/MyAccount/UnverifiedEmail'; type DetailProps = { label: string; diff --git a/identity/webapp/src/frontend/Error/Error.test.tsx b/identity/webapp/src/frontend/Error/Error.test.tsx index 3f5d57db91..09eb459d09 100644 --- a/identity/webapp/src/frontend/Error/Error.test.tsx +++ b/identity/webapp/src/frontend/Error/Error.test.tsx @@ -1,5 +1,5 @@ import { render, screen } from '@testing-library/react'; -import ErrorPage from '../../../pages/error'; +import ErrorPage from '@weco/identity/pages/error'; import { ThemeProvider } from 'styled-components'; import theme from '@weco/common/views/themes/default'; import { defaultServerData } from '@weco/common/server-data/types'; diff --git a/identity/webapp/src/frontend/MyAccount/ChangeDetailsModal.tsx b/identity/webapp/src/frontend/MyAccount/ChangeDetailsModal.tsx index 550859aec1..5c150df01f 100644 --- a/identity/webapp/src/frontend/MyAccount/ChangeDetailsModal.tsx +++ b/identity/webapp/src/frontend/MyAccount/ChangeDetailsModal.tsx @@ -1,7 +1,7 @@ import { FunctionComponent, ReactElement, useRef, useState } from 'react'; import Modal from '@weco/common/views/components/Modal/Modal'; import Button from '@weco/common/views/components/Buttons'; -import { UpdateUserSchema } from '../../types/schemas/update-user'; +import { UpdateUserSchema } from '@weco/identity/src/types/schemas/update-user'; import { themeValues } from '@weco/common/views/themes/config'; export type ChangeDetailsModalContentProps = diff --git a/identity/webapp/src/frontend/MyAccount/ChangeEmail.test.tsx b/identity/webapp/src/frontend/MyAccount/ChangeEmail.test.tsx index c411233559..ea97f77e13 100644 --- a/identity/webapp/src/frontend/MyAccount/ChangeEmail.test.tsx +++ b/identity/webapp/src/frontend/MyAccount/ChangeEmail.test.tsx @@ -1,11 +1,11 @@ +import { ThemeProvider } from 'styled-components'; +import { rest } from 'msw'; import { act, render, screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { ChangeEmail } from './ChangeEmail'; import { ChangeDetailsModalContentProps } from './ChangeDetailsModal'; -import { ThemeProvider } from 'styled-components'; import theme from '@weco/common/views/themes/default'; -import { server } from '../mocks/server'; -import { rest } from 'msw'; +import { server } from '@weco/identity/src/frontend/mocks/server'; import { mockUser } from '@weco/common/test/fixtures/identity/user'; import UserProvider from '@weco/common/views/components/UserProvider/UserProvider'; diff --git a/identity/webapp/src/frontend/MyAccount/ChangeEmail.tsx b/identity/webapp/src/frontend/MyAccount/ChangeEmail.tsx index 66a7af86fd..47aeb1b935 100644 --- a/identity/webapp/src/frontend/MyAccount/ChangeEmail.tsx +++ b/identity/webapp/src/frontend/MyAccount/ChangeEmail.tsx @@ -1,15 +1,18 @@ import { FunctionComponent, useEffect, useState } from 'react'; import { useForm, Controller } from 'react-hook-form'; import { ErrorMessage } from '@hookform/error-message'; -import { FieldMargin } from '../components/Form.style'; +import { FieldMargin } from '@weco/identity/src/frontend/components/Form.style'; import TextInput, { InputErrorMessage, } from '@weco/common/views/components/TextInput'; -import { PasswordInput } from '../components/PasswordInput'; -import { validEmailPattern } from '../components/ValidationPatterns'; +import { PasswordInput } from '@weco/identity/src/frontend/components/PasswordInput'; +import { validEmailPattern } from '@weco/identity/src/frontend/components/ValidationPatterns'; import { Loading } from './Loading'; import { ChangeDetailsModalContentProps } from './ChangeDetailsModal'; -import { UpdateUserError, useUpdateUser } from '../hooks/useUpdateUser'; +import { + UpdateUserError, + useUpdateUser, +} from '@weco/identity/src/frontend/hooks/useUpdateUser'; import { ModalContainer, ModalTitle, StatusAlert } from './MyAccount.style'; import Button, { ButtonTypes } from '@weco/common/views/components/Buttons'; import Space from '@weco/common/views/components/styled/Space'; diff --git a/identity/webapp/src/frontend/MyAccount/ChangePassword.test.tsx b/identity/webapp/src/frontend/MyAccount/ChangePassword.test.tsx index 013e71931e..b4e85a0e38 100644 --- a/identity/webapp/src/frontend/MyAccount/ChangePassword.test.tsx +++ b/identity/webapp/src/frontend/MyAccount/ChangePassword.test.tsx @@ -1,11 +1,11 @@ +import { rest } from 'msw'; +import { ThemeProvider } from 'styled-components'; import { act, render, screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { ChangePassword } from './ChangePassword'; -import { ThemeProvider } from 'styled-components'; import theme from '@weco/common/views/themes/default'; import { ChangeDetailsModalContentProps } from './ChangeDetailsModal'; -import { server } from '../mocks/server'; -import { rest } from 'msw'; +import { server } from '@weco/identity/src/frontend/mocks/server'; const defaultProps: ChangeDetailsModalContentProps = { onComplete: () => null, diff --git a/identity/webapp/src/frontend/MyAccount/ChangePassword.tsx b/identity/webapp/src/frontend/MyAccount/ChangePassword.tsx index 4cc16522be..5caee67902 100644 --- a/identity/webapp/src/frontend/MyAccount/ChangePassword.tsx +++ b/identity/webapp/src/frontend/MyAccount/ChangePassword.tsx @@ -1,8 +1,11 @@ import { FunctionComponent, useEffect, useMemo, useState } from 'react'; import { ErrorMessage } from '@hookform/error-message'; -import usePasswordRules from '../hooks/usePasswordRules'; -import { PasswordInput, PasswordRules } from '../components/PasswordInput'; -import { FieldMargin } from '../components/Form.style'; +import usePasswordRules from '@weco/identity/src/frontend/hooks/usePasswordRules'; +import { + PasswordInput, + PasswordRules, +} from '@weco/identity/src/frontend/components/PasswordInput'; +import { FieldMargin } from '@weco/identity/src/frontend/components/Form.style'; import Button, { ButtonTypes } from '@weco/common/views/components/Buttons'; import { InputErrorMessage } from '@weco/common/views/components/TextInput'; import { useForm, useWatch } from 'react-hook-form'; @@ -11,9 +14,9 @@ import { ChangeDetailsModalContentProps } from './ChangeDetailsModal'; import { UpdatePasswordError, useUpdatePassword, -} from '../hooks/useUpdatePassword'; +} from '@weco/identity/src/frontend/hooks/useUpdatePassword'; import { Loading } from './Loading'; -import { validPasswordPattern } from '../components/ValidationPatterns'; +import { validPasswordPattern } from '@weco/identity/src/frontend/components/ValidationPatterns'; import Space from '@weco/common/views/components/styled/Space'; type ChangePasswordInputs = { diff --git a/identity/webapp/src/frontend/MyAccount/DeleteAccount.test.tsx b/identity/webapp/src/frontend/MyAccount/DeleteAccount.test.tsx index e19631321d..31ce0707d7 100644 --- a/identity/webapp/src/frontend/MyAccount/DeleteAccount.test.tsx +++ b/identity/webapp/src/frontend/MyAccount/DeleteAccount.test.tsx @@ -1,11 +1,11 @@ +import { ThemeProvider } from 'styled-components'; +import { rest } from 'msw'; import { act, render, screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { DeleteAccount } from './DeleteAccount'; -import { ThemeProvider } from 'styled-components'; import theme from '@weco/common/views/themes/default'; import { ChangeDetailsModalContentProps } from './ChangeDetailsModal'; -import { server } from '../mocks/server'; -import { rest } from 'msw'; +import { server } from '@weco/identity/src/frontend/mocks/server'; const defaultProps: ChangeDetailsModalContentProps = { onComplete: () => null, diff --git a/identity/webapp/src/frontend/MyAccount/DeleteAccount.tsx b/identity/webapp/src/frontend/MyAccount/DeleteAccount.tsx index c4d274b917..e637a5c54a 100644 --- a/identity/webapp/src/frontend/MyAccount/DeleteAccount.tsx +++ b/identity/webapp/src/frontend/MyAccount/DeleteAccount.tsx @@ -2,7 +2,7 @@ import { FunctionComponent, useEffect, useMemo, useState } from 'react'; import { useForm } from 'react-hook-form'; import { font } from '@weco/common/utils/classnames'; import { ErrorMessage } from '@hookform/error-message'; -import { FieldMargin } from '../components/Form.style'; +import { FieldMargin } from '@weco/identity/src/frontend/components/Form.style'; import { InputErrorMessage } from '@weco/common/views/components/TextInput'; import Button, { ButtonTypes } from '@weco/common/views/components/Buttons'; import { @@ -11,12 +11,12 @@ import { StatusAlert, ButtonAlign, } from './MyAccount.style'; -import { PasswordInput } from '../components/PasswordInput'; +import { PasswordInput } from '@weco/identity/src/frontend/components/PasswordInput'; import { ChangeDetailsModalContentProps } from './ChangeDetailsModal'; import { RequestDeleteError, useRequestDelete, -} from '../hooks/useRequestDelete'; +} from '@weco/identity/src/frontend/hooks/useRequestDelete'; import { Loading } from './Loading'; import { themeValues } from '@weco/common/views/themes/config'; diff --git a/identity/webapp/src/frontend/MyAccount/MyAccount.test.tsx b/identity/webapp/src/frontend/MyAccount/MyAccount.test.tsx index 3d1ca20fc6..2b41092122 100644 --- a/identity/webapp/src/frontend/MyAccount/MyAccount.test.tsx +++ b/identity/webapp/src/frontend/MyAccount/MyAccount.test.tsx @@ -1,18 +1,18 @@ +import { ThemeProvider } from 'styled-components'; import { act, render, screen, waitFor } from '@testing-library/react'; -import AccountPage from '../../../pages'; +import AccountPage from '@weco/identity/pages'; import { mockAuth0Profile, mockItemRequests, mockUser, } from '@weco/common/test/fixtures/identity/user'; import userEvent from '@testing-library/user-event'; -import { ThemeProvider } from 'styled-components'; import theme from '@weco/common/views/themes/default'; import { ServerData } from '@weco/common/server-data/types'; import UserProvider from '@weco/common/views/components/UserProvider/UserProvider'; // avoid rendering header SVG to help with debugging tests -jest.mock('../components/PageWrapper', () => ({ +jest.mock('@weco/identity/src/frontend/components/PageWrapper', () => ({ __esModule: true, PageWrapper: ({ children }) => <>{children}, })); diff --git a/identity/webapp/src/frontend/MyAccount/UnverifiedEmail.tsx b/identity/webapp/src/frontend/MyAccount/UnverifiedEmail.tsx index 1bc0575385..35aa45fc14 100644 --- a/identity/webapp/src/frontend/MyAccount/UnverifiedEmail.tsx +++ b/identity/webapp/src/frontend/MyAccount/UnverifiedEmail.tsx @@ -1,5 +1,5 @@ import { FunctionComponent } from 'react'; -import { UseSendVerificationEmail } from '../hooks/useSendVerificationEmail'; +import { UseSendVerificationEmail } from '@weco/identity/src/frontend/hooks/useSendVerificationEmail'; export const UnverifiedEmail: FunctionComponent = ({ sendVerificationEmail, diff --git a/identity/webapp/src/frontend/Registration/AccountCreated.tsx b/identity/webapp/src/frontend/Registration/AccountCreated.tsx index 47401c323f..db26e19382 100644 --- a/identity/webapp/src/frontend/Registration/AccountCreated.tsx +++ b/identity/webapp/src/frontend/Registration/AccountCreated.tsx @@ -1,9 +1,13 @@ import { FunctionComponent } from 'react'; import SpacingComponent from '@weco/common/views/components/styled/SpacingComponent'; import Icon from '@weco/common/views/components/Icon/Icon'; -import { PageWrapper } from '../components/PageWrapper'; +import { PageWrapper } from '@weco/identity/src/frontend/components/PageWrapper'; import { SuccessMessage } from './Registration.style'; -import { Container, Wrapper, SectionHeading } from '../components/Layout.style'; +import { + Container, + Wrapper, + SectionHeading, +} from '@weco/identity/src/frontend/components/Layout.style'; import Layout, { gridSize10 } from '@weco/common/views/components/Layout'; import Space from '@weco/common/views/components/styled/Space'; import { info2 } from '@weco/common/icons'; diff --git a/identity/webapp/src/frontend/Registration/AccountValidated.test.tsx b/identity/webapp/src/frontend/Registration/AccountValidated.test.tsx index 2feaccfaad..51e2c08877 100644 --- a/identity/webapp/src/frontend/Registration/AccountValidated.test.tsx +++ b/identity/webapp/src/frontend/Registration/AccountValidated.test.tsx @@ -5,7 +5,7 @@ import theme from '@weco/common/views/themes/default'; import { defaultServerData } from '@weco/common/server-data/types'; // avoid rendering header SVG to help with debugging tests -jest.mock('../components/PageWrapper', () => ({ +jest.mock('@weco/identity/src/frontend/components/PageWrapper', () => ({ __esModule: true, PageWrapper: ({ children }) => <>{children}, })); diff --git a/identity/webapp/src/frontend/Registration/RegistrationInformation.tsx b/identity/webapp/src/frontend/Registration/RegistrationInformation.tsx index dda3fb1ed3..86c9cadcce 100644 --- a/identity/webapp/src/frontend/Registration/RegistrationInformation.tsx +++ b/identity/webapp/src/frontend/Registration/RegistrationInformation.tsx @@ -1,6 +1,6 @@ import { FunctionComponent } from 'react'; import Divider from '@weco/common/views/components/Divider/Divider'; -import { SectionHeading } from '../components/Layout.style'; +import { SectionHeading } from '@weco/identity/src/frontend/components/Layout.style'; import { font } from '@weco/common/utils/classnames'; import Space from '@weco/common/views/components/styled/Space'; diff --git a/identity/webapp/src/frontend/Registration/useRegisterUser.ts b/identity/webapp/src/frontend/Registration/useRegisterUser.ts index 168cd021a4..6ef15a3f99 100644 --- a/identity/webapp/src/frontend/Registration/useRegisterUser.ts +++ b/identity/webapp/src/frontend/Registration/useRegisterUser.ts @@ -1,6 +1,6 @@ import { useState } from 'react'; import axios, { AxiosError } from 'axios'; -import { RegisterUserSchema } from '../../types/schemas/register-user'; +import { RegisterUserSchema } from '@weco/identity/src/types/schemas/register-user'; export enum RegistrationError { EMAIL_ALREADY_EXISTS = 'EMAIL_ALREADY_EXISTS', diff --git a/identity/webapp/src/frontend/hooks/useRequestDelete.ts b/identity/webapp/src/frontend/hooks/useRequestDelete.ts index 87dceb6b44..4feec7fc82 100644 --- a/identity/webapp/src/frontend/hooks/useRequestDelete.ts +++ b/identity/webapp/src/frontend/hooks/useRequestDelete.ts @@ -1,6 +1,6 @@ import { useState } from 'react'; import axios, { AxiosError } from 'axios'; -import { RequestDeleteSchema } from '../../types/schemas/request-delete'; +import { RequestDeleteSchema } from '@weco/identity/src/types/schemas/request-delete'; export enum RequestDeleteError { INCORRECT_PASSWORD, diff --git a/identity/webapp/src/frontend/hooks/useUpdatePassword.ts b/identity/webapp/src/frontend/hooks/useUpdatePassword.ts index 8e6103d9ed..ec73003892 100644 --- a/identity/webapp/src/frontend/hooks/useUpdatePassword.ts +++ b/identity/webapp/src/frontend/hooks/useUpdatePassword.ts @@ -1,6 +1,6 @@ import { useState } from 'react'; import axios, { AxiosError } from 'axios'; -import { UpdatePasswordSchema } from '../../types/schemas/update-password'; +import { UpdatePasswordSchema } from '@weco/identity/src/types/schemas/update-password'; export enum UpdatePasswordError { INCORRECT_PASSWORD, diff --git a/identity/webapp/src/frontend/hooks/useUpdateUser.ts b/identity/webapp/src/frontend/hooks/useUpdateUser.ts index 45adbd39c2..f47771ac12 100644 --- a/identity/webapp/src/frontend/hooks/useUpdateUser.ts +++ b/identity/webapp/src/frontend/hooks/useUpdateUser.ts @@ -1,6 +1,6 @@ import { useState } from 'react'; import axios from 'axios'; -import { UpdateUserSchema } from '../../types/schemas/update-user'; +import { UpdateUserSchema } from '@weco/identity/src/types/schemas/update-user'; import { useUser } from '@weco/common/views/components/UserProvider/UserProvider'; import { UserInfo } from '@weco/common/model/user'; diff --git a/identity/webapp/src/index.ts b/identity/webapp/src/index.ts index b7d8e1c3eb..afdb570329 100644 --- a/identity/webapp/src/index.ts +++ b/identity/webapp/src/index.ts @@ -1,5 +1,5 @@ import { createApp } from './app'; -import { port } from '../config'; +import { port } from '@weco/identity/config'; async function main() { if (process.env.NODE_ENV === 'development') { diff --git a/identity/webapp/types/styled-components.d.ts b/identity/webapp/types/styled-components.d.ts index 1d75dd7534..6bd930a786 100644 --- a/identity/webapp/types/styled-components.d.ts +++ b/identity/webapp/types/styled-components.d.ts @@ -3,6 +3,5 @@ import theme from '@weco/common/views/themes/default'; type ThemeInterface = typeof theme; declare module 'styled-components' { - // eslint-disable-next-line @typescript-eslint/no-empty-interface interface DefaultTheme extends ThemeInterface {} } diff --git a/prismic-model/utils/prismic.ts b/prismic-model/utils/prismic.ts index 73a668fc65..2cf9cae280 100644 --- a/prismic-model/utils/prismic.ts +++ b/prismic-model/utils/prismic.ts @@ -1,5 +1,5 @@ import { setEnvsFromSecrets } from '@weco/ts-aws'; -import { secrets } from '../config'; +import { secrets } from '@weco/prismic-model/config'; import fetch from 'node-fetch'; type CustomType = { diff --git a/toggles/webapp/scripts/deploy.ts b/toggles/webapp/scripts/deploy.ts index 8480dc0b5b..de89187919 100644 --- a/toggles/webapp/scripts/deploy.ts +++ b/toggles/webapp/scripts/deploy.ts @@ -1,7 +1,7 @@ import { S3Client } from '@aws-sdk/client-s3'; import { getCreds } from '@weco/ts-aws'; -import { region } from '../config'; -import { deploy } from '../deploy'; +import { region } from '@weco/toggles/config'; +import { deploy } from '@weco/toggles/deploy'; export const isCi = process.env.CI === 'true'; diff --git a/toggles/webapp/scripts/setDefaultValueFor.ts b/toggles/webapp/scripts/setDefaultValueFor.ts index 631f1fdb84..f83f4808dc 100644 --- a/toggles/webapp/scripts/setDefaultValueFor.ts +++ b/toggles/webapp/scripts/setDefaultValueFor.ts @@ -1,7 +1,7 @@ import { S3Client } from '@aws-sdk/client-s3'; import { getCreds } from '@weco/ts-aws'; -import { region } from '../config'; -import { setDefaultValueFor } from '../setDefaultValueFor'; +import { region } from '@weco/toggles/config'; +import { setDefaultValueFor } from '@weco/toggles/setDefaultValueFor'; export const isCi = process.env.CI === 'true';