Skip to content

Commit b5959e1

Browse files
theolemagueclaude
andauthored
fix(app): correct moderation filters and tabs overflow (#975)
* fix(app): align moderation filters with publisherIds API and adjust UI Co-Authored-By: Claude <noreply@anthropic.com> * fix(app): prevent vertical overflow on tabs container Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 050d13f commit b5959e1

3 files changed

Lines changed: 13 additions & 7 deletions

File tree

app/src/components/Select.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Listbox, ListboxButton, ListboxOption, ListboxOptions } from "@headless
33
import { Fragment, useEffect, useState } from "react";
44
import { RiArrowDownSLine, RiCloseFill } from "react-icons/ri";
55

6-
const Select = ({ options, value, onChange, className, placeholder = "Sélectionner une option", loading = false }) => {
6+
const Select = ({ options, value, onChange, className, placeholder = "Sélectionner une option", loading = false, anchor = "bottom start" }) => {
77
const [selected, setSelected] = useState(null);
88

99
useEffect(() => {
@@ -34,7 +34,7 @@ const Select = ({ options, value, onChange, className, placeholder = "Sélection
3434
)}
3535
</div>
3636

37-
<ListboxOptions anchor="bottom" className={`mt-1 max-h-80 w-(--button-width) overflow-y-auto border border-gray-200 bg-white py-4 shadow-md ${className}`}>
37+
<ListboxOptions anchor={anchor} className={`mt-1 max-h-80 w-(--button-width) overflow-y-auto border border-gray-200 bg-white py-4 shadow-md ${className}`}>
3838
{loading ? (
3939
<div className="mx-4 flex cursor-default items-center justify-center px-4 py-2">
4040
<Loader />

app/src/components/Tabs.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ const Tabs = ({ tabs, ariaLabel, panelId, className = "", variant = "primary", t
104104
};
105105

106106
return (
107-
<div role="tablist" aria-label={ariaLabel} className={`flex flex-nowrap overflow-x-auto ${className}`}>
107+
<div role="tablist" aria-label={ariaLabel} className={`flex flex-nowrap overflow-x-auto overflow-y-hidden ${className}`}>
108108
{tabs.map((tab, index) => (
109109
<Tab
110110
key={tab.key}

app/src/scenes/my-missions/Moderation.jsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const Moderation = () => {
5353
useEffect(() => {
5454
const fetchData = async () => {
5555
const query = {
56-
publisherId: publisher.id,
56+
publisherIds: [publisher.id],
5757
status: filters.status,
5858
comment: filters.comment,
5959
domain: filters.domain,
@@ -79,7 +79,7 @@ const Moderation = () => {
7979
};
8080
const fetchAggs = async () => {
8181
const query = {
82-
publisherId: publisher.id,
82+
publisherIds: [publisher.id],
8383
status: filters.status,
8484
comment: filters.comment,
8585
domain: filters.domain,
@@ -149,6 +149,7 @@ const Moderation = () => {
149149
value={filters.status}
150150
onChange={(e) => setFilters({ ...filters, status: e.value })}
151151
placeholder="Statut"
152+
className="w-full sm:w-80"
152153
/>
153154
<Select
154155
options={options.comments.map((e) => ({
@@ -159,12 +160,14 @@ const Moderation = () => {
159160
value={filters.comment}
160161
onChange={(e) => setFilters({ ...filters, comment: e.value })}
161162
placeholder="Motif de refus"
163+
className="w-full sm:w-80"
162164
/>
163165
<Select
164166
options={options.domains.map((e) => ({ value: e.key === "" ? "none" : e.key, label: e.key === "" ? "Non renseigné" : DOMAINS_LABELS[e.key], count: e.doc_count }))}
165167
value={filters.domain}
166168
onChange={(e) => setFilters({ ...filters, domain: e.value })}
167169
placeholder="Domaine"
170+
className="w-full sm:w-80"
168171
/>
169172
<Select
170173
options={options.departments.map((e) => ({
@@ -175,12 +178,15 @@ const Moderation = () => {
175178
value={filters.department}
176179
onChange={(e) => setFilters({ ...filters, department: e.value })}
177180
placeholder="Département"
181+
className="w-full sm:w-80"
178182
/>
179183
<Select
180-
options={options.organizations.map((e) => ({ value: e.key === "" ? "none" : e.key, label: e.key === "" ? "Non renseigné" : e.key, count: e.doc_count }))}
184+
options={options.organizations.map((e) => ({ value: e.key === "" ? "none" : e.key, label: e.key === "" ? "Non renseigné" : e.label, count: e.doc_count }))}
181185
value={filters.organization}
182186
onChange={(e) => setFilters({ ...filters, organization: e.value })}
183187
placeholder="Organisation"
188+
className="w-full sm:w-80"
189+
anchor="bottom end"
184190
/>
185191
</div>
186192
</div>
@@ -190,7 +196,7 @@ const Moderation = () => {
190196
{Object.keys(filters)
191197
.filter((key) => filters[key] && key !== "page")
192198
.map((key, i) => {
193-
let label = filters[key] === "" ? "Non renseigné" : FILTERS[key] || key;
199+
let label = filters[key] === "" ? "Non renseigné" : filters[key];
194200

195201
if (key === "comment") {
196202
label = JVA_MODERATION_COMMENTS_LABELS[filters[key]] || filters[key];

0 commit comments

Comments
 (0)