Skip to content

Commit

Permalink
chore: replace dataset filter
Browse files Browse the repository at this point in the history
  • Loading branch information
Chisomchima committed Nov 13, 2024
1 parent 8722443 commit 5a88fd4
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 12 deletions.
22 changes: 14 additions & 8 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2024-11-12T08:30:18.816Z\n"
"PO-Revision-Date: 2024-11-12T08:30:18.816Z\n"
"POT-Creation-Date: 2024-11-13T12:57:12.003Z\n"
"PO-Revision-Date: 2024-11-13T12:57:12.004Z\n"

msgid "schemas"
msgstr "schemas"
Expand Down Expand Up @@ -306,6 +306,9 @@ msgstr "Type to filter options"
msgid "No matches"
msgstr "No matches"

msgid "Data set"
msgstr "Data set"

msgid "Search by name, code or ID"
msgstr "Search by name, code or ID"

Expand Down Expand Up @@ -477,9 +480,6 @@ msgstr "Data element group set"
msgid "Data element group sets"
msgstr "Data element group sets"

msgid "Data set"
msgstr "Data set"

msgid "Data sets"
msgstr "Data sets"

Expand Down Expand Up @@ -849,6 +849,12 @@ msgstr "MultiPolygon"
msgid "GeometryCollection"
msgstr "GeometryCollection"

msgid "Section"
msgstr "Section"

msgid "Section Multi-org"
msgstr "Section Multi-org"

msgid "Aggregation type"
msgstr "Aggregation type"

Expand All @@ -861,6 +867,9 @@ msgstr "Form name"
msgid "Domain type"
msgstr "Domain type"

msgid "Form type"
msgstr "Form type"

msgid "Sharing"
msgstr "Sharing"

Expand Down Expand Up @@ -900,9 +909,6 @@ msgstr "Created successfully"
msgid "Required"
msgstr "Required"

msgid "Form type"
msgstr "Form type"

msgid "Period type"
msgstr "Period type"

Expand Down
2 changes: 1 addition & 1 deletion src/components/sectionList/filters/FilterWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import i18n from '@dhis2/d2-i18n'
import { Button } from '@dhis2/ui'
import React from 'react'
import { useSectionListFilters } from './../../../lib'
import { DynamicFilters } from './DynamicFilters'
import { DynamicFilters } from './filterSelectors/DynamicFilters'
import { IdentifiableFilter } from './filterSelectors/IdentifiableFilter'
import css from './FilterWrapper.module.css'

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import i18n from '@dhis2/d2-i18n'
import React from 'react'
import { useSectionListFilter } from '../../../../lib'
import { createFilterDataQuery } from './createFilterDataQuery'
import { ModelFilterSelect } from './ModelFilter'

const query = createFilterDataQuery('dataSets')

export const DataSetFilter = () => {
const [filter, setFilter] = useSectionListFilter('dataSet')

const selected = filter?.[0]

return (
<ModelFilterSelect
placeholder={i18n.t('Data set')}
query={query}
selected={selected}
onChange={({ selected }) =>
setFilter(selected ? [selected] : undefined)
}
/>
)
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { ConfigurableFilterKey } from './../../../lib'
import { ConfigurableFilterKey } from '../../../../lib'
import {
AggregationTypeFilter,
CategoryComboFilter,
Expand All @@ -13,8 +13,9 @@ import {
PublicAccessFilter,
ValueTypeSelectionFilter,
FormTypeFilter,
} from './filterSelectors'
import { useFilterKeys } from './useFilterKeys'
DataSetFilter
} from '.'
import { useFilterKeys } from '../useFilterKeys'

type FilterKeyToComponentMap = Partial<Record<ConfigurableFilterKey, React.FC>>

Expand All @@ -31,6 +32,7 @@ const filterKeyToComponentMap: FilterKeyToComponentMap = {
publicAccess: PublicAccessFilter,
dataDimensionType: DataDimensionTypeFilter,
ignoreApproval: IgnoreApprovalFilter,
dataSet: DataSetFilter,
}

export const DynamicFilters = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ export * from './CategoryOptionGroupFilter'
export * from './BooleanFilters'
export * from './CategoryOptionFilter'
export * from './IndicatorFilter'
export * from './DataSetFilter'

0 comments on commit 5a88fd4

Please sign in to comment.