{"version":3,"file":"ListOfCards-CViM12p9.js","sources":["../../../frontend/src/Components/Entities/ListOfCards/ButtonViewAll.tsx","../../../frontend/src/Components/Entities/ListOfCards/ListOfCards.tsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { FormattedMessage } from 'react-intl';\nimport { Button, Grid2 as Grid } from '@mui/material';\nimport { Link } from 'react-router-dom';\n\nfunction ButtonViewAll({ href, variant = 'outlined' }: any) {\n return (\n \n \n \n \n \n );\n}\n\nButtonViewAll.ButtonViewAll = {\n href: PropTypes.string.isRequired,\n};\n\nexport default ButtonViewAll;\n","import React, { Fragment } from 'react';\nimport { Box, Typography, Fade } from '@mui/material';\nimport { FormattedMessage } from 'react-intl';\n\nimport usePostsInfiniteQuery from '../../../Hooks/usePostsInfiniteQuery';\nimport PostCard from '../../DesignSystem/PostCard/PostCard';\nimport PostCardSkeleton from '../../DesignSystem/PostCard/PostCardSkeleton';\nimport ButtonLoadMore from '../../Posts/ButtonLoadMore';\nimport ButtonViewAll from './ButtonViewAll';\nimport { PostVisibilities } from '../../../Utils/Types';\nimport { Post } from '../../../Utils/Types/Posts';\n\ninterface ListOfCardsProps {\n trackingProps?: {\n category: string;\n name: string;\n };\n space: any;\n queryKey?: string;\n titleI18nKey?: string;\n titleComponent?: any;\n postsTypes?: string[];\n emptyState?: any;\n limit?: number;\n viewAllHref?: string;\n viewAllEnabled?: boolean;\n newTab?: boolean;\n extraParams?: any;\n}\n\nfunction ListOfCards({\n space,\n queryKey = 'infinite-query-posts',\n titleI18nKey,\n titleComponent = 'h2',\n postsTypes = [],\n emptyState,\n trackingProps,\n limit = 10,\n viewAllHref,\n viewAllEnabled,\n newTab,\n extraParams = {},\n}: ListOfCardsProps) {\n const { pages, postsCount, paging, isFetching, isFetchingNextPage, fetchNextPage, hasNextPage } =\n usePostsInfiniteQuery([queryKey, postsTypes.join('-')], {\n space,\n types: postsTypes,\n visibilities: [PostVisibilities.PUBLISHED],\n limit,\n sort: '-dates',\n extraParams,\n });\n const showSkeleton = isFetching && !postsCount;\n const showEmptyState = postsCount === 0 && !showSkeleton;\n\n if (showEmptyState && !emptyState) {\n return null;\n }\n\n return (\n <>\n {titleI18nKey && (\n \n \n \n )}\n\n {showSkeleton &&\n [0, 1, 2].map((i) => (\n \n \n \n \n \n ))}\n\n {showEmptyState && {emptyState}}\n\n {!showSkeleton &&\n pages.map(({ data }: any) => (\n \n {data.data.map((post: Post) => (\n \n \n \n \n \n ))}\n \n ))}\n\n {hasNextPage && (\n \n fetchNextPage()}\n paging={paging}\n isFetching={isFetchingNextPage}\n variant=\"text\"\n />\n \n )}\n\n {viewAllHref && viewAllEnabled && (\n \n \n \n )}\n >\n );\n}\n\nexport default ListOfCards;\n"],"names":["ButtonViewAll","_ref","href","_ref$variant","variant","React","createElement","Grid","container","sx","justifyContent","alignItems","Button","color","to","component","Link","FormattedMessage","id","PropTypes","string","isRequired","ListOfCards","space","_ref$queryKey","queryKey","titleI18nKey","_ref$titleComponent","titleComponent","_ref$postsTypes","postsTypes","emptyState","trackingProps","_ref$limit","limit","viewAllHref","viewAllEnabled","newTab","_ref$extraParams","extraParams","_usePostsInfiniteQuer","usePostsInfiniteQuery","join","types","visibilities","PostVisibilities","PUBLISHED","sort","pages","postsCount","paging","isFetching","isFetchingNextPage","fetchNextPage","hasNextPage","showSkeleton","showEmptyState","Fragment","Typography","align","pb","values","count","map","i","Fade","timeout","key","Box","mb","PostCardSkeleton","_ref2","data","page","post","PostCard","entity","mt","ButtonLoadMore","onClick"],"mappings":"iTAMA,SAASA,EAAaC,EAAsC,CAAnCC,IAAAA,EAAID,EAAJC,KAAIC,EAAAF,EAAEG,QAAAA,EAAOD,IAAG,OAAA,WAAUA,EAE/CE,OAAAA,EAAAC,cAACC,EAAI,CACHC,UAAS,GACTC,GAAI,CACFC,eAAgB,SAChBC,WAAY,QAAA,CACd,EAEAL,EAAAA,cAACC,OACCF,EAAAC,cAACM,EAAM,CAACR,QAAAA,EAAkBS,MAAM,UAA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