upd: notifikasi

Deskripsi:
- list notifikasi
- tanda notifikasi
- entiti user login

NO Issues
This commit is contained in:
amel
2025-06-26 12:28:36 +08:00
parent ed08953a14
commit 76c0ba0535
9 changed files with 231 additions and 156 deletions

View File

@@ -1,14 +1,35 @@
import { View } from "react-native"
import { router } from "expo-router"
import Feather from '@expo/vector-icons/Feather';
import { ButtonHeader } from "../buttonHeader";
import Styles from "@/constants/Styles";
import { apiGetDataHome } from "@/lib/api";
import { useAuthSession } from "@/providers/AuthProvider";
import Feather from '@expo/vector-icons/Feather';
import { router } from "expo-router";
import { useEffect, useState } from "react";
import { View } from "react-native";
import { ButtonHeader } from "../buttonHeader";
export function HeaderRightHome() {
const { decryptToken, token } = useAuthSession()
const [notification, setNotification] = useState(0)
async function handleData() {
try {
const hasil = await decryptToken(String(token?.current))
const response = await apiGetDataHome({ cat: "header", user: hasil })
setNotification(response.data.totalNotif)
} catch (error) {
console.error(error)
}
}
useEffect(() => {
handleData()
}, []);
return (
<View style={[Styles.rowSpaceBetween, { width: 140 }]}>
<ButtonHeader item={<Feather name="search" size={20} color="white" />} onPress={() => { router.push('/search') }} />
<ButtonHeader item={<Feather name="bell" size={20} color="white" />} onPress={() => { router.push('/notification') }} />
<ButtonHeader valueTop={notification > 0 ? true : false} item={<Feather name="bell" size={20} color="white" />} onPress={() => { router.push('/notification') }} />
<ButtonHeader item={<Feather name="user" size={20} color="white" />} onPress={() => { router.push('/profile') }} />
</View>
)