Skip to content

Commit

Permalink
Revert test
Browse files Browse the repository at this point in the history
  • Loading branch information
thordurhhh committed Jun 17, 2024
1 parent 3e064f5 commit 17e5673
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion libs/service-portal/information/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export * from './module'
export * from './lib/navigation'
export * from './lib/paths'
export * from './components/FamilyMemberCard/FamilyMemberCard'
export * from './screens/Notifications/NotificationInfo.generated'
export * from './screens/Notifications/Notifications.generated'
export * from './utils/notificationLinkResolver'

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fragment NotificationDataFields on Notification {
}

query GetUserNotificationsList($input: NotificationsInput!, $locale: String) {
userNotificationsList: userNotifications(input: $input, locale: $locale) {
userNotifications(input: $input, locale: $locale) {
data {
...NotificationDataFields
recipient {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
useGetUserNotificationsListQuery,
useMarkAllNotificationsAsReadMutation,
useMarkUserNotificationAsReadMutation,
} from './NotificationInfo.generated'
} from './Notifications.generated'

import { mInformationNotifications } from '../../lib/messages'
import { ActionCard, CardLoader } from '@island.is/service-portal/core'
Expand Down Expand Up @@ -76,12 +76,12 @@ const UserNotifications = () => {
},
updateQuery: (prevResult, { fetchMoreResult }) => {
if (
fetchMoreResult?.userNotificationsList?.data.length &&
prevResult?.userNotificationsList?.data.length
fetchMoreResult?.userNotifications?.data.length &&
prevResult?.userNotifications?.data.length
) {
fetchMoreResult.userNotificationsList.data = [
...prevResult.userNotificationsList.data,
...fetchMoreResult.userNotificationsList.data,
fetchMoreResult.userNotifications.data = [
...prevResult.userNotifications.data,
...fetchMoreResult.userNotifications.data,
]
return fetchMoreResult
}
Expand All @@ -90,8 +90,7 @@ const UserNotifications = () => {
}).finally(() => setLoadingMore(false))
}

const noData =
!data?.userNotificationsList?.data?.length && !loading && !error
const noData = !data?.userNotifications?.data?.length && !loading && !error
return (
<>
<IntroHeader
Expand Down Expand Up @@ -145,7 +144,7 @@ const UserNotifications = () => {
)}

{!loading &&
data?.userNotificationsList?.data.map((item) => (
data?.userNotifications?.data.map((item) => (
<ActionCard
heading={item.message.title}
text={item.message.displayBody}
Expand Down Expand Up @@ -175,7 +174,7 @@ const UserNotifications = () => {
/>
))}
{loadingMore && <CardLoader />}
{data?.userNotificationsList?.pageInfo.hasNextPage ? (
{data?.userNotifications?.pageInfo.hasNextPage ? (
<Box
display="flex"
alignItems="center"
Expand All @@ -184,14 +183,14 @@ const UserNotifications = () => {
>
<Button
onClick={() =>
loadMore(data?.userNotificationsList?.pageInfo.endCursor ?? '')
loadMore(data?.userNotifications?.pageInfo.endCursor ?? '')
}
variant="ghost"
size="small"
>
{`${formatMessage(m.fetchMore)} ${
data?.userNotificationsList?.data?.length ?? 0
}/${data?.userNotificationsList?.totalCount ?? 1}`}
data?.userNotifications?.data?.length ?? 0
}/${data?.userNotifications?.totalCount ?? 1}`}
</Button>
</Box>
) : undefined}
Expand Down

0 comments on commit 17e5673

Please sign in to comment.