Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(web): Stop importing GraphQL types from api/schema #17356

Merged
merged 4 commits into from
Jan 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/web/components/Charts/v2/hooks/chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
PieChart,
} from 'recharts'

import { Chart } from '@island.is/api/schema'
import { Chart } from '@island.is/web/graphql/schema'

import { ChartComponentWithRenderProps, ChartType } from '../types'
import { decideChartBase } from '../utils'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { OfficialJournalOfIcelandAdvertsResponse } from '@island.is/api/schema'
import { Stack } from '@island.is/island-ui/core'
import { Locale } from '@island.is/shared/types'
import { OfficialJournalOfIcelandAdvertsResponse } from '@island.is/web/graphql/schema'
import { linkResolver } from '@island.is/web/hooks'

import { OJOIAdvertCard } from './OJOIAdvertCard'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { useDebounce } from 'react-use'
import { useLazyQuery } from '@apollo/client'
import slugify from '@sindresorhus/slugify'

import { Organizations, SupportCategory } from '@island.is/api/schema'
import {
Box,
Button,
Expand All @@ -35,7 +34,9 @@ import {
ContentLanguage,
GetSupportSearchResultsQuery,
GetSupportSearchResultsQueryVariables,
Organizations,
SearchableContentTypes,
SupportCategory,
SupportQna,
} from '@island.is/web/graphql/schema'
import { useNamespace } from '@island.is/web/hooks'
Expand Down
2 changes: 1 addition & 1 deletion apps/web/components/TableOfContents/TableOfContents.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FC, useMemo } from 'react'

import { Slice } from '@island.is/api/schema'
import { TableOfContents } from '@island.is/island-ui/core'
import { Slice } from '@island.is/web/graphql/schema'
import { scrollTo } from '@island.is/web/hooks/useScrollSpy'

export const TOC: FC<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { Bar, BarChart, Legend, Tooltip, XAxis, YAxis } from 'recharts'
import { useQuery } from '@apollo/client'

import { BrokenDownRegistrationStatisticResponse } from '@island.is/api/domains/electronic-registration-statistics'
import { ConnectedComponent } from '@island.is/api/schema'
import {
Box,
GridColumn,
Expand All @@ -12,13 +11,13 @@ import {
LoadingDots,
Select,
} from '@island.is/island-ui/core'
import { ConnectedComponent } from '@island.is/web/graphql/schema'
import { useNamespace } from '@island.is/web/hooks'

import { GET_BROKEN_DOWN_ELECTRONIC_REGISTRATION_STATISTICS_QUERY } from '../queries'
import { CustomLegend } from './CustomLegend'
import { CustomTooltip } from './CustomTooltip'
import { extractRegistrationTypesFromData } from './utils'
import { CustomLegend } from './CustomLegend'

import * as styles from './MonthlyStatistics.css'

type QueryType = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ import { useIntl } from 'react-intl'
import { useRouter } from 'next/router'
import { useLazyQuery } from '@apollo/client'

import {
FiskistofaShipBasicInfo as ShipBasicInfo,
FiskistofaShipBasicInfoResponse,
QueryFiskistofaGetShipsArgs as QueryGetShipsArgs,
} from '@island.is/api/schema'
import {
Box,
Button,
Expand All @@ -17,6 +12,11 @@ import {
Text,
} from '@island.is/island-ui/core'
import { shouldLinkOpenInNewWindow } from '@island.is/shared/utils'
import {
FiskistofaShipBasicInfo as ShipBasicInfo,
FiskistofaShipBasicInfoResponse,
QueryFiskistofaGetShipsArgs as QueryGetShipsArgs,
} from '@island.is/web/graphql/schema'

import { GET_SHIPS_QUERY } from './queries'
import { translation as translationStrings } from './translation.strings'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import cn from 'classnames'
import { useRouter } from 'next/router'
import { useMachine } from '@xstate/react'

import { FiskistofaExtendedCatchQuotaCategory as ExtendedCatchQuotaCategory } from '@island.is/api/schema'
import {
Box,
Button,
Expand All @@ -14,6 +13,7 @@ import {
Tag,
Text,
} from '@island.is/island-ui/core'
import { FiskistofaExtendedCatchQuotaCategory as ExtendedCatchQuotaCategory } from '@island.is/web/graphql/schema'

import {
formattedNumberStringToNumber,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
import { assign, createMachine } from 'xstate'
import { ApolloClient } from '@apollo/client'
import { createMachine, assign } from 'xstate'

import { sortAlpha } from '@island.is/shared/utils'
import initApollo from '@island.is/web/graphql/client'
import {
FiskistofaCatchQuotaCategory as CatchQuotaCategory,
FiskistofaExtendedCatchQuotaCategory as ExtendedCatchQuotaCategory,
QueryFiskistofaUpdateShipStatusForTimePeriodArgs as QueryUpdateShipStatusForTimePeriodArgs,
QueryFiskistofaGetShipStatusForTimePeriodArgs as QueryGetShipStatusForTimePeriodArgs,
FiskistofaQuotaType as QuotaType,
FiskistofaShip as Ship,
QueryFiskistofaUpdateShipQuotaStatusForTimePeriodArgs as QueryUpdateShipQuotaStatusForTimePeriodArgs,
FiskistofaExtendedShipStatusInformationResponse,
FiskistofaQuotaTypeResponse,
FiskistofaExtendedShipStatusInformationUpdateResponse,
FiskistofaQuotaStatusResponse,
} from '@island.is/api/schema'
import { sortAlpha } from '@island.is/shared/utils'
FiskistofaQuotaType as QuotaType,
FiskistofaQuotaTypeResponse,
FiskistofaShip as Ship,
QueryFiskistofaGetShipStatusForTimePeriodArgs as QueryGetShipStatusForTimePeriodArgs,
QueryFiskistofaUpdateShipQuotaStatusForTimePeriodArgs as QueryUpdateShipQuotaStatusForTimePeriodArgs,
QueryFiskistofaUpdateShipStatusForTimePeriodArgs as QueryUpdateShipStatusForTimePeriodArgs,
} from '@island.is/web/graphql/schema'

import {
GET_QUOTA_TYPES_FOR_TIME_PERIOD,
GET_SHIP_STATUS_FOR_TIME_PERIOD,
UPDATE_SHIP_QUOTA_STATUS_FOR_TIME_PERIOD,
UPDATE_SHIP_STATUS_FOR_TIME_PERIOD,
} from '../queries'
import initApollo from '@island.is/web/graphql/client'

type ContextData = {
shipInformation?: Ship
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import cn from 'classnames'
import { useRouter } from 'next/router'
import { useMachine } from '@xstate/react'

import { FiskistofaCatchQuotaCategory as CatchQuotaCategory } from '@island.is/api/schema'
import {
Box,
Button,
Expand All @@ -14,6 +13,7 @@ import {
Tag,
Text,
} from '@island.is/island-ui/core'
import { FiskistofaCatchQuotaCategory as CatchQuotaCategory } from '@island.is/web/graphql/schema'

import {
getYearOptions,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import { assign, createMachine } from 'xstate'
import { ApolloClient } from '@apollo/client'

import { sortAlpha } from '@island.is/shared/utils'
import initApollo from '@island.is/web/graphql/client'
import {
FiskistofaCatchQuotaCategory as CatchQuotaCategory,
QueryFiskistofaUpdateShipStatusForCalendarYearArgs as QueryUpdateShipStatusForCalendarYearArgs,
QueryFiskistofaGetShipStatusForCalendarYearArgs as QueryGetShipStatusForCalendarYearArgs,
FiskistofaQuotaType as QuotaType,
FiskistofaQuotaTypeResponse,
FiskistofaShip as Ship,
FiskistofaShipStatusInformationResponse,
FiskistofaQuotaTypeResponse,
} from '@island.is/api/schema'
import { sortAlpha } from '@island.is/shared/utils'
import initApollo from '@island.is/web/graphql/client'
import { createMachine, assign } from 'xstate'
QueryFiskistofaGetShipStatusForCalendarYearArgs as QueryGetShipStatusForCalendarYearArgs,
QueryFiskistofaUpdateShipStatusForCalendarYearArgs as QueryUpdateShipStatusForCalendarYearArgs,
} from '@island.is/web/graphql/schema'

import {
GET_QUOTA_TYPES_FOR_CALENDAR_YEAR,
GET_SHIP_STATUS_FOR_CALENDAR_YEAR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { CSSProperties, FC, useState } from 'react'
import { useIntl } from 'react-intl'
import { useQuery } from '@apollo/client/react'

import { ConnectedComponent, Query } from '@island.is/api/schema'
import {
AlertMessage,
Box,
Expand All @@ -13,6 +12,7 @@ import {
Text,
} from '@island.is/island-ui/core'
import { sortAlpha } from '@island.is/shared/utils'
import { ConnectedComponent, Query } from '@island.is/web/graphql/schema'

import { GET_BROKERS_QUERY } from './queries'
import { translation as t } from './translation.strings'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { useIntl } from 'react-intl'
import { useQueryState } from 'next-usequerystate'
import { useQuery } from '@apollo/client/react'

import { ConnectedComponent, Query } from '@island.is/api/schema'
import {
AlertMessage,
Box,
Expand All @@ -19,7 +18,11 @@ import {
} from '@island.is/island-ui/core'
import { sortAlpha } from '@island.is/shared/utils'
import { SyslumennListCsvExport } from '@island.is/web/components'
import { JourneymanLicence } from '@island.is/web/graphql/schema'
import {
ConnectedComponent,
JourneymanLicence,
Query,
} from '@island.is/web/graphql/schema'
import { useDateUtils } from '@island.is/web/i18n/useDateUtils'

import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { useIntl } from 'react-intl'
import { useQueryState } from 'next-usequerystate'
import { useQuery } from '@apollo/client/react'

import { ConnectedComponent, Query } from '@island.is/api/schema'
import {
AlertMessage,
Box,
Expand All @@ -19,6 +18,7 @@ import {
} from '@island.is/island-ui/core'
import { sortAlpha } from '@island.is/shared/utils'
import { SyslumennListCsvExport } from '@island.is/web/components'
import { ConnectedComponent, Query } from '@island.is/web/graphql/schema'
import { MasterLicence } from '@island.is/web/graphql/schema'
import { useDateUtils } from '@island.is/web/i18n/useDateUtils'

Expand Down
10 changes: 5 additions & 5 deletions apps/web/components/connected/syslumenn/utils/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ export const textSearch = (
)
}

export const getSortedAndFilteredList = <
T extends Record<string, string | null>,
>(
export const getSortedAndFilteredList = <T>(
list: T[],
searchTerms: string[],
keys: (keyof T)[],
Expand All @@ -30,13 +28,15 @@ export const getSortedAndFilteredList = <

const startsWithFullSearchString = (item: T): boolean => {
return keys.some((key) =>
item[key]?.trim().toLowerCase().startsWith(fullSearchString),
(item[key] as string)?.trim().toLowerCase().startsWith(fullSearchString),
RunarVestmann marked this conversation as resolved.
Show resolved Hide resolved
)
}

const containsAllTerms = (item: T): boolean => {
return searchTerms.every((searchTerm) =>
keys.some((key) => item[key]?.trim().toLowerCase().includes(searchTerm)),
keys.some((key) =>
(item[key] as string)?.trim().toLowerCase().includes(searchTerm),
),
RunarVestmann marked this conversation as resolved.
Show resolved Hide resolved
)
}

Expand Down
43 changes: 22 additions & 21 deletions apps/web/screens/Adgerdir/Article.tsx
Original file line number Diff line number Diff line change
@@ -1,43 +1,44 @@
/* eslint-disable jsx-a11y/anchor-is-valid */
import React, { useRef, useState, useEffect } from 'react'
import React, { useEffect, useRef, useState } from 'react'
import { createPortal } from 'react-dom'
import NextLink from 'next/link'

import { richText, Slice as SliceType } from '@island.is/island-ui/contentful'
import {
ContentBlock,
Box,
Stack,
ContentBlock,
Inline,
Stack,
Text,
} from '@island.is/island-ui/core'
import { richText, Slice as SliceType } from '@island.is/island-ui/contentful'
import { HeadWithSocialSharing } from '@island.is/web/components'
import {
Query,
QueryGetNamespaceArgs,
ContentLanguage,
Query,
QueryGetAdgerdirPageArgs,
QueryGetAdgerdirPagesArgs,
QueryGetAdgerdirTagsArgs,
} from '@island.is/api/schema'
QueryGetNamespaceArgs,
} from '@island.is/web/graphql/schema'
import { useNamespace } from '@island.is/web/hooks'
import { useI18n } from '@island.is/web/i18n'
import { withMainLayout } from '@island.is/web/layouts/main'
import { HeadWithSocialSharing } from '@island.is/web/components'
import AdgerdirArticles from './components/AdgerdirArticles/AdgerdirArticles'
import { Tag } from './components/UI/Tag/Tag'
import { ProcessEntry } from './components/UI/ProcessEntry/ProcessEntry'
import { Breadcrumbs } from './components/UI/Breadcrumbs/Breadcrumbs'
import { ColorSchemeContext } from './components/UI/ColorSchemeContext/ColorSchemeContext'
import { SidebarLayout } from '@island.is/web/screens/Layouts/SidebarLayout'
import { Screen } from '@island.is/web/types'
import { CustomNextError } from '@island.is/web/units/errors'

import { LinkType, useLinkResolver } from '../../hooks/useLinkResolver'
import {
GET_ADGERDIR_PAGE_QUERY,
GET_NAMESPACE_QUERY,
GET_ADGERDIR_PAGES_QUERY,
GET_ADGERDIR_TAGS_QUERY,
GET_NAMESPACE_QUERY,
} from '../queries'
import { SidebarLayout } from '@island.is/web/screens/Layouts/SidebarLayout'
import { Screen } from '@island.is/web/types'
import { useI18n } from '@island.is/web/i18n'
import { CustomNextError } from '@island.is/web/units/errors'
import { useNamespace } from '@island.is/web/hooks'
import { LinkType, useLinkResolver } from '../../hooks/useLinkResolver'

import AdgerdirArticles from './components/AdgerdirArticles/AdgerdirArticles'
import { Breadcrumbs } from './components/UI/Breadcrumbs/Breadcrumbs'
import { ColorSchemeContext } from './components/UI/ColorSchemeContext/ColorSchemeContext'
import { ProcessEntry } from './components/UI/ProcessEntry/ProcessEntry'
import { Tag } from './components/UI/Tag/Tag'
import * as covidStyles from './components/UI/styles/styles.css'

interface AdgerdirArticleProps {
Expand Down
Loading
Loading