Skip to content

Commit

Permalink
Merge branch 'main' into my-pages/healthcenter-update
Browse files Browse the repository at this point in the history
  • Loading branch information
disaerna authored Nov 22, 2024
2 parents 40315b8 + d45ac0c commit d9f64ea
Show file tree
Hide file tree
Showing 61 changed files with 1,043 additions and 311 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pullrequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ jobs:
runs-on: ec2-runners
container:
image: public.ecr.aws/m3u4c4h9/island-is/actions-runner-public:latest
timeout-minutes: 35
timeout-minutes: 45
env:
AFFECTED_PROJECTS: ${{ matrix.projects }}
MAX_JOBS: 1
Expand Down Expand Up @@ -220,7 +220,7 @@ jobs:
runs-on: ec2-runners
container:
image: public.ecr.aws/m3u4c4h9/island-is/actions-runner-public:latest
timeout-minutes: 35
timeout-minutes: 45
env:
AFFECTED_PROJECT: ${{ matrix.projects }}
CYPRESS_PROJECT_ID: 4q7jz8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export abstract class BaseNotificationService {
// We use the first one as the main recipient and the rest as CC
let recipients = recipientEmail ? recipientEmail.split(',') : undefined

if (!this.config.production && recipients) {
if (this.config.shouldUseWhitelist && recipients) {
recipients = await this.handleWhitelist(recipients)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ export const notificationModuleConfig = defineConfig({
load: (env) => ({
production: env.optional('NODE_ENV') === 'production',
courtOfAppealsId: '4676f08b-aab4-4b4f-a366-697540788088',
shouldUseWhitelist:
env.required('CONTENTFUL_ENVIRONMENT', 'test') !== 'master',
email: {
fromEmail: env.required('EMAIL_FROM', '[email protected]'),
fromName: env.required('EMAIL_FROM_NAME', 'Réttarvörslugátt'),
Expand Down
6 changes: 6 additions & 0 deletions apps/services/auth/admin-api/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@
},
"outputs": ["{workspaceRoot}/coverage/apps/services/auth/admin-api"]
},
"dev": {
"executor": "nx:run-commands",
"options": {
"command": "yarn start --project services-auth-admin-api"
}
},
"codegen/backend-schema": {
"executor": "nx:run-commands",
"options": {
Expand Down
2 changes: 2 additions & 0 deletions apps/services/bff/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ConfigModule } from '@island.is/nest/config'
import { Module } from '@nestjs/common'
import { ProblemModule } from '@island.is/nest/problem'
import { BffConfig } from './bff.config'
import { AuthModule as AppAuthModule } from './modules/auth/auth.module'
import { CacheModule } from './modules/cache/cache.module'
Expand All @@ -18,6 +19,7 @@ import { EnhancedFetchModule } from './modules/enhancedFetch/enhanced-fetch.modu
AppAuthModule,
ProxyModule,
EnhancedFetchModule,
ProblemModule,
],
})
export class AppModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -456,8 +456,8 @@ describe('AuthController', () => {
expect(res.status).toEqual(HttpStatus.BAD_REQUEST)
// Expect error to be
expect(res.body).toMatchObject({
statusCode: 400,
message: 'No param "logout_token" provided!',
status: 400,
detail: 'No param "logout_token" provided!',
})
})

Expand Down
1 change: 1 addition & 0 deletions apps/services/bff/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ bootstrap({
port: environment.port,
globalPrefix: `${environment.keyPath}/bff`,
healthCheck: true,
jsonBodyLimit: '350kb',
})
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ export class NotificationsWorkerService implements OnApplicationBootstrap {
const nationalIdOfOriginalRecipient =
message.onBehalfOf?.nationalId ?? profile.nationalId

fullName = await this.getFullName(nationalIdOfOriginalRecipient)
fullName = await this.getName(nationalIdOfOriginalRecipient)
}

const isEnglish = profile.locale === 'en'
Expand Down Expand Up @@ -412,7 +412,7 @@ export class NotificationsWorkerService implements OnApplicationBootstrap {
let recipientName = ''

if (delegations.data.length > 0) {
recipientName = await this.getFullName(message.recipient)
recipientName = await this.getName(message.recipient)
}

await Promise.all(
Expand Down Expand Up @@ -441,16 +441,23 @@ export class NotificationsWorkerService implements OnApplicationBootstrap {
)
}

private async getFullName(nationalId: string): Promise<string> {
let identity: CompanyExtendedInfo | EinstaklingurDTONafnItar | null
private async getName(nationalId: string): Promise<string> {
try {
let identity: CompanyExtendedInfo | EinstaklingurDTONafnItar | null

if (isCompany(nationalId)) {
identity = await this.companyRegistryService.getCompany(nationalId)
return identity?.name ?? ''
}
if (isCompany(nationalId)) {
identity = await this.companyRegistryService.getCompany(nationalId)
return identity?.name ?? ''
}

identity = await this.nationalRegistryService.getName(nationalId)
return identity?.birtNafn ?? ''
identity = await this.nationalRegistryService.getName(nationalId)
return identity?.birtNafn ?? ''
} catch (error) {
this.logger.error('Error getting name from national registry', {
error,
})
return ''
}
}

/* Private methods */
Expand Down
2 changes: 1 addition & 1 deletion apps/web/components/connected/WHODAS/Calculator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const WHODASForm = ({ step, stepIndex, state, setState }: WHODASFormProps) => {
{answerOptions.map((option, answerIndex) => {
const id = `${step.title}-${questionIndex}-${answerIndex}`

if (answerIndex > 3) {
if (answerIndex > 4) {
return null
}

Expand Down
2 changes: 1 addition & 1 deletion apps/web/hooks/useLinkResolver/useLinkResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ export const routesTemplate = {
en: '',
},
styrkjatorgsearch: {
is: '/styrkjatorg/leit',
is: '/styrkjatorg/styrkir',
en: '',
},
styrkjatorggrant: {
Expand Down
File renamed without changes.
7 changes: 6 additions & 1 deletion apps/web/screens/Grants/Grant/Grant.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
} from '@island.is/web/graphql/schema'
import { useLinkResolver } from '@island.is/web/hooks'
import { withMainLayout } from '@island.is/web/layouts/main'
import { CustomNextError } from '@island.is/web/units/errors'
import { webRichText } from '@island.is/web/utils/richText'

import {
Expand All @@ -32,14 +33,14 @@ import SidebarLayout from '../../Layouts/SidebarLayout'
import { GET_GRANT_QUERY } from '../../queries'
import { m } from '../messages'
import { GrantSidebar } from './GrantSidebar'
import { CustomNextError } from '@island.is/web/units/errors'

const GrantSinglePage: CustomScreen<GrantSingleProps> = ({ grant, locale }) => {
const { formatMessage } = useIntl()
const { linkResolver } = useLinkResolver()
const router = useRouter()

const baseUrl = linkResolver('styrkjatorg', [], locale).href
const searchUrl = linkResolver('styrkjatorgsearch', [], locale).href
const currentUrl = linkResolver(
'styrkjatorggrant',
[grant?.applicationId ?? ''],
Expand All @@ -55,6 +56,10 @@ const GrantSinglePage: CustomScreen<GrantSingleProps> = ({ grant, locale }) => {
title: formatMessage(m.home.title),
href: baseUrl,
},
{
title: formatMessage(m.search.results),
href: searchUrl,
},
{
title: grant?.name ?? formatMessage(m.home.grant),
href: currentUrl,
Expand Down
28 changes: 17 additions & 11 deletions apps/web/screens/Grants/Grant/GrantSidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useMemo } from 'react'
import { useIntl } from 'react-intl'

import { Box, Button, LinkV2, Stack, Text } from '@island.is/island-ui/core'
import { Locale } from '@island.is/shared/types'
Expand All @@ -9,6 +8,8 @@ import { Grant } from '@island.is/web/graphql/schema'
import { LinkType, useLinkResolver } from '@island.is/web/hooks'

import { m } from '../messages'
import { useLocale } from '@island.is/localization'
import { generateStatusTag } from '../utils'

interface Props {
grant: Grant
Expand All @@ -30,20 +31,21 @@ const generateLine = (heading: string, content?: React.ReactNode) => {
}

export const GrantSidebar = ({ grant, locale }: Props) => {
const { formatMessage } = useIntl()
const { linkResolver } = useLinkResolver()
const { formatMessage } = useLocale()

const detailPanelData = useMemo(
() =>
[
generateLine(
formatMessage(m.single.fund),
grant?.fund?.link?.slug ? (
<Text fontWeight="semiBold" color="blue400">
<Text fontWeight="semiBold" variant="medium" color="blue400">
<LinkV2
{...linkResolver(grant.fund.link.type as LinkType, [
grant.fund.link.slug,
])}
newTab
color="blue400"
underline="normal"
underlineVisibility="hover"
Expand All @@ -55,12 +57,14 @@ export const GrantSidebar = ({ grant, locale }: Props) => {
),
generateLine(
formatMessage(m.single.category),
grant?.categoryTags
? grant.categoryTags
grant?.categoryTags ? (
<Text variant="medium">
{grant.categoryTags
.map((ct) => ct.title)
.filter(isDefined)
.join(', ')
: undefined,
.join(', ')}
</Text>
) : undefined,
),
generateLine(
formatMessage(m.single.type),
Expand All @@ -70,14 +74,16 @@ export const GrantSidebar = ({ grant, locale }: Props) => {
),
generateLine(
formatMessage(m.single.deadline),
grant?.applicationDeadlineText ? (
<Text variant="medium">{grant.applicationDeadlineText}</Text>
grant?.applicationDeadlineStatus ? (
<Text variant="medium">{grant.applicationDeadlineStatus}</Text>
) : undefined,
),
generateLine(
formatMessage(m.single.status),
grant?.statusText ? (
<Text variant="medium">{grant.statusText}</Text>
grant?.status ? (
<Text variant="medium">
{generateStatusTag(grant.status, formatMessage)?.label}
</Text>
) : undefined,
),
].filter(isDefined) ?? [],
Expand Down
14 changes: 13 additions & 1 deletion apps/web/screens/Grants/Home/GrantsHome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ import {
} from '../../CustomPage/CustomPageWrapper'
import { GET_GENERIC_TAGS_IN_TAG_GROUPS_QUERY } from '../../queries/GenericTag'
import { m } from '../messages'
import {
CATEGORY_TAG_SLUGS,
CategorySlug,
mapTagToMessageId,
} from './mapTagToMessageId'

const GrantsHomePage: CustomScreen<GrantsHomeProps> = ({
categories,
Expand All @@ -51,6 +56,7 @@ const GrantsHomePage: CustomScreen<GrantsHomeProps> = ({
{
title: formatMessage(m.home.title),
href: baseUrl,
isTag: true,
},
]

Expand Down Expand Up @@ -138,7 +144,13 @@ const GrantsHomePage: CustomScreen<GrantsHomeProps> = ({
<CategoryCard
href={`${searchUrl}?category=${c.slug}`}
heading={c.title}
text={'Lýsing á flokk'}
text={
CATEGORY_TAG_SLUGS.includes(c.slug as CategorySlug)
? formatMessage(
mapTagToMessageId(c.slug as CategorySlug),
)
: ''
}
/>
</GridColumn>
))}
Expand Down
38 changes: 38 additions & 0 deletions apps/web/screens/Grants/Home/mapTagToMessageId.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { m } from '../messages'

export const CATEGORY_TAG_SLUGS = [
'grant-category-business',
'grant-category-culture-and-arts',
'grant-category-native',
'grant-category-research',
'grant-category-innovation',
'grant-category-global',
'grant-category-professional-education',
'grant-category-education-and-teaching',
'grant-category-youth-and-sports',
] as const

export type CategorySlug = typeof CATEGORY_TAG_SLUGS[number]

export const mapTagToMessageId = (tagSlug: CategorySlug) => {
switch (tagSlug) {
case 'grant-category-business':
return m.home.grantCategoryBusinessDescription
case 'grant-category-culture-and-arts':
return m.home.grantCategoryCultureAndArtsDescription
case 'grant-category-native':
return m.home.grantCategoryNativeDescription
case 'grant-category-research':
return m.home.grantCategoryResearchDescription
case 'grant-category-innovation':
return m.home.grantCategoryInnovationDescription
case 'grant-category-global':
return m.home.grantCategoryGlobalDescription
case 'grant-category-professional-education':
return m.home.grantCategoryProfessionalEducationDescription
case 'grant-category-education-and-teaching':
return m.home.grantCategoryEducationAndTeachingDescription
case 'grant-category-youth-and-sports':
return m.home.grantCategoryYouthAndSportsDescription
}
}
20 changes: 13 additions & 7 deletions apps/web/screens/Grants/SearchResults/SearchResults.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ const GrantsSearchResultsPage: CustomScreen<GrantsHomeProps> = ({
setInitialRender(false)
return
}

getGrants({
variables: {
input: {
Expand Down Expand Up @@ -357,15 +358,14 @@ const GrantsSearchResults: CustomScreen<GrantsHomeProps> = ({
GrantsSearchResults.getProps = async ({ apolloClient, locale, query }) => {
const arrayParser = parseAsArrayOf<string>(parseAsString)

const parseArray = (arg: string | string[] | undefined) => {
const array = arrayParser.parseServerSide(arg)

const filterArray = <T,>(array: Array<T> | null | undefined) => {
if (array && array.length > 0) {
return array
}

return undefined
}

const [
{
data: { getGrants },
Expand All @@ -381,10 +381,16 @@ GrantsSearchResults.getProps = async ({ apolloClient, locale, query }) => {
lang: locale as ContentLanguage,
page: parseAsInteger.withDefault(1).parseServerSide(query?.page),
search: parseAsString.parseServerSide(query?.query) ?? undefined,
categories: parseArray(query?.category),
statuses: parseArray(query?.status),
types: parseArray(query?.type),
organizations: parseArray(query?.organization),
categories: filterArray<string>(
arrayParser.parseServerSide(query?.category),
),
statuses: filterArray<string>(
arrayParser.parseServerSide(query?.status),
),
types: filterArray<string>(arrayParser.parseServerSide(query?.type)),
organizations: filterArray<string>(
arrayParser.parseServerSide(query?.organization),
),
},
},
}),
Expand Down
Loading

0 comments on commit d9f64ea

Please sign in to comment.