diff --git a/common/messages/fr.json b/common/messages/fr.json index 0fd8379f..173a08af 100644 --- a/common/messages/fr.json +++ b/common/messages/fr.json @@ -340,7 +340,8 @@ "filter.label.pref_age_min": "Âge min", "filter.label.pref_gender": "Genre recherché", "filter.label.pref_relation_styles": "Recherche", - "filter.label.wants_kids_strength": "Enfants", + "filter.label.wants_kids_strength": "Désir d'enfants", + "filter.label.has_kids": "Enfants", "filter.location": "Habite", "filter.location.any": "n'importe où", "filter.location.search_city": "Rechercher une ville...", @@ -360,9 +361,9 @@ "filter.last_active.3months": "3 derniers mois", "filter.reset": "Réinitialiser", "filter.short_bio_toggle": "Inclure les profils incomplets", - "filter.wants_kids.any_preference": "Toutes préférences", + "filter.wants_kids.any_preference": "N'importe", "filter.wants_kids.doesnt_want_kids": "Ne veut pas d'enfants", - "filter.wants_kids.either": "Tout désir d'enfants", + "filter.wants_kids.either": "N'importe", "filter.wants_kids.wants_kids": "Veut des enfants", "font.atkinson": "Atkinson Hyperlegible", "font.classic-serif": "Serif classique", @@ -679,12 +680,12 @@ "profile.gender.plural.male": "Hommes", "profile.gender.plural.other": "Autres", "profile.has_kids": "A des enfants", - "profile.has_kids.-1": "Tout enfant", + "profile.has_kids.-1": "N'importe", "profile.has_kids.0": "N'a pas d'enfants", "profile.has_kids.1": "A des enfants", "profile.has_kids.doesnt_have_kids": "N'a pas d'enfants", "profile.has_kids.has_kids": "A des enfants", - "profile.has_kids.no_preference": "Tout enfant", + "profile.has_kids.no_preference": "N'importe", "profile.has_kids_many": "A {count} enfants", "profile.has_kids_one": "A {count} enfant", "profile.header.age": "{age} ans", diff --git a/common/src/has-kids.ts b/common/src/has-kids.ts index 52214ddb..4b022faf 100644 --- a/common/src/has-kids.ts +++ b/common/src/has-kids.ts @@ -10,7 +10,7 @@ export interface HasKidsLabelsMap { export const hasKidsLabels: HasKidsLabelsMap = { no_preference: { - name: 'Any kids', + name: 'Either way', shortName: 'Either', value: -1, }, diff --git a/common/src/util/array.ts b/common/src/util/array.ts index dd58b41e..e9407308 100644 --- a/common/src/util/array.ts +++ b/common/src/util/array.ts @@ -31,3 +31,8 @@ export function groupConsecutive(xs: T[], key: (x: T) => U) { result.push(curr) return result } + +export function nullifyEmpty(array: T[]) { + if (!Array.isArray(array)) return null + return array.length > 0 ? array : null +} diff --git a/common/src/wants-kids.ts b/common/src/wants-kids.ts index 03478262..287e0b0c 100644 --- a/common/src/wants-kids.ts +++ b/common/src/wants-kids.ts @@ -10,7 +10,7 @@ export type KidsLabelsMap = Record export const wantsKidsLabels: KidsLabelsMap = { no_preference: { - name: 'Any preference', + name: 'Either', shortName: 'Either', strength: -1, }, diff --git a/web/components/answers/compatibility-questions-display.tsx b/web/components/answers/compatibility-questions-display.tsx index 015f48fb..0e5627c3 100644 --- a/web/components/answers/compatibility-questions-display.tsx +++ b/web/components/answers/compatibility-questions-display.tsx @@ -11,7 +11,7 @@ import {buildArray} from 'common/util/array' import {keyBy, partition, sortBy} from 'lodash' import {useEffect, useState} from 'react' import toast from 'react-hot-toast' -import DropdownMenu from 'web/components/comments/dropdown-menu' +import DropdownMenu, {DropdownButton} from 'web/components/comments/dropdown-menu' import {Col} from 'web/components/layout/col' import {Modal, MODAL_CLASS, SCROLLABLE_MODAL_CLASS} from 'web/components/layout/modal' import {Row} from 'web/components/layout/row' @@ -32,7 +32,6 @@ import {useUser} from 'web/hooks/use-user' import {useT} from 'web/lib/locale' import {db} from 'web/lib/supabase/db' -import {DropdownButton} from '../filters/desktop-filters' import {Subtitle} from '../widgets/profile-subtitle' import {AddCompatibilityQuestionButton} from './add-compatibility-question-button' import { diff --git a/web/components/comments/dropdown-menu.tsx b/web/components/comments/dropdown-menu.tsx index a0dee85e..53193d9b 100644 --- a/web/components/comments/dropdown-menu.tsx +++ b/web/components/comments/dropdown-menu.tsx @@ -1,10 +1,11 @@ import {Popover, Transition} from '@headlessui/react' -import {DotsHorizontalIcon} from '@heroicons/react/solid' +import {ChevronDownIcon, ChevronUpIcon, DotsHorizontalIcon} from '@heroicons/react/solid' import clsx from 'clsx' import {toKey} from 'common/parsing' import {Fragment, ReactNode, useState} from 'react' import {usePopper} from 'react-popper' import {Col} from 'web/components/layout/col' +import {Row} from 'web/components/layout/row' import {useT} from 'web/lib/locale' export type DropdownItem = { @@ -165,3 +166,15 @@ export function DropdownOptions(props: { ) } + +export function DropdownButton(props: {open: boolean; content: ReactNode}) { + const {open, content} = props + return ( + + {content} + + {open ? : } + + + ) +} diff --git a/web/components/filters/desktop-filters.tsx b/web/components/filters/desktop-filters.tsx index d2150b19..8e3dfb30 100644 --- a/web/components/filters/desktop-filters.tsx +++ b/web/components/filters/desktop-filters.tsx @@ -1,705 +1,691 @@ -import {ChevronDownIcon, ChevronUpIcon} from '@heroicons/react/outline' -import {FilterFields} from 'common/filters' -import {Gender} from 'common/gender' -import {hasKidsLabels} from 'common/has-kids' -import {OptionTableKey} from 'common/profiles/constants' -import {Profile} from 'common/profiles/profile' -import {ReactNode} from 'react' -import {BsPersonHeart, BsPersonVcard} from 'react-icons/bs' -import {FaBriefcase, FaHandsHelping, FaHeart, FaStar} from 'react-icons/fa' -import {FaUserGroup} from 'react-icons/fa6' -import {GiFruitBowl} from 'react-icons/gi' -import {LuCigarette, LuGraduationCap} from 'react-icons/lu' -import {MdLanguage, MdLocalBar} from 'react-icons/md' -import {PiHandsPrayingBold} from 'react-icons/pi' -import {RiScales3Line} from 'react-icons/ri' -import DropdownMenu from 'web/components/comments/dropdown-menu' -import {Big5Filters, Big5FilterText, hasAnyBig5Filter} from 'web/components/filters/big5-filter' -import {DietFilter, DietFilterText} from 'web/components/filters/diet-filter' -import {DrinksFilter, DrinksFilterText} from 'web/components/filters/drinks-filter' -import {EducationFilter, EducationFilterText} from 'web/components/filters/education-filter' -import {HasKidsLabel} from 'web/components/filters/has-kids-filter' -import {InterestFilter, InterestFilterText} from 'web/components/filters/interest-filter' -import {LanguageFilter, LanguageFilterText} from 'web/components/filters/language-filter' -import {MbtiFilter, MbtiFilterText} from 'web/components/filters/mbti-filter' -import {PoliticalFilter, PoliticalFilterText} from 'web/components/filters/political-filter' -import { - RelationshipStatusFilter, - RelationshipStatusFilterText, -} from 'web/components/filters/relationship-status-filter' -import {ReligionFilter, ReligionFilterText} from 'web/components/filters/religion-filter' -import {RomanticFilter, RomanticFilterText} from 'web/components/filters/romantic-filter' -import {ShortBioToggle} from 'web/components/filters/short-bio-toggle' -import {SmokerFilter, SmokerFilterText} from 'web/components/filters/smoker-filter' -import {KidsLabel, useWantsKidsLabelsWithIcon} from 'web/components/filters/wants-kids-filter' -import {Col} from 'web/components/layout/col' -import {Row} from 'web/components/layout/row' -import {ResetFiltersButton} from 'web/components/searches/button' -import {CustomizeableDropdown} from 'web/components/widgets/customizeable-dropdown' -import {useT} from 'web/lib/locale' -import {DietType, RelationshipType, RomanticType} from 'web/lib/util/convert-types' - -import {AgeFilter, AgeFilterText} from './age-filter' -import {GenderFilter, GenderFilterText} from './gender-filter' -import {LastActiveFilter, LastActiveFilterText} from './last-active-filter' -import {LocationFilter, LocationFilterProps, LocationFilterText} from './location-filter' -import {MyMatchesToggle} from './my-matches-toggle' -import {RelationshipFilter, RelationshipFilterText} from './relationship-filter' - -export function DesktopFilters(props: { - filters: Partial - youProfile: Profile | undefined | null - updateFilter: (newState: Partial) => void - clearFilters: () => void - setYourFilters: (checked: boolean) => void - isYourFilters: boolean - locationFilterProps: LocationFilterProps - raisedInLocationFilterProps?: LocationFilterProps - includeRelationshipFilters: boolean | undefined - choices: Record> -}) { - const { - filters, - youProfile, - updateFilter, - clearFilters, - setYourFilters, - isYourFilters, - locationFilterProps, - raisedInLocationFilterProps, - includeRelationshipFilters, - choices, - } = props - - const t = useT() - const wantsKidsLabelsWithIcon = useWantsKidsLabelsWithIcon() - - return ( - <> - - -