upd: redesign
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import HeaderRightAnnouncementList from "@/components/announcement/headerAnnouncementList";
|
import HeaderRightAnnouncementList from "@/components/announcement/headerAnnouncementList";
|
||||||
import AppHeader from "@/components/AppHeader";
|
import AppHeader from "@/components/AppHeader";
|
||||||
|
import Styles from "@/constants/Styles";
|
||||||
import HeaderDiscussionGeneral from "@/components/discussion_general/headerDiscussionGeneral";
|
import HeaderDiscussionGeneral from "@/components/discussion_general/headerDiscussionGeneral";
|
||||||
import HeaderRightDivisionList from "@/components/division/headerDivisionList";
|
import HeaderRightDivisionList from "@/components/division/headerDivisionList";
|
||||||
import HeaderRightGroupList from "@/components/group/headerGroupList";
|
import HeaderRightGroupList from "@/components/group/headerGroupList";
|
||||||
@@ -18,7 +19,7 @@ import { getMessaging, onMessage } from "@react-native-firebase/messaging";
|
|||||||
import { Redirect, router, Stack, usePathname } from "expo-router";
|
import { Redirect, router, Stack, usePathname } from "expo-router";
|
||||||
import { StatusBar } from 'expo-status-bar';
|
import { StatusBar } from 'expo-status-bar';
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import { Easing, Notifier } from 'react-native-notifier';
|
import { Easing, Notifier, NotifierComponents } from 'react-native-notifier';
|
||||||
import { Provider } from "react-redux";
|
import { Provider } from "react-redux";
|
||||||
import { useTheme } from "@/providers/ThemeProvider";
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
|
|
||||||
@@ -67,12 +68,34 @@ export default function RootLayout() {
|
|||||||
} else if (pathname !== `/${category}/${content}`) {
|
} else if (pathname !== `/${category}/${content}`) {
|
||||||
Notifier.showNotification({
|
Notifier.showNotification({
|
||||||
title: title,
|
title: title,
|
||||||
description: remoteMessage.notification?.body,
|
description: String(remoteMessage.notification?.body),
|
||||||
duration: 3000,
|
duration: 3000,
|
||||||
animationDuration: 300,
|
animationDuration: 300,
|
||||||
showEasing: Easing.ease,
|
showEasing: Easing.ease,
|
||||||
onPress: () => handleReadNotification(String(id), String(category), String(content), String(title)),
|
onPress: () => handleReadNotification(String(id), String(category), String(content), String(title)),
|
||||||
hideOnPress: true,
|
hideOnPress: true,
|
||||||
|
Component: NotifierComponents.Notification,
|
||||||
|
componentProps: {
|
||||||
|
containerStyle: [
|
||||||
|
Styles.shadowBox,
|
||||||
|
{
|
||||||
|
backgroundColor: colors.modalBackground,
|
||||||
|
borderRadius: 5,
|
||||||
|
marginHorizontal: 15,
|
||||||
|
marginTop: 10,
|
||||||
|
padding: 15,
|
||||||
|
}
|
||||||
|
],
|
||||||
|
titleStyle: {
|
||||||
|
color: colors.text,
|
||||||
|
fontWeight: 'bold',
|
||||||
|
fontSize: 16,
|
||||||
|
},
|
||||||
|
descriptionStyle: {
|
||||||
|
color: colors.dimmed,
|
||||||
|
fontSize: 14,
|
||||||
|
},
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,17 +95,16 @@ export default function CreateAnnouncement() {
|
|||||||
|
|
||||||
const response = await apiCreateAnnouncement(fd)
|
const response = await apiCreateAnnouncement(fd)
|
||||||
|
|
||||||
// const response = await apiCreateAnnouncement({
|
|
||||||
// data: { ...dataForm, user: hasil, groups: divisionMember },
|
|
||||||
// });
|
|
||||||
|
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
dispatch(setUpdateAnnouncement(!update))
|
dispatch(setUpdateAnnouncement(!update))
|
||||||
Toast.show({ type: 'small', text1: 'Berhasil menambahkan data', })
|
Toast.show({ type: 'small', text1: 'Berhasil menambahkan data', })
|
||||||
router.back();
|
router.back();
|
||||||
|
} else {
|
||||||
|
Toast.show({ type: 'small', text1: 'Gagal menambahkan data', })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
Toast.show({ type: 'small', text1: 'Gagal menambahkan data', })
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
}
|
}
|
||||||
@@ -210,7 +209,7 @@ export default function CreateAnnouncement() {
|
|||||||
<Text style={[Styles.textDefaultSemiBold]}>File</Text>
|
<Text style={[Styles.textDefaultSemiBold]}>File</Text>
|
||||||
<Text style={[Styles.textDefault]}>{fileForm.length} file</Text>
|
<Text style={[Styles.textDefault]}>{fileForm.length} file</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={[Styles.borderAll, Styles.round05, Styles.p10, Styles.mb10, { borderColor: colors.icon + '20' }]}>
|
<View style={[Styles.borderAll, Styles.round05, Styles.p10, Styles.mb10, { backgroundColor: colors.card, borderColor: colors.icon + '20' }]}>
|
||||||
{
|
{
|
||||||
fileForm.map((item, index) => (
|
fileForm.map((item, index) => (
|
||||||
<BorderBottomItem
|
<BorderBottomItem
|
||||||
@@ -242,7 +241,7 @@ export default function CreateAnnouncement() {
|
|||||||
<View style={[Styles.rowSpaceBetween, Styles.mv05]}>
|
<View style={[Styles.rowSpaceBetween, Styles.mv05]}>
|
||||||
<Text style={[Styles.textDefaultSemiBold]}>Divisi</Text>
|
<Text style={[Styles.textDefaultSemiBold]}>Divisi</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={[Styles.borderAll, Styles.round05, Styles.p10, { borderColor: colors.icon + '20' }]}>
|
<View style={[Styles.borderAll, Styles.round05, Styles.p10, { backgroundColor: colors.card, borderColor: colors.icon + '20' }]}>
|
||||||
{
|
{
|
||||||
divisionMember.map((item: { name: any; Division: any }, index: any) => {
|
divisionMember.map((item: { name: any; Division: any }, index: any) => {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -144,9 +144,12 @@ export default function EditAnnouncement() {
|
|||||||
dispatch(setUpdateAnnouncement(!update))
|
dispatch(setUpdateAnnouncement(!update))
|
||||||
Toast.show({ type: 'small', text1: 'Berhasil mengubah data', })
|
Toast.show({ type: 'small', text1: 'Berhasil mengubah data', })
|
||||||
router.back();
|
router.back();
|
||||||
|
} else {
|
||||||
|
Toast.show({ type: 'small', text1: 'Gagal mengubah data', })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
Toast.show({ type: 'small', text1: 'Gagal mengubah data', })
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
}
|
}
|
||||||
@@ -263,7 +266,7 @@ export default function EditAnnouncement() {
|
|||||||
<Text style={[Styles.textDefaultSemiBold]}>File</Text>
|
<Text style={[Styles.textDefaultSemiBold]}>File</Text>
|
||||||
<Text style={[Styles.textDefault]}>{fileForm.length + dataFile.filter((val) => !val.delete).length} file</Text>
|
<Text style={[Styles.textDefault]}>{fileForm.length + dataFile.filter((val) => !val.delete).length} file</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={[Styles.borderAll, Styles.round05, Styles.p10, Styles.mb10, { borderColor: colors.icon + '20' }]}>
|
<View style={[Styles.borderAll, Styles.round05, Styles.p10, Styles.mb10, { backgroundColor: colors.card, borderColor: colors.icon + '20' }]}>
|
||||||
{
|
{
|
||||||
dataFile.filter((val) => !val.delete).map((item, index) => (
|
dataFile.filter((val) => !val.delete).map((item, index) => (
|
||||||
<BorderBottomItem
|
<BorderBottomItem
|
||||||
@@ -306,7 +309,7 @@ export default function EditAnnouncement() {
|
|||||||
<View style={[Styles.rowSpaceBetween, Styles.mv05]}>
|
<View style={[Styles.rowSpaceBetween, Styles.mv05]}>
|
||||||
<Text style={[Styles.textDefaultSemiBold]}>Divisi</Text>
|
<Text style={[Styles.textDefaultSemiBold]}>Divisi</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={[Styles.borderAll, Styles.round05, Styles.p10, { borderColor: colors.icon + '20' }]}>
|
<View style={[Styles.borderAll, Styles.round05, Styles.p10, {backgroundColor: colors.card, borderColor: colors.icon + '20' }]}>
|
||||||
{
|
{
|
||||||
dataMember.map((item: { name: any; Division: any }, index: any) => {
|
dataMember.map((item: { name: any; Division: any }, index: any) => {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -258,7 +258,7 @@ export default function CreateDiscussionGeneral() {
|
|||||||
<Text style={[Styles.textDefaultSemiBold]}>File</Text>
|
<Text style={[Styles.textDefaultSemiBold]}>File</Text>
|
||||||
<Text style={[Styles.textDefault]}>{fileForm.length} file</Text>
|
<Text style={[Styles.textDefault]}>{fileForm.length} file</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={[Styles.borderAll, Styles.round05, Styles.p10, Styles.mb10, { borderColor: colors.icon + '20' }]}>
|
<View style={[Styles.borderAll, Styles.round05, Styles.p10, Styles.mb10, { backgroundColor: colors.card, borderColor: colors.icon + '20' }]}>
|
||||||
{
|
{
|
||||||
fileForm.map((item, index) => (
|
fileForm.map((item, index) => (
|
||||||
<BorderBottomItem
|
<BorderBottomItem
|
||||||
@@ -302,7 +302,7 @@ export default function CreateDiscussionGeneral() {
|
|||||||
<Text style={[Styles.textDefault]}>{entitiesMember.length} Anggota</Text>
|
<Text style={[Styles.textDefault]}>{entitiesMember.length} Anggota</Text>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View style={[Styles.borderAll, Styles.round05, Styles.p10, { borderColor: colors.icon + '20' }]}>
|
<View style={[Styles.borderAll, Styles.round05, Styles.p10, { backgroundColor: colors.card, borderColor: colors.icon + '20' }]}>
|
||||||
{
|
{
|
||||||
entitiesMember.map((item: { img: any; name: any; }, index: any) => {
|
entitiesMember.map((item: { img: any; name: any; }, index: any) => {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -154,6 +154,8 @@ export default function EditDiscussionGeneral() {
|
|||||||
dispatch(setUpdateDiscussionGeneralDetail(!update))
|
dispatch(setUpdateDiscussionGeneralDetail(!update))
|
||||||
Toast.show({ type: 'small', text1: 'Berhasil mengubah data', })
|
Toast.show({ type: 'small', text1: 'Berhasil mengubah data', })
|
||||||
router.back();
|
router.back();
|
||||||
|
} else {
|
||||||
|
Toast.show({ type: 'small', text1: 'Gagal mengubah data', })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
@@ -234,7 +236,7 @@ export default function EditDiscussionGeneral() {
|
|||||||
<Text style={[Styles.textDefaultSemiBold]}>File</Text>
|
<Text style={[Styles.textDefaultSemiBold]}>File</Text>
|
||||||
<Text style={[Styles.textDefault]}>{fileForm.length + dataFile.filter((val) => !val.delete).length} file</Text>
|
<Text style={[Styles.textDefault]}>{fileForm.length + dataFile.filter((val) => !val.delete).length} file</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={[Styles.borderAll, Styles.round05, Styles.p10, Styles.mb10, { borderColor: colors.icon + '20' }]}>
|
<View style={[Styles.borderAll, Styles.round05, Styles.p10, Styles.mb10, { backgroundColor: colors.card, borderColor: colors.icon + '20' }]}>
|
||||||
{
|
{
|
||||||
dataFile.filter((val) => !val.delete).map((item, index) => (
|
dataFile.filter((val) => !val.delete).map((item, index) => (
|
||||||
<BorderBottomItem
|
<BorderBottomItem
|
||||||
|
|||||||
@@ -186,33 +186,38 @@ export default function DiscussionDivisionEdit() {
|
|||||||
{
|
{
|
||||||
(fileForm.length > 0 || dataFile.filter((val) => !val.delete).length > 0)
|
(fileForm.length > 0 || dataFile.filter((val) => !val.delete).length > 0)
|
||||||
&&
|
&&
|
||||||
<View style={[Styles.borderAll, Styles.round05, Styles.p10, Styles.mb10, { borderColor: colors.background, backgroundColor: colors.card }]}>
|
<>
|
||||||
<Text style={[Styles.textDefaultSemiBold]}>File</Text>
|
<View style={[Styles.rowSpaceBetween, Styles.mv05]}>
|
||||||
{
|
<Text style={[Styles.textDefaultSemiBold]}>File</Text>
|
||||||
dataFile.filter((val) => !val.delete).map((item, index) => (
|
<Text style={[Styles.textDefault]}>{fileForm.length + dataFile.filter((val) => !val.delete).length} file</Text>
|
||||||
<BorderBottomItem
|
</View>
|
||||||
key={index}
|
<View style={[Styles.borderAll, Styles.round05, Styles.p10, Styles.mb10, { backgroundColor: colors.card, borderColor: colors.icon + '20' }]}>
|
||||||
borderType={(fileForm.length + dataFile.length) > 1 ? "bottom" : "none"}
|
{
|
||||||
icon={<MaterialCommunityIcons name="file-outline" size={25} color={colors.text} />}
|
dataFile.filter((val) => !val.delete).map((item, index) => (
|
||||||
title={item.name + '.' + item.extension}
|
<BorderBottomItem
|
||||||
titleWeight="normal"
|
key={index}
|
||||||
onPress={() => { setIndexDelFile({ id: item.id, cat: "oldFile" }); setModalFile(true) }}
|
borderType={dataFile.filter((val) => !val.delete).length - 1 == index && fileForm.length == 0 ? "none" : "bottom"}
|
||||||
/>
|
icon={<MaterialCommunityIcons name="file-outline" size={25} color={colors.text} />}
|
||||||
))
|
title={item.name + '.' + item.extension}
|
||||||
}
|
titleWeight="normal"
|
||||||
{
|
onPress={() => { setIndexDelFile({ id: item.id, cat: "oldFile" }); setModalFile(true) }}
|
||||||
fileForm.map((item, index) => (
|
/>
|
||||||
<BorderBottomItem
|
))
|
||||||
key={index}
|
}
|
||||||
borderType={fileForm.length > 1 ? "bottom" : "none"}
|
{
|
||||||
icon={<MaterialCommunityIcons name="file-outline" size={25} color={colors.text} />}
|
fileForm.map((item, index) => (
|
||||||
title={item.name}
|
<BorderBottomItem
|
||||||
titleWeight="normal"
|
key={index}
|
||||||
onPress={() => { setIndexDelFile({ id: index, cat: "newFile" }); setModalFile(true) }}
|
borderType={fileForm.length - 1 == index ? "none" : "bottom"}
|
||||||
/>
|
icon={<MaterialCommunityIcons name="file-outline" size={25} color={colors.text} />}
|
||||||
))
|
title={item.name}
|
||||||
}
|
titleWeight="normal"
|
||||||
</View>
|
onPress={() => { setIndexDelFile({ id: index, cat: "newFile" }); setModalFile(true) }}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</View>
|
||||||
|
</>
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|||||||
@@ -135,21 +135,27 @@ export default function CreateDiscussionDivision() {
|
|||||||
{
|
{
|
||||||
fileForm.length > 0
|
fileForm.length > 0
|
||||||
&&
|
&&
|
||||||
<View style={[Styles.borderAll, Styles.round05, Styles.p10, Styles.mb10, { borderColor: colors.background, backgroundColor: colors.card }]}>
|
<>
|
||||||
<Text style={[Styles.textDefaultSemiBold]}>File</Text>
|
<View style={[Styles.rowSpaceBetween, Styles.mv05]}>
|
||||||
{
|
<Text style={[Styles.textDefaultSemiBold]}>File</Text>
|
||||||
fileForm.map((item, index) => (
|
<Text style={[Styles.textDefault]}>{fileForm.length} file</Text>
|
||||||
<BorderBottomItem
|
</View>
|
||||||
key={index}
|
<View style={[Styles.borderAll, Styles.round05, Styles.p10, Styles.mb10, { backgroundColor: colors.card, borderColor: colors.icon + '20' }]}>
|
||||||
borderType={fileForm.length > 1 ? "bottom" : "none"}
|
{
|
||||||
icon={<MaterialCommunityIcons name="file-outline" size={25} color={colors.text} />}
|
fileForm.map((item, index) => (
|
||||||
title={item.name}
|
<BorderBottomItem
|
||||||
titleWeight="normal"
|
key={index}
|
||||||
onPress={() => { setIndexDelFile(index); setModalFile(true) }}
|
borderType={fileForm.length - 1 == index ? "none" : "bottom"}
|
||||||
/>
|
icon={<MaterialCommunityIcons name="file-outline" size={25} color={colors.text} />}
|
||||||
))
|
title={item.name}
|
||||||
}
|
titleWeight="normal"
|
||||||
</View>
|
onPress={() => { setIndexDelFile(index); setModalFile(true) }}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</View>
|
||||||
|
</>
|
||||||
|
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export default function ToastCustom({ position }: { position?: 'top' | 'bottom'
|
|||||||
bottomOffset={80}
|
bottomOffset={80}
|
||||||
config={{
|
config={{
|
||||||
small: ({ text1 }) => (
|
small: ({ text1 }) => (
|
||||||
<View style={[Styles.toastContainer, { backgroundColor: colors.card, borderColor: colors.icon + '20' }]}>
|
<View style={[Styles.toastContainer, { backgroundColor: colors.modalBackground, borderColor: colors.icon + '20' }]}>
|
||||||
<Text style={{ fontSize: 12 }}>{text1}</Text>
|
<Text style={{ fontSize: 12 }}>{text1}</Text>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user