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

@@ -333,6 +333,7 @@
"filter.label.diet": "Ernährung",
"filter.label.drinks": "Getränke",
"filter.label.education_levels": "Bildung",
"filter.label.last_active": "Aktiv",
"filter.label.mbti": "MBTI",
"filter.label.name": "Suche",
"filter.label.political_beliefs": "Politische Ansichten",

View File

@@ -354,6 +354,7 @@
"filter.relationship_status.any": "Tout statut romantique",
"filter.last_active.any": "N'importe quand",
"filter.last_active.label": "Actif",
"filter.label.last_active": "Actif",
"filter.last_active.today": "Aujourd'hui",
"filter.last_active.3days": "3 derniers jours",
"filter.last_active.week": "Dernière semaine",

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])