diff --git a/ArtisanConnect/app/notice/[id].jsx b/ArtisanConnect/app/notice/[id].jsx index 31b4154..e1b6e49 100644 --- a/ArtisanConnect/app/notice/[id].jsx +++ b/ArtisanConnect/app/notice/[id].jsx @@ -5,6 +5,7 @@ import { Heading } from "@/components/ui/heading"; import { Image } from "@/components/ui/image"; import { Text } from "@/components/ui/text"; import { VStack } from "@/components/ui/vstack"; +import { Avatar, AvatarImage, AvatarFallbackText } from "@gluestack-ui/themed"; import { Ionicons } from "@expo/vector-icons"; import { ActivityIndicator, @@ -12,6 +13,7 @@ import { FlatList, View, TextInput, + SafeAreaView, } from "react-native"; import { useEffect, useState, useRef } from "react"; import { useNoticesStore } from "@/store/noticesStore"; @@ -98,7 +100,6 @@ export default function NoticeDetails() { unlockOrientation(); getInitialOrientation(); - // Listen for orientation changes const subscription = ScreenOrientation.addOrientationChangeListener( ({ orientationInfo }) => { const isLandscapeMode = @@ -147,6 +148,7 @@ export default function NoticeDetails() { if (notice) { try { const fetchedImages = await getAllImagesByNoticeId(notice.noticeId); + console.log("Fetched images:", fetchedImages); setImages( fetchedImages && fetchedImages.length > 0 ? fetchedImages @@ -230,6 +232,7 @@ export default function NoticeDetails() { }`} alt={`Zdjęcie ${index + 1}`} resizeMode={isLandscape ? "cover" : "contain"} + onError={(e) => console.error("Image load error:", e.nativeEvent.error)} /> )} @@ -241,8 +244,8 @@ export default function NoticeDetails() { ))} @@ -252,137 +255,143 @@ export default function NoticeDetails() { }; return ( - - - - {renderImageSection()} - - - {formatDate(notice.publishDate)} - - - {notice.title} - - - - Cena: - {notice.price} zł - - { - toggleNoticeInWishlist(id); - }} - > - - - - - - Kategoria:{" "} - {notice.category} + + + + + {renderImageSection()} + + + {formatDate(notice.publishDate)} - - - Opis ogłoszenia - - {notice.description} + + {notice.title} - - - Użytkownik: - {isUserLoading ? ( - - ) : user ? ( - <> - - Zdjęcie profilowe - - - - {user.firstName} {user.lastName} - - - Email: {user.email} - - setIsMessageFormVisible(true)} - className="mt-3 bg-primary-500 py-2 px-4 rounded-md" - > - - Wyślij wiadomość - - - - - Zobacz więcej ogłoszeń od {user.firstName} - - - - - ) : ( - Błąd podczas ładowania danych użytkownika - )} - - - - {isMessageFormVisible && ( - - - - Wyślij wiadomość do {user?.firstName} + + + Cena: + {notice.price} zł + + { + toggleNoticeInWishlist(id); + }} + > + + + + + + Kategoria:{" "} + {notice.category} - Do: - - {user?.email || "Brak adresu e-mail"} - - Twój e-mail: - - - - setIsMessageFormVisible(false)} - className="bg-gray-300 py-2 px-4 rounded-md" - > - Anuluj - - - Wyślij - + + + Opis ogłoszenia + {notice.description} + + + Użytkownik: + {isUserLoading ? ( + + ) : user ? ( + <> + + + + + {user.firstName?.[0]} + {user.lastName?.[0]} + + + + + + {user.firstName} {user.lastName} + + + Email: {user.email} + + setIsMessageFormVisible(true)} + className="mt-3 bg-blue-500 py-2 px-4 rounded-md" + > + + Wyślij wiadomość + + + + + Zobacz więcej ogłoszeń od {user.firstName} + + + + + ) : ( + Błąd podczas ładowania danych użytkownika + )} + + + + {isMessageFormVisible && ( + + + + Wyślij wiadomość do {user?.firstName} + + Do: + + {user?.email || "Brak adresu e-mail"} + + Twój e-mail: + + Treść: + + + setIsMessageFormVisible(false)} + className="bg-gray-300 py-2 px-4 rounded-md" + > + Anuluj + + + Wyślij + + - - )} - + )} + + ); } \ No newline at end of file