Skip to content

Commit

Permalink
Merge pull request #275 from City-of-Helsinki/dev
Browse files Browse the repository at this point in the history
Dev to main
  • Loading branch information
rpnykanen authored Oct 23, 2024
2 parents 0234d75 + c0f30cd commit 79f03fd
Show file tree
Hide file tree
Showing 14 changed files with 3,987 additions and 4,088 deletions.
6 changes: 6 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,11 @@ module.exports = {
],
},
],
'react/no-unknown-property': [
'error',
{
ignore: ['jsx', 'global'],
},
],
},
}
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16.12.0
v20.18.0
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# =======================================
FROM registry.access.redhat.com/ubi8/nodejs-16 AS deps
FROM registry.access.redhat.com/ubi8/nodejs-20 AS deps
# =======================================

USER root
Expand All @@ -12,7 +12,7 @@ COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile

# =======================================
FROM registry.access.redhat.com/ubi8/nodejs-16 AS builder
FROM registry.access.redhat.com/ubi8/nodejs-20 AS builder
# =======================================
# USER node:0
ARG NEXT_PUBLIC_DRUPAL_BASE_URL
Expand Down Expand Up @@ -64,7 +64,7 @@ RUN rm -rf node_modules
RUN yarn install --production --ignore-scripts --prefer-offline

# =======================================
FROM registry.access.redhat.com/ubi8/nodejs-16 AS runner
FROM registry.access.redhat.com/ubi8/nodejs-20 AS runner
# =======================================

WORKDIR /app
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,13 @@ Build Dockerfile, start container. See `localhost:8080`
```bash
docker build --build-arg [NEXT_DRUPAL_SITE_ID|and other variables]='env values to docker container' -t infofinlandui .
```

OR (but you need to clear all comments from env file)

```bash
docker build -t infofinlandui $(for i in `cat .env.local`; do out+="--build-arg $i " ; done; echo $out;out="") .
```

- Check that image is built without errors.
- Select the new image from Docker-tab, Run Interactive, See localhost:8080.

Expand Down
9 changes: 4 additions & 5 deletions pages/[[...slug]].jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ import getDrupalClient from '@/lib/drupal-client'
const USE_TIMER = process.env.USE_TIMER || false

export async function getStaticPaths() {
const { DRUPAL_MENUS, BUILD_ALL, BUILD_PHASE } = getConfig().serverRuntimeConfig;
const { DRUPAL_MENUS, BUILD_ALL, BUILD_PHASE } =
getConfig().serverRuntimeConfig

if (BUILD_PHASE) {
return {
Expand Down Expand Up @@ -94,7 +95,7 @@ export async function getStaticProps(context) {
}

const entityLangcode = translatedPath?.entity?.langcode
const isRedirect = translatedPath?.redirect;
const isRedirect = translatedPath?.redirect
// If page doesn't exist on current language.
if (!isRedirect && locale !== entityLangcode) {
logger.warn('Requested language version not found', {
Expand Down Expand Up @@ -235,9 +236,7 @@ export async function getStaticProps(context) {
}

// Format date in server. Don't load luxon to browser for one single formatting task.
const lastUpdated = DateTime.fromISO(node.changed).toFormat(
'dd.MM.yyyy'
)
const lastUpdated = DateTime.fromISO(node.changed).toFormat('dd.MM.yyyy')

USE_TIMER && console.log('page ready')

Expand Down
8 changes: 1 addition & 7 deletions pages/api/feedback.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,7 @@ export default async function handler(request, response) {
// Send feedback form to drupal
if (request.method === 'POST') {
try {
const {
sender_email,
message,
page,
name,
uuid,
} = request?.body
const { sender_email, message, page, name, uuid } = request?.body
const form_response = await axios.post(POST_URL, {
sender_email,
message,
Expand Down
36 changes: 20 additions & 16 deletions pages/sitemap.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ import getDrupalClient from '@/lib/drupal-client'

export async function getStaticProps(context) {
const { locale, preview } = context
const { SITEMAP_PAGE_PATH, DRUPAL_MENUS, REVALIDATE_TIME } = getConfig().serverRuntimeConfig
const { SITEMAP_PAGE_PATH, DRUPAL_MENUS, REVALIDATE_TIME } =
getConfig().serverRuntimeConfig

if (i18n.disabledLocales.includes(locale)) {
return NOT_FOUND
Expand Down Expand Up @@ -59,7 +60,7 @@ export async function getStaticProps(context) {
menus,
...(await serverSideTranslations(locale, ['common'])),
},
revalidate: REVALIDATE_TIME
revalidate: REVALIDATE_TIME,
}
}

Expand Down Expand Up @@ -104,27 +105,30 @@ export default function SiteMap({ node, urls, menus }) {
return (
<>
<CommonHead key={`head-sitemap-${node?.id}`} node={node} />
<SecondaryLayout node={node} menus={menus}>
<Block>
<h1 className="mt-16 mb-8 text-h1 md:text-h1xl">{node?.title}</h1>
<SitemapList
<SecondaryLayout node={node} menus={menus}>
<Block>
<h1 className="mt-16 mb-8 text-h1 md:text-h1xl">{node?.title}</h1>
<SitemapList
urls={[
{ url: `/${locale}`, title: t('breadcrumbs.frontpage') },
...urls?.main,
]}
name={DRUPAL_MENUS.MAIN}
/>

<SitemapList
urls={[
{ url: `/${locale}/${DRUPAL_MENUS.CITIES}`, title: t('frontpage.cities.title') },
...urls?.cities,
]}
name={DRUPAL_MENUS.CITIES}
/>
<SitemapList urls={urls?.about} name={DRUPAL_MENUS.ABOUT} />
</Block>
</SecondaryLayout>
<SitemapList
urls={[
{
url: `/${locale}/${DRUPAL_MENUS.CITIES}`,
title: t('frontpage.cities.title'),
},
...urls?.cities,
]}
name={DRUPAL_MENUS.CITIES}
/>
<SitemapList urls={urls?.about} name={DRUPAL_MENUS.ABOUT} />
</Block>
</SecondaryLayout>
</>
)
}
14 changes: 7 additions & 7 deletions pipelines/infofinland-ui-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ extends:
# Filename in Azure DevOps Repository
template: components/infofinland-ui/pipelines/infofinland-ui-production.yml@infofinland-pipelines
# parameters:
# Application build arguments and config map values as key value pairs.
# Does not contain all buildArguments or configMap values, the rest located in infofinland-pipelines
# The values here will override the values defined in the infofinland-pipelines repository
# buildArgs:
# DEBUG: 1
# configMap: # pod environment variables
# DEBUG: 1
# Application build arguments and config map values as key value pairs.
# Does not contain all buildArguments or configMap values, the rest located in infofinland-pipelines
# The values here will override the values defined in the infofinland-pipelines repository
# buildArgs:
# DEBUG: 1
# configMap: # pod environment variables
# DEBUG: 1
22 changes: 11 additions & 11 deletions pipelines/infofinland-ui-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ trigger:
- main
paths:
exclude:
- '*.md'
- '.github/'
- 'pipelines/infofinland-ui-production.yml'
- 'pipelines/infofinland-ui-test.yml'
- '*.md'
- '.github/'
- 'pipelines/infofinland-ui-production.yml'
- 'pipelines/infofinland-ui-test.yml'

# Pull request (PR) triggers cause a pipeline to run whenever a pull request is
# opened with one of the specified target branches, or when updates are made to
Expand Down Expand Up @@ -38,10 +38,10 @@ extends:
# Filename in Azure DevOps Repository
template: components/infofinland-ui/pipelines/infofinland-ui-staging.yml@infofinland-pipelines
# parameters:
# Application build arguments and config map values as key value pairs.
# Does not contain all buildArguments or configMap values, the rest located in infofinland-pipelines
# The values here will override the values defined in the infofinland-pipelines repository
# buildArgs:
# DEBUG: 1
# configMap: # pod environment variables
# DEBUG: 1
# Application build arguments and config map values as key value pairs.
# Does not contain all buildArguments or configMap values, the rest located in infofinland-pipelines
# The values here will override the values defined in the infofinland-pipelines repository
# buildArgs:
# DEBUG: 1
# configMap: # pod environment variables
# DEBUG: 1
22 changes: 11 additions & 11 deletions pipelines/infofinland-ui-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ trigger:
- dev
paths:
exclude:
- '*.md'
- '.github/'
- 'pipelines/infofinland-ui-production.yml'
- 'pipelines/infofinland-ui-staging.yml'
- '*.md'
- '.github/'
- 'pipelines/infofinland-ui-production.yml'
- 'pipelines/infofinland-ui-staging.yml'

# Pull request (PR) triggers cause a pipeline to run whenever a pull request is
# opened with one of the specified target branches, or when updates are made to
Expand Down Expand Up @@ -38,10 +38,10 @@ extends:
# Filename in Azure DevOps Repository
template: components/infofinland-ui/pipelines/infofinland-ui-test.yml@infofinland-pipelines
# parameters:
# Application build arguments and config map values as key value pairs.
# Does not contain all buildArguments or configMap values, the rest located in infofinland-pipelines
# The values here will override the values defined in the infofinland-pipelines repository
# buildArgs:
# DEBUG: 1
# configMap: # pod environment variables
# DEBUG: 1
# Application build arguments and config map values as key value pairs.
# Does not contain all buildArguments or configMap values, the rest located in infofinland-pipelines
# The values here will override the values defined in the infofinland-pipelines repository
# buildArgs:
# DEBUG: 1
# configMap: # pod environment variables
# DEBUG: 1
2 changes: 1 addition & 1 deletion src/components/article/VideoBlock.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const VideoBlock = ({ url, title }) => {
<div
className="flex justify-center pt-2 mt-4 border-t border-gray-lighter aspect-video"
role="button"
arial-label={t('video.button')}
aria-label={t('video.button')}
>
<ReactPlayer
light
Expand Down
8 changes: 4 additions & 4 deletions src/components/feedback/FeedbackForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useForm } from 'react-hook-form'
import InfoBlock from '@/components/feedback/InfoBlock'
import { isSSR } from '@/hooks/useIsomorphicLayoutEffect'
import axios from 'axios'
import {nodeIdAtom} from '@/src/store'
import { nodeIdAtom } from '@/src/store'
import { useAtomValue } from 'jotai/utils'

// eslint-disable-next-line react/display-name
Expand Down Expand Up @@ -99,7 +99,7 @@ const FeedbackForm = forwardRef(({ onCancel }, ref) => {
aria-required="true"
id="ifu-feedback-name"
className="ifu-feedback__input"
disable={isSubmitting.toString()}
disabled={isSubmitting.toString()}
{...register('name', { required: true })}
/>
</div>
Expand All @@ -120,7 +120,7 @@ const FeedbackForm = forwardRef(({ onCancel }, ref) => {
type="email"
id="ifu-feedback-email"
aria-required="true"
disable={isSubmitting.toString()}
disabled={isSubmitting.toString()}
className="ifu-feedback__input"
{...register('sender_email', {
required: true,
Expand All @@ -146,7 +146,7 @@ const FeedbackForm = forwardRef(({ onCancel }, ref) => {
rows="6"
aria-required="true"
className="ifu-feedback__input"
disable={isSubmitting.toString()}
disabled={isSubmitting.toString()}
{...register('message', { required: true })}
></textarea>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/drupal-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const getDrupalClient = (withAuth) => {
// Make preview work in development environment.
forceIframeSameSiteCookie: process.env.NODE_ENV === 'development',
...(withAuth && { withAuth: true }),
next: { revalidate: REVALIDATE_TIME }
next: { revalidate: REVALIDATE_TIME },
})
}

Expand Down
Loading

0 comments on commit 79f03fd

Please sign in to comment.