import React, { useState } from "react"; import { View, Text, StyleSheet, TouchableOpacity, ScrollView, Image, } from "react-native"; import Icon from "react-native-vector-icons/Ionicons"; import { useNavigation } from "@react-navigation/native"; const users = [ { name: "Diana Fitri Nur Aini", coins: 5000, rank: 1, color: "#A30000" }, { name: "Revan Ilyas Fatoni", coins: 4800, rank: 2, color: "#FFD700" }, { name: "Alena Syahwa", coins: 4350, rank: 3, color: "#228B22" }, { name: "Dina Dwi Anisa", coins: 0, rank: "-", color: "#aaa" }, ]; const misimingguan = () => { const navigation = useNavigation(); const [completedDays, setCompletedDays] = useState([]); const [totalCoins, setTotalCoins] = useState(0); // Function to mark a day as completed const handleDayClick = (day, points) => { if (!completedDays.includes(day)) { setCompletedDays([...completedDays, day]); setTotalCoins(totalCoins + points); } }; // Check if the day is completed once const isCompleted = (day) => completedDays.includes(day); return ( {/* Header */} navigation.navigate("Home")} style={styles.backButton} > DAPATKAN KOIN {/* Subtitle */} Dapatkan Koin LEBIH BANYAK Koin Terkumpul{" "} {totalCoins} / 2600 {/* Daily Check-in */} KUNJUNGI TIAP HARI {[ { day: "Hari-1", point: 10 }, { day: "Hari-2", point: 15 }, { day: "Hari-3", point: 20 }, { day: "Hari-4", point: 25 }, { day: "Hari-5", point: 30 }, { day: "Hari-6", point: 35 }, { day: "Hari-7", point: 50 }, ].map((item, index) => ( handleDayClick(item.day, item.point)} disabled={isCompleted(item.day)} > {item.point} {item.day} ))} {/* Missions as buttons */} {/* Top 3 Users */} TOP 3 KOIN TERBANYAK {users.map((user, index) => ( {user.name} {user.coins} {user.rank} ))} "Ayo kumpulkan lebih banyak koin dengan berkontribusi aktif!{"\n"} Semakin banyak kamu membantu, semakin besar dampaknya{"\n"} untuk lingkungan kita!" ); }; const MissionButton = ({ point, label, icon }) => ( {point} {label} ); const styles = StyleSheet.create({ container: { padding: 16, backgroundColor: "#fff", marginTop: 40, flex: 1, }, header: { flexDirection: "row", alignItems: "center", marginBottom: 12, }, headerTitle: { flexDirection: "row", alignItems: "center", marginLeft: 12, }, titleText: { fontSize: 22, fontWeight: "bold", marginLeft: 6, }, subTitle: { fontSize: 16, marginVertical: 6, }, koinText: { textAlign: "right", fontSize: 16, color: "#555", }, dailyCheckinLabel: { textAlign: "center", marginVertical: 15, fontWeight: "bold", color: "#000", }, checkinRow: { flexDirection: "row", justifyContent: "space-evenly", marginBottom: 28, }, checkinItem: { alignItems: "center", width: 50, }, flameIcon: { alignItems: "center", backgroundColor: "#fff0f0", borderRadius: 10, padding: 9, borderWidth: 1, }, completedItem: { opacity: 0.5, // Lower opacity for completed item }, pointText: { fontWeight: "bold", color: "#2D572C", fontSize: 12, }, completedPointText: { color: "gray", // Change point color to gray when completed }, dayText: { fontSize: 10, color: "#444", marginTop: 4, }, missionContainer: { flexDirection: "row", justifyContent: "space-evenly", marginBottom: 10, flexWrap: "wrap", }, missionButton: { width: "30%", backgroundColor: "#fFF", borderRadius: 12, padding: 12, alignItems: "center", marginBottom: 12, justifyContent: "center", borderWidth: 1, }, koinBox: { backgroundColor: "#ffeb3b", justifyContent: "space-evenly", paddingHorizontal: 6, paddingVertical: 2, borderRadius: 10, fontWeight: "bold", marginBottom: 6, borderWidth: 0.5, }, missionText: { textAlign: "center", fontSize: 11, marginTop: 6, }, title: { textAlign: "center", fontWeight: "bold", fontSize: 18, color: "#2D572C", marginBottom: 10, borderBottomWidth: 1, borderTopWidth: 1, paddingVertical: 8, borderColor: "#ccc", }, userCard: { flexDirection: "row", alignItems: "center", borderWidth: 1, borderColor: "#ddd", borderRadius: 12, padding: 10, marginBottom: 12, }, userInfo: { flex: 1, marginLeft: 12, }, name: { fontWeight: "bold", fontSize: 14, }, coinRow: { flexDirection: "row", alignItems: "center", marginTop: 4, }, coinText: { marginLeft: 4, fontSize: 13, color: "#555", }, rankBox: { alignItems: "center", }, rankNumber: { fontWeight: "bold", fontSize: 14, marginBottom: 2, }, footerText: { marginTop: 10, textAlign: "center", fontSize: 13, color: "#444", }, }); export default misimingguan;