Skip to content

Commit

Permalink
fix: revert income plan
Browse files Browse the repository at this point in the history
  • Loading branch information
thorkellmani committed Dec 12, 2024
1 parent 931cd96 commit c17382e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,68 +8,21 @@ import {
} from '@island.is/island-ui/core'
import { useLocale, useNamespaces } from '@island.is/localization'
import {
FootNote,
IntroHeader,
EmptyTable,
IntroWrapper,
LinkButton,
amountFormat,
m as coreMessages,
} from '@island.is/portals/my-pages/core'
import { m } from '../../lib/messages'
import {
useGetIncomePlanDetailLazyQuery,
useGetIncomePlanDetailQuery,
} from './IncomePlanDetail.generated'
import { useGetIncomePlanDetailQuery } from './IncomePlanDetail.generated'
import { Problem } from '@island.is/react-spa/shared'
import { useEffect, useState } from 'react'
import { useFeatureFlagClient } from '@island.is/react/feature-flags'

const IncomePlanDetail = () => {
useNamespaces('sp.social-insurance-maintenance')
const { formatMessage } = useLocale()

const [displayPaymentPlan, setDisplayPaymentPlan] = useState(false)
const [query, { data, loading, error }] = useGetIncomePlanDetailLazyQuery()

const featureFlagClient = useFeatureFlagClient()
useEffect(() => {
const isFlagEnabled = async () => {
const ffEnabled = await featureFlagClient.getValue(
`isServicePortalPaymentPlan2025Enabled`,
false,
)
if (ffEnabled) {
setDisplayPaymentPlan(ffEnabled as boolean)
}
}
isFlagEnabled()
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])

useEffect(() => {
if (displayPaymentPlan) {
query()
}
}, [displayPaymentPlan])

if (!displayPaymentPlan) {
return (
<IntroWrapper
title={formatMessage(coreMessages.latestIncomePlan)}
intro={formatMessage(m.incomePlanDetail)}
serviceProviderSlug={'tryggingastofnun'}
serviceProviderTooltip={formatMessage(
coreMessages.socialInsuranceTooltip,
)}
>
<AlertMessage
type="warning"
message={formatMessage(m.incomePlanTemporarilyUnavailable)}
/>
</IntroWrapper>
)
}

const { data, loading, error } = useGetIncomePlanDetailQuery()
return (
<IntroWrapper
title={formatMessage(coreMessages.latestIncomePlan)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const PaymentPlan = () => {
const [query, { data, loading, error }] = useGetPreviousPaymentsLazyQuery()

const featureFlagClient = useFeatureFlagClient()

useEffect(() => {
const isFlagEnabled = async () => {
const ffEnabled = await featureFlagClient.getValue(
Expand Down

0 comments on commit c17382e

Please sign in to comment.