From 6c54a9adf0a829cf6b6cb7e4e955692c4f3a5cc5 Mon Sep 17 00:00:00 2001 From: MartinBraquet Date: Sun, 8 Mar 2026 17:38:43 +0100 Subject: [PATCH] Add option to view pics on profile cards --- common/messages/de.json | 2 + common/messages/fr.json | 2 + common/src/profiles-rendering.ts | 7 +++ web/components/filters/filters.tsx | 22 ++++++++- web/components/filters/show-photos-toggle.tsx | 33 +++++++++++++ web/components/filters/use-filters.ts | 6 +-- web/components/profile-grid.tsx | 46 +++++++++++-------- web/components/profiles/profiles-home.tsx | 6 +++ web/hooks/use-rendering-options.ts | 15 ++++++ 9 files changed, 117 insertions(+), 22 deletions(-) create mode 100644 common/src/profiles-rendering.ts create mode 100644 web/components/filters/show-photos-toggle.tsx create mode 100644 web/hooks/use-rendering-options.ts diff --git a/common/messages/de.json b/common/messages/de.json index 720dacc7..2dc15187 100644 --- a/common/messages/de.json +++ b/common/messages/de.json @@ -362,6 +362,7 @@ "filter.last_active.3months": "Letzte 3 Monate", "filter.reset": "Zurücksetzen", "filter.short_bio_toggle": "Kurze Bios einschließen", + "filter.show_photos": "Profilfotos anzeigen", "filter.wants_kids.any_preference": "Alle Präferenzen", "filter.wants_kids.doesnt_want_kids": "Möchte keine Kinder", "filter.wants_kids.either": "Egal", @@ -1161,6 +1162,7 @@ "stats.total": "Gesamt", "stats.votes": "Stimmen", "stats.with_bio": "Mit Bio", + "stats.gender_ratio": "Geschlechterverteilung", "sticky_format_menu.add_embed": "Embed hinzufügen", "sticky_format_menu.add_emoji": "Emoji hinzufügen", "sticky_format_menu.upload_image": "Bild hochladen", diff --git a/common/messages/fr.json b/common/messages/fr.json index 32261fbb..aded24f0 100644 --- a/common/messages/fr.json +++ b/common/messages/fr.json @@ -362,6 +362,7 @@ "filter.last_active.3months": "3 derniers mois", "filter.reset": "Réinitialiser", "filter.short_bio_toggle": "Inclure les profils incomplets", + "filter.show_photos": "Afficher les photos", "filter.wants_kids.any_preference": "N'importe", "filter.wants_kids.doesnt_want_kids": "Ne veut pas d'enfants", "filter.wants_kids.either": "N'importe", @@ -1160,6 +1161,7 @@ "stats.total": "Total", "stats.votes": "Votes", "stats.with_bio": "Complétés", + "stats.gender_ratio": "Répartition Hommes / Femmes", "sticky_format_menu.add_embed": "Ajouter un embed", "sticky_format_menu.add_emoji": "Ajouter un emoji", "sticky_format_menu.upload_image": "Ajouter une image", diff --git a/common/src/profiles-rendering.ts b/common/src/profiles-rendering.ts new file mode 100644 index 00000000..3972dc91 --- /dev/null +++ b/common/src/profiles-rendering.ts @@ -0,0 +1,7 @@ +export type RenderingOptions = { + showPhotos: boolean | null | undefined +} + +export const initialRenderingOptions: RenderingOptions = { + showPhotos: false, +} diff --git a/web/components/filters/filters.tsx b/web/components/filters/filters.tsx index 86a6de23..388fe71f 100644 --- a/web/components/filters/filters.tsx +++ b/web/components/filters/filters.tsx @@ -6,6 +6,7 @@ import {formatFilters, SKIPPED_FORMAT_FILTERS_KEYS} from 'common/filters-format' import {Gender} from 'common/gender' import {OptionTableKey} from 'common/profiles/constants' import {Profile} from 'common/profiles/profile' +import {RenderingOptions} from 'common/profiles-rendering' import {nullifyDictValues, removeNullOrUndefinedProps, sampleDictByPrefix} from 'common/util/object' import {ReactNode, useState} from 'react' import { @@ -27,6 +28,7 @@ import { 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 {ShowPhotosToggle} from 'web/components/filters/show-photos-toggle' import {KidsLabel, WantsKidsFilter} from 'web/components/filters/wants-kids-filter' import {FilterGuide} from 'web/components/guidance' import {Col} from 'web/components/layout/col' @@ -186,8 +188,8 @@ function SelectedFiltersSummary(props: { } function Filters(props: { - filters: Partial youProfile: Profile | undefined | null + filters: Partial updateFilter: (newState: Partial) => void clearFilters: () => void setYourFilters: (checked: boolean) => void @@ -196,6 +198,8 @@ function Filters(props: { raisedInLocationFilterProps: LocationFilterProps includeRelationshipFilters: boolean | undefined choices: Record> + renderingOptions: Partial + updateRenderingOptions: (newState: Partial) => void }) { const t = useT() const { @@ -208,6 +212,8 @@ function Filters(props: { locationFilterProps, raisedInLocationFilterProps, includeRelationshipFilters, + renderingOptions, + updateRenderingOptions, choices, } = props @@ -247,6 +253,14 @@ function Filters(props: {