Skip to content

Commit

Permalink
feat: order by default campaign first and fix an issue for nullish value
Browse files Browse the repository at this point in the history
  • Loading branch information
keellyp committed Oct 30, 2024
1 parent 6198ac9 commit 6067a6c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ export const EditCustomerDunningCampaignDialog = forwardRef<
value: campaign.id,
})) ?? []
}
isEmptyNull={false}
placeholder={translate('text_1729543690326d4dmmcw7n89')}
PopperProps={{ displayInDialog: true }}
/>
Expand Down
13 changes: 11 additions & 2 deletions src/pages/settings/Dunnings/Dunnings.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { gql } from '@apollo/client'
import { useRef } from 'react'
import { useMemo, useRef } from 'react'
import { useNavigate } from 'react-router-dom'

import {
Expand Down Expand Up @@ -102,6 +102,15 @@ const Dunnings = () => {
},
})

const sortedTable = useMemo(
() =>
[...(data?.dunningCampaigns.collection ?? [])].sort((a) => {
// Put items with appliedToOrganization: true first
return a.appliedToOrganization ? -1 : 1
}),
[data?.dunningCampaigns.collection],
)

if (!!error && !loading) {
return (
<GenericPlaceholder
Expand Down Expand Up @@ -200,7 +209,7 @@ const Dunnings = () => {
containerSize={{ default: 0 }}
rowSize={72}
isLoading={loading}
data={data.dunningCampaigns.collection}
data={sortedTable}
columns={[
{
key: 'name',
Expand Down

0 comments on commit 6067a6c

Please sign in to comment.