Skip to content

Commit

Permalink
Merge branch 'main' into bose/2580
Browse files Browse the repository at this point in the history
  • Loading branch information
BorghildSelle committed Nov 4, 2024
2 parents dc6d476 + e2915f6 commit 479e3b0
Show file tree
Hide file tree
Showing 117 changed files with 10,199 additions and 10,142 deletions.
387 changes: 215 additions & 172 deletions e2e/pnpm-lock.yaml

Large diffs are not rendered by default.

1,139 changes: 713 additions & 426 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions sanityv3/plugins/asset-source-fotoware/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export const getAuthURL = (requestState: string): string | false => {

const CLIENT_ID = process.env.SANITY_STUDIO_FOTOWARE_CLIENT_ID
const TENANT_URL = process.env.SANITY_STUDIO_FOTOWARE_TENANT_URL

return `${TENANT_URL}/fotoweb/oauth2/authorize?response_type=token&client_id=${CLIENT_ID}&state=${requestState}`
const REDIRECT_URI = process.env.SANITY_STUDIO_FOTOWARE_REDIRECT_ORIGIN
return `${TENANT_URL}/fotoweb/oauth2/authorize?response_type=token&client_id=${CLIENT_ID}&state=${requestState}&redirect_uri=${REDIRECT_URI}`
}

export const getAccessToken = (): string | false => {
Expand Down
5,775 changes: 2,247 additions & 3,528 deletions sanityv3/pnpm-lock.yaml

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions sanityv3/sanity.config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import type {
DocumentBadgeComponent,
DocumentFieldAction,
} from 'sanity'
import { deskTool, StructureBuilder } from 'sanity/desk'
import { structureTool } from 'sanity/structure'
import deskStructure, { defaultDocumentNodeResolver } from './deskStructure'
import { schemaTypes } from './schemas'
import { initialValueTemplates } from './initialValueTemplates'
Expand Down Expand Up @@ -88,8 +88,8 @@ const getConfig = (datasetParam: string, projectIdParam: string, isSecret = fals
},
plugins: [
documentInternationalization(i18n),
deskTool({
structure: (S: StructureBuilder, context: ConfigContext) => {
structureTool({
structure: (S, context: ConfigContext) => {
return deskStructure(S, context)
},
defaultDocumentNode: defaultDocumentNodeResolver,
Expand Down
38 changes: 38 additions & 0 deletions sanityv3/schemas/documents/newsroom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { file } from '@equinor/eds-icons'
import { EdsIcon } from '../../icons'
import type { PortableTextBlock, Rule } from 'sanity'
import { lang } from './langField'
import routes from '../routes'
import { filterByRoute } from '../../helpers/referenceFilters'

const titleContentType = configureTitleBlockContent()
const textContentType = configureBlockContent({
Expand Down Expand Up @@ -66,6 +68,42 @@ export default {
type: 'array',
of: [textContentType],
},
{
name: 'subscriptionLink',
title: 'Link to the email subscription page',
type: 'reference',
to: routes,
options: {
filter: filterByRoute,
},
},
{
name: 'subscriptionLinkTitle',
title: 'Title for the subscription link',
type: 'string',
},
{
title: 'List of local news pages',
name: 'localNewsPages',
type: 'array',
of: [{ type: 'linkSelector', title: 'Link' }],
},
{
title: 'Image thumbnail fallbacks',
name: 'imageThumbnailFallbacks',
type: 'array',
of: [
{
type: 'image',
title: 'Fallback image',
options: {
hotspot: true,
collapsed: false,
},
},
],
validation: (Rule: Rule) => Rule.max(3),
},
],
preview: {
select: {
Expand Down
1 change: 1 addition & 0 deletions sanityv3/schemas/documents/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export default {
{ type: 'videoPlayer' },
{ type: 'videoPlayerCarousel' },
{ type: 'table' },
{ type: 'imageForText' },
Flags.HAS_CAMPAIGN_BLOCKS && { type: 'grid' },
Flags.HAS_CAMPAIGN_BLOCKS && { type: 'campaignBanner' },
Flags.HAS_FORMS && { type: 'form' },
Expand Down
2 changes: 2 additions & 0 deletions sanityv3/schemas/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ import gridColorTheme from './objects/grid/theme'
import transcript from './objects/transcript'
import anchorLinkList from './objects/anchorLinkList/anchorLinkList'
import anchorLinkReference from './objects/anchorLinkList/anchorLinkReference'
import imageForText from './objects/imageForText'

const {
pageNotFound,
Expand Down Expand Up @@ -208,6 +209,7 @@ const RemainingSchemas = [
transcript,
anchorLinkList,
anchorLinkReference,
imageForText,
]

// Then we give our schema to the builder and provide the result to Sanity
Expand Down
18 changes: 8 additions & 10 deletions sanityv3/schemas/objects/card.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
/* eslint-disable react/display-name */
import { forwardRef } from 'react'
import { configureBlockContent } from '../editors'
import type { PortableTextBlock } from 'sanity'
import { Stack, Text, Card } from '@sanity/ui'
import { Text, Card, Box } from '@sanity/ui'
import blocksToText from '../../helpers/blocksToText'

const CardField = forwardRef((props: any) => {
const CardField = (props: any) => {
const { renderDefault } = props
return (
<Stack>
<Card padding={3} borderLeft>
<Text muted size={2} align={'left'}>
<Box>
<Text muted size={2} align="left" style={{marginBottom: 20}}>
If only title are used it will render only title as statement. If content below are used, both title and
content will be rendered.
</Text>
</Card>
<>{props.renderDefault(props)}</>
</Stack>
<>{renderDefault(props)}</>
</Box>
)
})
}

const blockConfig = {
h2: false,
Expand Down
67 changes: 67 additions & 0 deletions sanityv3/schemas/objects/imageForText.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import { info_circle } from '@equinor/eds-icons'
import { PortableTextBlock, Rule } from 'sanity'
import { EdsIcon } from '../../icons'
import { configureBlockContent } from '../editors/blockContentType'
import type { ImageWithAlt } from './imageWithAlt'

const blockContentType = configureBlockContent({
h2: true,
h3: true,
h4: true,
internalLink: false,
externalLink: false,
lists: false,
attachment: false,
smallText: false,
})

export type ImageForText = {
_type: 'imageForText'
content?: PortableTextBlock[]
image?: ImageWithAlt
}

export default {
title: 'Image for text',
name: 'imageForText',
type: 'object',
fields: [
{
name: 'content',
title: 'Content',
type: 'array',
of: [blockContentType],
validation: (Rule: Rule) => Rule.required(),
},
{
name: 'image',
title: 'Image',
type: 'imageWithAlt',
validation: (Rule: Rule) => Rule.required(),
},
{
name: 'aspectRatio',
type: 'string',
description: '',
title: 'Aspect ratio',
options: {
list: [
{ title: '16:9', value: '16:9' },
{ title: 'Full width 16:9', value: 'fullWidth' },
],
},
initialValue: '16:9',
},
],
preview: {
select: {
imageUrl: 'image.asset.url',
},
prepare({ imageUrl }: { title: string; imageUrl: string }) {
return {
title: 'Image for text',
media: imageUrl ? <img src={imageUrl} alt="" style={{ height: '100%' }} /> : EdsIcon(info_circle),
}
},
},
}
96 changes: 93 additions & 3 deletions sanityv3/schemas/textSnippets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export const groups = {
}
const snippets: textSnippet = {
country_code_format: {
title: 'e.g. +47',
defaultValue: 'e.g. +47',
title: 'Enter country code with phone number',
defaultValue: 'Enter country code with phone number',
group: groups.form,
},
all_fields_mandatory: {
Expand Down Expand Up @@ -81,6 +81,16 @@ const snippets: textSnippet = {
defaultValue: 'Search',
group: groups.search,
},
search_quick_search: {
title: 'Quick search',
defaultValue: 'Quick search',
group: groups.search,
},
search_quick_search_label: {
title: 'Quick search label',
defaultValue: 'Search among Equinor corporate-level news releases',
group: groups.search,
},
search_news_tab: {
title: 'News tab name',
defaultValue: 'News',
Expand Down Expand Up @@ -116,6 +126,31 @@ const snippets: textSnippet = {
defaultValue: 'Sorry, no results were found. Please try again with some different keywords.',
group: groups.search,
},
search_submit: {
title: 'Submit search',
defaultValue: 'Submit search',
group: groups.search,
},
search_reset: {
title: 'Reset',
defaultValue: 'Reset',
group: groups.search,
},
search_filter_by: {
title: 'Filter by',
defaultValue: 'Filter by',
group: groups.search,
},
search_pagination_first_page: {
title: 'First page',
defaultValue: 'First page',
group: groups.search,
},
search_pagination_last_page: {
title: 'Last page',
defaultValue: 'Last page',
group: groups.search,
},
copyright: {
title: 'Copyright',
defaultValue: 'Copyright 2022 Equinor ASA',
Expand Down Expand Up @@ -636,7 +671,7 @@ const snippets: textSnippet = {
careers_contact_form_supporting_documents: {
title: 'Supporting Documents checkbox',
defaultValue: 'Tick the box if you would like to send supporting documents, and we will get in touch with you',
group: groups.careerFairForm,
group: groups.careerContactForm,
},

form_sending: {
Expand Down Expand Up @@ -684,11 +719,36 @@ const snippets: textSnippet = {
defaultValue: 'Reopen the form',
group: groups.form,
},
form_validation_maxChars: {
title: 'Max X chars',
defaultValue: 'Max {maxChars} characters',
group: groups.form,
},
form_antirobot_validation_required: {
title: 'Anti-Robot verification is required',
defaultValue: 'Anti-Robot verification is required',
group: groups.form,
},
newsroom_topic_filter: {
title: 'Topic filter heading',
defaultValue: 'Topic',
group: groups.newsroom,
},
newsroom_filters_label: {
title: 'Filters label',
defaultValue: 'Filter by:',
group: groups.newsroom,
},
newsroom_filters_selected: {
title: 'Selected',
defaultValue: 'Selected',
group: groups.newsroom,
},
newsroom_filters_clear_all: {
title: 'Clear all',
defaultValue: 'Clear all',
group: groups.newsroom,
},
newsroom_country_filter: {
title: 'Country filter heading',
defaultValue: 'Country',
Expand Down Expand Up @@ -720,6 +780,16 @@ const snippets: textSnippet = {
defaultValue: 'Your search returned no results',
group: groups.newsroom,
},
newsroom_related_links: {
title: 'Related links',
defaultValue: 'Related links',
group: groups.newsroom,
},
newsroom_skip_to_news: {
title: 'Skip to list of news',
defaultValue: 'Skip to list of news',
group: groups.newsroom,
},
magazineindex_list_header: {
title: 'Magazine index: Stories list heading',
defaultValue: 'Stories',
Expand Down Expand Up @@ -766,6 +836,26 @@ const snippets: textSnippet = {
defaultValue: 'Switch to',
group: groups.others,
},
next: {
title: 'Next',
defaultValue: 'Next',
group: groups.others,
},
previous: {
title: 'Previous',
defaultValue: 'Previous',
group: groups.others,
},
page: {
title: 'Page',
defaultValue: 'Page',
group: groups.others,
},
remove: {
title: 'Remove',
defaultValue: 'Remove',
group: groups.others,
},
}

type textSnippetGroup = { title: string; hidden?: boolean }
Expand Down
5 changes: 5 additions & 0 deletions sanityv3/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"paths": {
"react": ["./node_modules/@types/react"]
}
},
"include": ["**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}
2 changes: 2 additions & 0 deletions search/IndexSanityContent/common/news/SharedNewsFields.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Page } from '../../../common'
import { ImageWithAltAndCaption } from '../types'

export type SharedNewsFields = Page & {
title: string
Expand All @@ -18,4 +19,5 @@ export type SharedNewsFields = Page & {
text: string
}[]
_id: string
heroImage?: ImageWithAltAndCaption
}
Loading

0 comments on commit 479e3b0

Please sign in to comment.