fix notice status
This commit is contained in:
@@ -34,11 +34,14 @@ export default function Home() {
|
||||
|
||||
const notices = useNoticesStore((state) => state.notices);
|
||||
// console.log("Notices:", notices);
|
||||
// console.log("Notices length:", notices.length);
|
||||
|
||||
const latestNotices = [...notices]
|
||||
const activeNotices = notices.filter((notice) => notice.status === "ACTIVE");
|
||||
// console.log("Activer Notices:", activeNotices.length);
|
||||
const latestNotices = [...activeNotices]
|
||||
.sort((a, b) => new Date(b.publishDate) - new Date(a.publishDate))
|
||||
.slice(0, 6);
|
||||
const recomendedNotices = [...notices]
|
||||
const recomendedNotices = [...activeNotices]
|
||||
.sort(() => Math.random() - 0.5)
|
||||
.slice(0, 6);
|
||||
|
||||
@@ -47,13 +50,13 @@ export default function Home() {
|
||||
{/* <View> */}
|
||||
<SearchSection />
|
||||
<ScrollView showsVerticalScrollIndicator={false}>
|
||||
<CategorySection title="Polecane kategorie" notices={notices} />
|
||||
<CategorySection title="Polecane kategorie" notices={activeNotices} />
|
||||
<NoticeSection
|
||||
title="Najnowsze ogłoszenia"
|
||||
notices={latestNotices}
|
||||
ctaLink="/notices?sort=latest"
|
||||
/>
|
||||
<UserSection title="Popularni sprzedawcy" notices={notices} />
|
||||
<UserSection title="Popularni sprzedawcy" notices={activeNotices} />
|
||||
<NoticeSection
|
||||
title="Proponowane ogłoszenia"
|
||||
notices={recomendedNotices}
|
||||
|
||||
Reference in New Issue
Block a user