add simple home section
This commit is contained in:
@@ -1,22 +1,24 @@
|
||||
import { View, Text } from "react-native";
|
||||
import { Link } from "expo-router";
|
||||
import { Button, ButtonText } from "@/components/ui/button";
|
||||
import { ScrollView, Text } from "react-native";
|
||||
import { useNoticesStore } from '@/store/noticesStore';
|
||||
import { CategorySection } from "@/components/CategorySection";
|
||||
import { NoticeSection } from "@/components/NoticeSection";
|
||||
import { UserSection } from "@/components/UserSection";
|
||||
import { FlatList } from 'react-native';
|
||||
|
||||
export default function Home() {
|
||||
const notices = useNoticesStore((state) => state.notices);
|
||||
const latestNotices = [...notices]
|
||||
.sort((a, b) => new Date(b.publishDate) - new Date(a.publishDate))
|
||||
.slice(0, 6);
|
||||
const recomendedNotices = [...notices]
|
||||
.sort(() => Math.random() - 0.5)
|
||||
.slice(0, 6);
|
||||
return (
|
||||
<View>
|
||||
<Text>Home</Text>
|
||||
<Link href="/notices" asChild>
|
||||
<Button>
|
||||
<ButtonText>Ogłoszenia</ButtonText>
|
||||
</Button>
|
||||
</Link>
|
||||
|
||||
<Link href="/wishlist" asChild>
|
||||
<Button variant="outline" className="mt-2">
|
||||
<ButtonText>Ulubione</ButtonText>
|
||||
</Button>
|
||||
</Link>
|
||||
</View>
|
||||
<ScrollView showsVerticalScrollIndicator={false} className='m-2'>
|
||||
<CategorySection title="Polecane kategorie" notices={notices} />
|
||||
<NoticeSection title="Najnowsze ogłoszenia" notices={latestNotices}/>
|
||||
<UserSection title="Popularni sprzedawcy" notices={notices} />
|
||||
<NoticeSection title="Proponowane ogłoszenia" notices={recomendedNotices}/>
|
||||
</ScrollView>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user