updd: announcement

Deskripsi:
- edit pengumuman
- delete pengumuman

No Issues
This commit is contained in:
amel
2025-05-08 11:27:11 +08:00
parent 6cae53cbc7
commit e64f7c7e14
6 changed files with 263 additions and 45 deletions

View File

@@ -7,6 +7,7 @@ import { AntDesign, Entypo, MaterialIcons } from "@expo/vector-icons";
import { router, Stack, useLocalSearchParams } from "expo-router";
import { useEffect, useState } from "react";
import { SafeAreaView, ScrollView, Text, View } from "react-native";
import { useSelector } from "react-redux";
type Props = {
id: string
@@ -19,6 +20,8 @@ export default function DetailAnnouncement() {
const { token, decryptToken } = useAuthSession()
const [data, setData] = useState<Props>()
const [dataMember, setDataMember] = useState<any>({})
const update = useSelector((state: any) => state.announcementUpdate)
const entityUser = useSelector((state: any) => state.user)
async function handleLoad() {
try {
@@ -33,7 +36,7 @@ export default function DetailAnnouncement() {
useEffect(() => {
handleLoad()
}, [])
}, [update])
return (
<SafeAreaView>
@@ -42,7 +45,7 @@ export default function DetailAnnouncement() {
headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
headerTitle: 'Pengumuman',
headerTitleAlign: 'center',
headerRight: () => <HeaderRightAnnouncementDetail id={id} />,
headerRight: () => entityUser.role != 'user' && entityUser.role != 'coadmin' ? <HeaderRightAnnouncementDetail id={id} /> : <></>,
}}
/>
<ScrollView>
@@ -66,7 +69,7 @@ export default function DetailAnnouncement() {
{
dataMember[v].map((item: any, x: any) => {
return (
<View style={[Styles.rowItemsCenter]}>
<View key={x} style={[Styles.rowItemsCenter]}>
<Entypo name="dot-single" size={24} color="black" />
<Text style={[Styles.textDefault]}>{item.division}</Text>
</View>