From 8e6d7ca1500ec34eab47bee914e3e0b4c0da7598 Mon Sep 17 00:00:00 2001 From: Andrii Solianyk Date: Mon, 9 Jun 2025 11:07:58 +0200 Subject: [PATCH] indent fix --- ArtisanConnect/components/NoticeCard.jsx | 206 +++++++++++------------ 1 file changed, 103 insertions(+), 103 deletions(-) diff --git a/ArtisanConnect/components/NoticeCard.jsx b/ArtisanConnect/components/NoticeCard.jsx index eff274d..239dbf2 100644 --- a/ArtisanConnect/components/NoticeCard.jsx +++ b/ArtisanConnect/components/NoticeCard.jsx @@ -1,115 +1,115 @@ -import { Box } from "@/components/ui/box"; -import { Card } from "@/components/ui/card"; -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 { Link } from "expo-router"; -import { Pressable, ActivityIndicator, View } from "react-native"; -import { useWishlist } from "@/store/wishlistStore"; -import { useNoticesStore } from "@/store/noticesStore"; -import { Ionicons } from "@expo/vector-icons"; -import { useEffect, useState } from "react"; +import {Box} from "@/components/ui/box"; +import {Card} from "@/components/ui/card"; +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 {Link} from "expo-router"; +import {Pressable, ActivityIndicator, View} from "react-native"; +import {useWishlist} from "@/store/wishlistStore"; +import {useNoticesStore} from "@/store/noticesStore"; +import {Ionicons} from "@expo/vector-icons"; +import {useEffect, useState} from "react"; -export function NoticeCard({ notice }) { - const noticeId = notice?.noticeId; +export function NoticeCard({notice}) { + const noticeId = notice?.noticeId; - const toggleNoticeInWishlist = useWishlist( - (state) => state.toggleNoticeInWishlist - ); - const isInWishlist = useWishlist((state) => - noticeId - ? state.wishlistNotices.some((item) => item.noticeId === noticeId) - : false - ); + const toggleNoticeInWishlist = useWishlist( + (state) => state.toggleNoticeInWishlist + ); + const isInWishlist = useWishlist((state) => + noticeId + ? state.wishlistNotices.some((item) => item.noticeId === noticeId) + : false + ); - const [image, setImage] = useState(null); - const [isLoading, setIsLoading] = useState(true); + const [image, setImage] = useState(null); + const [isLoading, setIsLoading] = useState(true); - const { getAllImagesByNoticeId } = useNoticesStore(); + const {getAllImagesByNoticeId} = useNoticesStore(); - useEffect(() => { - let isMounted = true; + useEffect(() => { + let isMounted = true; - const fetchImage = async () => { - if (!noticeId) { - if (isMounted) { - setImage({uri: "https://http.cat/404.jpg"}); - setIsLoading(false); - } - return; - } + const fetchImage = async () => { + if (!noticeId) { + if (isMounted) { + setImage({uri: "https://http.cat/404.jpg"}); + setIsLoading(false); + } + return; + } - setIsLoading(true); - try { - const images = await getAllImagesByNoticeId(noticeId); - if (isMounted) { - setImage( - images && images.length > 0 ? images[0] : {uri: "https://http.cat/404.jpg"} - ); - } - } catch (error) { - console.error(`Error while loading image: ${error}`); - if (isMounted) { - setImage({uri: "https://http.cat/404.jpg"}); - } - } finally { - if (isMounted) { - setIsLoading(false); - } - } - }; + setIsLoading(true); + try { + const images = await getAllImagesByNoticeId(noticeId); + if (isMounted) { + setImage( + images && images.length > 0 ? images[0] : {uri: "https://http.cat/404.jpg"} + ); + } + } catch (error) { + console.error(`Error while loading image: ${error}`); + if (isMounted) { + setImage({uri: "https://http.cat/404.jpg"}); + } + } finally { + if (isMounted) { + setIsLoading(false); + } + } + }; - fetchImage(); + fetchImage(); - return () => { - isMounted = false; - }; - }, [noticeId]); + return () => { + isMounted = false; + }; + }, [noticeId]); - if (!notice) { - return ; - } + if (!notice) { + return ; + } - return ( - - - - {isLoading ? ( - - - - ) : ( - image - )} - - - {notice.title} - - - - {notice.price}zł - - { - toggleNoticeInWishlist(noticeId); - }} - > - - - - - - - - ); + return ( + + + + {isLoading ? ( + + + + ) : ( + image + )} + + + {notice.title} + + + + {notice.price}zł + + { + toggleNoticeInWishlist(noticeId); + }} + > + + + + + + + + ); }