diff --git a/front/src/components/StoriesPreview.tsx b/front/src/components/StoriesPreview.tsx index 24b8ffe..8871be0 100644 --- a/front/src/components/StoriesPreview.tsx +++ b/front/src/components/StoriesPreview.tsx @@ -1,12 +1,13 @@ import { Link } from 'react-router-dom' import { CSSProperties, useEffect, useMemo, useRef, useState } from 'react' +import { Button } from 'react-bootstrap' -import { UserCategory, userCategoriesInfos } from '../assets/userCategories' +import { UserCategory, composeUserCategoriesFilters, userCategoriesInfos } from '../assets/userCategories' import { Announcement } from '../api/announcement/types' import { categoryGraphics, categoryNames } from '../assets/category' +import { URLEncodeFilters } from '../utils/filters' import rightAngleIcon from '../assets/rightAngle.svg' -import { Button } from 'react-bootstrap' type StoriesPreviewProps = { announcements: Announcement[], @@ -113,8 +114,7 @@ function StoriesPreview({ announcements, category }: StoriesPreviewProps) { {useMemo(() => announcements.map((ann, i) => (
  • {ann.src?.endsWith('mp4') ? ( diff --git a/front/src/utils/filters.ts b/front/src/utils/filters.ts index 30a821f..ca4b6f0 100644 --- a/front/src/utils/filters.ts +++ b/front/src/utils/filters.ts @@ -10,7 +10,13 @@ const defaultFilters: FiltersType = { userId: undefined, category: undefined, me const URLEncodeFilters = (filters: FiltersType) => ( Object.fromEntries( filterNames.map( - fName => [fName, filters[fName]?.toString()] + fName => { + const v = filters[fName] + if (v) { + return [fName, encodeURIComponent(v)] + } + return [fName, undefined] + } ).filter((p): p is [string, string] => typeof p[1] !== 'undefined') ) )