import { ColorsStatus } from "@/constants/ColorsStatus"; import Styles from "@/constants/Styles"; import { apiGetDataHome } from "@/lib/api"; import { useAuthSession } from "@/providers/AuthProvider"; import { router } from "expo-router"; import React, { useEffect, useState } from "react"; import { Dimensions, Text, View } from "react-native"; import Carousel, { ICarouselInstance } from "react-native-reanimated-carousel"; import PaperGridContent from "../paperGridContent"; import ProgressBar from "../progressBar"; type Props = { id: string title: string desc: string status: number progress: number createdAt: string } export default function ProjectHome() { const { decryptToken, token } = useAuthSession() const ref = React.useRef(null); const width = Dimensions.get("window").width; const [data, setData] = useState([]) async function handleData() { try { const hasil = await decryptToken(String(token?.current)) const response = await apiGetDataHome({ cat: "kegiatan", user: hasil }) setData(response.data) } catch (error) { console.error(error) } } useEffect(() => { handleData() }, []); return ( Kegiatan Terupdate ( { router.push(`/project/${data[index].id}`) }} title={data[index].title} headerColor="primary"> {data[index].createdAt} { data[index].status === 0 ? 'SEGERA' : data[index].status === 1 ? 'DIKERJAKAN' : data[index].status === 2 ? 'SELESAI' : data[index].status === 3 ? 'DIBATALKAN' : "SEGERA" } )} /> ) }