Format last active filter

This commit is contained in:
MartinBraquet
2026-02-28 13:23:47 +01:00
parent 740a7cc6f9
commit 27c03330c8
4 changed files with 11 additions and 1 deletions

View File

@@ -233,7 +233,7 @@ export const LAST_ONLINE_CHOICES = {
month: 'Last month',
'3months': 'Last 3 months',
any: 'Any time',
}
} as const
export const INVERTED_RELATIONSHIP_CHOICES = invert(RELATIONSHIP_CHOICES)
export const INVERTED_RELATIONSHIP_STATUS_CHOICES = invert(RELATIONSHIP_STATUS_CHOICES)

View File

@@ -9,6 +9,7 @@ import {
INVERTED_RELATIONSHIP_STATUS_CHOICES,
INVERTED_RELIGION_CHOICES,
INVERTED_ROMANTIC_CHOICES,
LAST_ONLINE_CHOICES,
} from 'common/choices'
import {FilterFields, initialFilters} from 'common/filters'
import {hasKidsNames} from 'common/has-kids'
@@ -40,6 +41,7 @@ const filterLabels: Record<string, string> = {
political_beliefs: 'Political views',
languages: '',
mbti: 'MBTI',
last_active: 'Active',
}
export type locationType = {
@@ -141,6 +143,12 @@ export function formatFilters(
`profile.smoker.${value ? 'yes' : 'no'}`,
value ? 'Smoker' : 'Non-smoker',
)
else if (key === 'last_active')
stringValue = translate(
`filter.last_active.${value}`,
LAST_ONLINE_CHOICES[value as keyof typeof LAST_ONLINE_CHOICES] ?? value,
)
if (Array.isArray(value)) {
if (choicesIdsToLabels[key]) {
value = value.map((id) => choicesIdsToLabels[key][id])