diff --git a/ArtisanConnect/api/notices.jsx b/ArtisanConnect/api/notices.jsx
index f9ef8b0..3bb9875 100644
--- a/ArtisanConnect/api/notices.jsx
+++ b/ArtisanConnect/api/notices.jsx
@@ -72,14 +72,14 @@ export async function getAllImagesByNoticeId(noticeId) {
`${API_URL}/images/get/${imageName}`
);
- console.log(`Pobrano ${imageUrls.length} zdjęć dla ogłoszenia o id: ${noticeId}`);
+ // console.log(`Pobrano ${imageUrls.length} zdjęć dla ogłoszenia o id: ${noticeId}`);
return imageUrls;
}
- console.log(`Brak zdjęć dla ogłoszenia o id: ${noticeId}`);
+ // console.log(`Brak zdjęć dla ogłoszenia o id: ${noticeId}`);
return ["https://http.cat/404.jpg"];
} catch (err) {
- console.log(`Błąd podczas pobierania listy zdjęć dla ogłoszenia o id: ${noticeId}`, err);
+ // console.log(`Błąd podczas pobierania listy zdjęć dla ogłoszenia o id: ${noticeId}`, err);
return ["https://http.cat/404.jpg"];
}
}
diff --git a/ArtisanConnect/app/(tabs)/index.jsx b/ArtisanConnect/app/(tabs)/index.jsx
index 884f285..6054802 100644
--- a/ArtisanConnect/app/(tabs)/index.jsx
+++ b/ArtisanConnect/app/(tabs)/index.jsx
@@ -1,8 +1,9 @@
-import { ScrollView, Text } from "react-native";
+import { ScrollView, View } from "react-native";
import { useNoticesStore } from '@/store/noticesStore';
import { CategorySection } from "@/components/CategorySection";
import { NoticeSection } from "@/components/NoticeSection";
import { UserSection } from "@/components/UserSection";
+import { SearchSection } from "@/components/SearchSection";
import { FlatList } from 'react-native';
export default function Home() {
@@ -14,11 +15,14 @@ export default function Home() {
.sort(() => Math.random() - 0.5)
.slice(0, 6);
return (
+
+
+
);
}
diff --git a/ArtisanConnect/app/(tabs)/notices.jsx b/ArtisanConnect/app/(tabs)/notices.jsx
index f1f08ab..5f8abe5 100644
--- a/ArtisanConnect/app/(tabs)/notices.jsx
+++ b/ArtisanConnect/app/(tabs)/notices.jsx
@@ -11,7 +11,6 @@ import { listCategories } from "@/api/categories";
import { FormControl, FormControlLabel } from "@/components/ui/form-control";
import { Input, InputField } from "@/components/ui/input";
import { HStack } from "@/components/ui/hstack";
-
import {
Actionsheet,
ActionsheetContent,
@@ -95,8 +94,16 @@ export default function Notices() {
});
}
+
+ if (params.search) {
+ const searchTerm = params.search.toLowerCase();
+ result = result.filter(notice =>{
+ return notice.title.toLowerCase().includes(searchTerm);
+ });
+ }
+
setFilteredNotices(result);
- }, [notices, params.category, params.sort, params.priceFrom, params.priceTo]);
+ }, );
let filterActive = !!params.category || params.sort === "latest";
diff --git a/ArtisanConnect/components/FilterSection.jsx b/ArtisanConnect/components/FilterSection.jsx
deleted file mode 100644
index e69de29..0000000
diff --git a/ArtisanConnect/components/SearchSection.jsx b/ArtisanConnect/components/SearchSection.jsx
new file mode 100644
index 0000000..c0aa15e
--- /dev/null
+++ b/ArtisanConnect/components/SearchSection.jsx
@@ -0,0 +1,31 @@
+import { Input, InputField, InputIcon, InputSlot } from "@/components/ui/input"
+import { SearchIcon } from "@/components/ui/icon"
+import { Box } from "@/components/ui/box"
+import { useRouter } from "expo-router";
+
+export function SearchSection({ searchQuery, setSearchQuery }) {
+ const router = useRouter();
+
+ const handleSubmit = (e) => {
+ const value = e.nativeEvent.text;
+ router.push({
+ pathname: "/notices",
+ params: { search: value }
+ });
+ };
+ return (
+
+
+
+
+
+
+
+
+
+ )
+}
\ No newline at end of file