oba przyciski muszą być

a co jak będę chciał usunąć ogłoszenie które nie jest aktywne?
This commit is contained in:
2025-06-09 12:09:44 +02:00
parent 9c3e883741
commit 77c3a694f8

View File

@@ -115,7 +115,11 @@ export default function UserNotices() {
.sort((a, b) => new Date(b.publishDate) - new Date(a.publishDate)); .sort((a, b) => new Date(b.publishDate) - new Date(a.publishDate));
if (isLoading) { if (isLoading) {
return <ActivityIndicator />; return (
<Box className="items-center justify-center flex-1">
<ActivityIndicator size="large" color="#787878"/>
</Box>
);
} }
return ( return (
@@ -136,44 +140,39 @@ export default function UserNotices() {
<Box className="flex-1 mb-4 pb-2 bg-white rounded-lg"> <Box className="flex-1 mb-4 pb-2 bg-white rounded-lg">
<NoticeCard notice={item} /> <NoticeCard notice={item} />
<Box className="flex-row justify-between mt-2"> <Box className="flex-row justify-between mt-2">
{item.status === "ACTIVE" ? ( <Button
<Button
className="ml-2" className="ml-2"
onPress={() => handleDeleteNotice(item.noticeId)} onPress={() => handleDeleteNotice(item.noticeId)}
size="md" size="md"
variant="outline" variant="outline"
action="primary" action="primary"
> >
<ButtonText>Usuń</ButtonText> <ButtonText>Usuń</ButtonText>
<Ionicons name="trash-outline" size={14} /> <Ionicons name="trash-outline" size={14} />
</Button> </Button>
{item.status === "ACTIVE" ? (
<Button
className="mr-2"
size="md"
variant="solid"
action="primary"
onPress={() => handleOrder(item.noticeId, "BOOST")}
>
<ButtonText>Podbij</ButtonText>
<Ionicons name="arrow-up" size={14} color="#fff" />
</Button>
) : ( ) : (
<Button <Button
className="ml-2" className="mr-2"
size="md" size="md"
variant="solid" variant="solid"
action="primary" action="primary"
onPress={() => handleOrder(item.noticeId, "ACTIVATE")} onPress={() => handleOrder(item.noticeId, "ACTIVATE")}
> >
<ButtonText>Aktywuj</ButtonText> <ButtonText>Aktywuj</ButtonText>
<Ionicons <Ionicons name="arrow-redo-outline" size={14} color="#fff" />
name="arrow-redo-outline" </Button>
size={14}
color="#fff"
/>
</Button>
)}
{item.status === "ACTIVE" && (
<Button
className="mr-2"
size="md"
variant="solid"
action="primary"
onPress={() => handleOrder(item.noticeId, "BOOST")}
>
<ButtonText>Podbij</ButtonText>
<Ionicons name="arrow-up" size={14} color="#fff" />
</Button>
)} )}
</Box> </Box>
</Box> </Box>