parent
58d1996ce3
commit
96388a9bea
@ -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) => (
|
||||
<li key={`${category}${i}`}>
|
||||
<Link to={'/?' + new URLSearchParams({
|
||||
userId: Number(-1).toString(),
|
||||
userCat: category,
|
||||
...URLEncodeFilters(composeUserCategoriesFilters[category]()),
|
||||
storyIndex: i.toString()
|
||||
}).toString()} style={styles.link}>
|
||||
{ann.src?.endsWith('mp4') ? (
|
||||
|
@ -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')
|
||||
)
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user