Skip to content

Commit

Permalink
Get basic filters working
Browse files Browse the repository at this point in the history
  • Loading branch information
haworku committed Oct 24, 2023
1 parent f5d8b9e commit 9169357
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { RateInDashboardType, RateReviewsTable } from './RateReviewsTable'
import { useLDClient } from 'launchdarkly-react-client-sdk'
import { featureFlags } from '../../../common-code/featureFlags'
import { ErrorFailedRequestPage } from '../../Errors/ErrorFailedRequestPage'
import { RateTypeRecord } from '../../../constants/healthPlanPackages'

const RateReviewsDashboard = (): React.ReactElement => {
const { loggedInUser } = useAuth()
Expand Down Expand Up @@ -66,6 +67,7 @@ const RateReviewsDashboard = (): React.ReactElement => {
rate.id
} formData: ${JSON.stringify(displayRateFormData)})}`
)
return
}

if (!lastUpdated) {
Expand All @@ -78,7 +80,6 @@ const RateReviewsDashboard = (): React.ReactElement => {
const programs = rate.state.programs

const missingField = 'Missing field'

reviewRows.push({
id: rate.id,
name: displayRateFormData.rateCertificationName || missingField,
Expand All @@ -92,7 +93,9 @@ const RateReviewsDashboard = (): React.ReactElement => {
rateDateEnd: displayRateFormData.rateDateEnd,
status: rate.status,
updatedAt: lastUpdated,
rateType: displayRateFormData.rateType || 'NEW',
rateType: displayRateFormData.rateType
? RateTypeRecord[displayRateFormData.rateType]
: missingField,
stateName: rate.state.name,
contractRevisions: currentRevision.contractRevisions,
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
HealthPlanPackageStatus,
Program,
RelatedContractRevisions,
RateType,
} from '../../../gen/gqlClient'
import styles from '../../../components/HealthPlanPackageTable/HealthPlanPackageTable.module.scss'
import { Table, Tag, Link } from '@trussworks/react-uswds'
Expand All @@ -31,7 +30,6 @@ import {
FilterOptionType,
} from '../../../components/FilterAccordion'
import { pluralize } from '../../../common-code/formatters'
import { RateTypeRecord } from '../../../constants/healthPlanPackages'

declare module '@tanstack/table-core' {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
Expand All @@ -47,7 +45,7 @@ export type RateInDashboardType = {
updatedAt: Date
status: HealthPlanPackageStatus
programs: Program[]
rateType: RateType
rateType: string
rateDateStart: Date
rateDateEnd: Date
stateName: string
Expand Down Expand Up @@ -128,9 +126,11 @@ const getSelectedFiltersFromUrl = (
})
}
})

const filterValues = valuesFromUrl
.filter((item) => item.id === id)
.map((item) => ({ value: item.value, label: item.value }))

return filterValues as FilterOptionType[]
}

Expand Down Expand Up @@ -213,7 +213,7 @@ export const RateReviewsTable = ({
columnHelper.accessor('rateType', {
id: 'rateType',
header: 'Rate type',
cell: (info) => <span>{RateTypeRecord[info.getValue()]}</span>,
cell: (info) => <span>{info.getValue()}</span>,
meta: {
dataTestID: 'rate-type',
},
Expand Down Expand Up @@ -276,6 +276,9 @@ export const RateReviewsTable = ({
a['updatedAt'] > b['updatedAt'] ? -1 : 1
),
columns: tableColumns,
state: {
columnFilters,
},
getCoreRowModel: getCoreRowModel(),
onColumnFiltersChange: setColumnFilters,
getFacetedUniqueValues: getFacetedUniqueValues(),
Expand Down

0 comments on commit 9169357

Please sign in to comment.