Compare commits
51 Commits
v-2.1.0
...
amalia/12-
| Author | SHA1 | Date | |
|---|---|---|---|
| d299484a98 | |||
| 003d92e4e3 | |||
| 18f548ed5c | |||
| 906a619593 | |||
| af2048b4cd | |||
| 7341f378dd | |||
| 84935e8188 | |||
| 74d8b8ef31 | |||
| d31a21cc9c | |||
| 4af54980a0 | |||
| 4eebf2f893 | |||
| bc2c89e030 | |||
| d96c954559 | |||
| ca512372dd | |||
| d82f0c5b20 | |||
| fad89fc910 | |||
| e48456ea7f | |||
| d2e1663f9f | |||
| bdfb3a8b2b | |||
| 11bb1ddc98 | |||
| 97726609e1 | |||
| b61cd51628 | |||
| eccfe29387 | |||
| a090a85142 | |||
| bbacc2a5bd | |||
| 5ad7874a92 | |||
| a5e379cc7f | |||
| 4d464adb2e | |||
| 36c2519fa0 | |||
| e2ffef1085 | |||
| cb2a57ee8e | |||
| f3b677f847 | |||
| 6ffe599ad0 | |||
| 4a92def490 | |||
| 0bad792ce8 | |||
| 6c9623954c | |||
| f39d5a4c85 | |||
| 6021d17b5a | |||
| 2d86a77a48 | |||
| b7165c5990 | |||
| 7dc51bd2b9 | |||
| de5ad545a7 | |||
| 47cb146c5a | |||
| 8b8ea61a13 | |||
| 5dac451754 | |||
| ccf8ee1caf | |||
| 887e787a99 | |||
| 772551a917 | |||
| 555b9e4037 | |||
| d4b4db4251 | |||
| 17d92cba25 |
37
CLAUDE.md
Normal file
37
CLAUDE.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# CLAUDE.md
|
||||
|
||||
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||
|
||||
## Project Overview
|
||||
|
||||
**Desa+** is a React Native (Expo) mobile app for village administration — managing announcements, projects, discussions, members, divisions, and documents. Primary platforms are Android and iOS.
|
||||
|
||||
## Commands
|
||||
|
||||
```bash
|
||||
npm run start # Start Expo dev server
|
||||
npm run android # Run on Android
|
||||
npm run ios # Run on iOS
|
||||
npm run lint # Expo lint
|
||||
npm run test # Jest tests
|
||||
npm run build:android # Production Android build via EAS (bumps version first)
|
||||
```
|
||||
|
||||
Run a single test file:
|
||||
```bash
|
||||
bunx jest path/to/test.tsx --no-coverage
|
||||
```
|
||||
|
||||
> Project uses **Bun** as the package manager (`bun.lock` present). Use `bun add` / `bunx` instead of `npm install` / `npx`.
|
||||
|
||||
## Architecture
|
||||
|
||||
See @docs/ARCHITECTURE.md
|
||||
|
||||
## Key Conventions
|
||||
|
||||
See @docs/CONVENTIONS.md
|
||||
|
||||
## File Health
|
||||
|
||||
See @docs/FILE-HEALTH.md
|
||||
77
__tests__/ErrorBoundary-test.tsx
Normal file
77
__tests__/ErrorBoundary-test.tsx
Normal file
@@ -0,0 +1,77 @@
|
||||
import React from 'react';
|
||||
import { render, fireEvent } from '@testing-library/react-native';
|
||||
import ErrorBoundary from '@/components/ErrorBoundary';
|
||||
|
||||
// Komponen yang sengaja throw error saat render
|
||||
const BrokenComponent = () => {
|
||||
throw new Error('Test error boundary!');
|
||||
};
|
||||
|
||||
// Komponen normal
|
||||
const NormalComponent = () => <></>;
|
||||
|
||||
// Suppress React's error boundary console output selama test
|
||||
|
||||
beforeEach(() => {
|
||||
jest.spyOn(console, 'error').mockImplementation(() => {});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
(console.error as jest.Mock).mockRestore();
|
||||
});
|
||||
|
||||
describe('ErrorBoundary', () => {
|
||||
it('merender children dengan normal jika tidak ada error', () => {
|
||||
// Tidak boleh throw dan tidak menampilkan teks error
|
||||
const { queryByText } = render(
|
||||
<ErrorBoundary>
|
||||
<NormalComponent />
|
||||
</ErrorBoundary>
|
||||
);
|
||||
expect(queryByText('Terjadi Kesalahan')).toBeNull();
|
||||
});
|
||||
|
||||
it('menampilkan UI fallback ketika child throw error', () => {
|
||||
const { getByText } = render(
|
||||
<ErrorBoundary>
|
||||
<BrokenComponent />
|
||||
</ErrorBoundary>
|
||||
);
|
||||
expect(getByText('Terjadi Kesalahan')).toBeTruthy();
|
||||
});
|
||||
|
||||
it('menampilkan pesan error yang dilempar', () => {
|
||||
const { getByText } = render(
|
||||
<ErrorBoundary>
|
||||
<BrokenComponent />
|
||||
</ErrorBoundary>
|
||||
);
|
||||
expect(getByText('Test error boundary!')).toBeTruthy();
|
||||
});
|
||||
|
||||
it('merender custom fallback jika prop fallback diberikan', () => {
|
||||
const { getByText } = render(
|
||||
<ErrorBoundary fallback={<></>}>
|
||||
<BrokenComponent />
|
||||
</ErrorBoundary>
|
||||
);
|
||||
// Custom fallback fragment kosong — pastikan teks default tidak muncul
|
||||
expect(() => getByText('Terjadi Kesalahan')).toThrow();
|
||||
});
|
||||
|
||||
it('mereset error state saat tombol Coba Lagi ditekan', () => {
|
||||
const { getByText } = render(
|
||||
<ErrorBoundary>
|
||||
<BrokenComponent />
|
||||
</ErrorBoundary>
|
||||
);
|
||||
|
||||
const button = getByText('Coba Lagi');
|
||||
expect(button).toBeTruthy();
|
||||
|
||||
// Tekan tombol reset — hasError kembali false, BrokenComponent throw lagi
|
||||
// sehingga fallback muncul kembali (membuktikan reset berjalan)
|
||||
fireEvent.press(button);
|
||||
expect(getByText('Terjadi Kesalahan')).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -85,6 +85,8 @@ export default {
|
||||
FIREBASE_STORAGE_BUCKET: process.env.FIREBASE_STORAGE_BUCKET,
|
||||
FIREBASE_MESSAGING_SENDER_ID: process.env.FIREBASE_MESSAGING_SENDER_ID,
|
||||
FIREBASE_APP_ID: process.env.FIREBASE_APP_ID,
|
||||
URL_MONITORING: process.env.URL_MONITORING,
|
||||
KEY_API_MONITORING: process.env.KEY_API_MONITORING,
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -106,9 +106,9 @@ export default function RootLayout() {
|
||||
|
||||
async function handleReadNotification(id: string, category: string, idContent: string, title: string) {
|
||||
try {
|
||||
if (title != "Komentar Baru") {
|
||||
if (title !== "Komentar Baru") {
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiReadOneNotification({ user: hasil, id: id })
|
||||
await apiReadOneNotification({ user: hasil, id: id })
|
||||
}
|
||||
pushToPage(category, idContent)
|
||||
} catch (error) {
|
||||
@@ -203,8 +203,6 @@ export default function RootLayout() {
|
||||
<Stack.Screen name="feature" options={{ title: 'Fitur' }} />
|
||||
<Stack.Screen name="search" options={{ title: 'Pencarian' }} />
|
||||
<Stack.Screen name="notification" options={{
|
||||
title: 'Notifikasi',
|
||||
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
||||
headerTitle: 'Notifikasi',
|
||||
headerTitleAlign: 'center',
|
||||
header: () => (
|
||||
@@ -213,10 +211,8 @@ export default function RootLayout() {
|
||||
}} />
|
||||
<Stack.Screen name="profile" options={{ title: 'Profile' }} />
|
||||
<Stack.Screen name="setting/index" options={{
|
||||
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
||||
title: 'Pengaturan',
|
||||
headerTitleAlign: 'center',
|
||||
// headerRight: () => <HeaderRightProjectList />
|
||||
header: () => (
|
||||
<AppHeader title="Pengaturan"
|
||||
showBack={true}
|
||||
@@ -225,10 +221,8 @@ export default function RootLayout() {
|
||||
)
|
||||
}} />
|
||||
<Stack.Screen name="member/index" options={{
|
||||
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
||||
title: 'Anggota',
|
||||
headerTitleAlign: 'center',
|
||||
// headerRight: () => <HeaderMemberList />
|
||||
header: () => (
|
||||
<AppHeader title="Anggota"
|
||||
showBack={true}
|
||||
@@ -238,10 +232,8 @@ export default function RootLayout() {
|
||||
)
|
||||
}} />
|
||||
<Stack.Screen name="discussion/index" options={{
|
||||
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
||||
title: 'Diskusi Umum',
|
||||
headerTitleAlign: 'center',
|
||||
// headerRight: () => <HeaderDiscussionGeneral />
|
||||
header: () => (
|
||||
<AppHeader
|
||||
title="Diskusi Umum"
|
||||
@@ -252,10 +244,8 @@ export default function RootLayout() {
|
||||
)
|
||||
}} />
|
||||
<Stack.Screen name="project/index" options={{
|
||||
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
||||
title: 'Kegiatan',
|
||||
headerTitleAlign: 'center',
|
||||
// headerRight: () => <HeaderRightProjectList />
|
||||
header: () => (
|
||||
<AppHeader title="Kegiatan"
|
||||
showBack={true}
|
||||
@@ -265,10 +255,8 @@ export default function RootLayout() {
|
||||
)
|
||||
}} />
|
||||
<Stack.Screen name="division/index" options={{
|
||||
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
||||
title: 'Divisi',
|
||||
headerTitleAlign: 'center',
|
||||
// headerRight: () => <HeaderRightDivisionList />
|
||||
header: () => (
|
||||
<AppHeader title="Divisi"
|
||||
showBack={true}
|
||||
@@ -279,10 +267,8 @@ export default function RootLayout() {
|
||||
}} />
|
||||
<Stack.Screen name="division/[id]/(fitur-division)" options={{ headerShown: false }} />
|
||||
<Stack.Screen name="group/index" options={{
|
||||
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
||||
headerTitle: 'Lembaga Desa',
|
||||
headerTitleAlign: 'center',
|
||||
// headerRight: () => <HeaderRightGroupList />
|
||||
header: () => (
|
||||
<AppHeader title="Lembaga Desa"
|
||||
showBack={true}
|
||||
@@ -292,10 +278,8 @@ export default function RootLayout() {
|
||||
)
|
||||
}} />
|
||||
<Stack.Screen name="position/index" options={{
|
||||
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
||||
headerTitle: 'Jabatan',
|
||||
headerTitleAlign: 'center',
|
||||
// headerRight: () => <HeaderRightPositionList />
|
||||
header: () => (
|
||||
<AppHeader title="Jabatan"
|
||||
showBack={true}
|
||||
@@ -306,10 +290,8 @@ export default function RootLayout() {
|
||||
}} />
|
||||
<Stack.Screen name="announcement/index"
|
||||
options={{
|
||||
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
||||
headerTitle: 'Pengumuman',
|
||||
headerTitleAlign: 'center',
|
||||
// headerRight: () => <HeaderRightAnnouncementList />
|
||||
header: () => (
|
||||
<AppHeader title="Pengumuman"
|
||||
showBack={true}
|
||||
|
||||
@@ -3,6 +3,7 @@ import AppHeader from "@/components/AppHeader";
|
||||
import BorderBottomItem from "@/components/borderBottomItem";
|
||||
import Skeleton from "@/components/skeleton";
|
||||
import Text from '@/components/Text';
|
||||
import ErrorView from "@/components/ErrorView";
|
||||
import { ConstEnv } from "@/constants/ConstEnv";
|
||||
import { isImageFile } from "@/constants/FileExtensions";
|
||||
import Styles from "@/constants/Styles";
|
||||
@@ -65,6 +66,7 @@ export default function DetailAnnouncement() {
|
||||
const [loadingOpen, setLoadingOpen] = useState(false)
|
||||
const [preview, setPreview] = useState(false)
|
||||
const [chooseFile, setChooseFile] = useState<FileData>()
|
||||
const [isError, setIsError] = useState(false)
|
||||
|
||||
/**
|
||||
* Opens the image preview modal for the selected image file
|
||||
@@ -79,6 +81,7 @@ export default function DetailAnnouncement() {
|
||||
|
||||
async function handleLoad(loading: boolean) {
|
||||
try {
|
||||
setIsError(false)
|
||||
setLoading(loading)
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response: ApiResponse = await apiGetAnnouncementOne({ id: id, user: hasil })
|
||||
@@ -87,10 +90,12 @@ export default function DetailAnnouncement() {
|
||||
setDataMember(response.member)
|
||||
setDataFile(response.file)
|
||||
} else {
|
||||
setIsError(true)
|
||||
Toast.show({ type: 'small', text1: response.message })
|
||||
}
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
setIsError(true)
|
||||
const message = error?.response?.data?.message || "Gagal mengambil data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
@@ -206,104 +211,110 @@ export default function DetailAnnouncement() {
|
||||
/>
|
||||
}
|
||||
>
|
||||
<View style={[Styles.p15, Styles.mb50]}>
|
||||
<View style={[Styles.wrapPaper, Styles.borderAll, { backgroundColor: colors.card, borderColor: colors.icon + '20' }]}>
|
||||
{
|
||||
loading ?
|
||||
<View>
|
||||
<View style={[Styles.rowOnly]}>
|
||||
<Skeleton width={30} height={30} borderRadius={10} />
|
||||
<View style={[Styles.flex1, Styles.ph05]}>
|
||||
<Skeleton width={100} widthType="percent" height={30} borderRadius={10} />
|
||||
</View>
|
||||
</View>
|
||||
<Skeleton width={100} widthType="percent" height={10} borderRadius={10} />
|
||||
<Skeleton width={100} widthType="percent" height={10} borderRadius={10} />
|
||||
<Skeleton width={100} widthType="percent" height={10} borderRadius={10} />
|
||||
</View>
|
||||
:
|
||||
<>
|
||||
<View style={[Styles.rowOnly, Styles.alignStart]}>
|
||||
<MaterialIcons name="campaign" size={25} color={colors.text} style={[Styles.mr05]} />
|
||||
<Text style={[Styles.textDefaultSemiBold, Styles.w90, Styles.mt02]}>{data?.title}</Text>
|
||||
</View>
|
||||
<View style={[Styles.mt10]}>
|
||||
{
|
||||
hasHtmlTags(data?.desc) ?
|
||||
<RenderHTML
|
||||
contentWidth={contentWidth}
|
||||
source={{ html: data?.desc }}
|
||||
baseStyle={{ color: colors.text }}
|
||||
/>
|
||||
:
|
||||
<Text>{data?.desc}</Text>
|
||||
}
|
||||
</View>
|
||||
</>
|
||||
}
|
||||
|
||||
{isError && !loading ? (
|
||||
<View style={[Styles.mv50]}>
|
||||
<ErrorView />
|
||||
</View>
|
||||
{
|
||||
dataFile.length > 0 && (
|
||||
<View style={[Styles.wrapPaper, Styles.borderAll, Styles.mt10, { backgroundColor: colors.card, borderColor: colors.icon + '20' }]}>
|
||||
<View style={[Styles.mb05]}>
|
||||
<Text style={[Styles.textDefaultSemiBold]}>File</Text>
|
||||
</View>
|
||||
{dataFile.map((item, index) => (
|
||||
<BorderBottomItem
|
||||
key={`${item.id}-${index}`}
|
||||
borderType={index === dataFile.length - 1 ? 'none' : 'bottom'}
|
||||
icon={<MaterialCommunityIcons
|
||||
name={isImageFile(item.extension) ? "file-image-outline" : "file-document-outline"}
|
||||
size={25}
|
||||
color={colors.text}
|
||||
/>}
|
||||
title={item.name + '.' + item.extension}
|
||||
titleWeight="normal"
|
||||
onPress={() => {
|
||||
isImageFile(item.extension) ?
|
||||
handleChooseFile(item)
|
||||
: openFile(item)
|
||||
}}
|
||||
/>
|
||||
))}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
<View style={[Styles.wrapPaper, Styles.borderAll, Styles.mt10, { backgroundColor: colors.card, borderColor: colors.icon + '20' }]}>
|
||||
{
|
||||
loading ?
|
||||
arrSkeleton.map((item, index) => {
|
||||
return (
|
||||
<View key={index}>
|
||||
<Skeleton width={30} widthType="percent" height={10} borderRadius={10} />
|
||||
<Skeleton width={100} widthType="percent" height={10} borderRadius={10} />
|
||||
<Skeleton width={100} widthType="percent" height={10} borderRadius={10} />
|
||||
) : (
|
||||
<View style={[Styles.p15, Styles.mb50]}>
|
||||
<View style={[Styles.wrapPaper, Styles.borderAll, { backgroundColor: colors.card, borderColor: colors.icon + '20' }]}>
|
||||
{
|
||||
loading ?
|
||||
<View>
|
||||
<View style={[Styles.rowOnly]}>
|
||||
<Skeleton width={30} height={30} borderRadius={10} />
|
||||
<View style={[Styles.flex1, Styles.ph05]}>
|
||||
<Skeleton width={100} widthType="percent" height={30} borderRadius={10} />
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
})
|
||||
:
|
||||
Object.keys(dataMember).map((v: any, i: any) => {
|
||||
return (
|
||||
<View key={i} style={[Styles.mb05]}>
|
||||
<Text style={[Styles.textDefaultSemiBold]}>{dataMember[v]?.[0].group}</Text>
|
||||
<Skeleton width={100} widthType="percent" height={10} borderRadius={10} />
|
||||
<Skeleton width={100} widthType="percent" height={10} borderRadius={10} />
|
||||
<Skeleton width={100} widthType="percent" height={10} borderRadius={10} />
|
||||
</View>
|
||||
:
|
||||
<>
|
||||
<View style={[Styles.rowOnly, Styles.alignStart]}>
|
||||
<MaterialIcons name="campaign" size={25} color={colors.text} style={[Styles.mr05]} />
|
||||
<Text style={[Styles.textDefaultSemiBold, Styles.w90, Styles.mt02]}>{data?.title}</Text>
|
||||
</View>
|
||||
<View style={[Styles.mt10]}>
|
||||
{
|
||||
dataMember[v].map((item: any, x: any) => {
|
||||
return (
|
||||
<View key={x} style={[Styles.rowItemsCenter, Styles.w90]}>
|
||||
<Entypo name="dot-single" size={24} color={colors.text} />
|
||||
<Text style={[Styles.textDefault]} numberOfLines={1} ellipsizeMode='tail'>{item.division}</Text>
|
||||
</View>
|
||||
)
|
||||
})
|
||||
hasHtmlTags(data?.desc) ?
|
||||
<RenderHTML
|
||||
contentWidth={contentWidth}
|
||||
source={{ html: data?.desc }}
|
||||
baseStyle={{ color: colors.text }}
|
||||
/>
|
||||
:
|
||||
<Text>{data?.desc}</Text>
|
||||
}
|
||||
|
||||
</View>
|
||||
)
|
||||
})
|
||||
</>
|
||||
}
|
||||
|
||||
</View>
|
||||
{
|
||||
dataFile.length > 0 && (
|
||||
<View style={[Styles.wrapPaper, Styles.borderAll, Styles.mt10, { backgroundColor: colors.card, borderColor: colors.icon + '20' }]}>
|
||||
<View style={[Styles.mb05]}>
|
||||
<Text style={[Styles.textDefaultSemiBold]}>File</Text>
|
||||
</View>
|
||||
{dataFile.map((item, index) => (
|
||||
<BorderBottomItem
|
||||
key={`${item.id}-${index}`}
|
||||
borderType={index === dataFile.length - 1 ? 'none' : 'bottom'}
|
||||
icon={<MaterialCommunityIcons
|
||||
name={isImageFile(item.extension) ? "file-image-outline" : "file-document-outline"}
|
||||
size={25}
|
||||
color={colors.text}
|
||||
/>}
|
||||
title={item.name + '.' + item.extension}
|
||||
titleWeight="normal"
|
||||
onPress={() => {
|
||||
isImageFile(item.extension) ?
|
||||
handleChooseFile(item)
|
||||
: openFile(item)
|
||||
}}
|
||||
/>
|
||||
))}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
<View style={[Styles.wrapPaper, Styles.borderAll, Styles.mt10, { backgroundColor: colors.card, borderColor: colors.icon + '20' }]}>
|
||||
{
|
||||
loading ?
|
||||
arrSkeleton.map((item, index) => {
|
||||
return (
|
||||
<View key={index}>
|
||||
<Skeleton width={30} widthType="percent" height={10} borderRadius={10} />
|
||||
<Skeleton width={100} widthType="percent" height={10} borderRadius={10} />
|
||||
<Skeleton width={100} widthType="percent" height={10} borderRadius={10} />
|
||||
</View>
|
||||
)
|
||||
})
|
||||
:
|
||||
Object.keys(dataMember).map((v: any, i: any) => {
|
||||
return (
|
||||
<View key={i} style={[Styles.mb05]}>
|
||||
<Text style={[Styles.textDefaultSemiBold]}>{dataMember[v]?.[0].group}</Text>
|
||||
{
|
||||
dataMember[v].map((item: any, x: any) => {
|
||||
return (
|
||||
<View key={x} style={[Styles.rowItemsCenter, Styles.w90]}>
|
||||
<Entypo name="dot-single" size={24} color={colors.text} />
|
||||
<Text style={[Styles.textDefault]} numberOfLines={1} ellipsizeMode='tail'>{item.division}</Text>
|
||||
</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
)}
|
||||
</ScrollView>
|
||||
|
||||
<ImageViewing
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
import GuideOverlay from "@/components/GuideOverlay";
|
||||
import BorderBottomItem from "@/components/borderBottomItem";
|
||||
import InputSearch from "@/components/inputSearch";
|
||||
import SkeletonContent from "@/components/skeletonContent";
|
||||
import Text from '@/components/Text';
|
||||
import { ColorsStatus } from "@/constants/ColorsStatus";
|
||||
import Styles from "@/constants/Styles";
|
||||
import { apiGetAnnouncement } from "@/lib/api";
|
||||
import { GUIDE_ANNOUNCEMENT } from "@/lib/guideSteps";
|
||||
import { useGuide } from "@/lib/useGuide";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
import { MaterialIcons } from "@expo/vector-icons";
|
||||
import { useInfiniteQuery } from "@tanstack/react-query";
|
||||
import { router } from "expo-router";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { RefreshControl, View, VirtualizedList } from "react-native";
|
||||
import { useSelector } from "react-redux";
|
||||
|
||||
@@ -20,89 +23,83 @@ type Props = {
|
||||
createdAt: string
|
||||
}
|
||||
|
||||
|
||||
export default function Announcement() {
|
||||
const { token, decryptToken } = useAuthSession()
|
||||
const { colors } = useTheme();
|
||||
const [data, setData] = useState<Props[]>([])
|
||||
const [search, setSearch] = useState('')
|
||||
const update = useSelector((state: any) => state.announcementUpdate)
|
||||
const [loading, setLoading] = useState(true)
|
||||
const { visible: guideVisible, dismiss: dismissGuide } = useGuide('announcement')
|
||||
const arrSkeleton = Array.from({ length: 5 }, (_, index) => index)
|
||||
const [page, setPage] = useState(1)
|
||||
const [waiting, setWaiting] = useState(false)
|
||||
const [refreshing, setRefreshing] = useState(false)
|
||||
|
||||
async function handleLoad(loading: boolean, thisPage: number) {
|
||||
try {
|
||||
setWaiting(true)
|
||||
setLoading(loading)
|
||||
setPage(thisPage)
|
||||
// TanStack Query Infinite Query
|
||||
const {
|
||||
data,
|
||||
fetchNextPage,
|
||||
hasNextPage,
|
||||
isFetchingNextPage,
|
||||
isLoading,
|
||||
refetch,
|
||||
isRefetching
|
||||
} = useInfiniteQuery({
|
||||
queryKey: ['announcements', search],
|
||||
queryFn: async ({ pageParam = 1 }) => {
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiGetAnnouncement({ user: hasil, search: search, page: thisPage })
|
||||
if (thisPage == 1) {
|
||||
setData(response.data)
|
||||
} else if (thisPage > 1 && response.data.length > 0) {
|
||||
setData([...data, ...response.data])
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
setLoading(false)
|
||||
setWaiting(false)
|
||||
}
|
||||
}
|
||||
const response = await apiGetAnnouncement({
|
||||
user: hasil,
|
||||
search: search,
|
||||
page: pageParam
|
||||
})
|
||||
return response.data
|
||||
},
|
||||
initialPageParam: 1,
|
||||
getNextPageParam: (lastPage, allPages) => {
|
||||
return lastPage.length > 0 ? allPages.length + 1 : undefined
|
||||
},
|
||||
})
|
||||
|
||||
// Trigger refetch when Redux state 'update' changes
|
||||
useEffect(() => {
|
||||
handleLoad(false, 1)
|
||||
}, [update])
|
||||
refetch()
|
||||
}, [update, refetch])
|
||||
|
||||
useEffect(() => {
|
||||
handleLoad(true, 1)
|
||||
}, [search])
|
||||
// Flatten data from pages
|
||||
const flattenedData = useMemo(() => {
|
||||
return data?.pages.flat() || []
|
||||
}, [data])
|
||||
|
||||
const loadMoreData = () => {
|
||||
if (waiting) return
|
||||
setTimeout(() => {
|
||||
handleLoad(false, page + 1)
|
||||
}, 1000);
|
||||
};
|
||||
|
||||
const handleRefresh = async () => {
|
||||
setRefreshing(true)
|
||||
handleLoad(false, 1)
|
||||
await new Promise(resolve => setTimeout(resolve, 2000));
|
||||
setRefreshing(false)
|
||||
if (hasNextPage && !isFetchingNextPage) {
|
||||
fetchNextPage()
|
||||
}
|
||||
};
|
||||
|
||||
const getItem = (_data: unknown, index: number): Props => ({
|
||||
id: data[index].id,
|
||||
title: data[index].title,
|
||||
desc: data[index].desc,
|
||||
createdAt: data[index].createdAt,
|
||||
id: flattenedData[index].id,
|
||||
title: flattenedData[index].title,
|
||||
desc: flattenedData[index].desc,
|
||||
createdAt: flattenedData[index].createdAt,
|
||||
})
|
||||
|
||||
return (
|
||||
<View style={[Styles.p15, Styles.flex1, { backgroundColor: colors.background }]}>
|
||||
<GuideOverlay visible={guideVisible} steps={GUIDE_ANNOUNCEMENT} onDismiss={dismissGuide} />
|
||||
<View>
|
||||
<InputSearch onChange={setSearch} />
|
||||
</View>
|
||||
<View style={[Styles.flex2, Styles.mt05]}>
|
||||
{
|
||||
loading ?
|
||||
isLoading && !flattenedData.length ?
|
||||
arrSkeleton.map((item, index) => {
|
||||
return (
|
||||
<SkeletonContent key={index} />
|
||||
)
|
||||
})
|
||||
:
|
||||
data.length > 0
|
||||
flattenedData.length > 0
|
||||
?
|
||||
<VirtualizedList
|
||||
data={data}
|
||||
getItemCount={() => data.length}
|
||||
data={flattenedData}
|
||||
getItemCount={() => flattenedData.length}
|
||||
getItem={getItem}
|
||||
renderItem={({ item, index }: { item: Props, index: number }) => {
|
||||
return (
|
||||
@@ -112,9 +109,7 @@ export default function Announcement() {
|
||||
borderType="bottom"
|
||||
bgColor="transparent"
|
||||
icon={
|
||||
// <View style={[Styles.iconContent]}>
|
||||
<MaterialIcons name="campaign" size={25} color={colors.text} />
|
||||
// </View>
|
||||
}
|
||||
title={item.title}
|
||||
desc={item.desc.replace(/<[^>]*>?/gm, '').replace(/\r?\n|\r/g, ' ')}
|
||||
@@ -122,14 +117,14 @@ export default function Announcement() {
|
||||
/>
|
||||
)
|
||||
}}
|
||||
keyExtractor={(item, index) => String(index)}
|
||||
keyExtractor={(item, index) => String(item.id || index)}
|
||||
onEndReached={loadMoreData}
|
||||
onEndReachedThreshold={0.5}
|
||||
showsVerticalScrollIndicator={false}
|
||||
refreshControl={
|
||||
<RefreshControl
|
||||
refreshing={refreshing}
|
||||
onRefresh={handleRefresh}
|
||||
refreshing={isRefetching && !isFetchingNextPage}
|
||||
onRefresh={refetch}
|
||||
tintColor={colors.icon}
|
||||
/>
|
||||
}
|
||||
|
||||
@@ -1,23 +1,28 @@
|
||||
import AppHeader from "@/components/AppHeader"
|
||||
import GuideOverlay from "@/components/GuideOverlay"
|
||||
import HeaderRightBannerList from "@/components/banner/headerBannerList"
|
||||
import BorderBottomItem from "@/components/borderBottomItem"
|
||||
import DrawerBottom from "@/components/drawerBottom"
|
||||
import MenuItemRow from "@/components/menuItemRow"
|
||||
import ModalConfirmation from "@/components/ModalConfirmation"
|
||||
import ModalLoading from "@/components/modalLoading"
|
||||
import Skeleton from "@/components/skeleton"
|
||||
import Text from "@/components/Text"
|
||||
import { ConstEnv } from "@/constants/ConstEnv"
|
||||
import Styles from "@/constants/Styles"
|
||||
import { apiDeleteBanner, apiGetBanner } from "@/lib/api"
|
||||
import { setEntities } from "@/lib/bannerSlice"
|
||||
import { GUIDE_BANNER } from "@/lib/guideSteps"
|
||||
import { useGuide } from "@/lib/useGuide"
|
||||
import { useAuthSession } from "@/providers/AuthProvider"
|
||||
import { useTheme } from "@/providers/ThemeProvider"
|
||||
import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons"
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"
|
||||
import * as FileSystem from 'expo-file-system'
|
||||
import { startActivityAsync } from 'expo-intent-launcher'
|
||||
import { router, Stack } from "expo-router"
|
||||
import * as Sharing from 'expo-sharing'
|
||||
import { useState } from "react"
|
||||
import { useEffect, useState } from "react"
|
||||
import { Alert, Image, Platform, RefreshControl, SafeAreaView, ScrollView, View } from "react-native"
|
||||
import ImageViewing from 'react-native-image-viewing'
|
||||
import * as mime from 'react-native-mime-types'
|
||||
@@ -41,38 +46,54 @@ export default function BannerList() {
|
||||
const dispatch = useDispatch()
|
||||
const [refreshing, setRefreshing] = useState(false)
|
||||
const [loadingOpen, setLoadingOpen] = useState(false)
|
||||
const { visible: guideVisible, dismiss: dismissGuide } = useGuide('banner')
|
||||
const [viewImg, setViewImg] = useState(false)
|
||||
const [showDeleteModal, setShowDeleteModal] = useState(false)
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
const handleDeleteEntity = async () => {
|
||||
try {
|
||||
const hasil = await decryptToken(String(token?.current));
|
||||
const deletedEntity = await apiDeleteBanner({ user: hasil }, dataId);
|
||||
if (deletedEntity.success) {
|
||||
Toast.show({ type: 'small', text1: 'Berhasil menghapus data', })
|
||||
apiGetBanner({ user: hasil }).then((data) =>
|
||||
dispatch(setEntities(data.data))
|
||||
);
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: 'Gagal menghapus data', })
|
||||
}
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal menghapus data"
|
||||
// 1. Fetching logic with useQuery
|
||||
const { data: bannersRes, isLoading } = useQuery({
|
||||
queryKey: ['banners'],
|
||||
queryFn: async () => {
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiGetBanner({ user: hasil })
|
||||
return response.data || []
|
||||
},
|
||||
enabled: !!token?.current,
|
||||
staleTime: 0,
|
||||
})
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setModal(false)
|
||||
// Sync results with Redux
|
||||
useEffect(() => {
|
||||
if (bannersRes) {
|
||||
dispatch(setEntities(bannersRes))
|
||||
}
|
||||
}, [bannersRes, dispatch])
|
||||
|
||||
// 2. Deletion logic with useMutation
|
||||
const deleteMutation = useMutation({
|
||||
mutationFn: async (id: string) => {
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
return await apiDeleteBanner({ user: hasil }, id)
|
||||
},
|
||||
onSuccess: () => {
|
||||
Toast.show({ type: 'small', text1: 'Berhasil menghapus data' })
|
||||
queryClient.invalidateQueries({ queryKey: ['banners'] })
|
||||
},
|
||||
onError: (error: any) => {
|
||||
const message = error?.response?.data?.message || "Gagal menghapus data"
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
}
|
||||
})
|
||||
|
||||
const handleDeleteEntity = () => {
|
||||
deleteMutation.mutate(dataId)
|
||||
setModal(false)
|
||||
};
|
||||
|
||||
const handleRefresh = async () => {
|
||||
setRefreshing(true)
|
||||
const hasil = await decryptToken(String(token?.current));
|
||||
apiGetBanner({ user: hasil }).then((data) =>
|
||||
dispatch(setEntities(data.data))
|
||||
);
|
||||
await new Promise(resolve => setTimeout(resolve, 2000));
|
||||
await queryClient.invalidateQueries({ queryKey: ['banners'] })
|
||||
setRefreshing(false)
|
||||
};
|
||||
|
||||
@@ -129,6 +150,7 @@ export default function BannerList() {
|
||||
)
|
||||
}}
|
||||
/>
|
||||
<GuideOverlay visible={guideVisible} steps={GUIDE_BANNER} onDismiss={dismissGuide} />
|
||||
<ModalLoading isVisible={loadingOpen} setVisible={setLoadingOpen} />
|
||||
<ScrollView
|
||||
refreshControl={
|
||||
@@ -140,36 +162,40 @@ export default function BannerList() {
|
||||
}
|
||||
style={[Styles.h100, { backgroundColor: colors.background }]}
|
||||
>
|
||||
{
|
||||
entities.length > 0
|
||||
?
|
||||
<View style={[Styles.p15, Styles.mb100]}>
|
||||
{entities.map((index: any, key: number) => (
|
||||
<BorderBottomItem
|
||||
key={key}
|
||||
onPress={() => {
|
||||
setDataId(index.id)
|
||||
setSelectFile(index)
|
||||
setModal(true)
|
||||
}}
|
||||
borderType="all"
|
||||
icon={
|
||||
<Image
|
||||
source={{ uri: `${ConstEnv.url_storage}/files/${index.image}` }}
|
||||
style={[Styles.imgListBanner]}
|
||||
/>
|
||||
}
|
||||
title={index.title}
|
||||
/>
|
||||
))}
|
||||
</View>
|
||||
:
|
||||
<View style={[Styles.p15, Styles.mb100]}>
|
||||
<Text style={[Styles.textDefault, Styles.textCenter]}>Tidak ada data</Text>
|
||||
</View>
|
||||
}
|
||||
|
||||
|
||||
<View style={[Styles.p15, Styles.mb100]}>
|
||||
{
|
||||
isLoading ? (
|
||||
<>
|
||||
<Skeleton width={100} height={150} borderRadius={10} widthType="percent" />
|
||||
<Skeleton width={100} height={150} borderRadius={10} widthType="percent" />
|
||||
<Skeleton width={100} height={150} borderRadius={10} widthType="percent" />
|
||||
</>
|
||||
) :
|
||||
entities.length > 0 ?
|
||||
entities.map((index: any, key: number) => (
|
||||
<BorderBottomItem
|
||||
key={key}
|
||||
onPress={() => {
|
||||
setDataId(index.id)
|
||||
setSelectFile(index)
|
||||
setModal(true)
|
||||
}}
|
||||
borderType="all"
|
||||
icon={
|
||||
<Image
|
||||
source={{ uri: `${ConstEnv.url_storage}/files/${index.image}` }}
|
||||
style={[Styles.imgListBanner]}
|
||||
/>
|
||||
}
|
||||
title={index.title}
|
||||
/>
|
||||
))
|
||||
:
|
||||
<View style={[Styles.p15, Styles.mb100]}>
|
||||
<Text style={[Styles.textDefault, Styles.textCenter]}>Tidak ada data</Text>
|
||||
</View>
|
||||
}
|
||||
</View>
|
||||
</ScrollView>
|
||||
|
||||
<DrawerBottom animation="slide" isVisible={isModal} setVisible={() => setModal(false)} title="Menu">
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
import AppHeader from "@/components/AppHeader";
|
||||
import BorderBottomItem from "@/components/borderBottomItem";
|
||||
import BorderBottomItem2 from "@/components/borderBottomItem2";
|
||||
import HeaderRightDiscussionGeneralDetail from "@/components/discussion_general/headerDiscussionDetail";
|
||||
import DrawerBottom from "@/components/drawerBottom";
|
||||
import ImageUser from "@/components/imageNew";
|
||||
import { InputForm } from "@/components/inputForm";
|
||||
import LabelStatus from "@/components/labelStatus";
|
||||
import MenuItemRow from "@/components/menuItemRow";
|
||||
import ModalConfirmation from "@/components/ModalConfirmation";
|
||||
import Skeleton from "@/components/skeleton";
|
||||
@@ -271,29 +269,36 @@ export default function DetailDiscussionGeneral() {
|
||||
borderType="all"
|
||||
bgColor="white"
|
||||
icon={
|
||||
<View style={[Styles.iconContent]}>
|
||||
<MaterialIcons name="chat" size={25} color={'black'} />
|
||||
<View style={[Styles.discussionIconCircleLg, { backgroundColor: colors.icon + '20' }]}>
|
||||
<Feather name="message-circle" size={22} color={colors.icon} />
|
||||
</View>
|
||||
}
|
||||
title={data?.title}
|
||||
titleShowAll={true}
|
||||
subtitle={
|
||||
!data?.isActive ?
|
||||
<LabelStatus category='warning' text='ARSIP' size="small" />
|
||||
:
|
||||
<LabelStatus category={data.status == 1 ? 'success' : 'error'} text={data.status == 1 ? 'BUKA' : 'TUTUP'} size="small" />
|
||||
<View style={[Styles.discussionStatusPill, {
|
||||
borderColor: !data?.isActive
|
||||
? '#F59E0B'
|
||||
: data?.status == 1 ? '#10B981' : colors.dimmed + '80',
|
||||
}]}>
|
||||
<Text style={[Styles.discussionStatusText, {
|
||||
color: !data?.isActive
|
||||
? '#F59E0B'
|
||||
: data?.status == 1 ? '#10B981' : colors.dimmed,
|
||||
}]}>
|
||||
{!data?.isActive ? 'Arsip' : data?.status == 1 ? 'Buka' : 'Tutup'}
|
||||
</Text>
|
||||
</View>
|
||||
}
|
||||
desc={data?.desc}
|
||||
leftBottomInfo={
|
||||
<View style={[Styles.rowItemsCenter]}>
|
||||
<Ionicons name="chatbox-ellipses-outline" size={18} color={colors.dimmed} style={Styles.mr05} />
|
||||
<Text style={[Styles.textInformation, { color: colors.dimmed }, Styles.mb05]}>{dataKomentar.length} Komentar</Text>
|
||||
<Feather name="message-square" size={14} color={colors.dimmed} style={Styles.mr05} />
|
||||
<Text style={[Styles.textInformation, { color: colors.dimmed }]}>{dataKomentar.length} Komentar</Text>
|
||||
</View>
|
||||
}
|
||||
rightBottomInfo={
|
||||
<View style={[Styles.rowItemsCenter]}>
|
||||
<Text style={[Styles.textInformation, { color: colors.dimmed }, Styles.mb05]}>{data?.createdAt}</Text>
|
||||
</View>
|
||||
<Text style={[Styles.textInformation, { color: colors.dimmed }]}>{data?.createdAt}</Text>
|
||||
}
|
||||
/>
|
||||
}
|
||||
@@ -306,36 +311,56 @@ export default function DetailDiscussionGeneral() {
|
||||
)
|
||||
})
|
||||
:
|
||||
dataKomentar.map((item, i) => {
|
||||
return (
|
||||
<BorderBottomItem
|
||||
key={i}
|
||||
borderType="all"
|
||||
colorPress
|
||||
icon={
|
||||
<ImageUser src={`${ConstEnv.url_storage}/files/${item.img}`} size="xs" />
|
||||
dataKomentar.map((item, i) => (
|
||||
<Pressable
|
||||
key={i}
|
||||
onPress={() => {
|
||||
setDetailMore((prev: any) =>
|
||||
prev.includes(item.id)
|
||||
? prev.filter((id: string) => id !== item.id)
|
||||
: [...prev, item.id]
|
||||
)
|
||||
}}
|
||||
onLongPress={() => {
|
||||
item.idUser == entities.id && data?.status != 2 && data?.isActive && handleMenuKomentar(item.id, item.comment)
|
||||
}}
|
||||
style={({ pressed }) => [
|
||||
Styles.discussionCommentCard,
|
||||
{
|
||||
backgroundColor: pressed ? colors.icon + '10' : colors.card,
|
||||
borderColor: colors.icon + '20',
|
||||
}
|
||||
title={item.username}
|
||||
rightTopInfo={item.createdAt}
|
||||
desc={item.comment}
|
||||
rightBottomInfo={item.isEdited ? "Edited" : ""}
|
||||
descEllipsize={detailMore.includes(item.id) ? false : true}
|
||||
bgColor="white"
|
||||
onPress={() => {
|
||||
setDetailMore((prev: any) => {
|
||||
if (prev.includes(item.id)) {
|
||||
return prev.filter((id: string) => id !== item.id)
|
||||
} else {
|
||||
return [...prev, item.id]
|
||||
}
|
||||
})
|
||||
}}
|
||||
onLongPress={() => {
|
||||
item.idUser == entities.id && data?.status != 2 && data?.isActive && handleMenuKomentar(item.id, item.comment)
|
||||
}}
|
||||
/>
|
||||
)
|
||||
})
|
||||
]}
|
||||
>
|
||||
<View style={Styles.flex1}>
|
||||
{/* Name + time */}
|
||||
<View style={[Styles.rowSpaceBetween, Styles.itemsCenter, Styles.mb05]}>
|
||||
<View style={[Styles.rowItemsCenter, { gap: 8, flex: 1, marginRight: 8 }]}>
|
||||
<ImageUser src={`${ConstEnv.url_storage}/files/${item.img}`} size="xs" />
|
||||
<Text style={[Styles.textMediumSemiBold, { color: colors.text }]} numberOfLines={1}>
|
||||
{item.username}
|
||||
</Text>
|
||||
{item.isEdited && (
|
||||
<Text style={[Styles.discussionEditedText, { color: colors.dimmed }]}>
|
||||
diedit
|
||||
</Text>
|
||||
)}
|
||||
</View>
|
||||
<Text style={[Styles.discussionDateText, { color: colors.dimmed, flexShrink: 0 }]}>
|
||||
{item.createdAt}
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
{/* Comment text */}
|
||||
<Text
|
||||
style={[Styles.textDefault, { color: colors.text }]}
|
||||
numberOfLines={detailMore.includes(item.id) ? 0 : 3}
|
||||
>
|
||||
{item.comment}
|
||||
</Text>
|
||||
</View>
|
||||
</Pressable>
|
||||
))
|
||||
}
|
||||
</View>
|
||||
</View>
|
||||
@@ -372,15 +397,14 @@ export default function DetailDiscussionGeneral() {
|
||||
multiline
|
||||
focus={viewEdit}
|
||||
itemRight={
|
||||
<Pressable onPress={() => {
|
||||
(!loadingSendKomentar && selectKomentar.comment != '' && !regexOnlySpacesOrEnter.test(selectKomentar.comment) && data?.status === 1 && data?.isActive && (memberDiscussion || (entityUser.role != "user" && entityUser.role != "coadmin")))
|
||||
&& handleEditKomentar()
|
||||
}}
|
||||
style={[
|
||||
Platform.OS == 'android' && Styles.mb12,
|
||||
]}
|
||||
<Pressable
|
||||
onPress={() => {
|
||||
(!loadingSendKomentar && selectKomentar.comment != '' && !regexOnlySpacesOrEnter.test(selectKomentar.comment) && data?.status === 1 && data?.isActive && (memberDiscussion || (entityUser.role != "user" && entityUser.role != "coadmin")))
|
||||
&& handleEditKomentar()
|
||||
}}
|
||||
style={[Platform.OS == 'android' && Styles.mb12]}
|
||||
>
|
||||
<MaterialIcons name="send" size={25} style={(loadingSendKomentar || selectKomentar.comment == '' || regexOnlySpacesOrEnter.test(selectKomentar.comment) || data?.status === 2 || !data?.isActive || (!memberDiscussion && (entityUser.role == "user" || entityUser.role == "coadmin"))) ? { color: colors.dimmed } : { color: colors.tint }} />
|
||||
<MaterialIcons name="send" size={25} style={(loadingSendKomentar || selectKomentar.comment == '' || regexOnlySpacesOrEnter.test(selectKomentar.comment) || data?.status === 2 || !data?.isActive || (!memberDiscussion && (entityUser.role == "user" || entityUser.role == "coadmin"))) ? { color: colors.dimmed } : { color: colors.tint }} />
|
||||
</Pressable>
|
||||
}
|
||||
/>
|
||||
@@ -398,15 +422,14 @@ export default function DetailDiscussionGeneral() {
|
||||
multiline
|
||||
focus={viewEdit}
|
||||
itemRight={
|
||||
<Pressable onPress={() => {
|
||||
(!loadingSendKomentar && komentar != '' && !regexOnlySpacesOrEnter.test(komentar) && data?.status === 1 && data?.isActive && (memberDiscussion || (entityUser.role != "user" && entityUser.role != "coadmin")))
|
||||
&& handleKomentar()
|
||||
}}
|
||||
style={[
|
||||
Platform.OS == 'android' && Styles.mb12,
|
||||
]}
|
||||
<Pressable
|
||||
onPress={() => {
|
||||
(!loadingSendKomentar && komentar != '' && !regexOnlySpacesOrEnter.test(komentar) && data?.status === 1 && data?.isActive && (memberDiscussion || (entityUser.role != "user" && entityUser.role != "coadmin")))
|
||||
&& handleKomentar()
|
||||
}}
|
||||
style={[Platform.OS == 'android' && Styles.mb12]}
|
||||
>
|
||||
<MaterialIcons name="send" size={25} style={(loadingSendKomentar || komentar == '' || regexOnlySpacesOrEnter.test(komentar) || data?.status === 2 || !data?.isActive || (!memberDiscussion && (entityUser.role == "user" || entityUser.role == "coadmin"))) ? { color: colors.dimmed } : { color: colors.tint }} />
|
||||
<MaterialIcons name="send" size={25} style={(loadingSendKomentar || komentar == '' || regexOnlySpacesOrEnter.test(komentar) || data?.status === 2 || !data?.isActive || (!memberDiscussion && (entityUser.role == "user" || entityUser.role == "coadmin"))) ? { color: colors.dimmed } : { color: colors.tint }} />
|
||||
</Pressable>
|
||||
}
|
||||
/>
|
||||
|
||||
@@ -1,22 +1,23 @@
|
||||
import BorderBottomItem from "@/components/borderBottomItem";
|
||||
import GuideOverlay from "@/components/GuideOverlay";
|
||||
import ButtonTab from "@/components/buttonTab";
|
||||
import InputSearch from "@/components/inputSearch";
|
||||
import LabelStatus from "@/components/labelStatus";
|
||||
import SkeletonContent from "@/components/skeletonContent";
|
||||
import Text from "@/components/Text";
|
||||
import WrapTab from "@/components/wrapTab";
|
||||
import { ColorsStatus } from "@/constants/ColorsStatus";
|
||||
import Styles from "@/constants/Styles";
|
||||
import { apiGetDiscussionGeneral } from "@/lib/api";
|
||||
import { GUIDE_DISCUSSION } from "@/lib/guideSteps";
|
||||
import { useGuide } from "@/lib/useGuide";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
import { AntDesign, Feather, Ionicons, MaterialIcons } from "@expo/vector-icons";
|
||||
import { AntDesign, Feather } from "@expo/vector-icons";
|
||||
import { useInfiniteQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { router, useLocalSearchParams } from "expo-router";
|
||||
import { useEffect, useState } from "react";
|
||||
import { RefreshControl, View, VirtualizedList } from "react-native";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { FlatList, Pressable, RefreshControl, View } from "react-native";
|
||||
import { useSelector } from "react-redux";
|
||||
|
||||
|
||||
type Props = {
|
||||
id: string
|
||||
title: string
|
||||
@@ -32,164 +33,182 @@ export default function Discussion() {
|
||||
const { colors } = useTheme();
|
||||
const { active, group } = useLocalSearchParams<{ active?: string, group?: string }>()
|
||||
const [search, setSearch] = useState('')
|
||||
const [nameGroup, setNameGroup] = useState('')
|
||||
const [data, setData] = useState<Props[]>([])
|
||||
const update = useSelector((state: any) => state.discussionGeneralDetailUpdate)
|
||||
const [loading, setLoading] = useState(true)
|
||||
const arrSkeleton = Array.from({ length: 5 }, (_, index) => index)
|
||||
const [status, setStatus] = useState<'true' | 'false'>('true')
|
||||
const [page, setPage] = useState(1)
|
||||
const [waiting, setWaiting] = useState(false)
|
||||
const queryClient = useQueryClient()
|
||||
const [status, setStatus] = useState<'true' | 'false'>(active == 'false' ? 'false' : 'true')
|
||||
const [refreshing, setRefreshing] = useState(false)
|
||||
const { visible: guideVisible, dismiss: dismissGuide } = useGuide('discussion')
|
||||
|
||||
async function handleLoad(loading: boolean, thisPage: number) {
|
||||
try {
|
||||
setWaiting(true)
|
||||
setLoading(loading)
|
||||
setPage(thisPage)
|
||||
const {
|
||||
data,
|
||||
fetchNextPage,
|
||||
hasNextPage,
|
||||
isFetchingNextPage,
|
||||
isLoading,
|
||||
refetch
|
||||
} = useInfiniteQuery({
|
||||
queryKey: ['discussions', { status, search, group }],
|
||||
queryFn: async ({ pageParam = 1 }) => {
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiGetDiscussionGeneral({ user: hasil, active: status, search: search, group: String(group), page: thisPage })
|
||||
if (thisPage == 1) {
|
||||
setData(response.data)
|
||||
} else if (thisPage > 1 && response.data.length > 0) {
|
||||
setData([...data, ...response.data])
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
setNameGroup(response.filter.name)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
setLoading(false)
|
||||
setWaiting(false)
|
||||
}
|
||||
}
|
||||
const response = await apiGetDiscussionGeneral({
|
||||
user: hasil,
|
||||
active: status,
|
||||
search: search,
|
||||
group: String(group),
|
||||
page: pageParam
|
||||
})
|
||||
return response;
|
||||
},
|
||||
initialPageParam: 1,
|
||||
getNextPageParam: (lastPage, allPages) => {
|
||||
return lastPage.data.length > 0 ? allPages.length + 1 : undefined;
|
||||
},
|
||||
enabled: !!token?.current,
|
||||
staleTime: 0,
|
||||
})
|
||||
|
||||
const flatData = useMemo(() => {
|
||||
return data?.pages.flatMap(page => page.data) || [];
|
||||
}, [data])
|
||||
|
||||
const nameGroup = useMemo(() => {
|
||||
return data?.pages[0]?.filter?.name || "";
|
||||
}, [data])
|
||||
|
||||
useEffect(() => {
|
||||
handleLoad(false, 1)
|
||||
}, [update])
|
||||
|
||||
useEffect(() => {
|
||||
handleLoad(true, 1)
|
||||
}, [status, search, group])
|
||||
|
||||
|
||||
const loadMoreData = () => {
|
||||
if (waiting) return
|
||||
setTimeout(() => {
|
||||
handleLoad(false, page + 1)
|
||||
}, 1000);
|
||||
};
|
||||
refetch()
|
||||
}, [update, refetch])
|
||||
|
||||
const handleRefresh = async () => {
|
||||
setRefreshing(true)
|
||||
handleLoad(false, 1)
|
||||
await new Promise(resolve => setTimeout(resolve, 2000));
|
||||
await queryClient.invalidateQueries({ queryKey: ['discussions'] })
|
||||
setRefreshing(false)
|
||||
};
|
||||
|
||||
const getItem = (_data: unknown, index: number): Props => ({
|
||||
id: data[index].id,
|
||||
title: data[index].title,
|
||||
desc: data[index].desc,
|
||||
status: data[index].status,
|
||||
total_komentar: data[index].total_komentar,
|
||||
createdAt: data[index].createdAt,
|
||||
})
|
||||
const isOpen = (item: Props) => item.status === 1
|
||||
|
||||
return (
|
||||
<View style={[Styles.p15, Styles.flex1, { backgroundColor: colors.background }]}>
|
||||
<View>
|
||||
{
|
||||
entityUser.role != "user" && entityUser.role != "coadmin" &&
|
||||
<View style={[Styles.flex1, { backgroundColor: colors.background }]}>
|
||||
<GuideOverlay visible={guideVisible} steps={GUIDE_DISCUSSION} onDismiss={dismissGuide} />
|
||||
{/* Header controls */}
|
||||
<View style={[Styles.ph15, { paddingTop: 12 }]}>
|
||||
{entityUser.role != "user" && entityUser.role != "coadmin" && (
|
||||
<WrapTab>
|
||||
<ButtonTab
|
||||
active={status == "false" ? "false" : "true"}
|
||||
value="true"
|
||||
onPress={() => { setStatus("true") }}
|
||||
onPress={() => setStatus("true")}
|
||||
label="Aktif"
|
||||
icon={<Feather name="check-circle" color={status == "false" ? colors.dimmed : 'white'} size={20} />}
|
||||
n={2} />
|
||||
n={2}
|
||||
/>
|
||||
<ButtonTab
|
||||
active={status == "false" ? "false" : "true"}
|
||||
value="false"
|
||||
onPress={() => { setStatus("false") }}
|
||||
onPress={() => setStatus("false")}
|
||||
label="Arsip"
|
||||
icon={<AntDesign name="closecircleo" color={status == "true" ? colors.dimmed : 'white'} size={20} />}
|
||||
n={2} />
|
||||
n={2}
|
||||
/>
|
||||
</WrapTab>
|
||||
}
|
||||
|
||||
)}
|
||||
<InputSearch onChange={setSearch} />
|
||||
{
|
||||
(entityUser.role == "supadmin" || entityUser.role == "developer") &&
|
||||
<View style={[Styles.mv05, Styles.rowOnly]}>
|
||||
<Text>Filter :</Text>
|
||||
{(entityUser.role == "supadmin" || entityUser.role == "developer") && (
|
||||
<View style={[Styles.mv05, Styles.rowItemsCenter]}>
|
||||
<Text style={{ color: colors.dimmed, fontSize: 12 }}>Filter:</Text>
|
||||
<LabelStatus size="small" category="secondary" text={nameGroup} style={[Styles.mh05]} />
|
||||
</View>
|
||||
}
|
||||
)}
|
||||
</View>
|
||||
<View style={[Styles.flex2, Styles.mt05]}>
|
||||
{
|
||||
loading ?
|
||||
arrSkeleton.map((item: any, i: number) => {
|
||||
return (
|
||||
<SkeletonContent key={i} />
|
||||
)
|
||||
})
|
||||
:
|
||||
data.length > 0
|
||||
?
|
||||
<VirtualizedList
|
||||
data={data}
|
||||
getItemCount={() => data.length}
|
||||
getItem={getItem}
|
||||
renderItem={({ item, index }: { item: Props, index: number }) => {
|
||||
return (
|
||||
<BorderBottomItem
|
||||
bgColor="transparent"
|
||||
key={index}
|
||||
onPress={() => { router.push(`/discussion/${item.id}`) }}
|
||||
borderType="bottom"
|
||||
icon={
|
||||
// <View style={[Styles.iconContent]}>
|
||||
<MaterialIcons name="chat" size={25} color={colors.text} />
|
||||
// </View>
|
||||
}
|
||||
title={item.title}
|
||||
subtitle={
|
||||
status != "false" && <LabelStatus category={item.status === 1 ? "success" : "error"} text={item.status === 1 ? "BUKA" : "TUTUP"} size="small" />
|
||||
}
|
||||
rightTopInfo={item.createdAt}
|
||||
desc={item.desc.replace(/<[^>]*>?/gm, ' ').replace(/\r?\n|\r/g, ' ')}
|
||||
leftBottomInfo={
|
||||
<View style={[Styles.rowItemsCenter]}>
|
||||
<Ionicons name="chatbox-ellipses-outline" size={18} color={colors.dimmed} style={Styles.mr05} />
|
||||
<Text style={[Styles.textInformation, { color: colors.dimmed }, Styles.mb05]}>Diskusikan</Text>
|
||||
</View>
|
||||
}
|
||||
rightBottomInfo={`${item.total_komentar} Komentar`}
|
||||
|
||||
/>
|
||||
)
|
||||
}}
|
||||
keyExtractor={(item, index) => String(index)}
|
||||
onEndReached={loadMoreData}
|
||||
onEndReachedThreshold={0.5}
|
||||
showsVerticalScrollIndicator={false}
|
||||
refreshControl={
|
||||
<RefreshControl
|
||||
refreshing={refreshing}
|
||||
onRefresh={handleRefresh}
|
||||
tintColor={colors.icon}
|
||||
/>
|
||||
}
|
||||
{/* List */}
|
||||
<View style={[Styles.flex1, Styles.ph15, { paddingTop: 8 }]}>
|
||||
{isLoading ? (
|
||||
[0, 1, 2, 3, 4].map((_, i) => <SkeletonContent key={i} />)
|
||||
) : flatData.length === 0 ? (
|
||||
<View style={[Styles.contentItemCenter, Styles.mt30]}>
|
||||
<Feather name="message-circle" size={42} color={colors.icon + '40'} />
|
||||
<Text style={[Styles.mt10, { color: colors.dimmed, fontSize: 14 }]}>
|
||||
Tidak ada diskusi
|
||||
</Text>
|
||||
</View>
|
||||
) : (
|
||||
<FlatList
|
||||
data={flatData}
|
||||
keyExtractor={(_, i) => String(i)}
|
||||
showsVerticalScrollIndicator={false}
|
||||
onEndReached={() => {
|
||||
if (hasNextPage && !isFetchingNextPage) fetchNextPage()
|
||||
}}
|
||||
onEndReachedThreshold={0.5}
|
||||
refreshControl={
|
||||
<RefreshControl
|
||||
refreshing={refreshing}
|
||||
onRefresh={handleRefresh}
|
||||
tintColor={colors.icon}
|
||||
/>
|
||||
:
|
||||
<Text style={[Styles.textDefault, Styles.textCenter, { color: colors.dimmed }]}>Tidak ada data</Text>
|
||||
}
|
||||
}
|
||||
ItemSeparatorComponent={() => <View style={Styles.discussionSeparator} />}
|
||||
renderItem={({ item }: { item: Props }) => (
|
||||
<Pressable
|
||||
onPress={() => router.push(`/discussion/${item.id}`)}
|
||||
style={({ pressed }) => [
|
||||
Styles.discussionCard,
|
||||
{
|
||||
backgroundColor: pressed ? colors.icon + '10' : colors.card,
|
||||
borderColor: colors.icon + '20',
|
||||
}
|
||||
]}
|
||||
>
|
||||
{/* Top row: icon + title + status badge */}
|
||||
<View style={[Styles.rowItemsCenter, Styles.mb08]}>
|
||||
{/* Discussion icon */}
|
||||
<View style={[Styles.discussionIconCircle, { backgroundColor: colors.icon + '20' }]}>
|
||||
<Feather name="message-circle" size={20} color={colors.icon} />
|
||||
</View>
|
||||
|
||||
{/* Title + status badge */}
|
||||
<View style={[Styles.flex1, { marginLeft: 10 }]}>
|
||||
<Text style={[Styles.textDefaultSemiBold, { color: colors.text }]} numberOfLines={1}>
|
||||
{item.title}
|
||||
</Text>
|
||||
{status !== "false" && (
|
||||
<View style={[Styles.discussionStatusPill, { borderColor: isOpen(item) ? '#10B981' : colors.dimmed + '80' }]}>
|
||||
<Text style={[Styles.discussionStatusText, { color: isOpen(item) ? '#10B981' : colors.dimmed }]}>
|
||||
{isOpen(item) ? 'Buka' : 'Tutup'}
|
||||
</Text>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
|
||||
{/* Description */}
|
||||
{item.desc ? (
|
||||
<Text
|
||||
style={[Styles.textMediumNormal, Styles.discussionCardIndent, { color: colors.dimmed, marginBottom: 10 }]}
|
||||
numberOfLines={2}
|
||||
>
|
||||
{item.desc.replace(/<[^>]*>?/gm, ' ').replace(/\r?\n|\r/g, ' ')}
|
||||
</Text>
|
||||
) : null}
|
||||
|
||||
{/* Bottom row: comment count + date */}
|
||||
<View style={[Styles.rowItemsCenter, Styles.rowSpaceBetween, Styles.discussionCardIndent]}>
|
||||
<View style={Styles.rowItemsCenter}>
|
||||
<Feather name="message-square" size={14} color={colors.dimmed} />
|
||||
<Text style={[Styles.discussionCommentText, { color: colors.dimmed }]}>
|
||||
{item.total_komentar} Komentar
|
||||
</Text>
|
||||
</View>
|
||||
<Text style={[Styles.discussionDateText, { color: colors.dimmed }]}>
|
||||
{item.createdAt}
|
||||
</Text>
|
||||
</View>
|
||||
</Pressable>
|
||||
)}
|
||||
/>
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import AppHeader from "@/components/AppHeader";
|
||||
import GuideOverlay from "@/components/GuideOverlay";
|
||||
import HeaderRightCalendarList from "@/components/calendar/headerCalendarList";
|
||||
import ItemDateCalendar from "@/components/calendar/itemDateCalendar";
|
||||
import EventItem from "@/components/eventItem";
|
||||
@@ -6,6 +7,8 @@ import Skeleton from "@/components/skeleton";
|
||||
import Text from "@/components/Text";
|
||||
import Styles from "@/constants/Styles";
|
||||
import { apiGetCalendarByDateDivision, apiGetIndicatorCalendar } from "@/lib/api";
|
||||
import { GUIDE_DIVISION_CALENDAR } from "@/lib/guideSteps";
|
||||
import { useGuide } from "@/lib/useGuide";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
import { Feather } from "@expo/vector-icons";
|
||||
@@ -46,6 +49,7 @@ export default function CalendarDivision() {
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [loadingBtn, setLoadingBtn] = useState(false)
|
||||
const [refreshing, setRefreshing] = useState(false)
|
||||
const { visible: guideVisible, dismiss: dismissGuide } = useGuide('division-calendar')
|
||||
|
||||
|
||||
async function handleLoad(loading: boolean) {
|
||||
@@ -150,6 +154,7 @@ export default function CalendarDivision() {
|
||||
)
|
||||
}}
|
||||
/>
|
||||
<GuideOverlay visible={guideVisible} steps={GUIDE_DIVISION_CALENDAR} onDismiss={dismissGuide} />
|
||||
<ScrollView
|
||||
refreshControl={
|
||||
<RefreshControl
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
import AppHeader from "@/components/AppHeader";
|
||||
import BorderBottomItem from "@/components/borderBottomItem";
|
||||
import BorderBottomItem2 from "@/components/borderBottomItem2";
|
||||
import HeaderRightDiscussionDetail from "@/components/discussion/headerDiscussionDetail";
|
||||
import DrawerBottom from "@/components/drawerBottom";
|
||||
import ImageUser from "@/components/imageNew";
|
||||
import { InputForm } from "@/components/inputForm";
|
||||
import LabelStatus from "@/components/labelStatus";
|
||||
import MenuItemRow from "@/components/menuItemRow";
|
||||
import ModalConfirmation from "@/components/ModalConfirmation";
|
||||
import Skeleton from "@/components/skeleton";
|
||||
@@ -24,7 +22,7 @@ import {
|
||||
import { getDB } from "@/lib/firebaseDatabase";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
import { Feather, Ionicons, MaterialCommunityIcons, MaterialIcons } from "@expo/vector-icons";
|
||||
import { Feather, MaterialCommunityIcons, MaterialIcons } from "@expo/vector-icons";
|
||||
import { ref } from "@react-native-firebase/database";
|
||||
import { useHeaderHeight } from '@react-navigation/elements';
|
||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||
@@ -87,24 +85,15 @@ export default function DiscussionDetail() {
|
||||
const [detailMore, setDetailMore] = useState<any>([])
|
||||
const entities = useSelector((state: any) => state.entities)
|
||||
const [isVisible, setVisible] = useState(false)
|
||||
const [selectKomentar, setSelectKomentar] = useState({
|
||||
id: '',
|
||||
comment: ''
|
||||
})
|
||||
const [selectKomentar, setSelectKomentar] = useState({ id: '', comment: '' })
|
||||
const [viewEdit, setViewEdit] = useState(false)
|
||||
const [showDeleteModal, setShowDeleteModal] = useState(false)
|
||||
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
const onValueChange = reference.on('value', snapshot => {
|
||||
if (snapshot.val() == null) {
|
||||
reference.set({ trigger: true })
|
||||
}
|
||||
if (snapshot.val() == null) { reference.set({ trigger: true }) }
|
||||
handleLoadComment(false)
|
||||
});
|
||||
|
||||
// Stop listening for updates when no longer required
|
||||
return () => reference.off('value', onValueChange);
|
||||
}, []);
|
||||
|
||||
@@ -115,23 +104,12 @@ export default function DiscussionDetail() {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
async function handleLoad(loading: boolean) {
|
||||
try {
|
||||
setLoading(loading)
|
||||
const hasil = await decryptToken(String(token?.current));
|
||||
const response = await apiGetDiscussionOne({
|
||||
id: detail,
|
||||
user: hasil,
|
||||
cat: "data",
|
||||
});
|
||||
|
||||
const responseFile = await apiGetDiscussionOne({
|
||||
id: detail,
|
||||
user: hasil,
|
||||
cat: "file",
|
||||
});
|
||||
|
||||
const response = await apiGetDiscussionOne({ id: detail, user: hasil, cat: "data" });
|
||||
const responseFile = await apiGetDiscussionOne({ id: detail, user: hasil, cat: "file" });
|
||||
setData(response.data);
|
||||
setFileDiscussion(responseFile.data)
|
||||
setIsCreator(response.data.createdBy == hasil);
|
||||
@@ -146,11 +124,7 @@ export default function DiscussionDetail() {
|
||||
try {
|
||||
setLoadingKomentar(loading)
|
||||
const hasil = await decryptToken(String(token?.current));
|
||||
const response = await apiGetDiscussionOne({
|
||||
id: detail,
|
||||
user: hasil,
|
||||
cat: "comment",
|
||||
});
|
||||
const response = await apiGetDiscussionOne({ id: detail, user: hasil, cat: "comment" });
|
||||
setDataComment(response.data);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
@@ -162,17 +136,8 @@ export default function DiscussionDetail() {
|
||||
async function handleCheckMember() {
|
||||
try {
|
||||
const hasil = await decryptToken(String(token?.current));
|
||||
const response = await apiGetDivisionOneFeature({
|
||||
id,
|
||||
user: hasil,
|
||||
cat: "check-member",
|
||||
});
|
||||
|
||||
const response2 = await apiGetDivisionOneFeature({
|
||||
id,
|
||||
user: hasil,
|
||||
cat: "check-admin",
|
||||
});
|
||||
const response = await apiGetDivisionOneFeature({ id, user: hasil, cat: "check-member" });
|
||||
const response2 = await apiGetDivisionOneFeature({ id, user: hasil, cat: "check-admin" });
|
||||
setIsMemberDivision(response.data);
|
||||
setIsAdminDivision(response2.data);
|
||||
} catch (error) {
|
||||
@@ -180,33 +145,18 @@ export default function DiscussionDetail() {
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
handleLoad(false);
|
||||
}, [update.data]);
|
||||
|
||||
useEffect(() => {
|
||||
handleLoad(true)
|
||||
handleLoadComment(true);
|
||||
handleCheckMember();
|
||||
}, []);
|
||||
useEffect(() => { handleLoad(false); }, [update.data]);
|
||||
useEffect(() => { handleLoad(true); handleLoadComment(true); handleCheckMember(); }, []);
|
||||
|
||||
async function handleKomentar() {
|
||||
try {
|
||||
setLoadingSend(true);
|
||||
const hasil = await decryptToken(String(token?.current));
|
||||
const response = await apiSendDiscussionCommentar({
|
||||
id: detail,
|
||||
data: { comment: komentar, user: hasil },
|
||||
});
|
||||
if (response.success) {
|
||||
setKomentar("")
|
||||
updateTrigger()
|
||||
}
|
||||
const response = await apiSendDiscussionCommentar({ id: detail, data: { comment: komentar, user: hasil } });
|
||||
if (response.success) { setKomentar(""); updateTrigger() }
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal menambahkan komentar"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
Toast.show({ type: 'small', text1: error?.response?.data?.message || "Gagal menambahkan komentar" })
|
||||
} finally {
|
||||
setLoadingSend(false);
|
||||
}
|
||||
@@ -216,20 +166,11 @@ export default function DiscussionDetail() {
|
||||
try {
|
||||
setLoadingSend(true);
|
||||
const hasil = await decryptToken(String(token?.current));
|
||||
const response = await apiEditDiscussionCommentar({
|
||||
id: selectKomentar.id,
|
||||
data: { comment: selectKomentar.comment, user: hasil },
|
||||
});
|
||||
if (response.success) {
|
||||
updateTrigger()
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message })
|
||||
}
|
||||
} catch (error : any ) {
|
||||
const response = await apiEditDiscussionCommentar({ id: selectKomentar.id, data: { comment: selectKomentar.comment, user: hasil } });
|
||||
if (response.success) { updateTrigger() } else { Toast.show({ type: 'small', text1: response.message }) }
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal mengedit komentar"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
Toast.show({ type: 'small', text1: error?.response?.data?.message || "Gagal mengedit komentar" })
|
||||
} finally {
|
||||
setLoadingSend(false);
|
||||
handleViewEditKomentar()
|
||||
@@ -240,20 +181,11 @@ export default function DiscussionDetail() {
|
||||
try {
|
||||
setLoadingSend(true);
|
||||
const hasil = await decryptToken(String(token?.current));
|
||||
const response = await apiDeleteDiscussionCommentar({
|
||||
id: selectKomentar.id,
|
||||
data: { user: hasil },
|
||||
});
|
||||
if (response.success) {
|
||||
updateTrigger()
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message })
|
||||
}
|
||||
} catch (error : any ) {
|
||||
const response = await apiDeleteDiscussionCommentar({ id: selectKomentar.id, data: { user: hasil } });
|
||||
if (response.success) { updateTrigger() } else { Toast.show({ type: 'small', text1: response.message }) }
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal menghapus komentar"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
Toast.show({ type: 'small', text1: error?.response?.data?.message || "Gagal menghapus komentar" })
|
||||
} finally {
|
||||
setLoadingSend(false)
|
||||
setVisible(false)
|
||||
@@ -265,13 +197,11 @@ export default function DiscussionDetail() {
|
||||
setVisible(true)
|
||||
}
|
||||
|
||||
|
||||
function handleViewEditKomentar() {
|
||||
setVisible(false)
|
||||
setViewEdit(!viewEdit)
|
||||
}
|
||||
|
||||
|
||||
const handleRefresh = async () => {
|
||||
setRefreshing(true)
|
||||
handleLoad(false)
|
||||
@@ -280,27 +210,15 @@ export default function DiscussionDetail() {
|
||||
setRefreshing(false)
|
||||
};
|
||||
|
||||
const canWrite = data?.status != 2 && data?.isActive && ((entityUser.role != "user" && entityUser.role != "coadmin") || isMemberDivision)
|
||||
const isOpen = data?.status === 1
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack.Screen
|
||||
options={{
|
||||
// headerLeft: () => (
|
||||
// <ButtonBackHeader
|
||||
// onPress={() => {
|
||||
// router.back();
|
||||
// }}
|
||||
// />
|
||||
// ),
|
||||
headerTitle: "Diskusi",
|
||||
headerTitleAlign: "center",
|
||||
// headerRight: () =>
|
||||
// (entityUser.role != "user" && entityUser.role != "coadmin") || isAdminDivision || isCreator ?
|
||||
// <HeaderRightDiscussionDetail
|
||||
// id={detail}
|
||||
// status={data?.status}
|
||||
// isActive={data?.isActive}
|
||||
// /> : (<></>)
|
||||
// ,
|
||||
header: () => (
|
||||
<AppHeader
|
||||
title="Diskusi"
|
||||
@@ -308,257 +226,177 @@ export default function DiscussionDetail() {
|
||||
onPressLeft={() => router.back()}
|
||||
right={
|
||||
((entityUser.role != "user" && entityUser.role != "coadmin") || isAdminDivision || isCreator) ?
|
||||
<HeaderRightDiscussionDetail
|
||||
id={detail}
|
||||
status={data?.status}
|
||||
isActive={data?.isActive}
|
||||
/> : (<></>)
|
||||
<HeaderRightDiscussionDetail id={detail} status={data?.status} isActive={data?.isActive} /> : undefined
|
||||
}
|
||||
/>
|
||||
)
|
||||
}}
|
||||
/>
|
||||
<View style={{ flex: 1, backgroundColor: colors.background }}>
|
||||
<View style={[Styles.flex1, { backgroundColor: colors.background }]}>
|
||||
<ScrollView
|
||||
refreshControl={
|
||||
<RefreshControl
|
||||
refreshing={refreshing}
|
||||
onRefresh={handleRefresh}
|
||||
tintColor={colors.icon}
|
||||
/>
|
||||
}
|
||||
showsVerticalScrollIndicator={false}
|
||||
refreshControl={<RefreshControl refreshing={refreshing} onRefresh={handleRefresh} tintColor={colors.icon} />}
|
||||
>
|
||||
<View style={[Styles.p15, Styles.mb100]}>
|
||||
{
|
||||
loading ?
|
||||
<SkeletonContent />
|
||||
:
|
||||
<BorderBottomItem2
|
||||
dataFile={fileDiscussion}
|
||||
descEllipsize={false}
|
||||
bgColor="white"
|
||||
borderType="all"
|
||||
icon={
|
||||
<ImageUser
|
||||
src={`${ConstEnv.url_storage}/files/${data?.user_img}`}
|
||||
size="sm"
|
||||
/>
|
||||
}
|
||||
title={data?.username}
|
||||
subtitle={
|
||||
data?.isActive ? (
|
||||
data?.status == 1 ? (
|
||||
<LabelStatus category="success" text="BUKA" size="small" />
|
||||
) : (
|
||||
<LabelStatus category="error" text="TUTUP" size="small" />
|
||||
<View style={[Styles.p15]}>
|
||||
{loading ? (
|
||||
<SkeletonContent />
|
||||
) : (
|
||||
<BorderBottomItem2
|
||||
dataFile={fileDiscussion}
|
||||
descEllipsize={false}
|
||||
borderType="all"
|
||||
bgColor="white"
|
||||
icon={
|
||||
<ImageUser src={`${ConstEnv.url_storage}/files/${data?.user_img}`} size="sm" />
|
||||
}
|
||||
title={data?.username}
|
||||
titleShowAll={true}
|
||||
subtitle={
|
||||
<View style={[Styles.discussionStatusPill, {
|
||||
borderColor: !data?.isActive ? '#F59E0B' : isOpen ? '#10B981' : colors.dimmed + '80',
|
||||
}]}>
|
||||
<Text style={[Styles.discussionStatusText, {
|
||||
color: !data?.isActive ? '#F59E0B' : isOpen ? '#10B981' : colors.dimmed,
|
||||
}]}>
|
||||
{!data?.isActive ? 'Arsip' : isOpen ? 'Buka' : 'Tutup'}
|
||||
</Text>
|
||||
</View>
|
||||
}
|
||||
desc={data?.desc}
|
||||
leftBottomInfo={
|
||||
<View style={Styles.rowItemsCenter}>
|
||||
<Feather name="message-square" size={14} color={colors.dimmed} style={Styles.mr05} />
|
||||
<Text style={[Styles.textInformation, { color: colors.dimmed }]}>{dataComment.length} Komentar</Text>
|
||||
</View>
|
||||
}
|
||||
rightBottomInfo={<Text style={[Styles.textInformation, { color: colors.dimmed }]}>{data?.createdAt}</Text>}
|
||||
/>
|
||||
)}
|
||||
|
||||
<View style={Styles.mt10}>
|
||||
{loadingKomentar ? (
|
||||
arrSkeleton.map((_, i) => (
|
||||
<Skeleton key={i} width={100} widthType="percent" height={40} borderRadius={5} />
|
||||
))
|
||||
) : (
|
||||
dataComment.map((item, i) => (
|
||||
<Pressable
|
||||
key={i}
|
||||
onPress={() => {
|
||||
setDetailMore((prev: any) =>
|
||||
prev.includes(item.id) ? prev.filter((id: string) => id !== item.id) : [...prev, item.id]
|
||||
)
|
||||
) : (
|
||||
<LabelStatus category="secondary" text="ARSIP" size="small" />
|
||||
)
|
||||
}
|
||||
rightTopInfo={data?.createdAt}
|
||||
desc={data?.desc}
|
||||
leftBottomInfo={
|
||||
<View style={[Styles.rowItemsCenter]}>
|
||||
<Ionicons
|
||||
name="chatbox-ellipses-outline"
|
||||
size={18}
|
||||
color="grey"
|
||||
style={Styles.mr05}
|
||||
/>
|
||||
<Text style={[Styles.textInformation, { color: colors.dimmed }, Styles.mb05]} >
|
||||
{dataComment.length} Komentar
|
||||
}}
|
||||
onLongPress={() => {
|
||||
item.idUser == entities.id && data?.status != 2 && data?.isActive && handleMenuKomentar(item.id, item.comment)
|
||||
}}
|
||||
style={({ pressed }) => [
|
||||
Styles.discussionCommentCard,
|
||||
{ backgroundColor: pressed ? colors.icon + '10' : colors.card, borderColor: colors.icon + '20' }
|
||||
]}
|
||||
>
|
||||
<View style={Styles.flex1}>
|
||||
<View style={[Styles.rowSpaceBetween, Styles.itemsCenter, Styles.mb05]}>
|
||||
<View style={[Styles.rowItemsCenter, { gap: 8, flex: 1, marginRight: 8 }]}>
|
||||
<ImageUser src={`${ConstEnv.url_storage}/files/${item.img}`} size="xs" />
|
||||
<Text style={[Styles.textMediumSemiBold, { color: colors.text }]} numberOfLines={1}>
|
||||
{item.username}
|
||||
</Text>
|
||||
{item.isEdited && (
|
||||
<Text style={[Styles.discussionEditedText, { color: colors.dimmed }]}>diedit</Text>
|
||||
)}
|
||||
</View>
|
||||
<Text style={[Styles.discussionDateText, { color: colors.dimmed, flexShrink: 0 }]}>
|
||||
{item.createdAt}
|
||||
</Text>
|
||||
</View>
|
||||
<Text style={[Styles.textDefault, { color: colors.text }]} numberOfLines={detailMore.includes(item.id) ? 0 : 3}>
|
||||
{item.comment}
|
||||
</Text>
|
||||
</View>
|
||||
}
|
||||
/>
|
||||
}
|
||||
|
||||
<View style={[Styles.mt10]}>
|
||||
{
|
||||
loadingKomentar ?
|
||||
arrSkeleton.map((item, index) => (
|
||||
<Skeleton key={index} width={100} widthType="percent" height={40} borderRadius={5} />
|
||||
))
|
||||
:
|
||||
dataComment.map((item, index) => (
|
||||
<BorderBottomItem
|
||||
key={index}
|
||||
borderType="all"
|
||||
colorPress
|
||||
icon={
|
||||
<ImageUser
|
||||
src={`${ConstEnv.url_storage}/files/${item.img}`}
|
||||
size="xs"
|
||||
/>
|
||||
}
|
||||
title={item.username}
|
||||
rightTopInfo={item.createdAt}
|
||||
desc={item.comment}
|
||||
rightBottomInfo={item.isEdited ? "Edited" : ""}
|
||||
descEllipsize={detailMore.includes(item.id) ? false : true}
|
||||
bgColor="white"
|
||||
onPress={() => {
|
||||
setDetailMore((prev: any) => {
|
||||
if (prev.includes(item.id)) {
|
||||
return prev.filter((id: string) => id !== item.id)
|
||||
} else {
|
||||
return [...prev, item.id]
|
||||
}
|
||||
})
|
||||
}}
|
||||
onLongPress={() => {
|
||||
item.idUser == entities.id && data?.status != 2 && data?.isActive && handleMenuKomentar(item.id, item.comment)
|
||||
}}
|
||||
/>
|
||||
))
|
||||
}
|
||||
|
||||
</Pressable>
|
||||
))
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
</ScrollView>
|
||||
<KeyboardAvoidingView
|
||||
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
||||
keyboardVerticalOffset={headerHeight}
|
||||
>
|
||||
<View
|
||||
style={[
|
||||
Styles.contentItemCenter,
|
||||
Styles.w100,
|
||||
{ backgroundColor: colors.background },
|
||||
viewEdit && Styles.borderTop
|
||||
]}
|
||||
>
|
||||
{
|
||||
viewEdit ?
|
||||
<>
|
||||
<View style={[Styles.w90, Styles.rowSpaceBetween, Styles.pv05]}>
|
||||
<View style={[Styles.rowItemsCenter]}>
|
||||
<Feather name="edit-3" color={colors.text} size={22} style={[Styles.mh05]} />
|
||||
<Text style={[Styles.textMediumSemiBold]}>Edit Komentar</Text>
|
||||
</View>
|
||||
<Pressable onPress={() => handleViewEditKomentar()}>
|
||||
<MaterialIcons name="close" color={colors.text} size={22} />
|
||||
</Pressable>
|
||||
</View>
|
||||
<InputForm
|
||||
bg={colors.card}
|
||||
type="default"
|
||||
round
|
||||
multiline
|
||||
placeholder="Kirim Komentar"
|
||||
onChange={(val: string) => setSelectKomentar({ ...selectKomentar, comment: val })}
|
||||
value={selectKomentar.comment}
|
||||
itemRight={
|
||||
<Pressable
|
||||
onPress={() => {
|
||||
selectKomentar.comment != "" &&
|
||||
!regexOnlySpacesOrEnter.test(selectKomentar.comment) &&
|
||||
!loadingSend &&
|
||||
data?.status != 2 &&
|
||||
data?.isActive &&
|
||||
(((entityUser.role == "user" ||
|
||||
entityUser.role == "coadmin") &&
|
||||
isMemberDivision) ||
|
||||
entityUser.role == "admin" ||
|
||||
entityUser.role == "supadmin" ||
|
||||
entityUser.role == "developer" ||
|
||||
entityUser.role == "cosupadmin") &&
|
||||
handleEditKomentar();
|
||||
}}
|
||||
style={[
|
||||
Platform.OS == 'android' && Styles.mb12,
|
||||
]}
|
||||
>
|
||||
<MaterialIcons
|
||||
name="send"
|
||||
size={25}
|
||||
style={
|
||||
[selectKomentar.comment == "" || regexOnlySpacesOrEnter.test(selectKomentar.comment) || loadingSend || ((entityUser.role == "user" || entityUser.role == "coadmin") && !isMemberDivision)
|
||||
? { color: colors.dimmed }
|
||||
: { color: colors.tint },
|
||||
]
|
||||
}
|
||||
/>
|
||||
</Pressable>
|
||||
}
|
||||
/>
|
||||
</>
|
||||
:
|
||||
data?.status != 2 && data?.isActive && ((entityUser.role != "user" && entityUser.role != "coadmin") ||
|
||||
isMemberDivision)
|
||||
?
|
||||
<InputForm
|
||||
type="default"
|
||||
round
|
||||
multiline
|
||||
placeholder="Kirim Komentar"
|
||||
onChange={setKomentar}
|
||||
value={komentar}
|
||||
itemRight={
|
||||
<Pressable
|
||||
onPress={() => {
|
||||
komentar != "" &&
|
||||
!regexOnlySpacesOrEnter.test(komentar) &&
|
||||
!loadingSend &&
|
||||
data?.status != 2 &&
|
||||
data?.isActive &&
|
||||
(((entityUser.role == "user" ||
|
||||
entityUser.role == "coadmin") &&
|
||||
isMemberDivision) ||
|
||||
entityUser.role == "admin" ||
|
||||
entityUser.role == "supadmin" ||
|
||||
entityUser.role == "developer" ||
|
||||
entityUser.role == "cosupadmin") &&
|
||||
handleKomentar();
|
||||
}}
|
||||
style={[
|
||||
Platform.OS == 'android' && Styles.mb12,
|
||||
]}
|
||||
>
|
||||
<MaterialIcons
|
||||
name="send"
|
||||
size={25}
|
||||
style={
|
||||
[komentar == "" || regexOnlySpacesOrEnter.test(komentar) || loadingSend || ((entityUser.role == "user" || entityUser.role == "coadmin") && !isMemberDivision)
|
||||
? { color: colors.dimmed }
|
||||
: { color: colors.tint }
|
||||
]
|
||||
}
|
||||
/>
|
||||
</Pressable>
|
||||
}
|
||||
/>
|
||||
:
|
||||
<View style={[Styles.pv20, { alignItems: 'center' }]}>
|
||||
<Text style={[Styles.textInformation, { color: colors.dimmed }]}>
|
||||
{
|
||||
data?.status == 2 ? "Diskusi telah ditutup" : data?.isActive == false ? "Diskusi telah diarsipkan" : "Hanya anggota divisi yang dapat memberikan komentar"
|
||||
}
|
||||
</Text>
|
||||
</View>
|
||||
}
|
||||
|
||||
<KeyboardAvoidingView behavior={Platform.OS === 'ios' ? 'padding' : undefined} keyboardVerticalOffset={headerHeight}>
|
||||
<View style={[Styles.contentItemCenter, Styles.w100, { backgroundColor: colors.background }, viewEdit && Styles.borderTop]}>
|
||||
{viewEdit ? (
|
||||
<>
|
||||
<View style={[Styles.w90, Styles.rowSpaceBetween, Styles.pv05]}>
|
||||
<View style={Styles.rowItemsCenter}>
|
||||
<Feather name="edit-3" color={colors.text} size={22} style={Styles.mh05} />
|
||||
<Text style={Styles.textMediumSemiBold}>Edit Komentar</Text>
|
||||
</View>
|
||||
<Pressable onPress={() => handleViewEditKomentar()}>
|
||||
<MaterialIcons name="close" color={colors.text} size={22} />
|
||||
</Pressable>
|
||||
</View>
|
||||
<InputForm
|
||||
bg={colors.card}
|
||||
type="default" round multiline
|
||||
placeholder="Kirim Komentar"
|
||||
onChange={(val: string) => setSelectKomentar({ ...selectKomentar, comment: val })}
|
||||
value={selectKomentar.comment}
|
||||
itemRight={
|
||||
<Pressable
|
||||
onPress={() => {
|
||||
selectKomentar.comment != "" && !regexOnlySpacesOrEnter.test(selectKomentar.comment) && !loadingSend && data?.status != 2 && data?.isActive
|
||||
&& (((entityUser.role == "user" || entityUser.role == "coadmin") && isMemberDivision) || entityUser.role == "admin" || entityUser.role == "supadmin" || entityUser.role == "developer" || entityUser.role == "cosupadmin")
|
||||
&& handleEditKomentar();
|
||||
}}
|
||||
style={[Platform.OS == 'android' && Styles.mb12]}
|
||||
>
|
||||
<MaterialIcons name="send" size={25}
|
||||
style={[
|
||||
selectKomentar.comment == "" || regexOnlySpacesOrEnter.test(selectKomentar.comment) || loadingSend || ((entityUser.role == "user" || entityUser.role == "coadmin") && !isMemberDivision)
|
||||
? { color: colors.dimmed } : { color: colors.tint },
|
||||
]}
|
||||
/>
|
||||
</Pressable>
|
||||
}
|
||||
/>
|
||||
</>
|
||||
) : canWrite ? (
|
||||
<InputForm
|
||||
type="default" round multiline
|
||||
placeholder="Kirim Komentar"
|
||||
onChange={setKomentar} value={komentar}
|
||||
itemRight={
|
||||
<Pressable
|
||||
onPress={() => {
|
||||
komentar != "" && !regexOnlySpacesOrEnter.test(komentar) && !loadingSend && data?.status != 2 && data?.isActive
|
||||
&& (((entityUser.role == "user" || entityUser.role == "coadmin") && isMemberDivision) || entityUser.role == "admin" || entityUser.role == "supadmin" || entityUser.role == "developer" || entityUser.role == "cosupadmin")
|
||||
&& handleKomentar();
|
||||
}}
|
||||
style={[Platform.OS == 'android' && Styles.mb12]}
|
||||
>
|
||||
<MaterialIcons name="send" size={25}
|
||||
style={[
|
||||
komentar == "" || regexOnlySpacesOrEnter.test(komentar) || loadingSend || ((entityUser.role == "user" || entityUser.role == "coadmin") && !isMemberDivision)
|
||||
? { color: colors.dimmed } : { color: colors.tint },
|
||||
]}
|
||||
/>
|
||||
</Pressable>
|
||||
}
|
||||
/>
|
||||
) : (
|
||||
<View style={[Styles.pv20, Styles.itemsCenter]}>
|
||||
<Text style={[Styles.textInformation, { color: colors.dimmed }]}>
|
||||
{data?.status == 2 ? "Diskusi telah ditutup" : data?.isActive == false ? "Diskusi telah diarsipkan" : "Hanya anggota divisi yang dapat memberikan komentar"}
|
||||
</Text>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
</KeyboardAvoidingView>
|
||||
</View>
|
||||
|
||||
<DrawerBottom animation="slide" isVisible={isVisible} setVisible={setVisible} title="Komentar">
|
||||
<View style={Styles.rowItemsCenter}>
|
||||
<MenuItemRow
|
||||
icon={<MaterialCommunityIcons name="pencil-outline" color={colors.text} size={25} />}
|
||||
title="Edit"
|
||||
onPress={() => { handleViewEditKomentar() }}
|
||||
/>
|
||||
<MenuItemRow
|
||||
icon={<Ionicons name="trash-outline" color={colors.text} size={25} />}
|
||||
title="Hapus"
|
||||
onPress={() => {
|
||||
setVisible(false)
|
||||
setTimeout(() => {
|
||||
setShowDeleteModal(true)
|
||||
}, 600)
|
||||
}}
|
||||
/>
|
||||
<MenuItemRow icon={<MaterialCommunityIcons name="pencil-outline" color={colors.text} size={25} />} title="Edit" onPress={() => handleViewEditKomentar()} />
|
||||
<MenuItemRow icon={<MaterialIcons name="delete-outline" color={colors.text} size={25} />} title="Hapus" onPress={() => { setVisible(false); setTimeout(() => setShowDeleteModal(true), 600) }} />
|
||||
</View>
|
||||
</DrawerBottom>
|
||||
|
||||
@@ -566,10 +404,7 @@ export default function DiscussionDetail() {
|
||||
visible={showDeleteModal}
|
||||
title="Konfirmasi"
|
||||
message="Apakah anda yakin ingin menghapus komentar?"
|
||||
onConfirm={() => {
|
||||
setShowDeleteModal(false)
|
||||
handleDeleteKomentar()
|
||||
}}
|
||||
onConfirm={() => { setShowDeleteModal(false); handleDeleteKomentar() }}
|
||||
onCancel={() => setShowDeleteModal(false)}
|
||||
confirmText="Hapus"
|
||||
cancelText="Batal"
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
import BorderBottomItem from "@/components/borderBottomItem";
|
||||
import GuideOverlay from "@/components/GuideOverlay";
|
||||
import ButtonTab from "@/components/buttonTab";
|
||||
import ImageUser from "@/components/imageNew";
|
||||
import InputSearch from "@/components/inputSearch";
|
||||
import LabelStatus from "@/components/labelStatus";
|
||||
import SkeletonContent from "@/components/skeletonContent";
|
||||
import Text from "@/components/Text";
|
||||
import WrapTab from "@/components/wrapTab";
|
||||
import { ConstEnv } from "@/constants/ConstEnv";
|
||||
import Styles from "@/constants/Styles";
|
||||
import { apiGetDiscussion, apiGetDivisionOneFeature } from "@/lib/api";
|
||||
import { GUIDE_DIVISION_DISCUSSION } from "@/lib/guideSteps";
|
||||
import { useGuide } from "@/lib/useGuide";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
import { AntDesign, Feather, Ionicons } from "@expo/vector-icons";
|
||||
import { AntDesign, Feather } from "@expo/vector-icons";
|
||||
import { router, useLocalSearchParams } from "expo-router";
|
||||
import { useEffect, useState } from "react";
|
||||
import { RefreshControl, View, VirtualizedList } from "react-native";
|
||||
import { FlatList, Pressable, RefreshControl, View } from "react-native";
|
||||
import { useSelector } from "react-redux";
|
||||
|
||||
|
||||
type Props = {
|
||||
id: string,
|
||||
title: string,
|
||||
@@ -30,7 +30,6 @@ type Props = {
|
||||
isActive: boolean
|
||||
}
|
||||
|
||||
|
||||
export default function DiscussionDivision() {
|
||||
const { colors } = useTheme();
|
||||
const { id, active } = useLocalSearchParams<{ id: string, active?: string }>()
|
||||
@@ -47,21 +46,13 @@ export default function DiscussionDivision() {
|
||||
const [isMemberDivision, setIsMemberDivision] = useState(false)
|
||||
const [isAdminDivision, setIsAdminDivision] = useState(false)
|
||||
const entityUser = useSelector((state: any) => state.user)
|
||||
const { visible: guideVisible, dismiss: dismissGuide } = useGuide('division-discussion')
|
||||
|
||||
async function handleCheckMember() {
|
||||
try {
|
||||
const hasil = await decryptToken(String(token?.current));
|
||||
const response = await apiGetDivisionOneFeature({
|
||||
id,
|
||||
user: hasil,
|
||||
cat: "check-member",
|
||||
});
|
||||
|
||||
const response2 = await apiGetDivisionOneFeature({
|
||||
id,
|
||||
user: hasil,
|
||||
cat: "check-admin",
|
||||
});
|
||||
const response = await apiGetDivisionOneFeature({ id, user: hasil, cat: "check-member" });
|
||||
const response2 = await apiGetDivisionOneFeature({ id, user: hasil, cat: "check-admin" });
|
||||
setIsMemberDivision(response.data);
|
||||
setIsAdminDivision(response2.data);
|
||||
} catch (error) {
|
||||
@@ -80,8 +71,6 @@ export default function DiscussionDivision() {
|
||||
setData(response.data)
|
||||
} else if (thisPage > 1 && response.data.length > 0) {
|
||||
setData([...data, ...response.data])
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
@@ -91,26 +80,15 @@ export default function DiscussionDivision() {
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
handleLoad(false, 1)
|
||||
}, [update.data])
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
handleLoad(true, 1)
|
||||
}, [status, search])
|
||||
useEffect(() => { handleLoad(false, 1) }, [update.data])
|
||||
useEffect(() => { handleLoad(true, 1) }, [status, search])
|
||||
useEffect(() => { handleCheckMember() }, [])
|
||||
|
||||
const loadMoreData = () => {
|
||||
if (waiting) return
|
||||
setTimeout(() => {
|
||||
handleLoad(false, page + 1)
|
||||
}, 1000);
|
||||
setTimeout(() => { handleLoad(false, page + 1) }, 1000);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
handleCheckMember()
|
||||
}, [])
|
||||
|
||||
const handleRefresh = async () => {
|
||||
setRefreshing(true)
|
||||
handleLoad(false, 1)
|
||||
@@ -118,100 +96,102 @@ export default function DiscussionDivision() {
|
||||
setRefreshing(false)
|
||||
};
|
||||
|
||||
const getItem = (_data: unknown, index: number): Props => ({
|
||||
id: data[index].id,
|
||||
title: data[index].title,
|
||||
desc: data[index].desc,
|
||||
status: data[index].status,
|
||||
user_name: data[index].user_name,
|
||||
img: data[index].img,
|
||||
total_komentar: data[index].total_komentar,
|
||||
createdAt: data[index].createdAt,
|
||||
isActive: data[index].isActive,
|
||||
})
|
||||
const isOpen = (item: Props) => item.status === 1
|
||||
|
||||
return (
|
||||
<View style={[Styles.p15, { flex: 1, backgroundColor: colors.background }]}>
|
||||
{
|
||||
((entityUser.role != "user" && entityUser.role != "coadmin") || isAdminDivision) &&
|
||||
<View>
|
||||
<View style={[Styles.flex1, { backgroundColor: colors.background }]}>
|
||||
<GuideOverlay visible={guideVisible} steps={GUIDE_DIVISION_DISCUSSION} onDismiss={dismissGuide} />
|
||||
{((entityUser.role != "user" && entityUser.role != "coadmin") || isAdminDivision) && (
|
||||
<View style={[Styles.ph15, { paddingTop: 12 }]}>
|
||||
<WrapTab>
|
||||
<ButtonTab
|
||||
active={status == "false" ? "false" : "true"}
|
||||
value="true"
|
||||
onPress={() => { setStatus("true") }}
|
||||
onPress={() => setStatus("true")}
|
||||
label="Aktif"
|
||||
icon={<Feather name="check-circle" color={status == "false" ? colors.dimmed : 'white'} size={20} />}
|
||||
n={2} />
|
||||
n={2}
|
||||
/>
|
||||
<ButtonTab
|
||||
active={status == "false" ? "false" : "true"}
|
||||
value="false"
|
||||
onPress={() => { setStatus("false") }}
|
||||
onPress={() => setStatus("false")}
|
||||
label="Arsip"
|
||||
icon={<AntDesign name="closecircleo" color={status == "true" ? colors.dimmed : 'white'} size={20} />}
|
||||
n={2} />
|
||||
n={2}
|
||||
/>
|
||||
</WrapTab>
|
||||
<InputSearch onChange={setSearch} />
|
||||
</View>
|
||||
}
|
||||
)}
|
||||
|
||||
<View style={[Styles.flex1, Styles.ph15, { paddingTop: 8 }]}>
|
||||
{loading ? (
|
||||
arrSkeleton.map((_, i) => <SkeletonContent key={i} />)
|
||||
) : data.length === 0 ? (
|
||||
<View style={[Styles.contentItemCenter, Styles.mt30]}>
|
||||
<Feather name="message-circle" size={42} color={colors.icon + '40'} />
|
||||
<Text style={[Styles.mt10, { color: colors.dimmed, fontSize: 14 }]}>
|
||||
Tidak ada diskusi
|
||||
</Text>
|
||||
</View>
|
||||
) : (
|
||||
<FlatList
|
||||
data={data}
|
||||
keyExtractor={(_, i) => String(i)}
|
||||
showsVerticalScrollIndicator={false}
|
||||
onEndReached={loadMoreData}
|
||||
onEndReachedThreshold={0.5}
|
||||
refreshControl={
|
||||
<RefreshControl refreshing={refreshing} onRefresh={handleRefresh} tintColor={colors.icon} />
|
||||
}
|
||||
ItemSeparatorComponent={() => <View style={Styles.discussionSeparator} />}
|
||||
renderItem={({ item }: { item: Props }) => (
|
||||
<Pressable
|
||||
onPress={() => router.push(`./discussion/${item.id}`)}
|
||||
style={({ pressed }) => [
|
||||
Styles.discussionCard,
|
||||
{ backgroundColor: pressed ? colors.icon + '10' : colors.card, borderColor: colors.icon + '20' }
|
||||
]}
|
||||
>
|
||||
<View style={[Styles.rowItemsCenter, Styles.mb08]}>
|
||||
<ImageUser src={`${ConstEnv.url_storage}/files/${item.img}`} size="xs" />
|
||||
<View style={[Styles.flex1, { marginLeft: 10 }]}>
|
||||
<Text style={[Styles.textDefaultSemiBold, { color: colors.text }]} numberOfLines={1}>
|
||||
{item.user_name}
|
||||
</Text>
|
||||
{status === "true" && (
|
||||
<View style={[Styles.discussionStatusPill, { borderColor: isOpen(item) ? '#10B981' : colors.dimmed + '80' }]}>
|
||||
<Text style={[Styles.discussionStatusText, { color: isOpen(item) ? '#10B981' : colors.dimmed }]}>
|
||||
{isOpen(item) ? 'Buka' : 'Tutup'}
|
||||
</Text>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View style={[{ flex: 2 }, Styles.mt05]}>
|
||||
{
|
||||
loading ?
|
||||
arrSkeleton.map((item: any, i: number) => {
|
||||
return (
|
||||
<SkeletonContent key={i} />
|
||||
)
|
||||
})
|
||||
:
|
||||
data.length > 0 ?
|
||||
<VirtualizedList
|
||||
data={data}
|
||||
getItemCount={() => data.length}
|
||||
getItem={getItem}
|
||||
renderItem={({ item, index }: { item: Props, index: number }) => {
|
||||
return (
|
||||
<BorderBottomItem
|
||||
key={index}
|
||||
onPress={() => { router.push(`./discussion/${item.id}`) }}
|
||||
borderType="bottom"
|
||||
icon={
|
||||
<ImageUser src={`${ConstEnv.url_storage}/files/${item.img}`} size="xs" />
|
||||
}
|
||||
title={item.user_name}
|
||||
subtitle={
|
||||
status == "true" ? item.status == 1 ? <LabelStatus category='success' text='BUKA' size="small" /> : <LabelStatus category='error' text='TUTUP' size="small" /> : <></>
|
||||
}
|
||||
rightTopInfo={item.createdAt}
|
||||
desc={item.desc}
|
||||
leftBottomInfo={
|
||||
<View style={[Styles.rowItemsCenter]}>
|
||||
<Ionicons name="chatbox-ellipses-outline" size={18} color={colors.dimmed} style={Styles.mr05} />
|
||||
<Text style={[Styles.textInformation, { color: colors.dimmed }, Styles.mb05]}>Diskusikan</Text>
|
||||
</View>
|
||||
}
|
||||
rightBottomInfo={item.total_komentar + ' Komentar'}
|
||||
bgColor="transparent"
|
||||
/>
|
||||
)
|
||||
}}
|
||||
keyExtractor={(item, index) => String(index)}
|
||||
onEndReached={loadMoreData}
|
||||
onEndReachedThreshold={0.5}
|
||||
showsVerticalScrollIndicator={false}
|
||||
refreshControl={
|
||||
<RefreshControl
|
||||
refreshing={refreshing}
|
||||
onRefresh={handleRefresh}
|
||||
tintColor={colors.icon}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
:
|
||||
(<Text style={[Styles.textDefault, Styles.mv10, { textAlign: "center", color: colors.dimmed }]}>Tidak ada diskusi</Text>)
|
||||
}
|
||||
{item.desc ? (
|
||||
<Text style={[Styles.textMediumNormal, Styles.discussionCardIndent, { color: colors.dimmed, marginBottom: 10 }]} numberOfLines={2}>
|
||||
{item.desc}
|
||||
</Text>
|
||||
) : null}
|
||||
|
||||
<View style={[Styles.rowItemsCenter, Styles.rowSpaceBetween, Styles.discussionCardIndent]}>
|
||||
<View style={Styles.rowItemsCenter}>
|
||||
<Feather name="message-square" size={14} color={colors.dimmed} />
|
||||
<Text style={[Styles.discussionCommentText, { color: colors.dimmed }]}>
|
||||
{item.total_komentar} Komentar
|
||||
</Text>
|
||||
</View>
|
||||
<Text style={[Styles.discussionDateText, { color: colors.dimmed }]}>
|
||||
{item.createdAt}
|
||||
</Text>
|
||||
</View>
|
||||
</Pressable>
|
||||
)}
|
||||
/>
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import GuideOverlay from "@/components/GuideOverlay";
|
||||
import ModalConfirmation from "@/components/ModalConfirmation";
|
||||
import AppHeader from "@/components/AppHeader";
|
||||
import { ButtonHeader } from "@/components/buttonHeader";
|
||||
@@ -22,6 +23,8 @@ import {
|
||||
apiShareDocument,
|
||||
} from "@/lib/api";
|
||||
import { setUpdateDokumen } from "@/lib/dokumenUpdate";
|
||||
import { GUIDE_DIVISION_DOCUMENT } from "@/lib/guideSteps";
|
||||
import { useGuide } from "@/lib/useGuide";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
import {
|
||||
@@ -90,6 +93,7 @@ export default function DocumentDivision() {
|
||||
const [isMemberDivision, setIsMemberDivision] = useState(false)
|
||||
const entityUser = useSelector((state: any) => state.user)
|
||||
const [showDeleteModal, setShowDeleteModal] = useState(false)
|
||||
const { visible: guideVisible, dismiss: dismissGuide } = useGuide('division-document')
|
||||
const [bodyRename, setBodyRename] = useState({
|
||||
id: "",
|
||||
name: "",
|
||||
@@ -415,6 +419,7 @@ export default function DocumentDivision() {
|
||||
)
|
||||
}}
|
||||
/>
|
||||
<GuideOverlay visible={guideVisible} steps={GUIDE_DIVISION_DOCUMENT} onDismiss={dismissGuide} />
|
||||
<ModalLoading isVisible={loadingOpen} setVisible={setLoadingOpen} />
|
||||
<ScrollView
|
||||
refreshControl={
|
||||
|
||||
@@ -206,6 +206,8 @@ export default function TaskDivisionAddTask() {
|
||||
day_label: { color: colors.text },
|
||||
time_label: { color: colors.text },
|
||||
weekday_label: { color: colors.text },
|
||||
button_next_image: { tintColor: colors.text },
|
||||
button_prev_image: { tintColor: colors.text },
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
@@ -238,7 +240,7 @@ export default function TaskDivisionAddTask() {
|
||||
>
|
||||
<Text style={[dsbButton ? Styles.cGray : Styles.cWhite]}>Detail</Text>
|
||||
</Pressable> */}
|
||||
<ButtonSelect value="Detail" onPress={() => { setModalDetail(true) }} />
|
||||
<ButtonSelect value="Detail" onPress={() => { setModalDetail(true) }} disabled={from == "" || to == ""} />
|
||||
</View>
|
||||
<InputForm
|
||||
label="Judul Tugas"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import AppHeader from "@/components/AppHeader";
|
||||
import GuideOverlay from "@/components/GuideOverlay";
|
||||
import SectionCancel from "@/components/sectionCancel";
|
||||
import SectionProgress from "@/components/sectionProgress";
|
||||
import HeaderRightTaskDetail from "@/components/task/headerTaskDetail";
|
||||
@@ -9,6 +10,8 @@ import SectionReportTask from "@/components/task/sectionReportTask";
|
||||
import SectionTanggalTugasTask from "@/components/task/sectionTanggalTugasTask";
|
||||
import Styles from "@/constants/Styles";
|
||||
import { apiGetDivisionOneFeature, apiGetTaskOne } from "@/lib/api";
|
||||
import { GUIDE_PROJECT_DETAIL } from "@/lib/guideSteps";
|
||||
import { useGuide } from "@/lib/useGuide";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||
@@ -32,9 +35,11 @@ export default function DetailTaskDivision() {
|
||||
const [data, setData] = useState<Props>()
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [progress, setProgress] = useState(0)
|
||||
const [taskStats, setTaskStats] = useState<{ done: number, total: number } | undefined>()
|
||||
const update = useSelector((state: any) => state.taskUpdate)
|
||||
const [refreshing, setRefreshing] = useState(false)
|
||||
const [isMemberDivision, setIsMemberDivision] = useState(false);
|
||||
const { visible: guideVisible, dismiss: dismissGuide } = useGuide('division-task-detail')
|
||||
const [isAdminDivision, setIsAdminDivision] = useState(false);
|
||||
const entityUser = useSelector((state: any) => state.user);
|
||||
|
||||
@@ -65,6 +70,17 @@ export default function DetailTaskDivision() {
|
||||
}, [])
|
||||
|
||||
|
||||
async function handleLoadTaskStats() {
|
||||
try {
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiGetTaskOne({ id: detail, user: hasil, cat: 'task' })
|
||||
const tasks: { status: number }[] = response.data
|
||||
setTaskStats({ done: tasks.filter(t => t.status === 1).length, total: tasks.length })
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleLoad(cat: 'data' | 'progress') {
|
||||
try {
|
||||
if (cat == 'data') setLoading(true)
|
||||
@@ -90,10 +106,15 @@ export default function DetailTaskDivision() {
|
||||
handleLoad('progress')
|
||||
}, [update.progress])
|
||||
|
||||
useEffect(() => {
|
||||
handleLoadTaskStats()
|
||||
}, [update.task])
|
||||
|
||||
const handleRefresh = async () => {
|
||||
setRefreshing(true)
|
||||
await handleLoad('data')
|
||||
await handleLoad('progress')
|
||||
await handleLoadTaskStats()
|
||||
await new Promise(resolve => setTimeout(resolve, 2000));
|
||||
setRefreshing(false)
|
||||
};
|
||||
@@ -122,6 +143,7 @@ export default function DetailTaskDivision() {
|
||||
)
|
||||
}}
|
||||
/>
|
||||
<GuideOverlay visible={guideVisible} steps={GUIDE_PROJECT_DETAIL} onDismiss={dismissGuide} />
|
||||
<ScrollView
|
||||
refreshControl={
|
||||
<RefreshControl
|
||||
@@ -135,9 +157,9 @@ export default function DetailTaskDivision() {
|
||||
{
|
||||
data?.reason != null && data?.reason != "" && <SectionCancel text={data?.reason} />
|
||||
}
|
||||
<SectionProgress text={`Kemajuan Kegiatan ${progress}%`} progress={progress} />
|
||||
<SectionProgress progress={progress} doneCount={taskStats?.done} totalCount={taskStats?.total} />
|
||||
<SectionReportTask refreshing={refreshing} />
|
||||
<SectionTanggalTugasTask refreshing={refreshing} isMemberDivision={isMemberDivision} />
|
||||
<SectionTanggalTugasTask refreshing={refreshing} isMemberDivision={isMemberDivision} isAdminDivision={isAdminDivision} status={data?.status} />
|
||||
<SectionFileTask refreshing={refreshing} isMemberDivision={isMemberDivision} />
|
||||
<SectionLinkTask refreshing={refreshing} isMemberDivision={isMemberDivision} />
|
||||
<SectionMemberTask refreshing={refreshing} isAdminDivision={isAdminDivision} />
|
||||
|
||||
@@ -0,0 +1,382 @@
|
||||
import AppHeader from "@/components/AppHeader";
|
||||
import BorderBottomItem from "@/components/borderBottomItem";
|
||||
import { ButtonForm } from "@/components/buttonForm";
|
||||
import ButtonSelect from "@/components/buttonSelect";
|
||||
import DrawerBottom from "@/components/drawerBottom";
|
||||
import ModalConfirmation from "@/components/ModalConfirmation";
|
||||
import ModalLoading from "@/components/modalLoading";
|
||||
import MenuItemRow from "@/components/menuItemRow";
|
||||
import Skeleton from "@/components/skeleton";
|
||||
import Text from "@/components/Text";
|
||||
import { ConstEnv } from "@/constants/ConstEnv";
|
||||
import Styles from "@/constants/Styles";
|
||||
import {
|
||||
apiAddTugasTaskFile,
|
||||
apiDeleteTugasTaskFile,
|
||||
apiGetTaskOne,
|
||||
apiGetTugasTaskFile,
|
||||
apiLinkTugasTaskFile,
|
||||
} from "@/lib/api";
|
||||
import { setUpdateTask } from "@/lib/taskUpdate";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons";
|
||||
import * as DocumentPicker from "expo-document-picker";
|
||||
import * as FileSystem from "expo-file-system";
|
||||
import { startActivityAsync } from "expo-intent-launcher";
|
||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||
import * as Sharing from "expo-sharing";
|
||||
import { useEffect, useState } from "react";
|
||||
import {
|
||||
ActivityIndicator,
|
||||
Alert,
|
||||
Platform,
|
||||
SafeAreaView,
|
||||
ScrollView,
|
||||
View,
|
||||
} from "react-native";
|
||||
import * as mime from "react-native-mime-types";
|
||||
import Toast from "react-native-toast-message";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
|
||||
type FileItem = {
|
||||
id: string; // DivisionProjectTaskFile.id
|
||||
idFile: string; // DivisionProjectFile.id
|
||||
name: string;
|
||||
extension: string;
|
||||
idStorage: string;
|
||||
};
|
||||
|
||||
type ProjectFile = {
|
||||
id: string;
|
||||
name: string;
|
||||
extension: string;
|
||||
idStorage: string;
|
||||
};
|
||||
|
||||
export default function TugasFileScreen() {
|
||||
const { colors } = useTheme();
|
||||
const { id, detail, taskId, member: memberParam } = useLocalSearchParams<{
|
||||
id: string;
|
||||
detail: string;
|
||||
taskId: string;
|
||||
member: string;
|
||||
}>();
|
||||
const { token, decryptToken } = useAuthSession();
|
||||
const dispatch = useDispatch();
|
||||
const update = useSelector((state: any) => state.taskUpdate);
|
||||
const entityUser = useSelector((state: any) => state.user);
|
||||
const isMember = memberParam === "true";
|
||||
const canEdit = isMember || (entityUser.role !== "user" && entityUser.role !== "coadmin");
|
||||
|
||||
const [data, setData] = useState<FileItem[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [loadingOpen, setLoadingOpen] = useState(false);
|
||||
const [loadingUpload, setLoadingUpload] = useState(false);
|
||||
const [loadingLink, setLoadingLink] = useState(false);
|
||||
|
||||
const [selectFile, setSelectFile] = useState<FileItem | null>(null);
|
||||
const [isMenuModal, setMenuModal] = useState(false);
|
||||
const [showDeleteModal, setShowDeleteModal] = useState(false);
|
||||
|
||||
const [projectFiles, setProjectFiles] = useState<ProjectFile[]>([]);
|
||||
const [isPickerModal, setPickerModal] = useState(false);
|
||||
const [loadingProjectFiles, setLoadingProjectFiles] = useState(false);
|
||||
const [selectedProjectFiles, setSelectedProjectFiles] = useState<string[]>([]);
|
||||
|
||||
const arrSkeleton = Array.from({ length: 4 });
|
||||
|
||||
async function loadFiles() {
|
||||
try {
|
||||
setLoading(true);
|
||||
const hasil = await decryptToken(String(token?.current));
|
||||
const response = await apiGetTugasTaskFile({ user: hasil, id: taskId });
|
||||
setData(response.data ?? []);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}
|
||||
|
||||
async function loadProjectFiles() {
|
||||
try {
|
||||
setLoadingProjectFiles(true);
|
||||
const hasil = await decryptToken(String(token?.current));
|
||||
const response = await apiGetTaskOne({ id: detail, user: hasil, cat: "file" });
|
||||
setProjectFiles(response.data ?? []);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
setLoadingProjectFiles(false);
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
loadFiles();
|
||||
}, []);
|
||||
|
||||
const openFile = () => {
|
||||
setMenuModal(false);
|
||||
setLoadingOpen(true);
|
||||
const remoteUrl = ConstEnv.url_storage + "/files/" + selectFile?.idStorage;
|
||||
const fileName = selectFile?.name + "." + selectFile?.extension;
|
||||
const localPath = `${FileSystem.documentDirectory}/${fileName}`;
|
||||
const mimeType = mime.lookup(fileName);
|
||||
|
||||
FileSystem.downloadAsync(remoteUrl, localPath).then(async ({ uri }) => {
|
||||
const contentURL = await FileSystem.getContentUriAsync(uri);
|
||||
try {
|
||||
if (Platform.OS === "android") {
|
||||
await startActivityAsync("android.intent.action.VIEW", {
|
||||
data: contentURL,
|
||||
flags: 1,
|
||||
type: mimeType as string,
|
||||
});
|
||||
} else {
|
||||
Sharing.shareAsync(localPath);
|
||||
}
|
||||
} catch {
|
||||
Alert.alert("INFO", "Gagal membuka file, tidak ada aplikasi yang dapat membuka file ini");
|
||||
} finally {
|
||||
setLoadingOpen(false);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
async function handleDelete() {
|
||||
try {
|
||||
const hasil = await decryptToken(String(token?.current));
|
||||
const response = await apiDeleteTugasTaskFile({ user: hasil }, String(selectFile?.id));
|
||||
if (response.success) {
|
||||
Toast.show({ type: "small", text1: "Berhasil menghapus file" });
|
||||
dispatch(setUpdateTask({ ...update, task: !update.task }));
|
||||
loadFiles();
|
||||
} else {
|
||||
Toast.show({ type: "small", text1: response.message });
|
||||
}
|
||||
} catch (error: any) {
|
||||
const message = error?.response?.data?.message || "Gagal menghapus file";
|
||||
Toast.show({ type: "small", text1: message });
|
||||
} finally {
|
||||
setMenuModal(false);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleUpload() {
|
||||
const result = await DocumentPicker.getDocumentAsync({ type: ["*/*"], multiple: true });
|
||||
if (result.canceled) return;
|
||||
|
||||
try {
|
||||
setLoadingUpload(true);
|
||||
const hasil = await decryptToken(String(token?.current));
|
||||
const fd = new FormData();
|
||||
|
||||
for (let i = 0; i < result.assets.length; i++) {
|
||||
fd.append(`file${i}`, {
|
||||
uri: result.assets[i].uri,
|
||||
type: "application/octet-stream",
|
||||
name: result.assets[i].name,
|
||||
} as any);
|
||||
}
|
||||
fd.append("data", JSON.stringify({ user: hasil }));
|
||||
|
||||
const response = await apiAddTugasTaskFile({ data: fd, id: taskId });
|
||||
if (response.success) {
|
||||
Toast.show({ type: "small", text1: "Berhasil menambahkan file" });
|
||||
dispatch(setUpdateTask({ ...update, task: !update.task }));
|
||||
loadFiles();
|
||||
} else {
|
||||
Toast.show({ type: "small", text1: response.message });
|
||||
}
|
||||
} catch (error: any) {
|
||||
const message = error?.response?.data?.message || "Gagal menambahkan file";
|
||||
Toast.show({ type: "small", text1: message });
|
||||
} finally {
|
||||
setLoadingUpload(false);
|
||||
}
|
||||
}
|
||||
|
||||
function toggleProjectFileSelect(id: string) {
|
||||
setSelectedProjectFiles((prev) =>
|
||||
prev.includes(id) ? prev.filter((v) => v !== id) : [...prev, id]
|
||||
);
|
||||
}
|
||||
|
||||
async function handleLinkFiles() {
|
||||
if (selectedProjectFiles.length === 0) return;
|
||||
try {
|
||||
setLoadingLink(true);
|
||||
const hasil = await decryptToken(String(token?.current));
|
||||
for (const idFile of selectedProjectFiles) {
|
||||
await apiLinkTugasTaskFile({ user: hasil, idFile, id: taskId });
|
||||
}
|
||||
Toast.show({ type: "small", text1: "Berhasil menambahkan file" });
|
||||
dispatch(setUpdateTask({ ...update, task: !update.task }));
|
||||
setPickerModal(false);
|
||||
setSelectedProjectFiles([]);
|
||||
loadFiles();
|
||||
} catch (error: any) {
|
||||
const message = error?.response?.data?.message || "Gagal menambahkan file";
|
||||
Toast.show({ type: "small", text1: message });
|
||||
} finally {
|
||||
setLoadingLink(false);
|
||||
}
|
||||
}
|
||||
|
||||
const attachedFileIds = new Set(data.map((f) => f.idFile));
|
||||
|
||||
return (
|
||||
<SafeAreaView style={{ flex: 1, backgroundColor: colors.background }}>
|
||||
<Stack.Screen
|
||||
options={{
|
||||
header: () => (
|
||||
<AppHeader
|
||||
title="File Tugas"
|
||||
showBack={true}
|
||||
onPressLeft={() => router.back()}
|
||||
/>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
<ModalLoading isVisible={loadingOpen} setVisible={setLoadingOpen} />
|
||||
|
||||
<ScrollView>
|
||||
<View style={[Styles.p15, Styles.mb100]}>
|
||||
{canEdit && (
|
||||
<>
|
||||
<ButtonSelect
|
||||
value="Upload dari Perangkat"
|
||||
onPress={handleUpload}
|
||||
disabled={loadingUpload}
|
||||
/>
|
||||
<ButtonSelect
|
||||
value="Pilih dari File Proyek"
|
||||
onPress={() => {
|
||||
setSelectedProjectFiles([]);
|
||||
setPickerModal(true);
|
||||
loadProjectFiles();
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
|
||||
{loadingUpload && <ActivityIndicator size="small" style={Styles.mv05} />}
|
||||
|
||||
<View style={[Styles.mb15, Styles.mt10]}>
|
||||
<Text style={[Styles.textDefaultSemiBold, Styles.mv05]}>File Terlampir</Text>
|
||||
<View style={[Styles.wrapPaper, { backgroundColor: colors.card, borderColor: colors.background }]}>
|
||||
{loading ? (
|
||||
arrSkeleton.map((_, index) => (
|
||||
<Skeleton key={index} width={100} height={40} widthType="percent" borderRadius={10} />
|
||||
))
|
||||
) : data.length > 0 ? (
|
||||
data.map((item, index) => (
|
||||
<BorderBottomItem
|
||||
key={index}
|
||||
borderType="all"
|
||||
icon={<MaterialCommunityIcons name="file-outline" size={25} color={colors.text} />}
|
||||
title={item.name + "." + item.extension}
|
||||
titleWeight="normal"
|
||||
onPress={() => {
|
||||
setSelectFile(item);
|
||||
setMenuModal(true);
|
||||
}}
|
||||
/>
|
||||
))
|
||||
) : (
|
||||
<Text style={[Styles.textDefault, { textAlign: "center", color: colors.dimmed }]}>
|
||||
Tidak ada file
|
||||
</Text>
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
</ScrollView>
|
||||
|
||||
{/* Menu per file */}
|
||||
<DrawerBottom animation="slide" isVisible={isMenuModal} setVisible={setMenuModal} title="Menu">
|
||||
<View style={Styles.rowItemsCenter}>
|
||||
<MenuItemRow
|
||||
icon={<MaterialCommunityIcons name="file-eye" color={colors.text} size={25} />}
|
||||
title="Lihat / Share"
|
||||
onPress={openFile}
|
||||
/>
|
||||
{canEdit && (
|
||||
<MenuItemRow
|
||||
icon={<Ionicons name="trash-outline" color={colors.text} size={25} />}
|
||||
title="Hapus"
|
||||
onPress={() => {
|
||||
setMenuModal(false);
|
||||
setTimeout(() => setShowDeleteModal(true), 600);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</View>
|
||||
</DrawerBottom>
|
||||
|
||||
<ModalConfirmation
|
||||
visible={showDeleteModal}
|
||||
title="Konfirmasi"
|
||||
message="Apakah Anda yakin ingin menghapus file ini?"
|
||||
onConfirm={() => {
|
||||
setShowDeleteModal(false);
|
||||
handleDelete();
|
||||
}}
|
||||
onCancel={() => setShowDeleteModal(false)}
|
||||
confirmText="Hapus"
|
||||
cancelText="Batal"
|
||||
/>
|
||||
|
||||
{/* Picker file dari proyek */}
|
||||
<DrawerBottom
|
||||
animation="slide"
|
||||
isVisible={isPickerModal}
|
||||
setVisible={setPickerModal}
|
||||
title="Pilih File Proyek"
|
||||
height={60}
|
||||
>
|
||||
<ScrollView>
|
||||
{loadingProjectFiles ? (
|
||||
<ActivityIndicator size="small" />
|
||||
) : projectFiles.length > 0 ? (
|
||||
projectFiles.map((item, index) => {
|
||||
const isAttached = attachedFileIds.has(item.id);
|
||||
const isSelected = selectedProjectFiles.includes(item.id);
|
||||
return (
|
||||
<View key={index} style={isAttached ? { opacity: 0.4 } : undefined}>
|
||||
<BorderBottomItem
|
||||
borderType="bottom"
|
||||
icon={
|
||||
isAttached || isSelected ? (
|
||||
<Ionicons name="checkmark-circle" size={25} color={colors.primary} />
|
||||
) : (
|
||||
<MaterialCommunityIcons name="file-outline" size={25} color={colors.text} />
|
||||
)
|
||||
}
|
||||
title={item.name + "." + item.extension}
|
||||
titleWeight="normal"
|
||||
onPress={() => !isAttached && toggleProjectFileSelect(item.id)}
|
||||
bgColor="transparent"
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
})
|
||||
) : (
|
||||
<Text style={[Styles.textDefault, { textAlign: "center", color: colors.dimmed }]}>
|
||||
Tidak ada file tersedia
|
||||
</Text>
|
||||
)}
|
||||
</ScrollView>
|
||||
{projectFiles.length > 0 && (
|
||||
<View>
|
||||
<ButtonForm
|
||||
text={loadingLink ? "Menyimpan..." : `Tambahkan (${selectedProjectFiles.length})`}
|
||||
disabled={selectedProjectFiles.length === 0 || loadingLink}
|
||||
onPress={handleLinkFiles} />
|
||||
</View>
|
||||
)}
|
||||
</DrawerBottom>
|
||||
</SafeAreaView>
|
||||
);
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
import AppHeader from "@/components/AppHeader";
|
||||
import BorderBottomItem from "@/components/borderBottomItem";
|
||||
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
||||
import ButtonSelect from "@/components/buttonSelect";
|
||||
import DrawerBottom from "@/components/drawerBottom";
|
||||
import ImageUser from "@/components/imageNew";
|
||||
import { InputForm } from "@/components/inputForm";
|
||||
@@ -21,11 +19,31 @@ import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons";
|
||||
import * as DocumentPicker from "expo-document-picker";
|
||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||
import { useEffect, useState } from "react";
|
||||
import { SafeAreaView, ScrollView, View } from "react-native";
|
||||
import { Pressable, SafeAreaView, ScrollView, View } from "react-native";
|
||||
import Toast from "react-native-toast-message";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
|
||||
|
||||
function getFileIcon(ext: string): keyof typeof MaterialCommunityIcons.glyphMap {
|
||||
if (['jpg', 'jpeg', 'png', 'gif', 'webp', 'heic', 'heif'].includes(ext)) return 'image-outline'
|
||||
if (ext === 'pdf') return 'file-pdf-box'
|
||||
if (['mp4', 'mov', 'avi', 'mkv'].includes(ext)) return 'video-outline'
|
||||
if (['doc', 'docx'].includes(ext)) return 'file-word-outline'
|
||||
if (['xls', 'xlsx'].includes(ext)) return 'file-excel-outline'
|
||||
if (['zip', 'rar', '7z'].includes(ext)) return 'zip-box-outline'
|
||||
return 'file-outline'
|
||||
}
|
||||
|
||||
function getFileColor(ext: string): string {
|
||||
if (['jpg', 'jpeg', 'png', 'gif', 'webp', 'heic', 'heif'].includes(ext)) return '#339AF0'
|
||||
if (ext === 'pdf') return '#F03E3E'
|
||||
if (['mp4', 'mov', 'avi', 'mkv'].includes(ext)) return '#AE3EC9'
|
||||
if (['doc', 'docx'].includes(ext)) return '#1C7ED6'
|
||||
if (['xls', 'xlsx'].includes(ext)) return '#2F9E44'
|
||||
if (['zip', 'rar', '7z'].includes(ext)) return '#E8590C'
|
||||
return '#868E96'
|
||||
}
|
||||
|
||||
export default function CreateTaskDivision() {
|
||||
const { colors } = useTheme();
|
||||
const { id } = useLocalSearchParams();
|
||||
@@ -168,59 +186,131 @@ export default function CreateTaskDivision() {
|
||||
bg={colors.card}
|
||||
errorText="Judul Tugas tidak boleh kosong"
|
||||
/>
|
||||
<ButtonSelect value="Tambah Tanggal & Tugas" onPress={() => { router.push(`/division/${id}/task/create/task`); }} />
|
||||
<ButtonSelect value="Upload File" onPress={pickDocumentAsync} />
|
||||
<ButtonSelect value="Tambah Anggota" onPress={() => { router.push(`/division/${id}/task/create/member`); }} />
|
||||
<SectionListAddTask />
|
||||
{
|
||||
fileForm.length > 0 && (
|
||||
<View style={[Styles.mb15]}>
|
||||
<Text style={[Styles.textDefaultSemiBold, Styles.mv05]}>File</Text>
|
||||
<View style={[Styles.wrapPaper, { backgroundColor: colors.card, borderColor: colors.background }]}>
|
||||
{
|
||||
fileForm.map((item, index) => (
|
||||
<BorderBottomItem
|
||||
key={index}
|
||||
borderType="all"
|
||||
icon={<MaterialCommunityIcons name="file-outline" size={25} color={colors.text} />}
|
||||
title={item.name}
|
||||
titleWeight="normal"
|
||||
onPress={() => { setIndexDelFile(index); setModal(true) }}
|
||||
/>
|
||||
))
|
||||
}
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
{entitiesMember.length > 0 && (
|
||||
<View>
|
||||
<View style={[Styles.rowSpaceBetween, Styles.mv05]}>
|
||||
<Text>Anggota</Text>
|
||||
<Text>Total {entitiesMember.length} Anggota</Text>
|
||||
</View>
|
||||
|
||||
<View style={[Styles.borderAll, Styles.round05, Styles.p10, { backgroundColor: colors.card, borderColor: colors.background }]}>
|
||||
{entitiesMember.map(
|
||||
(item: { img: any; name: any }, index: any) => {
|
||||
return (
|
||||
<BorderBottomItem
|
||||
key={index}
|
||||
borderType="bottom"
|
||||
icon={
|
||||
<ImageUser
|
||||
src={`${ConstEnv.url_storage}/files/${item.img}`}
|
||||
size="sm"
|
||||
/>
|
||||
}
|
||||
title={item.name}
|
||||
/>
|
||||
);
|
||||
}
|
||||
{/* Tanggal & Tugas */}
|
||||
<View style={[
|
||||
Styles.wrapPaper, Styles.mb15, Styles.sectionCard,
|
||||
{ backgroundColor: colors.card, borderColor: colors.icon + '18' }
|
||||
]}>
|
||||
<Pressable
|
||||
onPress={() => router.push(`/division/${id}/task/create/task`)}
|
||||
style={[Styles.sectionActionRow, { marginBottom: taskCreate.length > 0 ? 12 : 0 }]}
|
||||
>
|
||||
<View style={[Styles.sectionIconBox, { backgroundColor: colors.tabActive + '18' }]}>
|
||||
<MaterialCommunityIcons name="calendar-check-outline" size={18} color={colors.tabActive} />
|
||||
</View>
|
||||
<View style={Styles.flex1}>
|
||||
<Text style={[Styles.textDefaultSemiBold, { color: colors.text }]}>Tanggal & Tugas</Text>
|
||||
{taskCreate.length === 0 && (
|
||||
<Text style={[Styles.textMediumNormal, { color: colors.dimmed }]}>Belum ada tugas ditambahkan</Text>
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
)}
|
||||
{taskCreate.length > 0 && (
|
||||
<View style={[Styles.sectionBadge, { backgroundColor: colors.tabActive + '18' }]}>
|
||||
<Text style={[Styles.textSmallSemiBold, { color: colors.tabActive }]}>{taskCreate.length} tugas</Text>
|
||||
</View>
|
||||
)}
|
||||
<MaterialCommunityIcons name="chevron-right" size={18} color={colors.dimmed} />
|
||||
</Pressable>
|
||||
{taskCreate.length > 0 && <SectionListAddTask showTitle={false} />}
|
||||
</View>
|
||||
|
||||
{/* File */}
|
||||
<View style={[
|
||||
Styles.wrapPaper, Styles.mb15, Styles.sectionCard,
|
||||
{ backgroundColor: colors.card, borderColor: colors.icon + '18' }
|
||||
]}>
|
||||
<Pressable
|
||||
onPress={pickDocumentAsync}
|
||||
style={[Styles.sectionActionRow, { marginBottom: fileForm.length > 0 ? 12 : 0 }]}
|
||||
>
|
||||
<View style={[Styles.sectionIconBox, { backgroundColor: colors.icon + '15' }]}>
|
||||
<MaterialCommunityIcons name="paperclip" size={18} color={colors.dimmed} />
|
||||
</View>
|
||||
<View style={Styles.flex1}>
|
||||
<Text style={[Styles.textDefaultSemiBold, { color: colors.text }]}>File</Text>
|
||||
{fileForm.length === 0 && (
|
||||
<Text style={[Styles.textMediumNormal, { color: colors.dimmed }]}>Opsional — ketuk untuk upload</Text>
|
||||
)}
|
||||
</View>
|
||||
{fileForm.length > 0 && (
|
||||
<View style={[Styles.sectionBadge, { backgroundColor: colors.dimmed + '18' }]}>
|
||||
<Text style={[Styles.textSmallSemiBold, { color: colors.dimmed }]}>{fileForm.length} file</Text>
|
||||
</View>
|
||||
)}
|
||||
<MaterialCommunityIcons name="chevron-right" size={18} color={colors.dimmed} />
|
||||
</Pressable>
|
||||
{fileForm.length > 0 && (
|
||||
<View style={Styles.fileGrid}>
|
||||
{fileForm.map((item, index) => {
|
||||
const ext = item.name.split('.').pop()?.toLowerCase() ?? ''
|
||||
const baseName = item.name.includes('.') ? item.name.split('.').slice(0, -1).join('.') : item.name
|
||||
const iconName = getFileIcon(ext)
|
||||
const iconColor = getFileColor(ext)
|
||||
return (
|
||||
<Pressable
|
||||
key={index}
|
||||
onPress={() => { setIndexDelFile(index); setModal(true) }}
|
||||
style={[Styles.fileCard, { backgroundColor: 'transparent', borderColor: colors.icon + '18' }]}
|
||||
>
|
||||
<View style={[Styles.sectionIconBox, { backgroundColor: iconColor + '20' }]}>
|
||||
<MaterialCommunityIcons name={iconName} size={18} color={iconColor} />
|
||||
</View>
|
||||
<View style={Styles.flex1}>
|
||||
<Text style={Styles.textDefault} numberOfLines={1}>{baseName}</Text>
|
||||
<Text style={[Styles.textSmallSemiBold, { color: colors.dimmed }]}>{ext.toUpperCase()}</Text>
|
||||
</View>
|
||||
</Pressable>
|
||||
)
|
||||
})}
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
|
||||
{/* Anggota */}
|
||||
<View style={[
|
||||
Styles.wrapPaper, Styles.mb15, Styles.sectionCard,
|
||||
{ backgroundColor: colors.card, borderColor: colors.icon + '18' }
|
||||
]}>
|
||||
<Pressable
|
||||
onPress={() => router.push(`/division/${id}/task/create/member`)}
|
||||
style={[Styles.sectionActionRow, { marginBottom: entitiesMember.length > 0 ? 12 : 0 }]}
|
||||
>
|
||||
<View style={[Styles.sectionIconBox, { backgroundColor: colors.tabActive + '18' }]}>
|
||||
<MaterialCommunityIcons name="account-group-outline" size={18} color={colors.tabActive} />
|
||||
</View>
|
||||
<View style={Styles.flex1}>
|
||||
<Text style={[Styles.textDefaultSemiBold, { color: colors.text }]}>Anggota</Text>
|
||||
{entitiesMember.length === 0 && (
|
||||
<Text style={[Styles.textMediumNormal, { color: colors.dimmed }]}>Belum ada anggota dipilih</Text>
|
||||
)}
|
||||
</View>
|
||||
{entitiesMember.length > 0 && (
|
||||
<View style={[Styles.sectionBadge, { backgroundColor: colors.tabActive + '18' }]}>
|
||||
<Text style={[Styles.textSmallSemiBold, { color: colors.tabActive }]}>{entitiesMember.length} orang</Text>
|
||||
</View>
|
||||
)}
|
||||
<MaterialCommunityIcons name="chevron-right" size={18} color={colors.dimmed} />
|
||||
</Pressable>
|
||||
{entitiesMember.length > 0 && (
|
||||
<View style={{ gap: 6 }}>
|
||||
{entitiesMember.map((item: { img: any; name: any; position?: string }, index: any) => (
|
||||
<View
|
||||
key={index}
|
||||
style={[Styles.listItemCard, { borderColor: colors.icon + '18' }]}
|
||||
>
|
||||
<ImageUser src={`${ConstEnv.url_storage}/files/${item.img}`} size="xs" />
|
||||
<Text style={[Styles.textDefault, Styles.flex1, { color: colors.text }]} numberOfLines={1}>{item.name}</Text>
|
||||
{item.position && (
|
||||
<View style={[Styles.positionBadge, { backgroundColor: colors.dimmed + '15' }]}>
|
||||
<Text style={[Styles.textSmallSemiBold, { color: colors.dimmed }]} numberOfLines={1}>{item.position}</Text>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
))}
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
|
||||
</View>
|
||||
</ScrollView>
|
||||
|
||||
@@ -177,6 +177,8 @@ export default function CreateTaskAddTugas() {
|
||||
day_label: { color: colors.text },
|
||||
time_label: { color: colors.text },
|
||||
weekday_label: { color: colors.text },
|
||||
button_next_image: { tintColor: colors.text },
|
||||
button_prev_image: { tintColor: colors.text },
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
@@ -209,7 +211,7 @@ export default function CreateTaskAddTugas() {
|
||||
>
|
||||
<Text style={[dsbButton ? Styles.cGray : Styles.cWhite]}>Detail</Text>
|
||||
</Pressable> */}
|
||||
<ButtonSelect value="Detail" onPress={() => { setModalDetail(true) }} />
|
||||
<ButtonSelect value="Detail" onPress={() => { setModalDetail(true) }} disabled={from == "" || to == ""} />
|
||||
</View>
|
||||
<InputForm
|
||||
label="Judul Tugas"
|
||||
|
||||
@@ -21,6 +21,7 @@ import { router, useLocalSearchParams } from "expo-router";
|
||||
import { useEffect, useState } from "react";
|
||||
import { Pressable, RefreshControl, ScrollView, View, VirtualizedList } from "react-native";
|
||||
import { useSelector } from "react-redux";
|
||||
import AsyncStorage from "@react-native-async-storage/async-storage";
|
||||
|
||||
type Props = {
|
||||
id: string;
|
||||
@@ -36,6 +37,18 @@ export default function ListTask() {
|
||||
const { id, status, year } = useLocalSearchParams<{ id: string; status: string; year: string }>()
|
||||
const [isList, setList] = useState(false)
|
||||
const { token, decryptToken } = useAuthSession()
|
||||
|
||||
useEffect(() => {
|
||||
AsyncStorage.getItem('division_view_mode').then((val) => {
|
||||
if (val !== null) setList(val === 'list')
|
||||
})
|
||||
}, [])
|
||||
|
||||
function toggleView() {
|
||||
const next = !isList
|
||||
setList(next)
|
||||
AsyncStorage.setItem('division_view_mode', next ? 'list' : 'grid')
|
||||
}
|
||||
const [data, setData] = useState<Props[]>([])
|
||||
const [search, setSearch] = useState("")
|
||||
const update = useSelector((state: any) => state.taskUpdate)
|
||||
@@ -172,13 +185,9 @@ export default function ListTask() {
|
||||
n={4}
|
||||
/>
|
||||
</ScrollView>
|
||||
<View style={[Styles.rowSpaceBetween]}>
|
||||
<View style={[Styles.rowSpaceBetween, { alignItems: 'center' }]}>
|
||||
<InputSearch width={68} onChange={setSearch} />
|
||||
<Pressable
|
||||
onPress={() => {
|
||||
setList(!isList);
|
||||
}}
|
||||
>
|
||||
<Pressable onPress={toggleView}>
|
||||
<MaterialCommunityIcons
|
||||
name={isList ? "format-list-bulleted" : "view-grid"}
|
||||
color={colors.text}
|
||||
@@ -219,9 +228,10 @@ export default function ListTask() {
|
||||
router.push(`./task/${item.id}`);
|
||||
}}
|
||||
borderType="bottom"
|
||||
bgColor="transparent"
|
||||
icon={
|
||||
<View style={[Styles.iconContent, ColorsStatus.lightGreen]}>
|
||||
<AntDesign name="areachart" size={25} color={"#384288"} />
|
||||
<View style={[Styles.iconContent]}>
|
||||
<AntDesign name="areachart" size={25} color={"black"} />
|
||||
</View>
|
||||
}
|
||||
title={item.title}
|
||||
|
||||
@@ -255,6 +255,8 @@ export default function UpdateProjectTaskDivision() {
|
||||
day_label: { color: colors.text },
|
||||
time_label: { color: colors.text },
|
||||
weekday_label: { color: colors.text },
|
||||
button_next_image: { tintColor: colors.text },
|
||||
button_prev_image: { tintColor: colors.text },
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
@@ -290,7 +292,7 @@ export default function UpdateProjectTaskDivision() {
|
||||
>
|
||||
<Text style={[dsbButton ? Styles.cGray : Styles.cWhite]}>Detail</Text>
|
||||
</Pressable> */}
|
||||
<ButtonSelect value="Detail" onPress={() => { setModalDetail(true) }} />
|
||||
<ButtonSelect value="Detail" onPress={() => { setModalDetail(true) }} disabled={from == "" || to == ""} />
|
||||
</View>
|
||||
<InputForm
|
||||
label="Judul Tugas"
|
||||
|
||||
@@ -17,8 +17,10 @@ import {
|
||||
Ionicons,
|
||||
MaterialCommunityIcons
|
||||
} from "@expo/vector-icons";
|
||||
import AsyncStorage from "@react-native-async-storage/async-storage";
|
||||
import { useInfiniteQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { router, useLocalSearchParams } from "expo-router";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { Pressable, RefreshControl, View, VirtualizedList } from "react-native";
|
||||
import { useSelector } from "react-redux";
|
||||
|
||||
@@ -36,27 +38,39 @@ export default function ListDivision() {
|
||||
cat?: string;
|
||||
}>();
|
||||
const [isList, setList] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
AsyncStorage.getItem('division_view_mode').then((val) => {
|
||||
if (val !== null) setList(val === 'list')
|
||||
})
|
||||
}, [])
|
||||
|
||||
function toggleView() {
|
||||
const next = !isList
|
||||
setList(next)
|
||||
AsyncStorage.setItem('division_view_mode', next ? 'list' : 'grid')
|
||||
}
|
||||
const entityUser = useSelector((state: any) => state.user)
|
||||
const { token, decryptToken } = useAuthSession()
|
||||
const { colors } = useTheme();
|
||||
const [search, setSearch] = useState("")
|
||||
const [nameGroup, setNameGroup] = useState("")
|
||||
const [data, setData] = useState<Props[]>([])
|
||||
// ... state same ...
|
||||
const queryClient = useQueryClient()
|
||||
const [status, setStatus] = useState<'true' | 'false'>(active == 'false' ? 'false' : 'true')
|
||||
const [category, setCategory] = useState<'divisi-saya' | 'semua'>(cat == 'semua' ? 'semua' : 'divisi-saya')
|
||||
const update = useSelector((state: any) => state.divisionUpdate)
|
||||
const arrSkeleton = Array.from({ length: 3 }, (_, index) => index)
|
||||
const [loading, setLoading] = useState(false)
|
||||
const [status, setStatus] = useState<'true' | 'false'>('true')
|
||||
const [category, setCategory] = useState<'divisi-saya' | 'semua'>('divisi-saya')
|
||||
const [page, setPage] = useState(1)
|
||||
const [waiting, setWaiting] = useState(false)
|
||||
const [refreshing, setRefreshing] = useState(false)
|
||||
|
||||
async function handleLoad(loading: boolean, thisPage: number) {
|
||||
try {
|
||||
setWaiting(true)
|
||||
setLoading(loading)
|
||||
setPage(thisPage)
|
||||
// TanStack Query for Divisions with Infinite Scroll
|
||||
const {
|
||||
data,
|
||||
fetchNextPage,
|
||||
hasNextPage,
|
||||
isFetchingNextPage,
|
||||
isLoading,
|
||||
refetch
|
||||
} = useInfiniteQuery({
|
||||
queryKey: ['divisions', { status, search, group, category }],
|
||||
queryFn: async ({ pageParam = 1 }) => {
|
||||
const hasil = await decryptToken(String(token?.current));
|
||||
const response = await apiGetDivision({
|
||||
user: hasil,
|
||||
@@ -64,54 +78,52 @@ export default function ListDivision() {
|
||||
search: search,
|
||||
group: String(group),
|
||||
kategori: category,
|
||||
page: thisPage
|
||||
page: pageParam
|
||||
});
|
||||
return response;
|
||||
},
|
||||
initialPageParam: 1,
|
||||
getNextPageParam: (lastPage, allPages) => {
|
||||
return lastPage.data.length > 0 ? allPages.length + 1 : undefined;
|
||||
},
|
||||
enabled: !!token?.current,
|
||||
staleTime: 0,
|
||||
})
|
||||
|
||||
if (response.success) {
|
||||
if (thisPage == 1) {
|
||||
setData(response.data);
|
||||
} else if (thisPage > 1 && response.data.length > 0) {
|
||||
setData([...data, ...response.data]);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
setNameGroup(response.filter.name);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
setLoading(false)
|
||||
setWaiting(false)
|
||||
}
|
||||
}
|
||||
|
||||
// Refetch when manual update state changes
|
||||
useEffect(() => {
|
||||
handleLoad(false, 1);
|
||||
}, [update]);
|
||||
refetch()
|
||||
}, [update, refetch])
|
||||
|
||||
useEffect(() => {
|
||||
handleLoad(true, 1);
|
||||
}, [status, search, group, category]);
|
||||
// Flatten pages into a single data array
|
||||
const flatData = useMemo(() => {
|
||||
return data?.pages.flatMap(page => page.data) || [];
|
||||
}, [data])
|
||||
|
||||
const loadMoreData = () => {
|
||||
if (waiting) return
|
||||
setTimeout(() => {
|
||||
handleLoad(false, page + 1)
|
||||
}, 1000);
|
||||
};
|
||||
// Get nameGroup from the first available page
|
||||
const nameGroup = useMemo(() => {
|
||||
return data?.pages[0]?.filter?.name || "";
|
||||
}, [data])
|
||||
|
||||
const handleRefresh = async () => {
|
||||
setRefreshing(true)
|
||||
handleLoad(false, 1)
|
||||
await new Promise(resolve => setTimeout(resolve, 2000));
|
||||
await queryClient.invalidateQueries({ queryKey: ['divisions'] })
|
||||
setRefreshing(false)
|
||||
};
|
||||
|
||||
const loadMoreData = () => {
|
||||
if (hasNextPage && !isFetchingNextPage) {
|
||||
fetchNextPage()
|
||||
}
|
||||
};
|
||||
|
||||
const arrSkeleton = [0, 1, 2]
|
||||
|
||||
const getItem = (_data: unknown, index: number): Props => ({
|
||||
id: data[index].id,
|
||||
name: data[index].name,
|
||||
desc: data[index].desc,
|
||||
jumlah_member: data[index].jumlah_member,
|
||||
id: flatData[index]?.id,
|
||||
name: flatData[index]?.name,
|
||||
desc: flatData[index]?.desc,
|
||||
jumlah_member: flatData[index]?.jumlah_member,
|
||||
})
|
||||
|
||||
|
||||
@@ -185,11 +197,7 @@ export default function ListDivision() {
|
||||
|
||||
<View style={[Styles.rowSpaceBetween, { alignItems: 'center' }]}>
|
||||
<InputSearch width={68} onChange={setSearch} />
|
||||
<Pressable
|
||||
onPress={() => {
|
||||
setList(!isList);
|
||||
}}
|
||||
>
|
||||
<Pressable onPress={toggleView}>
|
||||
<MaterialCommunityIcons
|
||||
name={isList ? "format-list-bulleted" : "view-grid"}
|
||||
color={colors.text}
|
||||
@@ -206,7 +214,7 @@ export default function ListDivision() {
|
||||
</View>
|
||||
<View style={[{ flex: 2 }, Styles.mt10]}>
|
||||
{
|
||||
loading ?
|
||||
isLoading ?
|
||||
isList ?
|
||||
arrSkeleton.map((item, index) => (
|
||||
<SkeletonTwoItem key={index} />
|
||||
@@ -216,7 +224,7 @@ export default function ListDivision() {
|
||||
<Skeleton key={index} width={100} height={180} widthType="percent" borderRadius={10} />
|
||||
))
|
||||
:
|
||||
data.length == 0 ? (
|
||||
flatData.length == 0 ? (
|
||||
<View style={[Styles.mt15]}>
|
||||
<Text style={[Styles.textDefault, { textAlign: 'center', color: colors.dimmed }]}>Tidak ada data</Text>
|
||||
</View>
|
||||
@@ -224,9 +232,9 @@ export default function ListDivision() {
|
||||
isList ? (
|
||||
<View style={[Styles.h100]}>
|
||||
<VirtualizedList
|
||||
data={data}
|
||||
data={flatData}
|
||||
style={[{ paddingBottom: 100 }]}
|
||||
getItemCount={() => data.length}
|
||||
getItemCount={() => flatData.length}
|
||||
getItem={getItem}
|
||||
renderItem={({ item, index }: { item: Props, index: number }) => {
|
||||
return (
|
||||
@@ -260,9 +268,9 @@ export default function ListDivision() {
|
||||
) : (
|
||||
<View style={[Styles.h100]}>
|
||||
<VirtualizedList
|
||||
data={data}
|
||||
data={flatData}
|
||||
style={[{ paddingBottom: 100 }]}
|
||||
getItemCount={() => data.length}
|
||||
getItemCount={() => flatData.length}
|
||||
getItem={getItem}
|
||||
renderItem={({ item, index }: { item: Props, index: number }) => {
|
||||
return (
|
||||
|
||||
@@ -23,13 +23,12 @@ export default function Feature() {
|
||||
}}
|
||||
/>
|
||||
<View style={[Styles.p15]}>
|
||||
<View style={[Styles.rowSpaceBetween, Styles.mb15]}>
|
||||
<View style={{ flexDirection: 'row', flexWrap: 'wrap', rowGap: 20 }}>
|
||||
<ButtonFiturMenu icon={<Feather name="users" size={30} color={colors.icon} />} text="Divisi" onPress={() => { router.push('/division?active=true') }} />
|
||||
<ButtonFiturMenu icon={<Feather name="bar-chart" size={30} color={colors.icon} />} text="Kegiatan" onPress={() => { router.push('/project?status=0') }} />
|
||||
<ButtonFiturMenu icon={<Ionicons name="megaphone-outline" size={30} color={colors.icon} />} text="Pengumuman" onPress={() => { router.push('/announcement') }} />
|
||||
<ButtonFiturMenu icon={<Ionicons name="chatbubbles-outline" size={30} color={colors.icon} />} text="Diskusi" onPress={() => { router.push('/discussion?active=true') }} />
|
||||
</View>
|
||||
<View style={[Styles.rowSpaceBetween, Styles.mb15, (entityUser.role == 'cosupadmin' ? Styles.w70 : entityUser.role == 'supadmin' || entityUser.role == 'developer' ? Styles.w100 : Styles.w40)]}>
|
||||
<ButtonFiturMenu icon={<Feather name="calendar" size={30} color={colors.icon} />} text="Kalender" onPress={() => { router.push('/village-calendar') }} />
|
||||
<ButtonFiturMenu icon={<MaterialCommunityIcons name="account-group-outline" size={30} color={colors.icon} />} text="Anggota" onPress={() => { router.push('/member') }} />
|
||||
<ButtonFiturMenu icon={<MaterialCommunityIcons name="account-tie-outline" size={30} color={colors.icon} />} text="Jabatan" onPress={() => { router.push('/position') }} />
|
||||
{
|
||||
@@ -39,7 +38,6 @@ export default function Feature() {
|
||||
(entityUser.role == "supadmin" || entityUser.role == "developer") &&
|
||||
<>
|
||||
<ButtonFiturMenu icon={<Ionicons name="bookmarks-outline" size={30} color={colors.icon} />} text="Lembaga Desa" onPress={() => { router.push('/group') }} />
|
||||
{/* <ButtonFiturMenu icon={<Ionicons name="color-palette-sharp" size={30} color={colors.icon} />} text="Tema" onPress={() => { }} /> */}
|
||||
<ButtonFiturMenu icon={<Ionicons name="images-outline" size={30} color={colors.icon} />} text="Banner" onPress={() => { router.push('/banner') }} />
|
||||
</>
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import GuideOverlay from "@/components/GuideOverlay";
|
||||
import ModalConfirmation from "@/components/ModalConfirmation";
|
||||
import BorderBottomItem from "@/components/borderBottomItem";
|
||||
import { ButtonForm } from "@/components/buttonForm";
|
||||
@@ -12,10 +13,13 @@ import WrapTab from "@/components/wrapTab";
|
||||
import Styles from "@/constants/Styles";
|
||||
import { apiDeleteGroup, apiEditGroup, apiGetGroup } from "@/lib/api";
|
||||
import { setUpdateGroup } from "@/lib/groupSlice";
|
||||
import { GUIDE_GROUP } from "@/lib/guideSteps";
|
||||
import { useGuide } from "@/lib/useGuide";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
import { AntDesign, Feather, Ionicons, MaterialCommunityIcons } from "@expo/vector-icons";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { RefreshControl, View, VirtualizedList } from "react-native";
|
||||
import Toast from "react-native-toast-message";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
@@ -31,17 +35,16 @@ export default function Index() {
|
||||
const { colors } = useTheme();
|
||||
const [isModal, setModal] = useState(false)
|
||||
const [isVisibleEdit, setVisibleEdit] = useState(false)
|
||||
const [data, setData] = useState<Props[]>([])
|
||||
const [search, setSearch] = useState('')
|
||||
const arrSkeleton = Array.from({ length: 5 }, (_, index) => index)
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [showDeleteModal, setShowDeleteModal] = useState(false)
|
||||
const [status, setStatus] = useState<'true' | 'false'>('true')
|
||||
const [loadingSubmit, setLoadingSubmit] = useState(false)
|
||||
const [idChoose, setIdChoose] = useState('')
|
||||
const [activeChoose, setActiveChoose] = useState(true)
|
||||
const [titleChoose, setTitleChoose] = useState('')
|
||||
const queryClient = useQueryClient()
|
||||
const [refreshing, setRefreshing] = useState(false)
|
||||
const { visible: guideVisible, dismiss: dismissGuide } = useGuide('group')
|
||||
|
||||
const dispatch = useDispatch()
|
||||
const update = useSelector((state: any) => state.groupUpdate)
|
||||
@@ -49,12 +52,38 @@ export default function Index() {
|
||||
title: false,
|
||||
});
|
||||
|
||||
// TanStack Query for Groups
|
||||
const {
|
||||
data: queryData,
|
||||
isLoading,
|
||||
refetch
|
||||
} = useQuery({
|
||||
queryKey: ['groups', { status, search }],
|
||||
queryFn: async () => {
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiGetGroup({
|
||||
user: hasil,
|
||||
active: status,
|
||||
search: search
|
||||
})
|
||||
return response;
|
||||
},
|
||||
enabled: !!token?.current,
|
||||
staleTime: 0,
|
||||
})
|
||||
|
||||
const data = useMemo(() => queryData?.data || [], [queryData])
|
||||
|
||||
useEffect(() => {
|
||||
refetch()
|
||||
}, [update, refetch])
|
||||
|
||||
async function handleEdit() {
|
||||
try {
|
||||
setLoadingSubmit(true)
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiEditGroup({ user: hasil, name: titleChoose }, idChoose)
|
||||
await queryClient.invalidateQueries({ queryKey: ['groups'] })
|
||||
dispatch(setUpdateGroup(!update))
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
@@ -71,6 +100,7 @@ export default function Index() {
|
||||
try {
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiDeleteGroup({ user: hasil, isActive: activeChoose }, idChoose)
|
||||
await queryClient.invalidateQueries({ queryKey: ['groups'] })
|
||||
dispatch(setUpdateGroup(!update))
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
@@ -80,32 +110,9 @@ export default function Index() {
|
||||
}
|
||||
}
|
||||
|
||||
async function handleLoad(loading: boolean) {
|
||||
try {
|
||||
setLoading(loading)
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiGetGroup({ user: hasil, active: status, search: search })
|
||||
setData(response.data)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
setLoading(false)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
handleLoad(false)
|
||||
}, [update])
|
||||
|
||||
useEffect(() => {
|
||||
handleLoad(true)
|
||||
}, [status, search])
|
||||
|
||||
const handleRefresh = async () => {
|
||||
setRefreshing(true)
|
||||
handleLoad(false)
|
||||
await new Promise(resolve => setTimeout(resolve, 2000));
|
||||
await queryClient.invalidateQueries({ queryKey: ['groups'] })
|
||||
setRefreshing(false)
|
||||
};
|
||||
|
||||
@@ -129,8 +136,11 @@ export default function Index() {
|
||||
|
||||
|
||||
|
||||
const arrSkeleton = [0, 1, 2, 3, 4]
|
||||
|
||||
return (
|
||||
<View style={[Styles.p15, { flex: 1, backgroundColor: colors.background }]}>
|
||||
<GuideOverlay visible={guideVisible} steps={GUIDE_GROUP} onDismiss={dismissGuide} />
|
||||
<View style={[Styles.mb10]}>
|
||||
<WrapTab>
|
||||
<ButtonTab
|
||||
@@ -152,7 +162,7 @@ export default function Index() {
|
||||
</View>
|
||||
<View style={[{ flex: 2 }, Styles.mt10]}>
|
||||
{
|
||||
loading ?
|
||||
isLoading ?
|
||||
arrSkeleton.map((item, index) => {
|
||||
return (
|
||||
<SkeletonTwoItem key={index} />
|
||||
|
||||
@@ -12,10 +12,11 @@ import { apiGetProfile } from "@/lib/api";
|
||||
import { setEntities } from "@/lib/entitiesSlice";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { LinearGradient } from "expo-linear-gradient";
|
||||
import { Stack } from "expo-router";
|
||||
import { useEffect, useState } from "react";
|
||||
import { Dimensions, Platform, RefreshControl, SafeAreaView, ScrollView, View } from "react-native";
|
||||
import { Alert, Dimensions, Platform, RefreshControl, SafeAreaView, ScrollView, View } from "react-native";
|
||||
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
|
||||
@@ -23,28 +24,66 @@ import { useDispatch, useSelector } from "react-redux";
|
||||
export default function Home() {
|
||||
const entities = useSelector((state: any) => state.entities)
|
||||
const dispatch = useDispatch()
|
||||
const queryClient = useQueryClient()
|
||||
const { token, decryptToken, signOut } = useAuthSession()
|
||||
const { colors } = useTheme();
|
||||
const insets = useSafeAreaInsets()
|
||||
const [refreshing, setRefreshing] = useState(false)
|
||||
|
||||
useEffect(() => {
|
||||
handleUserLogin()
|
||||
}, [dispatch]);
|
||||
const { data: profile, isError } = useQuery({
|
||||
queryKey: ['profile'],
|
||||
queryFn: async () => {
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const data = await apiGetProfile({ id: hasil })
|
||||
return data.data
|
||||
},
|
||||
enabled: !!token?.current,
|
||||
staleTime: 0, // Ensure it refetches every time the component mounts
|
||||
})
|
||||
|
||||
async function handleUserLogin() {
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
apiGetProfile({ id: hasil })
|
||||
.then((data) => dispatch(setEntities(data.data)))
|
||||
.catch((error) => {
|
||||
signOut()
|
||||
});
|
||||
}
|
||||
// Sync to Redux for global usage
|
||||
useEffect(() => {
|
||||
if (profile) {
|
||||
dispatch(setEntities(profile))
|
||||
}
|
||||
}, [profile, dispatch])
|
||||
|
||||
// Auto Sign Out if profile fetch fails (e.g. invalid/expired token)
|
||||
useEffect(() => {
|
||||
if (isError) {
|
||||
signOut()
|
||||
}
|
||||
}, [isError, signOut])
|
||||
|
||||
useEffect(() => {
|
||||
if (profile && profile.isActive === false) {
|
||||
Alert.alert(
|
||||
'Akun Dinonaktifkan',
|
||||
'Akun kamu telah dinonaktifkan. Silahkan hubungi admin untuk informasi lebih lanjut.',
|
||||
[{ text: 'OK', onPress: signOut }]
|
||||
)
|
||||
}
|
||||
}, [profile, signOut])
|
||||
|
||||
useEffect(() => {
|
||||
if (profile && profile.villageIsActive === false) {
|
||||
Alert.alert(
|
||||
'Desa Dinonaktifkan',
|
||||
'Desa kamu saat ini telah dinonaktifkan. Silahkan hubungi pengelola sistem untuk informasi lebih lanjut.',
|
||||
[{ text: 'OK', onPress: signOut }]
|
||||
)
|
||||
}
|
||||
}, [profile, signOut])
|
||||
|
||||
const handleRefresh = async () => {
|
||||
setRefreshing(true)
|
||||
handleUserLogin()
|
||||
await new Promise(resolve => setTimeout(resolve, 2000));
|
||||
// Invalidate all queries related to the home screen
|
||||
await queryClient.invalidateQueries({ queryKey: ['profile'] })
|
||||
await queryClient.invalidateQueries({ queryKey: ['banners'] })
|
||||
await queryClient.invalidateQueries({ queryKey: ['homeData'] })
|
||||
|
||||
// Artificial delay to show refresh indicator if sync is too fast
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
setRefreshing(false)
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import AppHeader from "@/components/AppHeader";
|
||||
import ImageUser from "@/components/imageNew";
|
||||
import ItemDetailMember from "@/components/itemDetailMember";
|
||||
import LabelStatus from "@/components/labelStatus";
|
||||
import HeaderRightMemberDetail from "@/components/member/headerMemberDetail";
|
||||
import Skeleton from "@/components/skeleton";
|
||||
@@ -11,6 +10,7 @@ import { valueRoleUser } from "@/constants/RoleUser";
|
||||
import Styles from "@/constants/Styles";
|
||||
import { apiGetProfile } from "@/lib/api";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
import { AntDesign, MaterialCommunityIcons, MaterialIcons } from "@expo/vector-icons";
|
||||
import { LinearGradient } from "expo-linear-gradient";
|
||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||
import React, { useEffect, useState } from "react";
|
||||
@@ -30,6 +30,7 @@ type Props = {
|
||||
group: string,
|
||||
img: string,
|
||||
isActive: boolean,
|
||||
isApprover: boolean,
|
||||
role: string
|
||||
}
|
||||
|
||||
@@ -89,7 +90,7 @@ export default function MemberDetail() {
|
||||
showBack={true}
|
||||
onPressLeft={() => router.back()}
|
||||
right={
|
||||
(entityUser.role != "user") && isEdit ? <HeaderRightMemberDetail active={data?.isActive} id={id} /> : <></>
|
||||
(entityUser.role != "user") && isEdit ? <HeaderRightMemberDetail active={data?.isActive} id={id} isApprover={data?.isApprover ?? false} /> : <></>
|
||||
}
|
||||
/>
|
||||
)
|
||||
@@ -109,51 +110,71 @@ export default function MemberDetail() {
|
||||
colors={[colors.header, colors.homeGradient]}
|
||||
style={[Styles.wrapHeadViewMember]}
|
||||
>
|
||||
{
|
||||
loading ?
|
||||
<>
|
||||
<Skeleton width={100} height={100} borderRadius={100} />
|
||||
<Skeleton width={200} height={10} borderRadius={5} />
|
||||
<Skeleton width={150} height={10} borderRadius={5} />
|
||||
</>
|
||||
:
|
||||
<>
|
||||
<Pressable onPress={() => setPreview(true)}>
|
||||
{loading ? (
|
||||
<>
|
||||
<Skeleton width={100} height={100} borderRadius={100} />
|
||||
<Skeleton width={200} height={10} borderRadius={5} />
|
||||
<Skeleton width={150} height={10} borderRadius={5} />
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Pressable onPress={() => setPreview(true)}>
|
||||
<View style={[Styles.memberAvatarRing]}>
|
||||
<ImageUser src={`${ConstEnv.url_storage}/files/${data?.img}`} size="lg" onError={setErrorImg} />
|
||||
</Pressable>
|
||||
<Text style={[Styles.textSubtitle, Styles.cWhite, Styles.mt10, Styles.textCenter]}>{data?.name}</Text>
|
||||
<Text style={[Styles.textMediumNormal, Styles.cWhite]}>{data?.role}</Text>
|
||||
</>
|
||||
|
||||
}
|
||||
</View>
|
||||
</Pressable>
|
||||
<Text style={[Styles.textSubtitle, Styles.cWhite, Styles.mt10, Styles.textCenter]}>{data?.name}</Text>
|
||||
<Text style={[Styles.textMediumNormal, Styles.cWhiteDimmed]}>{data?.role}</Text>
|
||||
<View style={[Styles.memberBadgeRow]}>
|
||||
{data?.isApprover && (
|
||||
<View style={[Styles.memberBadgeApprover]}>
|
||||
<Text style={[Styles.textSmallSemiBold, Styles.cWhite]}>APPROVER</Text>
|
||||
</View>
|
||||
)}
|
||||
<View style={[Styles.memberBadgePill, { backgroundColor: data?.isActive ? colors.success : colors.error }]}>
|
||||
<Text style={[Styles.textSmallSemiBold, Styles.cWhite]}>{data?.isActive ? 'AKTIF' : 'TIDAK AKTIF'}</Text>
|
||||
</View>
|
||||
</View>
|
||||
</>
|
||||
)}
|
||||
</LinearGradient>
|
||||
<View style={[Styles.p15]}>
|
||||
<View style={[Styles.rowSpaceBetween]}>
|
||||
<Text style={[Styles.textDefaultSemiBold, { color: colors.text }]}>Informasi</Text>
|
||||
<LabelStatus
|
||||
size="small"
|
||||
category={data?.isActive ? 'success' : 'error'}
|
||||
text={data?.isActive ? 'AKTIF' : 'TIDAK AKTIF'}
|
||||
/>
|
||||
</View>
|
||||
{
|
||||
loading ?
|
||||
arrSkeleton.map((item, index) => {
|
||||
return (
|
||||
<Skeleton key={index} width={100} widthType="percent" height={25} borderRadius={5} />
|
||||
)
|
||||
})
|
||||
:
|
||||
<>
|
||||
<ItemDetailMember category="nik" value={data?.nik} />
|
||||
<ItemDetailMember category="group" value={data?.group} />
|
||||
<ItemDetailMember category="position" value={data?.position} />
|
||||
<ItemDetailMember category="phone" value={`+62${data?.phone}`} />
|
||||
<ItemDetailMember category="email" value={data?.email} />
|
||||
<ItemDetailMember category="gender" value={data?.gender == "F" ? "Perempuan" : "Laki-Laki"} />
|
||||
</>
|
||||
}
|
||||
|
||||
<View style={[Styles.p15]}>
|
||||
<Text style={[Styles.textDefaultSemiBold, Styles.mb08, { color: colors.dimmed }]}>Informasi</Text>
|
||||
<View>
|
||||
{loading ? (
|
||||
arrSkeleton.map((_, index) => (
|
||||
<View key={index} style={[Styles.pv14, { borderBottomWidth: index < arrSkeleton.length - 1 ? 1 : 0, borderBottomColor: `${colors.dimmed}30` }]}>
|
||||
<Skeleton width={80} height={8} borderRadius={4} />
|
||||
<View style={[Styles.mt05]}>
|
||||
<Skeleton width={60} widthType="percent" height={10} borderRadius={4} />
|
||||
</View>
|
||||
</View>
|
||||
))
|
||||
) : (
|
||||
[
|
||||
{ icon: <MaterialCommunityIcons name="card-account-details" size={20} color={colors.icon} />, label: 'NIK', value: data?.nik },
|
||||
{ icon: <MaterialCommunityIcons name="office-building-outline" size={20} color={colors.icon} />, label: 'Lembaga Desa', value: data?.group },
|
||||
{ icon: <MaterialCommunityIcons name="account-tie" size={20} color={colors.icon} />, label: 'Jabatan', value: data?.position },
|
||||
{ icon: <MaterialIcons name="phone" size={20} color={colors.icon} />, label: 'No Telepon', value: `+62${data?.phone}` },
|
||||
{ icon: <MaterialIcons name="email" size={20} color={colors.icon} />, label: 'Email', value: data?.email },
|
||||
{ icon: <MaterialCommunityIcons name="gender-male-female" size={20} color={colors.icon} />, label: 'Jenis Kelamin', value: data?.gender == "F" ? "Perempuan" : "Laki-Laki" },
|
||||
].map((item, index, arr) => (
|
||||
<View
|
||||
key={index}
|
||||
style={[Styles.memberInfoRow, { borderBottomWidth: index < arr.length - 1 ? 1 : 0, borderBottomColor: `${colors.dimmed}30` }]}
|
||||
>
|
||||
<View style={[Styles.memberInfoIcon]}>
|
||||
{item.icon}
|
||||
</View>
|
||||
<View style={[Styles.memberInfoContent]}>
|
||||
<Text style={[Styles.textInformation, { color: colors.dimmed }]}>{item.label}</Text>
|
||||
<Text style={[Styles.textDefault, Styles.mt02, { color: colors.text }]} numberOfLines={1}>{item.value ?? '-'}</Text>
|
||||
</View>
|
||||
</View>
|
||||
))
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
</ScrollView>
|
||||
|
||||
|
||||
@@ -171,11 +171,9 @@ export default function EditMember() {
|
||||
}
|
||||
|
||||
function checkForm() {
|
||||
if (Object.values(error).some((v) => v == true) || Object.values(data).some((v) => v == "")) {
|
||||
setDisableBtn(true)
|
||||
} else {
|
||||
setDisableBtn(false)
|
||||
}
|
||||
const requiredFields: (keyof Props)[] = ["idPosition", "idUserRole", "nik", "name", "email", "phone", "gender"];
|
||||
const hasEmpty = requiredFields.some((key) => data[key] === "");
|
||||
setDisableBtn(Object.values(error).some((v) => v === true) || hasEmpty);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import GuideOverlay from "@/components/GuideOverlay";
|
||||
import BorderBottomItem from "@/components/borderBottomItem";
|
||||
import ButtonTab from "@/components/buttonTab";
|
||||
import ImageUser from "@/components/imageNew";
|
||||
@@ -9,11 +10,14 @@ import WrapTab from "@/components/wrapTab";
|
||||
import { ConstEnv } from "@/constants/ConstEnv";
|
||||
import Styles from "@/constants/Styles";
|
||||
import { apiGetUser } from "@/lib/api";
|
||||
import { GUIDE_MEMBER } from "@/lib/guideSteps";
|
||||
import { useGuide } from "@/lib/useGuide";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
import { AntDesign, Feather } from "@expo/vector-icons";
|
||||
import { useInfiniteQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { router, useLocalSearchParams } from "expo-router";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { RefreshControl, View, VirtualizedList } from "react-native";
|
||||
import { useSelector } from "react-redux";
|
||||
|
||||
@@ -37,77 +41,87 @@ export default function Index() {
|
||||
const entityUser = useSelector((state: any) => state.user)
|
||||
const { colors } = useTheme();
|
||||
const [search, setSearch] = useState('')
|
||||
const [nameGroup, setNameGroup] = useState('')
|
||||
const [data, setData] = useState<Props[]>([])
|
||||
const update = useSelector((state: any) => state.memberUpdate)
|
||||
const arrSkeleton = Array.from({ length: 5 }, (_, index) => index)
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [status, setStatus] = useState<'true' | 'false'>('true')
|
||||
const [page, setPage] = useState(1)
|
||||
const [waiting, setWaiting] = useState(false)
|
||||
const queryClient = useQueryClient()
|
||||
const [status, setStatus] = useState<'true' | 'false'>(active == 'false' ? 'false' : 'true')
|
||||
const [refreshing, setRefreshing] = useState(false)
|
||||
const { visible: guideVisible, dismiss: dismissGuide } = useGuide('member')
|
||||
|
||||
async function handleLoad(loading: boolean, thisPage: number) {
|
||||
try {
|
||||
setWaiting(true)
|
||||
setLoading(loading)
|
||||
setPage(thisPage)
|
||||
// TanStack Query for Members with Infinite Scroll
|
||||
const {
|
||||
data,
|
||||
fetchNextPage,
|
||||
hasNextPage,
|
||||
isFetchingNextPage,
|
||||
isLoading,
|
||||
refetch
|
||||
} = useInfiniteQuery({
|
||||
queryKey: ['members', { status, search, group }],
|
||||
queryFn: async ({ pageParam = 1 }) => {
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiGetUser({ user: hasil, active: status, search, group: String(group), page: thisPage })
|
||||
if (thisPage == 1) {
|
||||
setData(response.data)
|
||||
} else if (thisPage > 1 && response.data.length > 0) {
|
||||
setData([...data, ...response.data])
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
setNameGroup(response.filter.name)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
setLoading(false)
|
||||
setWaiting(false)
|
||||
}
|
||||
}
|
||||
const response = await apiGetUser({
|
||||
user: hasil,
|
||||
active: status,
|
||||
search,
|
||||
group: String(group),
|
||||
page: pageParam
|
||||
})
|
||||
return response;
|
||||
},
|
||||
initialPageParam: 1,
|
||||
getNextPageParam: (lastPage, allPages) => {
|
||||
return lastPage.data.length > 0 ? allPages.length + 1 : undefined;
|
||||
},
|
||||
enabled: !!token?.current,
|
||||
staleTime: 0,
|
||||
})
|
||||
|
||||
const loadMoreData = () => {
|
||||
if (waiting) return
|
||||
setTimeout(() => {
|
||||
handleLoad(false, page + 1)
|
||||
}, 1000);
|
||||
};
|
||||
// Flatten pages into a single data array
|
||||
const flatData = useMemo(() => {
|
||||
return data?.pages.flatMap(page => page.data) || [];
|
||||
}, [data])
|
||||
|
||||
// Get nameGroup from the first available page
|
||||
const nameGroup = useMemo(() => {
|
||||
return data?.pages[0]?.filter?.name || "";
|
||||
}, [data])
|
||||
|
||||
// Refetch when manual update state changes
|
||||
useEffect(() => {
|
||||
handleLoad(false, 1)
|
||||
}, [update])
|
||||
|
||||
useEffect(() => {
|
||||
handleLoad(true, 1)
|
||||
}, [group, search, status])
|
||||
refetch()
|
||||
}, [update, refetch])
|
||||
|
||||
const handleRefresh = async () => {
|
||||
setRefreshing(true)
|
||||
handleLoad(false, 1)
|
||||
await new Promise(resolve => setTimeout(resolve, 2000));
|
||||
await queryClient.invalidateQueries({ queryKey: ['members'] })
|
||||
setRefreshing(false)
|
||||
};
|
||||
|
||||
const loadMoreData = () => {
|
||||
if (hasNextPage && !isFetchingNextPage) {
|
||||
fetchNextPage()
|
||||
}
|
||||
};
|
||||
|
||||
const arrSkeleton = [0, 1, 2, 3, 4]
|
||||
|
||||
const getItem = (_data: unknown, index: number): Props => ({
|
||||
id: data[index].id,
|
||||
name: data[index].name,
|
||||
nik: data[index].nik,
|
||||
email: data[index].email,
|
||||
phone: data[index].phone,
|
||||
gender: data[index].gender,
|
||||
position: data[index].position,
|
||||
group: data[index].group,
|
||||
img: data[index].img,
|
||||
isActive: data[index].isActive,
|
||||
role: data[index].role,
|
||||
id: flatData[index]?.id,
|
||||
name: flatData[index]?.name,
|
||||
nik: flatData[index]?.nik,
|
||||
email: flatData[index]?.email,
|
||||
phone: flatData[index]?.phone,
|
||||
gender: flatData[index]?.gender,
|
||||
position: flatData[index]?.position,
|
||||
group: flatData[index]?.group,
|
||||
img: flatData[index]?.img,
|
||||
isActive: flatData[index]?.isActive,
|
||||
role: flatData[index]?.role,
|
||||
});
|
||||
|
||||
return (
|
||||
<View style={[Styles.p15, { flex: 1, backgroundColor: colors.background }]}>
|
||||
<GuideOverlay visible={guideVisible} steps={GUIDE_MEMBER} onDismiss={dismissGuide} />
|
||||
<View>
|
||||
<WrapTab>
|
||||
<ButtonTab
|
||||
@@ -136,18 +150,18 @@ export default function Index() {
|
||||
</View>
|
||||
<View style={[{ flex: 2 }, Styles.mt10]}>
|
||||
{
|
||||
loading ?
|
||||
isLoading ?
|
||||
arrSkeleton.map((item, index) => {
|
||||
return (
|
||||
<SkeletonTwoItem key={index} />
|
||||
)
|
||||
})
|
||||
:
|
||||
data.length > 0
|
||||
flatData.length > 0
|
||||
?
|
||||
<VirtualizedList
|
||||
data={data}
|
||||
getItemCount={() => data.length}
|
||||
data={flatData}
|
||||
getItemCount={() => flatData.length}
|
||||
getItem={getItem}
|
||||
renderItem={({ item, index }: { item: Props, index: number }) => {
|
||||
return (
|
||||
|
||||
@@ -1,18 +1,20 @@
|
||||
import BorderBottomItem from "@/components/borderBottomItem";
|
||||
import BorderBottomItemVertical from "@/components/borderBottomItemVertical";
|
||||
import AppHeader from "@/components/AppHeader";
|
||||
import ModalConfirmation from "@/components/ModalConfirmation";
|
||||
import SkeletonTwoItem from "@/components/skeletonTwoItem";
|
||||
import Text from "@/components/Text";
|
||||
import { ColorsStatus } from "@/constants/ColorsStatus";
|
||||
import Styles from "@/constants/Styles";
|
||||
import { apiGetNotification, apiReadOneNotification } from "@/lib/api";
|
||||
import { apiGetNotification, apiReadAllNotification, apiReadOneNotification } from "@/lib/api";
|
||||
import { setUpdateNotification } from "@/lib/notificationSlice";
|
||||
import { pushToPage } from "@/lib/pushToPage";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
import { Feather } from "@expo/vector-icons";
|
||||
import { useEffect, useState } from "react";
|
||||
import { RefreshControl, SafeAreaView, View, VirtualizedList } from "react-native";
|
||||
import { router, Stack } from "expo-router";
|
||||
import { useInfiniteQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { useEffect, useMemo } from "react";
|
||||
import { FlatList, Pressable, RefreshControl, SafeAreaView, View } from "react-native";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { useState } from "react";
|
||||
|
||||
type Props = {
|
||||
id: string
|
||||
@@ -24,67 +26,110 @@ type Props = {
|
||||
createdAt: string
|
||||
}
|
||||
|
||||
type HeaderRow = { _type: 'header'; date: string }
|
||||
type ItemRow = Props & { _type: 'item' }
|
||||
type ListRow = HeaderRow | ItemRow
|
||||
|
||||
function getNotifStyle(category: string): { icon: keyof typeof Feather.glyphMap; color: string } {
|
||||
if (category === 'announcement') return { icon: 'volume-2', color: '#3B82F6' }
|
||||
if (category === 'project') return { icon: 'activity', color: '#10B981' }
|
||||
if (category.includes('/task')) return { icon: 'clipboard', color: '#8B5CF6' }
|
||||
if (category === 'division') return { icon: 'users', color: '#3B82F6' }
|
||||
if (category.includes('/discussion') || category === 'discussion-general') return { icon: 'message-square', color: '#06B6D4' }
|
||||
if (category.includes('/calendar')) return { icon: 'calendar', color: '#F59E0B' }
|
||||
if (category.includes('/document')) return { icon: 'file-text', color: '#FBBF24' }
|
||||
if (category === 'member') return { icon: 'user', color: '#1F3C88' }
|
||||
return { icon: 'bell', color: '#6B7280' }
|
||||
}
|
||||
|
||||
export default function Notification() {
|
||||
const { token, decryptToken } = useAuthSession()
|
||||
const { colors } = useTheme();
|
||||
const [loading, setLoading] = useState(false)
|
||||
const [data, setData] = useState<Props[]>([])
|
||||
const [page, setPage] = useState(1)
|
||||
const [waiting, setWaiting] = useState(false)
|
||||
const arrSkeleton = Array.from({ length: 5 }, (_, index) => index)
|
||||
const queryClient = useQueryClient()
|
||||
const dispatch = useDispatch()
|
||||
const updateNotification = useSelector((state: any) => state.notificationUpdate)
|
||||
const [refreshing, setRefreshing] = useState(false)
|
||||
const [markingAll, setMarkingAll] = useState(false)
|
||||
const [showConfirm, setShowConfirm] = useState(false)
|
||||
|
||||
async function handleLoad(loading: boolean, thisPage: number) {
|
||||
try {
|
||||
setLoading(loading)
|
||||
setPage(thisPage)
|
||||
setWaiting(true)
|
||||
const {
|
||||
data,
|
||||
fetchNextPage,
|
||||
hasNextPage,
|
||||
isFetchingNextPage,
|
||||
isLoading,
|
||||
refetch
|
||||
} = useInfiniteQuery({
|
||||
queryKey: ['notifications'],
|
||||
queryFn: async ({ pageParam = 1 }) => {
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiGetNotification({ user: hasil, page: thisPage })
|
||||
if (thisPage == 1) {
|
||||
setData(response.data)
|
||||
} else if (thisPage > 1 && response.data.length > 0) {
|
||||
setData([...data, ...response.data])
|
||||
} else {
|
||||
return;
|
||||
const response = await apiGetNotification({ user: hasil, page: pageParam })
|
||||
return response;
|
||||
},
|
||||
initialPageParam: 1,
|
||||
getNextPageParam: (lastPage, allPages) => {
|
||||
return lastPage.data.length > 0 ? allPages.length + 1 : undefined;
|
||||
},
|
||||
enabled: !!token?.current,
|
||||
staleTime: 0,
|
||||
})
|
||||
|
||||
const flatData = useMemo(() => {
|
||||
return data?.pages.flatMap(page => page.data) || [];
|
||||
}, [data])
|
||||
|
||||
const listData = useMemo<ListRow[]>(() => {
|
||||
const groups: Record<string, Props[]> = {}
|
||||
const dateOrder: string[] = []
|
||||
|
||||
flatData.forEach((item) => {
|
||||
if (!groups[item.createdAt]) {
|
||||
groups[item.createdAt] = []
|
||||
dateOrder.push(item.createdAt)
|
||||
}
|
||||
groups[item.createdAt].push(item)
|
||||
})
|
||||
|
||||
const result: ListRow[] = []
|
||||
dateOrder.forEach((date) => {
|
||||
result.push({ _type: 'header', date })
|
||||
const sorted = [...groups[date]].sort((a, b) => Number(a.isRead) - Number(b.isRead))
|
||||
sorted.forEach((item) => result.push({ ...item, _type: 'item' }))
|
||||
})
|
||||
return result
|
||||
}, [flatData])
|
||||
|
||||
useEffect(() => {
|
||||
refetch()
|
||||
}, [updateNotification, refetch])
|
||||
|
||||
const handleRefresh = async () => {
|
||||
setRefreshing(true)
|
||||
await queryClient.invalidateQueries({ queryKey: ['notifications'] })
|
||||
setRefreshing(false)
|
||||
};
|
||||
|
||||
const hasUnread = flatData.some((item) => !item.isRead)
|
||||
|
||||
async function handleReadAll() {
|
||||
try {
|
||||
setMarkingAll(true)
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
await apiReadAllNotification({ user: hasil })
|
||||
await queryClient.invalidateQueries({ queryKey: ['notifications'] })
|
||||
dispatch(setUpdateNotification(!updateNotification))
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
setLoading(false)
|
||||
setWaiting(false)
|
||||
setMarkingAll(false)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const loadMoreData = () => {
|
||||
if (waiting) return
|
||||
setTimeout(() => {
|
||||
handleLoad(false, page + 1)
|
||||
}, 1000);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
handleLoad(true, 1)
|
||||
}, [])
|
||||
|
||||
|
||||
const getItem = (_data: unknown, index: number): Props => ({
|
||||
id: data[index].id,
|
||||
title: data[index].title,
|
||||
desc: data[index].desc,
|
||||
category: data[index].category,
|
||||
idContent: data[index].idContent,
|
||||
isRead: data[index].isRead,
|
||||
createdAt: data[index].createdAt,
|
||||
});
|
||||
|
||||
async function handleReadNotification(id: string, category: string, idContent: string) {
|
||||
try {
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiReadOneNotification({ user: hasil, id: id })
|
||||
await apiReadOneNotification({ user: hasil, id: id })
|
||||
await queryClient.invalidateQueries({ queryKey: ['notifications'] })
|
||||
pushToPage(category, idContent)
|
||||
dispatch(setUpdateNotification(!updateNotification))
|
||||
} catch (error) {
|
||||
@@ -92,65 +137,141 @@ export default function Notification() {
|
||||
}
|
||||
}
|
||||
|
||||
const handleRefresh = async () => {
|
||||
setRefreshing(true)
|
||||
handleLoad(false, 1)
|
||||
await new Promise(resolve => setTimeout(resolve, 2000));
|
||||
setRefreshing(false)
|
||||
};
|
||||
|
||||
return (
|
||||
<SafeAreaView style={[Styles.flex1, { backgroundColor: colors.background }]}>
|
||||
<View style={[Styles.p15]}>
|
||||
{
|
||||
loading ?
|
||||
arrSkeleton.map((item, index) => {
|
||||
return (
|
||||
<SkeletonTwoItem key={index} />
|
||||
)
|
||||
})
|
||||
:
|
||||
data.length > 0 ?
|
||||
<VirtualizedList
|
||||
data={data}
|
||||
getItemCount={() => data.length}
|
||||
getItem={getItem}
|
||||
renderItem={({ item, index }: { item: Props, index: number }) => {
|
||||
return (
|
||||
<BorderBottomItemVertical
|
||||
borderType="bottom"
|
||||
icon={
|
||||
<View style={[Styles.iconContent, item.isRead && ColorsStatus.secondary]}>
|
||||
<Feather name="bell" size={25} color="black" />
|
||||
</View>
|
||||
}
|
||||
title={item.title}
|
||||
rightTopInfo={item.createdAt}
|
||||
desc={item.desc}
|
||||
textColor={item.isRead ? 'gray' : colors.text}
|
||||
onPress={() => {
|
||||
handleReadNotification(item.id, item.category, item.idContent)
|
||||
}}
|
||||
bgColor={'transparent'}
|
||||
/>
|
||||
)
|
||||
}}
|
||||
keyExtractor={(item, index) => String(index)}
|
||||
onEndReached={loadMoreData}
|
||||
onEndReachedThreshold={0.5}
|
||||
showsVerticalScrollIndicator={false}
|
||||
refreshControl={
|
||||
<RefreshControl
|
||||
refreshing={refreshing}
|
||||
onRefresh={handleRefresh}
|
||||
tintColor={colors.icon}
|
||||
/>
|
||||
}
|
||||
<Stack.Screen
|
||||
options={{
|
||||
header: () => (
|
||||
<AppHeader
|
||||
title="Notifikasi"
|
||||
showBack={true}
|
||||
onPressLeft={() => router.back()}
|
||||
right={
|
||||
hasUnread ? (
|
||||
<Pressable
|
||||
onPress={() => setShowConfirm(true)}
|
||||
disabled={markingAll}
|
||||
style={{ opacity: markingAll ? 0.5 : 1, padding: 4 }}
|
||||
>
|
||||
<Feather name="check-square" size={22} color="white" />
|
||||
</Pressable>
|
||||
) : undefined
|
||||
}
|
||||
/>
|
||||
)
|
||||
}}
|
||||
/>
|
||||
|
||||
<ModalConfirmation
|
||||
visible={showConfirm}
|
||||
title="Tandai Semua Dibaca"
|
||||
message="Semua notifikasi akan ditandai sebagai telah dibaca."
|
||||
confirmText="Tandai"
|
||||
cancelText="Batal"
|
||||
onConfirm={() => {
|
||||
setShowConfirm(false)
|
||||
handleReadAll()
|
||||
}}
|
||||
onCancel={() => setShowConfirm(false)}
|
||||
/>
|
||||
|
||||
<View style={[Styles.flex1, Styles.ph15, { paddingTop: 10 }]}>
|
||||
{isLoading ? (
|
||||
[0, 1, 2, 3, 4].map((_, i) => <SkeletonTwoItem key={i} />)
|
||||
) : flatData.length === 0 ? (
|
||||
<View style={[Styles.contentItemCenter, Styles.mt30]}>
|
||||
<Feather name="bell-off" size={42} color={colors.icon + '40'} />
|
||||
<Text style={[Styles.mt10, { color: colors.dimmed, fontSize: 14 }]}>
|
||||
Tidak ada notifikasi
|
||||
</Text>
|
||||
</View>
|
||||
) : (
|
||||
<FlatList
|
||||
data={listData}
|
||||
keyExtractor={(item, index) => String(index)}
|
||||
showsVerticalScrollIndicator={false}
|
||||
onEndReached={() => {
|
||||
if (hasNextPage && !isFetchingNextPage) fetchNextPage()
|
||||
}}
|
||||
onEndReachedThreshold={0.5}
|
||||
refreshControl={
|
||||
<RefreshControl
|
||||
refreshing={refreshing}
|
||||
onRefresh={handleRefresh}
|
||||
tintColor={colors.icon}
|
||||
/>
|
||||
:
|
||||
<Text style={[Styles.textDefault, Styles.textCenter, { color: colors.dimmed }]}>Tidak ada data</Text>
|
||||
}
|
||||
}
|
||||
renderItem={({ item }) => {
|
||||
if (item._type === 'header') {
|
||||
return (
|
||||
<View style={[Styles.rowItemsCenter, { marginTop: 16, marginBottom: 8 }]}>
|
||||
<Text style={{ fontSize: 11, fontWeight: '600', color: colors.dimmed, letterSpacing: 0.6, textTransform: 'uppercase' }}>
|
||||
{item.date}
|
||||
</Text>
|
||||
<View style={{ flex: 1, height: 1, backgroundColor: colors.icon + '20', marginLeft: 8 }} />
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
const { icon, color } = getNotifStyle(item.category)
|
||||
|
||||
return (
|
||||
<Pressable
|
||||
onPress={() => handleReadNotification(item.id, item.category, item.idContent)}
|
||||
style={({ pressed }) => [{
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
borderRadius: 10,
|
||||
borderWidth: 1,
|
||||
borderColor: colors.icon + '20',
|
||||
backgroundColor: pressed
|
||||
? colors.icon + '10'
|
||||
: item.isRead
|
||||
? colors.icon + '10'
|
||||
: colors.card,
|
||||
paddingHorizontal: 12,
|
||||
paddingVertical: 10,
|
||||
marginBottom: 6,
|
||||
}]}
|
||||
>
|
||||
{/* Colored icon */}
|
||||
<View style={{
|
||||
width: 42,
|
||||
height: 42,
|
||||
borderRadius: 21,
|
||||
backgroundColor: color + '20',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
flexShrink: 0,
|
||||
}}>
|
||||
<Feather name={icon} size={20} color={color} />
|
||||
</View>
|
||||
|
||||
{/* Content */}
|
||||
<View style={[Styles.flex1, { marginLeft: 10 }]}>
|
||||
<View style={[Styles.rowSpaceBetween, Styles.itemsCenter]}>
|
||||
<View style={[Styles.flex1, Styles.mr10]}>
|
||||
<Text
|
||||
style={[Styles.textDefaultSemiBold, { color: item.isRead ? colors.dimmed : colors.text }]}
|
||||
numberOfLines={1}
|
||||
>
|
||||
{item.title}
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
<Text
|
||||
style={[Styles.textMediumNormal, { color: item.isRead ? colors.dimmed : colors.text, opacity: item.isRead ? 0.7 : 1 }]}
|
||||
numberOfLines={2}
|
||||
>
|
||||
{item.desc}
|
||||
</Text>
|
||||
</View>
|
||||
</Pressable>
|
||||
)
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</View>
|
||||
</SafeAreaView>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import GuideOverlay from "@/components/GuideOverlay";
|
||||
import BorderBottomItem from "@/components/borderBottomItem";
|
||||
import { ButtonForm } from "@/components/buttonForm";
|
||||
import ButtonTab from "@/components/buttonTab";
|
||||
@@ -13,11 +14,14 @@ import WrapTab from "@/components/wrapTab";
|
||||
import Styles from "@/constants/Styles";
|
||||
import { apiDeletePosition, apiEditPosition, apiGetPosition } from "@/lib/api";
|
||||
import { setUpdatePosition } from "@/lib/positionSlice";
|
||||
import { GUIDE_POSITION } from "@/lib/guideSteps";
|
||||
import { useGuide } from "@/lib/useGuide";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
import { AntDesign, Feather, MaterialCommunityIcons } from "@expo/vector-icons";
|
||||
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { useLocalSearchParams } from "expo-router";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { RefreshControl, View, VirtualizedList } from "react-native";
|
||||
import Toast from "react-native-toast-message";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
@@ -31,51 +35,54 @@ type Props = {
|
||||
}
|
||||
|
||||
export default function Index() {
|
||||
const arrSkeleton = Array.from({ length: 5 }, (_, index) => index)
|
||||
const [loading, setLoading] = useState(true)
|
||||
const { token, decryptToken } = useAuthSession()
|
||||
const { colors } = useTheme()
|
||||
const [status, setStatus] = useState<'true' | 'false'>('true')
|
||||
const entityUser = useSelector((state: any) => state.user)
|
||||
const { active, group } = useLocalSearchParams<{ active?: string, group?: string }>()
|
||||
const [status, setStatus] = useState<'true' | 'false'>(active == 'false' ? 'false' : 'true')
|
||||
const entityUser = useSelector((state: any) => state.user)
|
||||
const [isModal, setModal] = useState(false)
|
||||
const [isVisibleEdit, setVisibleEdit] = useState(false)
|
||||
const [data, setData] = useState<Props[]>([])
|
||||
const [search, setSearch] = useState('')
|
||||
const [nameGroup, setNameGroup] = useState('')
|
||||
const [loadingSubmit, setLoadingSubmit] = useState(false)
|
||||
const [chooseData, setChooseData] = useState({ name: '', id: '', active: false, idGroup: '' })
|
||||
const [error, setError] = useState({
|
||||
name: false,
|
||||
});
|
||||
const queryClient = useQueryClient()
|
||||
const [refreshing, setRefreshing] = useState(false)
|
||||
const [showDeleteModal, setShowDeleteModal] = useState(false)
|
||||
const { visible: guideVisible, dismiss: dismissGuide } = useGuide('position')
|
||||
|
||||
const dispatch = useDispatch()
|
||||
const update = useSelector((state: any) => state.positionUpdate)
|
||||
|
||||
async function handleLoad(loading: boolean) {
|
||||
try {
|
||||
setLoading(loading)
|
||||
// TanStack Query for Positions
|
||||
const {
|
||||
data: queryData,
|
||||
isLoading,
|
||||
refetch
|
||||
} = useQuery({
|
||||
queryKey: ['positions', { status, search, group }],
|
||||
queryFn: async () => {
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiGetPosition({ user: hasil, active: status, search: search, group: String(group) })
|
||||
setData(response.data)
|
||||
setNameGroup(response.filter.name)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}
|
||||
const response = await apiGetPosition({
|
||||
user: hasil,
|
||||
active: status,
|
||||
search: search,
|
||||
group: String(group)
|
||||
})
|
||||
return response;
|
||||
},
|
||||
enabled: !!token?.current,
|
||||
staleTime: 0,
|
||||
})
|
||||
|
||||
const data = useMemo(() => queryData?.data || [], [queryData])
|
||||
const nameGroup = useMemo(() => queryData?.filter?.name || "", [queryData])
|
||||
|
||||
useEffect(() => {
|
||||
handleLoad(false)
|
||||
}, [update])
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
handleLoad(true)
|
||||
}, [status, search, group])
|
||||
refetch()
|
||||
}, [update, refetch])
|
||||
|
||||
|
||||
function handleChooseData(id: string, name: string, active: boolean, group: string) {
|
||||
@@ -88,7 +95,7 @@ export default function Index() {
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiDeletePosition({ user: hasil, isActive: chooseData.active }, chooseData.id)
|
||||
dispatch(setUpdatePosition(!update))
|
||||
} catch (error : any ) {
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal menghapus data"
|
||||
|
||||
@@ -110,7 +117,7 @@ export default function Index() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error : any ) {
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal mengubah data"
|
||||
|
||||
@@ -138,10 +145,11 @@ export default function Index() {
|
||||
handleEdit()
|
||||
}
|
||||
|
||||
const arrSkeleton = [0, 1, 2, 3, 4]
|
||||
|
||||
const handleRefresh = async () => {
|
||||
setRefreshing(true)
|
||||
handleLoad(false)
|
||||
await new Promise(resolve => setTimeout(resolve, 2000));
|
||||
await queryClient.invalidateQueries({ queryKey: ['positions'] })
|
||||
setRefreshing(false)
|
||||
};
|
||||
|
||||
@@ -156,6 +164,7 @@ export default function Index() {
|
||||
|
||||
return (
|
||||
<View style={[Styles.p15, Styles.flex1, { backgroundColor: colors.background }]}>
|
||||
<GuideOverlay visible={guideVisible} steps={GUIDE_POSITION} onDismiss={dismissGuide} />
|
||||
<View>
|
||||
<WrapTab>
|
||||
<ButtonTab
|
||||
@@ -184,7 +193,7 @@ export default function Index() {
|
||||
</View>
|
||||
<View style={[Styles.flex2, Styles.mt10]}>
|
||||
{
|
||||
loading ?
|
||||
isLoading ?
|
||||
arrSkeleton.map((item, index) => {
|
||||
return (
|
||||
<SkeletonTwoItem key={index} />
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import AppHeader from "@/components/AppHeader";
|
||||
import { ButtonHeader } from "@/components/buttonHeader";
|
||||
import ItemDetailMember from "@/components/itemDetailMember";
|
||||
import Text from "@/components/Text";
|
||||
import { assetUserImage } from "@/constants/AssetsError";
|
||||
import { ConstEnv } from "@/constants/ConstEnv";
|
||||
@@ -9,7 +8,7 @@ import { apiGetProfile } from "@/lib/api";
|
||||
import { setEntities } from "@/lib/entitiesSlice";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
import { Feather } from "@expo/vector-icons";
|
||||
import { Feather, MaterialCommunityIcons, MaterialIcons } from "@expo/vector-icons";
|
||||
import { LinearGradient } from "expo-linear-gradient";
|
||||
import { router, Stack } from "expo-router";
|
||||
import { useState } from "react";
|
||||
@@ -42,6 +41,15 @@ export default function Profile() {
|
||||
setRefreshing(false)
|
||||
};
|
||||
|
||||
const infoRows = [
|
||||
{ icon: <MaterialCommunityIcons name="card-account-details" size={20} color={colors.icon} />, label: 'NIK', value: entities.nik },
|
||||
{ icon: <MaterialCommunityIcons name="office-building-outline" size={20} color={colors.icon} />, label: 'Lembaga Desa', value: entities.group },
|
||||
{ icon: <MaterialCommunityIcons name="account-tie" size={20} color={colors.icon} />, label: 'Jabatan', value: entities.position },
|
||||
{ icon: <MaterialIcons name="phone" size={20} color={colors.icon} />, label: 'No Telepon', value: `0${entities.phone}` },
|
||||
{ icon: <MaterialIcons name="email" size={20} color={colors.icon} />, label: 'Email', value: entities.email },
|
||||
{ icon: <MaterialCommunityIcons name="gender-male-female" size={20} color={colors.icon} />, label: 'Jenis Kelamin', value: entities.gender == "F" ? 'Perempuan' : 'Laki-laki' },
|
||||
]
|
||||
|
||||
return (
|
||||
<SafeAreaView style={[Styles.flex1, { backgroundColor: colors.background }]}>
|
||||
<Stack.Screen
|
||||
@@ -56,9 +64,7 @@ export default function Profile() {
|
||||
right={
|
||||
<ButtonHeader
|
||||
item={<Feather name="settings" size={20} color="white" />}
|
||||
onPress={() => {
|
||||
router.push('/setting')
|
||||
}}
|
||||
onPress={() => router.push('/setting')}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
@@ -75,32 +81,47 @@ export default function Profile() {
|
||||
}
|
||||
style={[Styles.h100, { backgroundColor: colors.background }]}
|
||||
>
|
||||
<View style={[Styles.flexColumn]}>
|
||||
<LinearGradient
|
||||
colors={[colors.header, colors.homeGradient]}
|
||||
style={[Styles.wrapHeadViewMember]}
|
||||
>
|
||||
<Pressable onPress={() => setPreview(true)}>
|
||||
<LinearGradient
|
||||
colors={[colors.header, colors.homeGradient]}
|
||||
style={[Styles.wrapHeadViewMember]}
|
||||
>
|
||||
<Pressable onPress={() => setPreview(true)}>
|
||||
<View style={[Styles.memberAvatarRing]}>
|
||||
<Image
|
||||
source={error ? require("../../assets/images/user.jpg") : { uri: `${ConstEnv.url_storage}/files/${entities.img}` }}
|
||||
onError={() => { setError(true) }}
|
||||
onError={() => setError(true)}
|
||||
style={[Styles.userProfileBig]}
|
||||
/>
|
||||
</Pressable>
|
||||
<Text style={[Styles.textSubtitle, Styles.cWhite, Styles.mt10]}>{entities.name}</Text>
|
||||
<Text style={[Styles.textMediumNormal, Styles.cWhite]}>{entities.role}</Text>
|
||||
</LinearGradient>
|
||||
<View style={[Styles.p15]}>
|
||||
<View style={[Styles.rowSpaceBetween]}>
|
||||
<Text style={[Styles.textDefaultSemiBold, { color: colors.text }]}>Informasi</Text>
|
||||
</View>
|
||||
{/* Note: ItemDetailMember might need updates to support dynamic colors if it uses default text colors */}
|
||||
<ItemDetailMember category="nik" value={entities.nik} />
|
||||
<ItemDetailMember category="group" value={entities.group} />
|
||||
<ItemDetailMember category="position" value={entities.position} />
|
||||
<ItemDetailMember category="phone" value={`0${entities.phone}`} />
|
||||
<ItemDetailMember category="email" value={entities.email} />
|
||||
<ItemDetailMember category="gender" value={entities.gender == "F" ? 'Perempuan' : 'Laki-laki'} />
|
||||
</Pressable>
|
||||
<Text style={[Styles.textSubtitle, Styles.cWhite, Styles.mt10, Styles.textCenter]}>{entities.name}</Text>
|
||||
<Text style={[Styles.textMediumNormal, Styles.cWhiteDimmed]}>{entities.role}</Text>
|
||||
{entities.isApprover && (
|
||||
<View style={[Styles.memberBadgeRow, { justifyContent: 'center' }]}>
|
||||
<View style={[Styles.memberBadgeApprover]}>
|
||||
<Text style={[Styles.textSmallSemiBold, Styles.cWhite]}>APPROVER</Text>
|
||||
</View>
|
||||
</View>
|
||||
)}
|
||||
</LinearGradient>
|
||||
|
||||
<View style={[Styles.p15]}>
|
||||
<Text style={[Styles.textDefaultSemiBold, Styles.mb08, { color: colors.dimmed }]}>Informasi</Text>
|
||||
<View>
|
||||
{infoRows.map((item, index, arr) => (
|
||||
<View
|
||||
key={index}
|
||||
style={[Styles.memberInfoRow, { borderBottomWidth: index < arr.length - 1 ? 1 : 0, borderBottomColor: `${colors.dimmed}30` }]}
|
||||
>
|
||||
<View style={[Styles.memberInfoIcon]}>
|
||||
{item.icon}
|
||||
</View>
|
||||
<View style={[Styles.memberInfoContent]}>
|
||||
<Text style={[Styles.textInformation, { color: colors.dimmed }]}>{item.label}</Text>
|
||||
<Text style={[Styles.textDefault, Styles.mt02, { color: colors.text }]} numberOfLines={1}>{item.value ?? '-'}</Text>
|
||||
</View>
|
||||
</View>
|
||||
))}
|
||||
</View>
|
||||
</View>
|
||||
</ScrollView>
|
||||
@@ -114,4 +135,4 @@ export default function Profile() {
|
||||
/>
|
||||
</SafeAreaView>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,6 +195,8 @@ export default function ProjectAddTask() {
|
||||
day_label: { color: colors.text },
|
||||
time_label: { color: colors.text },
|
||||
weekday_label: { color: colors.text },
|
||||
button_next_image: { tintColor: colors.text },
|
||||
button_prev_image: { tintColor: colors.text },
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
@@ -227,7 +229,7 @@ export default function ProjectAddTask() {
|
||||
>
|
||||
<Text style={[dsbButton ? Styles.cGray : Styles.cWhite]}>Detail</Text>
|
||||
</Pressable> */}
|
||||
<ButtonSelect value="Detail" onPress={() => { setModalDetail(true) }} />
|
||||
<ButtonSelect value="Detail" onPress={() => { setModalDetail(true) }} disabled={from == "" || to == ""} />
|
||||
</View>
|
||||
<InputForm
|
||||
label="Judul Tugas"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import AppHeader from "@/components/AppHeader";
|
||||
import GuideOverlay from "@/components/GuideOverlay";
|
||||
import HeaderRightProjectDetail from "@/components/project/headerProjectDetail";
|
||||
import SectionFile from "@/components/project/sectionFile";
|
||||
import SectionLink from "@/components/project/sectionLink";
|
||||
@@ -9,6 +10,8 @@ import SectionCancel from "@/components/sectionCancel";
|
||||
import SectionProgress from "@/components/sectionProgress";
|
||||
import Styles from "@/constants/Styles";
|
||||
import { apiGetProjectOne } from "@/lib/api";
|
||||
import { GUIDE_PROJECT_DETAIL } from "@/lib/guideSteps";
|
||||
import { useGuide } from "@/lib/useGuide";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||
@@ -37,11 +40,13 @@ export default function DetailProject() {
|
||||
const { id } = useLocalSearchParams<{ id: string }>();
|
||||
const [data, setData] = useState<Props>()
|
||||
const [progress, setProgress] = useState(0)
|
||||
const [taskStats, setTaskStats] = useState<{ done: number, total: number } | undefined>()
|
||||
const [loading, setLoading] = useState(true)
|
||||
const update = useSelector((state: any) => state.projectUpdate)
|
||||
const [isMember, setIsMember] = useState(false)
|
||||
const entityUser = useSelector((state: any) => state.user)
|
||||
const [refreshing, setRefreshing] = useState(false)
|
||||
const { visible: guideVisible, dismiss: dismissGuide } = useGuide('project-detail')
|
||||
|
||||
async function handleLoad(cat: 'data' | 'progress') {
|
||||
try {
|
||||
@@ -60,6 +65,17 @@ export default function DetailProject() {
|
||||
}
|
||||
}
|
||||
|
||||
async function handleLoadTaskStats() {
|
||||
try {
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiGetProjectOne({ user: hasil, cat: 'task', id: id })
|
||||
const tasks: { status: number }[] = response.data
|
||||
setTaskStats({ done: tasks.filter(t => t.status === 1).length, total: tasks.length })
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
}
|
||||
|
||||
async function checkMember() {
|
||||
try {
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
@@ -79,6 +95,10 @@ export default function DetailProject() {
|
||||
handleLoad('progress')
|
||||
}, [update.progress])
|
||||
|
||||
useEffect(() => {
|
||||
handleLoadTaskStats()
|
||||
}, [update.task])
|
||||
|
||||
useEffect(() => {
|
||||
checkMember()
|
||||
}, [])
|
||||
@@ -88,6 +108,7 @@ export default function DetailProject() {
|
||||
setRefreshing(true)
|
||||
await handleLoad('data')
|
||||
await handleLoad('progress')
|
||||
await handleLoadTaskStats()
|
||||
await new Promise(resolve => setTimeout(resolve, 2000));
|
||||
setRefreshing(false)
|
||||
};
|
||||
@@ -112,6 +133,7 @@ export default function DetailProject() {
|
||||
)
|
||||
}}
|
||||
/>
|
||||
<GuideOverlay visible={guideVisible} steps={GUIDE_PROJECT_DETAIL} onDismiss={dismissGuide} />
|
||||
<ScrollView
|
||||
style={[Styles.h100, { backgroundColor: colors.background }]}
|
||||
refreshControl={
|
||||
@@ -126,7 +148,7 @@ export default function DetailProject() {
|
||||
{
|
||||
data?.reason != null && data?.reason != "" && <SectionCancel text={data?.reason} />
|
||||
}
|
||||
<SectionProgress text={`Kemajuan Kegiatan ${progress}%`} progress={progress} />
|
||||
<SectionProgress progress={progress} doneCount={taskStats?.done} totalCount={taskStats?.total} />
|
||||
<SectionReportProject refreshing={refreshing} />
|
||||
<SectionTanggalTugasProject status={data?.status} member={isMember} refreshing={refreshing} />
|
||||
<SectionFile status={data?.status} member={isMember} refreshing={refreshing} />
|
||||
|
||||
377
app/(application)/project/[id]/tugas-file/[taskId].tsx
Normal file
377
app/(application)/project/[id]/tugas-file/[taskId].tsx
Normal file
@@ -0,0 +1,377 @@
|
||||
import AppHeader from "@/components/AppHeader";
|
||||
import BorderBottomItem from "@/components/borderBottomItem";
|
||||
import { ButtonForm } from "@/components/buttonForm";
|
||||
import ButtonSelect from "@/components/buttonSelect";
|
||||
import DrawerBottom from "@/components/drawerBottom";
|
||||
import MenuItemRow from "@/components/menuItemRow";
|
||||
import ModalConfirmation from "@/components/ModalConfirmation";
|
||||
import ModalLoading from "@/components/modalLoading";
|
||||
import Skeleton from "@/components/skeleton";
|
||||
import Text from "@/components/Text";
|
||||
import { ConstEnv } from "@/constants/ConstEnv";
|
||||
import Styles from "@/constants/Styles";
|
||||
import {
|
||||
apiAddProjectTaskFile,
|
||||
apiDeleteProjectTaskFile,
|
||||
apiGetProjectOne,
|
||||
apiGetProjectTaskFile,
|
||||
apiLinkProjectTaskFile,
|
||||
} from "@/lib/api";
|
||||
import { setUpdateProject } from "@/lib/projectUpdate";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons";
|
||||
import * as DocumentPicker from "expo-document-picker";
|
||||
import * as FileSystem from "expo-file-system";
|
||||
import { startActivityAsync } from "expo-intent-launcher";
|
||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||
import * as Sharing from "expo-sharing";
|
||||
import { useEffect, useState } from "react";
|
||||
import {
|
||||
ActivityIndicator,
|
||||
Alert,
|
||||
Platform,
|
||||
SafeAreaView,
|
||||
ScrollView,
|
||||
View,
|
||||
} from "react-native";
|
||||
import * as mime from "react-native-mime-types";
|
||||
import Toast from "react-native-toast-message";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
|
||||
type FileItem = {
|
||||
id: string; // ProjectTaskFile.id
|
||||
idFile: string; // ProjectFile.id
|
||||
name: string;
|
||||
extension: string;
|
||||
idStorage: string;
|
||||
};
|
||||
|
||||
type ProjectFile = {
|
||||
id: string;
|
||||
name: string;
|
||||
extension: string;
|
||||
idStorage: string;
|
||||
};
|
||||
|
||||
export default function ProjectTugasFileScreen() {
|
||||
const { colors } = useTheme();
|
||||
const { id, taskId, member: memberParam } = useLocalSearchParams<{ id: string; taskId: string; member: string }>();
|
||||
const { token, decryptToken } = useAuthSession();
|
||||
const dispatch = useDispatch();
|
||||
const update = useSelector((state: any) => state.projectUpdate);
|
||||
const entityUser = useSelector((state: any) => state.user);
|
||||
const isMember = memberParam === "true";
|
||||
const canEdit = isMember || (entityUser.role !== "user" && entityUser.role !== "coadmin");
|
||||
|
||||
const [data, setData] = useState<FileItem[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [loadingOpen, setLoadingOpen] = useState(false);
|
||||
const [loadingUpload, setLoadingUpload] = useState(false);
|
||||
const [loadingLink, setLoadingLink] = useState(false);
|
||||
|
||||
const [selectFile, setSelectFile] = useState<FileItem | null>(null);
|
||||
const [isMenuModal, setMenuModal] = useState(false);
|
||||
const [showDeleteModal, setShowDeleteModal] = useState(false);
|
||||
|
||||
const [projectFiles, setProjectFiles] = useState<ProjectFile[]>([]);
|
||||
const [isPickerModal, setPickerModal] = useState(false);
|
||||
const [loadingProjectFiles, setLoadingProjectFiles] = useState(false);
|
||||
const [selectedProjectFiles, setSelectedProjectFiles] = useState<string[]>([]);
|
||||
|
||||
const arrSkeleton = Array.from({ length: 4 });
|
||||
|
||||
async function loadFiles() {
|
||||
try {
|
||||
setLoading(true);
|
||||
const hasil = await decryptToken(String(token?.current));
|
||||
const response = await apiGetProjectTaskFile({ user: hasil, id: taskId });
|
||||
setData(response.data ?? []);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}
|
||||
|
||||
async function loadProjectFiles() {
|
||||
try {
|
||||
setLoadingProjectFiles(true);
|
||||
const hasil = await decryptToken(String(token?.current));
|
||||
const response = await apiGetProjectOne({ user: hasil, cat: "file", id });
|
||||
setProjectFiles(response.data ?? []);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
setLoadingProjectFiles(false);
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
loadFiles();
|
||||
}, []);
|
||||
|
||||
const openFile = () => {
|
||||
setMenuModal(false);
|
||||
setLoadingOpen(true);
|
||||
const remoteUrl = ConstEnv.url_storage + "/files/" + selectFile?.idStorage;
|
||||
const fileName = selectFile?.name + "." + selectFile?.extension;
|
||||
const localPath = `${FileSystem.documentDirectory}/${fileName}`;
|
||||
const mimeType = mime.lookup(fileName);
|
||||
|
||||
FileSystem.downloadAsync(remoteUrl, localPath).then(async ({ uri }) => {
|
||||
const contentURL = await FileSystem.getContentUriAsync(uri);
|
||||
try {
|
||||
if (Platform.OS === "android") {
|
||||
await startActivityAsync("android.intent.action.VIEW", {
|
||||
data: contentURL,
|
||||
flags: 1,
|
||||
type: mimeType as string,
|
||||
});
|
||||
} else {
|
||||
Sharing.shareAsync(localPath);
|
||||
}
|
||||
} catch {
|
||||
Alert.alert("INFO", "Gagal membuka file, tidak ada aplikasi yang dapat membuka file ini");
|
||||
} finally {
|
||||
setLoadingOpen(false);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
async function handleDelete() {
|
||||
try {
|
||||
const hasil = await decryptToken(String(token?.current));
|
||||
const response = await apiDeleteProjectTaskFile({ user: hasil }, String(selectFile?.id));
|
||||
if (response.success) {
|
||||
Toast.show({ type: "small", text1: "Berhasil menghapus file" });
|
||||
dispatch(setUpdateProject({ ...update, task: !update.task }));
|
||||
loadFiles();
|
||||
} else {
|
||||
Toast.show({ type: "small", text1: response.message });
|
||||
}
|
||||
} catch (error: any) {
|
||||
const message = error?.response?.data?.message || "Gagal menghapus file";
|
||||
Toast.show({ type: "small", text1: message });
|
||||
} finally {
|
||||
setMenuModal(false);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleUpload() {
|
||||
const result = await DocumentPicker.getDocumentAsync({ type: ["*/*"], multiple: true });
|
||||
if (result.canceled) return;
|
||||
|
||||
try {
|
||||
setLoadingUpload(true);
|
||||
const hasil = await decryptToken(String(token?.current));
|
||||
const fd = new FormData();
|
||||
|
||||
for (let i = 0; i < result.assets.length; i++) {
|
||||
fd.append(`file${i}`, {
|
||||
uri: result.assets[i].uri,
|
||||
type: "application/octet-stream",
|
||||
name: result.assets[i].name,
|
||||
} as any);
|
||||
}
|
||||
fd.append("data", JSON.stringify({ user: hasil }));
|
||||
|
||||
const response = await apiAddProjectTaskFile({ data: fd, id: taskId });
|
||||
if (response.success) {
|
||||
Toast.show({ type: "small", text1: "Berhasil menambahkan file" });
|
||||
dispatch(setUpdateProject({ ...update, task: !update.task }));
|
||||
loadFiles();
|
||||
} else {
|
||||
Toast.show({ type: "small", text1: response.message });
|
||||
}
|
||||
} catch (error: any) {
|
||||
const message = error?.response?.data?.message || "Gagal menambahkan file";
|
||||
Toast.show({ type: "small", text1: message });
|
||||
} finally {
|
||||
setLoadingUpload(false);
|
||||
}
|
||||
}
|
||||
|
||||
function toggleProjectFileSelect(fileId: string) {
|
||||
setSelectedProjectFiles((prev) =>
|
||||
prev.includes(fileId) ? prev.filter((v) => v !== fileId) : [...prev, fileId]
|
||||
);
|
||||
}
|
||||
|
||||
async function handleLinkFiles() {
|
||||
if (selectedProjectFiles.length === 0) return;
|
||||
try {
|
||||
setLoadingLink(true);
|
||||
const hasil = await decryptToken(String(token?.current));
|
||||
for (const idFile of selectedProjectFiles) {
|
||||
await apiLinkProjectTaskFile({ user: hasil, idFile, id: taskId });
|
||||
}
|
||||
Toast.show({ type: "small", text1: "Berhasil menambahkan file" });
|
||||
dispatch(setUpdateProject({ ...update, task: !update.task }));
|
||||
setPickerModal(false);
|
||||
setSelectedProjectFiles([]);
|
||||
loadFiles();
|
||||
} catch (error: any) {
|
||||
const message = error?.response?.data?.message || "Gagal menambahkan file";
|
||||
Toast.show({ type: "small", text1: message });
|
||||
} finally {
|
||||
setLoadingLink(false);
|
||||
}
|
||||
}
|
||||
|
||||
const attachedFileIds = new Set(data.map((f) => f.idFile));
|
||||
|
||||
return (
|
||||
<SafeAreaView style={{ flex: 1, backgroundColor: colors.background }}>
|
||||
<Stack.Screen
|
||||
options={{
|
||||
header: () => (
|
||||
<AppHeader
|
||||
title="File Tugas"
|
||||
showBack={true}
|
||||
onPressLeft={() => router.back()}
|
||||
/>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
<ModalLoading isVisible={loadingOpen} setVisible={setLoadingOpen} />
|
||||
|
||||
<ScrollView>
|
||||
<View style={[Styles.p15, Styles.mb100]}>
|
||||
{canEdit && (
|
||||
<>
|
||||
<ButtonSelect
|
||||
value="Upload dari Perangkat"
|
||||
onPress={handleUpload}
|
||||
disabled={loadingUpload}
|
||||
/>
|
||||
<ButtonSelect
|
||||
value="Pilih dari File Proyek"
|
||||
onPress={() => {
|
||||
setSelectedProjectFiles([]);
|
||||
setPickerModal(true);
|
||||
loadProjectFiles();
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
|
||||
{loadingUpload && <ActivityIndicator size="small" style={Styles.mv05} />}
|
||||
|
||||
<View style={[Styles.mb15, Styles.mt10]}>
|
||||
<Text style={[Styles.textDefaultSemiBold, Styles.mv05]}>File Terlampir</Text>
|
||||
<View style={[Styles.wrapPaper, { backgroundColor: colors.card, borderColor: colors.background }]}>
|
||||
{loading ? (
|
||||
arrSkeleton.map((_, index) => (
|
||||
<Skeleton key={index} width={100} height={40} widthType="percent" borderRadius={10} />
|
||||
))
|
||||
) : data.length > 0 ? (
|
||||
data.map((item, index) => (
|
||||
<BorderBottomItem
|
||||
key={index}
|
||||
borderType="all"
|
||||
icon={<MaterialCommunityIcons name="file-outline" size={25} color={colors.text} />}
|
||||
title={item.name + "." + item.extension}
|
||||
titleWeight="normal"
|
||||
onPress={() => {
|
||||
setSelectFile(item);
|
||||
setMenuModal(true);
|
||||
}}
|
||||
/>
|
||||
))
|
||||
) : (
|
||||
<Text style={[Styles.textDefault, { textAlign: "center", color: colors.dimmed }]}>
|
||||
Tidak ada file
|
||||
</Text>
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
</ScrollView>
|
||||
|
||||
{/* Menu per file */}
|
||||
<DrawerBottom animation="slide" isVisible={isMenuModal} setVisible={setMenuModal} title="Menu">
|
||||
<View style={Styles.rowItemsCenter}>
|
||||
<MenuItemRow
|
||||
icon={<MaterialCommunityIcons name="file-eye" color={colors.text} size={25} />}
|
||||
title="Lihat / Share"
|
||||
onPress={openFile}
|
||||
/>
|
||||
{canEdit && (
|
||||
<MenuItemRow
|
||||
icon={<Ionicons name="trash-outline" color={colors.text} size={25} />}
|
||||
title="Hapus"
|
||||
onPress={() => {
|
||||
setMenuModal(false);
|
||||
setTimeout(() => setShowDeleteModal(true), 600);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</View>
|
||||
</DrawerBottom>
|
||||
|
||||
<ModalConfirmation
|
||||
visible={showDeleteModal}
|
||||
title="Konfirmasi"
|
||||
message="Apakah Anda yakin ingin menghapus file ini?"
|
||||
onConfirm={() => {
|
||||
setShowDeleteModal(false);
|
||||
handleDelete();
|
||||
}}
|
||||
onCancel={() => setShowDeleteModal(false)}
|
||||
confirmText="Hapus"
|
||||
cancelText="Batal"
|
||||
/>
|
||||
|
||||
{/* Picker file dari proyek */}
|
||||
<DrawerBottom
|
||||
animation="slide"
|
||||
isVisible={isPickerModal}
|
||||
setVisible={setPickerModal}
|
||||
title="Pilih File Proyek"
|
||||
height={60}
|
||||
>
|
||||
<ScrollView>
|
||||
{loadingProjectFiles ? (
|
||||
<ActivityIndicator size="small" />
|
||||
) : projectFiles.length > 0 ? (
|
||||
projectFiles.map((item, index) => {
|
||||
const isAttached = attachedFileIds.has(item.id);
|
||||
const isSelected = selectedProjectFiles.includes(item.id);
|
||||
return (
|
||||
<View key={index} style={isAttached ? { opacity: 0.4 } : undefined}>
|
||||
<BorderBottomItem
|
||||
borderType="bottom"
|
||||
icon={
|
||||
isAttached || isSelected ? (
|
||||
<Ionicons name="checkmark-circle" size={25} color={colors.primary} />
|
||||
) : (
|
||||
<MaterialCommunityIcons name="file-outline" size={25} color={colors.text} />
|
||||
)
|
||||
}
|
||||
title={item.name + "." + item.extension}
|
||||
titleWeight="normal"
|
||||
onPress={() => !isAttached && toggleProjectFileSelect(item.id)}
|
||||
bgColor="transparent"
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
})
|
||||
) : (
|
||||
<Text style={[Styles.textDefault, { textAlign: "center", color: colors.dimmed }]}>
|
||||
Tidak ada file tersedia
|
||||
</Text>
|
||||
)}
|
||||
</ScrollView>
|
||||
{projectFiles.length > 0 && (
|
||||
<View>
|
||||
<ButtonForm
|
||||
text={loadingLink ? "Menyimpan..." : `Tambahkan (${selectedProjectFiles.length})`}
|
||||
disabled={selectedProjectFiles.length === 0 || loadingLink}
|
||||
onPress={handleLinkFiles} />
|
||||
</View>
|
||||
)}
|
||||
</DrawerBottom>
|
||||
</SafeAreaView>
|
||||
);
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
import AppHeader from "@/components/AppHeader";
|
||||
import BorderBottomItem from "@/components/borderBottomItem";
|
||||
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
||||
import ButtonSelect from "@/components/buttonSelect";
|
||||
import DrawerBottom from "@/components/drawerBottom";
|
||||
import ImageUser from "@/components/imageNew";
|
||||
import { InputForm } from "@/components/inputForm";
|
||||
@@ -25,6 +23,7 @@ import * as DocumentPicker from "expo-document-picker";
|
||||
import { router, Stack } from "expo-router";
|
||||
import { useEffect, useState } from "react";
|
||||
import {
|
||||
Pressable,
|
||||
SafeAreaView,
|
||||
ScrollView,
|
||||
View
|
||||
@@ -32,6 +31,26 @@ import {
|
||||
import Toast from "react-native-toast-message";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
|
||||
function getFileIcon(ext: string): keyof typeof MaterialCommunityIcons.glyphMap {
|
||||
if (['jpg', 'jpeg', 'png', 'gif', 'webp', 'heic', 'heif'].includes(ext)) return 'image-outline'
|
||||
if (ext === 'pdf') return 'file-pdf-box'
|
||||
if (['mp4', 'mov', 'avi', 'mkv'].includes(ext)) return 'video-outline'
|
||||
if (['doc', 'docx'].includes(ext)) return 'file-word-outline'
|
||||
if (['xls', 'xlsx'].includes(ext)) return 'file-excel-outline'
|
||||
if (['zip', 'rar', '7z'].includes(ext)) return 'zip-box-outline'
|
||||
return 'file-outline'
|
||||
}
|
||||
|
||||
function getFileColor(ext: string): string {
|
||||
if (['jpg', 'jpeg', 'png', 'gif', 'webp', 'heic', 'heif'].includes(ext)) return '#339AF0'
|
||||
if (ext === 'pdf') return '#F03E3E'
|
||||
if (['mp4', 'mov', 'avi', 'mkv'].includes(ext)) return '#AE3EC9'
|
||||
if (['doc', 'docx'].includes(ext)) return '#1C7ED6'
|
||||
if (['xls', 'xlsx'].includes(ext)) return '#2F9E44'
|
||||
if (['zip', 'rar', '7z'].includes(ext)) return '#E8590C'
|
||||
return '#868E96'
|
||||
}
|
||||
|
||||
export default function CreateProject() {
|
||||
const { colors } = useTheme();
|
||||
const [loading, setLoading] = useState(false)
|
||||
@@ -241,26 +260,23 @@ export default function CreateProject() {
|
||||
style={[Styles.h100, { backgroundColor: colors.background }]}
|
||||
>
|
||||
<View style={[Styles.p15]}>
|
||||
{
|
||||
(entityUser.role == "supadmin" || entityUser.role == "developer")
|
||||
&&
|
||||
(
|
||||
<SelectForm
|
||||
label="Lembaga Desa"
|
||||
placeholder="Pilih Lembaga Desa"
|
||||
value={chooseGroup.label}
|
||||
required
|
||||
bg={colors.card}
|
||||
onPress={() => {
|
||||
setValChoose(chooseGroup.val);
|
||||
setValSelect("group");
|
||||
setSelect(true);
|
||||
}}
|
||||
error={error.group}
|
||||
errorText="Lembaga Desa tidak boleh kosong"
|
||||
/>
|
||||
)
|
||||
}
|
||||
{(entityUser.role == "supadmin" || entityUser.role == "developer") && (
|
||||
<SelectForm
|
||||
label="Lembaga Desa"
|
||||
placeholder="Pilih Lembaga Desa"
|
||||
value={chooseGroup.label}
|
||||
required
|
||||
bg={colors.card}
|
||||
onPress={() => {
|
||||
setValChoose(chooseGroup.val);
|
||||
setValSelect("group");
|
||||
setSelect(true);
|
||||
}}
|
||||
error={error.group}
|
||||
errorText="Lembaga Desa tidak boleh kosong"
|
||||
/>
|
||||
)}
|
||||
|
||||
<InputForm
|
||||
label="Kegiatan"
|
||||
type="default"
|
||||
@@ -270,85 +286,154 @@ export default function CreateProject() {
|
||||
value={dataForm.title}
|
||||
error={error.title}
|
||||
errorText="Nama kegiatan tidak boleh kosong"
|
||||
onChange={(val) => {
|
||||
validationForm("title", val);
|
||||
}}
|
||||
onChange={(val) => validationForm("title", val)}
|
||||
/>
|
||||
<ButtonSelect
|
||||
value="Tambah Tanggal & Tugas"
|
||||
onPress={() => {
|
||||
router.push(`/project/create/task`);
|
||||
}}
|
||||
error={error.task}
|
||||
errorText="Tanggal & Tugas tidak boleh kosong"
|
||||
/>
|
||||
<ButtonSelect value="Upload File" onPress={pickDocumentAsync} />
|
||||
<ButtonSelect
|
||||
value="Pilih Anggota"
|
||||
onPress={() => {
|
||||
if (entityUser.role == "supadmin" || entityUser.role == "developer") {
|
||||
if (chooseGroup.val != "") {
|
||||
router.push(`/project/create/member`);
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: "Pilih Lembaga Desa terlebih dahulu", })
|
||||
}
|
||||
} else {
|
||||
router.push(`/project/create/member`);
|
||||
}
|
||||
}}
|
||||
error={error.member}
|
||||
errorText="Anggota tidak boleh kosong"
|
||||
/>
|
||||
<SectionListAddTask />
|
||||
{
|
||||
fileForm.length > 0 && (
|
||||
<View style={[Styles.mb15]}>
|
||||
<Text style={[Styles.textDefaultSemiBold, Styles.mv05]}>File</Text>
|
||||
<View style={[Styles.wrapPaper, { backgroundColor: colors.card, borderColor: colors.background }]}>
|
||||
{
|
||||
fileForm.map((item, index) => (
|
||||
<BorderBottomItem
|
||||
key={index}
|
||||
borderType="all"
|
||||
icon={<MaterialCommunityIcons name="file-outline" size={25} color={colors.text} />}
|
||||
title={item.name}
|
||||
titleWeight="normal"
|
||||
onPress={() => { setIndexDelFile(index); setModal(true) }}
|
||||
/>
|
||||
))
|
||||
}
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
{entitiesMember.length > 0 && (
|
||||
<View>
|
||||
<View style={[Styles.rowSpaceBetween, Styles.mv05]}>
|
||||
<Text>Anggota</Text>
|
||||
<Text>Total {entitiesMember.length} Anggota</Text>
|
||||
</View>
|
||||
|
||||
<View style={[Styles.borderAll, Styles.round05, Styles.p10, { borderColor: colors.icon + '20', backgroundColor: colors.card }]}>
|
||||
{entitiesMember.map(
|
||||
(item: { img: any; name: any }, index: any) => {
|
||||
return (
|
||||
<BorderBottomItem
|
||||
key={index}
|
||||
borderType="bottom"
|
||||
icon={
|
||||
<ImageUser
|
||||
src={`${ConstEnv.url_storage}/files/${item.img}`}
|
||||
size="sm"
|
||||
/>
|
||||
}
|
||||
title={item.name}
|
||||
/>
|
||||
);
|
||||
}
|
||||
{/* Tanggal & Tugas */}
|
||||
<View style={[
|
||||
Styles.wrapPaper, Styles.mb15, Styles.sectionCard,
|
||||
{ backgroundColor: colors.card, borderColor: error.task ? colors.error + '50' : colors.icon + '18' }
|
||||
]}>
|
||||
<Pressable
|
||||
onPress={() => router.push(`/project/create/task`)}
|
||||
style={[Styles.sectionActionRow, { marginBottom: taskCreate.length > 0 ? 12 : 0 }]}
|
||||
>
|
||||
<View style={[Styles.sectionIconBox, { backgroundColor: colors.tabActive + '18' }]}>
|
||||
<MaterialCommunityIcons name="calendar-check-outline" size={18} color={colors.tabActive} />
|
||||
</View>
|
||||
<View style={Styles.flex1}>
|
||||
<Text style={[Styles.textDefaultSemiBold, { color: colors.text }]}>Tanggal & Tugas</Text>
|
||||
{taskCreate.length === 0 && (
|
||||
<Text style={[Styles.textMediumNormal, { color: colors.dimmed }]}>Belum ada tugas ditambahkan</Text>
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
)}
|
||||
{taskCreate.length > 0 && (
|
||||
<View style={[Styles.sectionBadge, { backgroundColor: colors.tabActive + '18' }]}>
|
||||
<Text style={[Styles.textSmallSemiBold, { color: colors.tabActive }]}>{taskCreate.length} tugas</Text>
|
||||
</View>
|
||||
)}
|
||||
<MaterialCommunityIcons name="chevron-right" size={18} color={colors.dimmed} />
|
||||
</Pressable>
|
||||
{taskCreate.length > 0 && <SectionListAddTask showTitle={false} />}
|
||||
{error.task && (
|
||||
<Text style={[Styles.textMediumNormal, Styles.mt05, { color: colors.error }]}>
|
||||
Tanggal & Tugas tidak boleh kosong
|
||||
</Text>
|
||||
)}
|
||||
</View>
|
||||
|
||||
{/* File */}
|
||||
<View style={[
|
||||
Styles.wrapPaper, Styles.mb15, Styles.sectionCard,
|
||||
{ backgroundColor: colors.card, borderColor: colors.icon + '18' }
|
||||
]}>
|
||||
<Pressable
|
||||
onPress={pickDocumentAsync}
|
||||
style={[Styles.sectionActionRow, { marginBottom: fileForm.length > 0 ? 12 : 0 }]}
|
||||
>
|
||||
<View style={[Styles.sectionIconBox, { backgroundColor: colors.icon + '15' }]}>
|
||||
<MaterialCommunityIcons name="paperclip" size={18} color={colors.dimmed} />
|
||||
</View>
|
||||
<View style={Styles.flex1}>
|
||||
<Text style={[Styles.textDefaultSemiBold, { color: colors.text }]}>File</Text>
|
||||
{fileForm.length === 0 && (
|
||||
<Text style={[Styles.textMediumNormal, { color: colors.dimmed }]}>Opsional — ketuk untuk upload</Text>
|
||||
)}
|
||||
</View>
|
||||
{fileForm.length > 0 && (
|
||||
<View style={[Styles.sectionBadge, { backgroundColor: colors.dimmed + '18' }]}>
|
||||
<Text style={[Styles.textSmallSemiBold, { color: colors.dimmed }]}>{fileForm.length} file</Text>
|
||||
</View>
|
||||
)}
|
||||
<MaterialCommunityIcons name="chevron-right" size={18} color={colors.dimmed} />
|
||||
</Pressable>
|
||||
{fileForm.length > 0 && (
|
||||
<View style={Styles.fileGrid}>
|
||||
{fileForm.map((item, index) => {
|
||||
const ext = item.name.split('.').pop()?.toLowerCase() ?? ''
|
||||
const baseName = item.name.includes('.') ? item.name.split('.').slice(0, -1).join('.') : item.name
|
||||
const iconName = getFileIcon(ext)
|
||||
const iconColor = getFileColor(ext)
|
||||
return (
|
||||
<Pressable
|
||||
key={index}
|
||||
onPress={() => { setIndexDelFile(index); setModal(true) }}
|
||||
style={[Styles.fileCard, { backgroundColor: 'transparent', borderColor: colors.icon + '18' }]}
|
||||
>
|
||||
<View style={[Styles.sectionIconBox, { backgroundColor: iconColor + '20' }]}>
|
||||
<MaterialCommunityIcons name={iconName} size={18} color={iconColor} />
|
||||
</View>
|
||||
<View style={Styles.flex1}>
|
||||
<Text style={Styles.textDefault} numberOfLines={1}>{baseName}</Text>
|
||||
<Text style={[Styles.textSmallSemiBold, { color: colors.dimmed }]}>{ext.toUpperCase()}</Text>
|
||||
</View>
|
||||
</Pressable>
|
||||
)
|
||||
})}
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
|
||||
{/* Anggota */}
|
||||
<View style={[
|
||||
Styles.wrapPaper, Styles.mb15, Styles.sectionCard,
|
||||
{ backgroundColor: colors.card, borderColor: error.member ? colors.error + '50' : colors.icon + '18' }
|
||||
]}>
|
||||
<Pressable
|
||||
onPress={() => {
|
||||
if (entityUser.role == "supadmin" || entityUser.role == "developer") {
|
||||
if (chooseGroup.val != "") {
|
||||
router.push(`/project/create/member`);
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: "Pilih Lembaga Desa terlebih dahulu" })
|
||||
}
|
||||
} else {
|
||||
router.push(`/project/create/member`);
|
||||
}
|
||||
}}
|
||||
style={[Styles.sectionActionRow, { marginBottom: entitiesMember.length > 0 ? 12 : 0 }]}
|
||||
>
|
||||
<View style={[Styles.sectionIconBox, { backgroundColor: colors.tabActive + '18' }]}>
|
||||
<MaterialCommunityIcons name="account-group-outline" size={18} color={colors.tabActive} />
|
||||
</View>
|
||||
<View style={Styles.flex1}>
|
||||
<Text style={[Styles.textDefaultSemiBold, { color: colors.text }]}>Anggota</Text>
|
||||
{entitiesMember.length === 0 && (
|
||||
<Text style={[Styles.textMediumNormal, { color: colors.dimmed }]}>Belum ada anggota dipilih</Text>
|
||||
)}
|
||||
</View>
|
||||
{entitiesMember.length > 0 && (
|
||||
<View style={[Styles.sectionBadge, { backgroundColor: colors.tabActive + '18' }]}>
|
||||
<Text style={[Styles.textSmallSemiBold, { color: colors.tabActive }]}>{entitiesMember.length} orang</Text>
|
||||
</View>
|
||||
)}
|
||||
<MaterialCommunityIcons name="chevron-right" size={18} color={colors.dimmed} />
|
||||
</Pressable>
|
||||
{entitiesMember.length > 0 && (
|
||||
<View style={{ gap: 6 }}>
|
||||
{entitiesMember.map((item: { img: any; name: any; position?: string }, index: any) => (
|
||||
<View
|
||||
key={index}
|
||||
style={[Styles.listItemCard, { borderColor: colors.icon + '18' }]}
|
||||
>
|
||||
<ImageUser src={`${ConstEnv.url_storage}/files/${item.img}`} size="xs" />
|
||||
<Text style={[Styles.textDefault, Styles.flex1, { color: colors.text }]} numberOfLines={1}>{item.name}</Text>
|
||||
{item.position && (
|
||||
<View style={[Styles.positionBadge, { backgroundColor: colors.dimmed + '15' }]}>
|
||||
<Text style={[Styles.textSmallSemiBold, { color: colors.dimmed }]} numberOfLines={1}>{item.position}</Text>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
))}
|
||||
</View>
|
||||
)}
|
||||
{error.member && (
|
||||
<Text style={[Styles.textMediumNormal, Styles.mt05, { color: colors.error }]}>
|
||||
Anggota tidak boleh kosong
|
||||
</Text>
|
||||
)}
|
||||
</View>
|
||||
|
||||
</View>
|
||||
</ScrollView>
|
||||
<DrawerBottom animation="slide" isVisible={isModal} setVisible={setModal} title="Menu">
|
||||
|
||||
@@ -179,6 +179,8 @@ export default function CreateProjectAddTask() {
|
||||
day_label: { color: colors.text },
|
||||
time_label: { color: colors.text },
|
||||
weekday_label: { color: colors.text },
|
||||
button_next_image: { tintColor: colors.text },
|
||||
button_prev_image: { tintColor: colors.text },
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
@@ -204,14 +206,7 @@ export default function CreateProjectAddTask() {
|
||||
{
|
||||
(error.endDate || error.startDate) && <Text style={[Styles.textInformation, Styles.mt05, { color: colors.error }]}>Tanggal tidak boleh kosong</Text>
|
||||
}
|
||||
{/* <Pressable
|
||||
style={[Styles.btnTab, Styles.btnLainnya, dsbButton && Styles.btnDisabled]}
|
||||
disabled={dsbButton}
|
||||
onPress={() => { setModalDetail(true) }}
|
||||
>
|
||||
<Text style={[dsbButton ? Styles.cGray : Styles.cWhite]}>Detail</Text>
|
||||
</Pressable> */}
|
||||
<ButtonSelect value="Detail" onPress={() => { setModalDetail(true) }} />
|
||||
<ButtonSelect value="Detail" onPress={() => { setModalDetail(true) }} disabled={from == "" || to == ""} />
|
||||
</View>
|
||||
<InputForm
|
||||
label="Judul Tugas"
|
||||
|
||||
@@ -18,10 +18,12 @@ import {
|
||||
Ionicons,
|
||||
MaterialCommunityIcons,
|
||||
} from "@expo/vector-icons";
|
||||
import { useInfiniteQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { router, useLocalSearchParams } from "expo-router";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { Pressable, RefreshControl, ScrollView, View, VirtualizedList } from "react-native";
|
||||
import { useSelector } from "react-redux";
|
||||
import AsyncStorage from "@react-native-async-storage/async-storage";
|
||||
|
||||
type Props = {
|
||||
id: string;
|
||||
@@ -40,28 +42,41 @@ export default function ListProject() {
|
||||
cat?: string;
|
||||
year?: string;
|
||||
}>();
|
||||
const [statusFix, setStatusFix] = useState<'0' | '1' | '2' | '3'>('0')
|
||||
const [statusFix, setStatusFix] = useState<'0' | '1' | '2' | '3'>(
|
||||
(status == '1' || status == '2' || status == '3') ? status : '0'
|
||||
)
|
||||
const { token, decryptToken } = useAuthSession();
|
||||
const { colors } = useTheme();
|
||||
const entityUser = useSelector((state: any) => state.user)
|
||||
const [search, setSearch] = useState("")
|
||||
const [nameGroup, setNameGroup] = useState("")
|
||||
// ... state same ...
|
||||
const [isYear, setYear] = useState("")
|
||||
const [data, setData] = useState<Props[]>([])
|
||||
const [isList, setList] = useState(false)
|
||||
const update = useSelector((state: any) => state.projectUpdate)
|
||||
const [loading, setLoading] = useState(true)
|
||||
const arrSkeleton = Array.from({ length: 3 }, (_, index) => index)
|
||||
const [page, setPage] = useState(1)
|
||||
const [waiting, setWaiting] = useState(false)
|
||||
|
||||
useEffect(() => {
|
||||
AsyncStorage.getItem('division_view_mode').then((val) => {
|
||||
if (val !== null) setList(val === 'list')
|
||||
})
|
||||
}, [])
|
||||
|
||||
function toggleView() {
|
||||
const next = !isList
|
||||
setList(next)
|
||||
AsyncStorage.setItem('division_view_mode', next ? 'list' : 'grid')
|
||||
}
|
||||
const queryClient = useQueryClient()
|
||||
const [refreshing, setRefreshing] = useState(false)
|
||||
|
||||
async function handleLoad(loading: boolean, thisPage: number) {
|
||||
try {
|
||||
setLoading(loading)
|
||||
setWaiting(true)
|
||||
setPage(thisPage)
|
||||
// TanStack Query for Projects with Infinite Scroll
|
||||
const {
|
||||
data,
|
||||
fetchNextPage,
|
||||
hasNextPage,
|
||||
isFetchingNextPage,
|
||||
isLoading,
|
||||
refetch
|
||||
} = useInfiniteQuery({
|
||||
queryKey: ['projects', { statusFix, search, group, cat, year }],
|
||||
queryFn: async ({ pageParam = 1 }) => {
|
||||
const hasil = await decryptToken(String(token?.current));
|
||||
const response = await apiGetProject({
|
||||
user: hasil,
|
||||
@@ -69,60 +84,55 @@ export default function ListProject() {
|
||||
search: search,
|
||||
group: String(group),
|
||||
kategori: String(cat),
|
||||
page: thisPage,
|
||||
page: pageParam,
|
||||
year: String(year)
|
||||
});
|
||||
return response;
|
||||
},
|
||||
initialPageParam: 1,
|
||||
getNextPageParam: (lastPage, allPages) => {
|
||||
return lastPage.data.length > 0 ? allPages.length + 1 : undefined;
|
||||
},
|
||||
enabled: !!token?.current,
|
||||
staleTime: 0,
|
||||
})
|
||||
|
||||
if (response.success) {
|
||||
setNameGroup(response.filter.name);
|
||||
setYear(response.tahun)
|
||||
if (thisPage == 1) {
|
||||
setData(response.data);
|
||||
} else if (thisPage > 1 && response.data.length > 0) {
|
||||
setData([...data, ...response.data])
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
setLoading(false)
|
||||
setWaiting(false)
|
||||
}
|
||||
}
|
||||
|
||||
// Refetch when manual update state changes
|
||||
useEffect(() => {
|
||||
handleLoad(false, 1);
|
||||
}, [update.data]);
|
||||
refetch()
|
||||
}, [update.data, refetch])
|
||||
|
||||
// Flatten pages into a single data array
|
||||
const flatData = useMemo(() => {
|
||||
return data?.pages.flatMap(page => page.data) || [];
|
||||
}, [data])
|
||||
|
||||
useEffect(() => {
|
||||
handleLoad(true, 1);
|
||||
}, [statusFix, search, group, cat, year]);
|
||||
|
||||
const loadMoreData = () => {
|
||||
if (waiting) return
|
||||
setTimeout(() => {
|
||||
handleLoad(false, page + 1)
|
||||
}, 1000);
|
||||
}
|
||||
// Get metadata from the first available page
|
||||
const nameGroup = useMemo(() => data?.pages[0]?.filter?.name || "", [data])
|
||||
const isYear = useMemo(() => data?.pages[0]?.tahun || "", [data])
|
||||
|
||||
const handleRefresh = async () => {
|
||||
setRefreshing(true)
|
||||
handleLoad(false, 1)
|
||||
await new Promise(resolve => setTimeout(resolve, 2000));
|
||||
await queryClient.invalidateQueries({ queryKey: ['projects'] })
|
||||
setRefreshing(false)
|
||||
}
|
||||
};
|
||||
|
||||
const loadMoreData = () => {
|
||||
if (hasNextPage && !isFetchingNextPage) {
|
||||
fetchNextPage()
|
||||
}
|
||||
};
|
||||
|
||||
const arrSkeleton = [0, 1, 2]
|
||||
|
||||
const getItem = (_data: unknown, index: number): Props => ({
|
||||
id: data[index].id,
|
||||
title: data[index].title,
|
||||
desc: data[index].desc,
|
||||
status: data[index].status,
|
||||
member: data[index].member,
|
||||
progress: data[index].progress,
|
||||
createdAt: data[index].createdAt,
|
||||
id: flatData[index]?.id,
|
||||
title: flatData[index]?.title,
|
||||
desc: flatData[index]?.desc,
|
||||
status: flatData[index]?.status,
|
||||
member: flatData[index]?.member,
|
||||
progress: flatData[index]?.progress,
|
||||
createdAt: flatData[index]?.createdAt,
|
||||
})
|
||||
|
||||
return (
|
||||
@@ -191,11 +201,7 @@ export default function ListProject() {
|
||||
|
||||
<View style={[Styles.rowSpaceBetween, Styles.rowItemsCenter]}>
|
||||
<InputSearch width={68} onChange={setSearch} />
|
||||
<Pressable
|
||||
onPress={() => {
|
||||
setList(!isList);
|
||||
}}
|
||||
>
|
||||
<Pressable onPress={toggleView}>
|
||||
<MaterialCommunityIcons
|
||||
name={isList ? "format-list-bulleted" : "view-grid"}
|
||||
color={colors.text}
|
||||
@@ -205,7 +211,6 @@ export default function ListProject() {
|
||||
</View>
|
||||
<View style={[Styles.mt10]}>
|
||||
{
|
||||
// entityUser.role != 'cosupadmin' && entityUser.role != 'admin' &&
|
||||
<View style={[Styles.rowOnly]}>
|
||||
<Text style={[Styles.mr05]}>Filter :</Text>
|
||||
{
|
||||
@@ -218,18 +223,13 @@ export default function ListProject() {
|
||||
: ''
|
||||
}
|
||||
<LabelStatus size="small" category="secondary" text={isYear} style={[Styles.mr05]} />
|
||||
{/* {
|
||||
(entityUser.role == 'user' || entityUser.role == 'coadmin')
|
||||
? (cat == 'null' || cat == 'undefined' || cat == undefined || cat == '' || cat == 'data-saya') ? <LabelStatus size="small" category="primary" text="Kegiatan Saya" /> : <LabelStatus size="small" category="primary" text="Semua Kegiatan" />
|
||||
: ''
|
||||
} */}
|
||||
</View>
|
||||
}
|
||||
</View>
|
||||
</View>
|
||||
<View style={[Styles.flex2, Styles.mt10]}>
|
||||
{
|
||||
loading ?
|
||||
isLoading ?
|
||||
isList ?
|
||||
arrSkeleton.map((item, index) => (
|
||||
<SkeletonTwoItem key={index} />
|
||||
@@ -239,13 +239,13 @@ export default function ListProject() {
|
||||
<Skeleton key={index} width={100} height={180} widthType="percent" borderRadius={10} />
|
||||
))
|
||||
:
|
||||
data.length > 0
|
||||
flatData.length > 0
|
||||
?
|
||||
isList ? (
|
||||
<View style={[Styles.h100]}>
|
||||
<VirtualizedList
|
||||
data={data}
|
||||
getItemCount={() => data.length}
|
||||
data={flatData}
|
||||
getItemCount={() => flatData.length}
|
||||
getItem={getItem}
|
||||
renderItem={({ item, index }: { item: Props, index: number }) => {
|
||||
return (
|
||||
@@ -279,35 +279,12 @@ export default function ListProject() {
|
||||
/>
|
||||
}
|
||||
/>
|
||||
{/* {
|
||||
data.map((item, index) => {
|
||||
return (
|
||||
<BorderBottomItem
|
||||
key={index}
|
||||
onPress={() => { router.push(`/project/${item.id}`); }}
|
||||
borderType="bottom"
|
||||
icon={
|
||||
<View
|
||||
style={[Styles.iconContent, ColorsStatus.lightGreen]}
|
||||
>
|
||||
<AntDesign
|
||||
name="areachart"
|
||||
size={25}
|
||||
color={"#384288"}
|
||||
/>
|
||||
</View>
|
||||
}
|
||||
title={item.title}
|
||||
/>
|
||||
);
|
||||
})
|
||||
} */}
|
||||
</View>
|
||||
) : (
|
||||
<View style={[Styles.h100]}>
|
||||
<VirtualizedList
|
||||
data={data}
|
||||
getItemCount={() => data.length}
|
||||
data={flatData}
|
||||
getItemCount={() => flatData.length}
|
||||
getItem={getItem}
|
||||
renderItem={({ item, index }: { item: Props, index: number }) => {
|
||||
return (
|
||||
@@ -359,43 +336,6 @@ export default function ListProject() {
|
||||
/>
|
||||
}
|
||||
/>
|
||||
{/* {data.map((item, index) => {
|
||||
return (
|
||||
<PaperGridContent
|
||||
key={index}
|
||||
onPress={() => {
|
||||
router.push(`/project/${item.id}`);
|
||||
}}
|
||||
content="page"
|
||||
title={item.title}
|
||||
headerColor="primary"
|
||||
>
|
||||
<ProgressBar value={item.progress} category="list" />
|
||||
<View style={[Styles.rowSpaceBetween]}>
|
||||
<Text style={[Styles.textDefault, { color: colors.dimmed }]}>
|
||||
{item.createdAt}
|
||||
</Text>
|
||||
<LabelStatus
|
||||
size="default"
|
||||
category={
|
||||
item.status === 0 ? 'primary' :
|
||||
item.status === 1 ? 'warning' :
|
||||
item.status === 2 ? 'success' :
|
||||
item.status === 3 ? 'error' :
|
||||
'primary'
|
||||
}
|
||||
text={
|
||||
item.status === 0 ? 'SEGERA' :
|
||||
item.status === 1 ? 'DIKERJAKAN' :
|
||||
item.status === 2 ? 'SELESAI' :
|
||||
item.status === 3 ? 'DIBATALKAN' :
|
||||
'SEGERA'
|
||||
}
|
||||
/>
|
||||
</View>
|
||||
</PaperGridContent>
|
||||
);
|
||||
})} */}
|
||||
</View>
|
||||
)
|
||||
:
|
||||
|
||||
@@ -229,6 +229,8 @@ export default function UpdateProjectTask() {
|
||||
day_label: { color: colors.text },
|
||||
time_label: { color: colors.text },
|
||||
weekday_label: { color: colors.text },
|
||||
button_next_image: { tintColor: colors.text },
|
||||
button_prev_image: { tintColor: colors.text },
|
||||
}}
|
||||
/>
|
||||
}
|
||||
@@ -259,7 +261,7 @@ export default function UpdateProjectTask() {
|
||||
>
|
||||
<Text style={[dsbButton ? Styles.cGray : Styles.cWhite]}>Detail</Text>
|
||||
</Pressable> */}
|
||||
<ButtonSelect value="Detail" onPress={() => { setModalDetail(true) }} />
|
||||
<ButtonSelect value="Detail" onPress={() => { setModalDetail(true) }} disabled={from == "" || to == ""} />
|
||||
</View>
|
||||
<InputForm
|
||||
label="Judul Tugas"
|
||||
|
||||
@@ -9,13 +9,12 @@ import Styles from "@/constants/Styles";
|
||||
import { apiGetSearch } from "@/lib/api";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
import { AntDesign, MaterialIcons } from "@expo/vector-icons";
|
||||
import { AntDesign, Feather, MaterialIcons } from "@expo/vector-icons";
|
||||
import { router, Stack } from "expo-router";
|
||||
import React, { useState } from "react";
|
||||
import { RefreshControl, SafeAreaView, ScrollView, View } from "react-native";
|
||||
import { RefreshControl, SafeAreaView, ScrollView, TouchableOpacity, View } from "react-native";
|
||||
import Toast from "react-native-toast-message";
|
||||
|
||||
// ... types ...
|
||||
type PropsUser = {
|
||||
id: string
|
||||
name: string
|
||||
@@ -38,6 +37,27 @@ type PropDivisi = {
|
||||
group: string
|
||||
}
|
||||
|
||||
type FilterType = "all" | "member" | "division" | "project"
|
||||
|
||||
function SectionHeader({ label, count, colors }: { label: string; count: number; colors: any }) {
|
||||
return (
|
||||
<View style={[Styles.rowItemsCenter, Styles.mb08]}>
|
||||
<Text style={{ fontSize: 11, fontWeight: '600', color: colors.dimmed, letterSpacing: 0.8, textTransform: 'uppercase' }}>
|
||||
{label}
|
||||
</Text>
|
||||
<View style={{
|
||||
marginLeft: 6,
|
||||
backgroundColor: colors.icon + '25',
|
||||
borderRadius: 10,
|
||||
paddingHorizontal: 7,
|
||||
paddingVertical: 1,
|
||||
}}>
|
||||
<Text style={{ fontSize: 11, color: colors.dimmed, fontWeight: '600' }}>{count}</Text>
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
export default function Search() {
|
||||
const { token, decryptToken } = useAuthSession()
|
||||
const [dataUser, setDataUser] = useState<PropsUser[]>([])
|
||||
@@ -45,11 +65,16 @@ export default function Search() {
|
||||
const [dataProject, setDataProject] = useState<PropProject[]>([])
|
||||
const [refreshing, setRefreshing] = useState(false)
|
||||
const [search, setSearch] = useState('')
|
||||
const [activeFilter, setActiveFilter] = useState<FilterType>("all")
|
||||
const { colors } = useTheme();
|
||||
|
||||
const totalResults = dataUser.length + dataDivisi.length + dataProject.length
|
||||
const hasSearch = search.length >= 3
|
||||
|
||||
async function handleSearch(cari: string) {
|
||||
try {
|
||||
setSearch(cari)
|
||||
setActiveFilter("all")
|
||||
if (cari.length >= 3) {
|
||||
const user = await decryptToken(String(token?.current))
|
||||
const hasil = await apiGetSearch({ text: cari, user: user })
|
||||
@@ -58,7 +83,7 @@ export default function Search() {
|
||||
setDataDivisi(hasil.data.division)
|
||||
setDataProject(hasil.data.project)
|
||||
} else {
|
||||
return Toast.show({ type: 'small', text1: hasil.message, })
|
||||
return Toast.show({ type: 'small', text1: hasil.message })
|
||||
}
|
||||
} else {
|
||||
setDataUser([])
|
||||
@@ -68,15 +93,10 @@ export default function Search() {
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal melakukan pencarian"
|
||||
|
||||
Toast.show({
|
||||
type: 'small',
|
||||
text1: message
|
||||
})
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const handleRefresh = async () => {
|
||||
setRefreshing(true)
|
||||
handleSearch(search)
|
||||
@@ -84,114 +104,203 @@ export default function Search() {
|
||||
setRefreshing(false)
|
||||
};
|
||||
|
||||
const filters: { key: FilterType; label: string; count: number }[] = [
|
||||
{ key: "all", label: "Semua", count: totalResults },
|
||||
{ key: "member", label: "Anggota", count: dataUser.length },
|
||||
{ key: "division", label: "Divisi", count: dataDivisi.length },
|
||||
{ key: "project", label: "Kegiatan", count: dataProject.length },
|
||||
]
|
||||
|
||||
const showUser = activeFilter === "all" || activeFilter === "member"
|
||||
const showDivision = activeFilter === "all" || activeFilter === "division"
|
||||
const showProject = activeFilter === "all" || activeFilter === "project"
|
||||
|
||||
const activeFilterEmpty =
|
||||
(activeFilter === "member" && dataUser.length === 0) ||
|
||||
(activeFilter === "division" && dataDivisi.length === 0) ||
|
||||
(activeFilter === "project" && dataProject.length === 0)
|
||||
|
||||
return (
|
||||
<>
|
||||
<SafeAreaView style={[Styles.flex1, { backgroundColor: colors.background }]}>
|
||||
<Stack.Screen
|
||||
options={{
|
||||
headerTitle: 'Pencarian',
|
||||
headerTitleAlign: 'center',
|
||||
header: () => (
|
||||
<AppHeader title="Pencarian" showBack={true} onPressLeft={() => router.back()} />
|
||||
)
|
||||
}}
|
||||
/>
|
||||
<View style={[Styles.p15]}>
|
||||
<SafeAreaView style={[Styles.flex1, { backgroundColor: colors.background }]}>
|
||||
<Stack.Screen
|
||||
options={{
|
||||
headerTitle: 'Pencarian',
|
||||
headerTitleAlign: 'center',
|
||||
header: () => (
|
||||
<AppHeader title="Pencarian" showBack={true} onPressLeft={() => router.back()} />
|
||||
)
|
||||
}}
|
||||
/>
|
||||
|
||||
<View style={[Styles.flex1]}>
|
||||
{/* Search bar */}
|
||||
<View style={[Styles.ph15, { paddingTop: 15 }]}>
|
||||
<InputSearch onChange={handleSearch} />
|
||||
{
|
||||
dataProject.length + dataDivisi.length + dataUser.length > 0
|
||||
?
|
||||
<ScrollView
|
||||
style={[Styles.h100]}
|
||||
refreshControl={
|
||||
<RefreshControl
|
||||
refreshing={refreshing}
|
||||
onRefresh={handleRefresh}
|
||||
tintColor={colors.icon}
|
||||
/>
|
||||
}
|
||||
>
|
||||
{
|
||||
dataUser.length > 0 &&
|
||||
<View style={[Styles.mv05, Styles.p10]}>
|
||||
<Text>ANGGOTA</Text>
|
||||
{
|
||||
dataUser.map((item, index) => (
|
||||
<BorderBottomItem
|
||||
key={index}
|
||||
borderType="bottom"
|
||||
icon={<ImageUser src={`${ConstEnv.url_storage}/files/${item.img}`} />}
|
||||
title={item.name}
|
||||
subtitle={`${item.group}-${item.position}`}
|
||||
onPress={() => {
|
||||
router.push(`/member/${item.id}`)
|
||||
}}
|
||||
/>
|
||||
))
|
||||
}
|
||||
</View>
|
||||
}
|
||||
|
||||
{
|
||||
dataDivisi.length > 0 &&
|
||||
<View style={[Styles.mv05, Styles.p10]}>
|
||||
<Text>DIVISI</Text>
|
||||
{
|
||||
dataDivisi.map((item, index) => (
|
||||
<BorderBottomItem
|
||||
key={index}
|
||||
borderType="bottom"
|
||||
icon={
|
||||
<View style={[Styles.iconContent, ColorsStatus.primary]}>
|
||||
<MaterialIcons name="group" size={25} color="white" />
|
||||
</View>
|
||||
}
|
||||
title={item.name}
|
||||
subtitle={item.group}
|
||||
onPress={() => {
|
||||
router.push(`/division/${item.id}`)
|
||||
}}
|
||||
/>
|
||||
))
|
||||
}
|
||||
</View>
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
dataProject.length > 0 &&
|
||||
<View style={[Styles.mv05, Styles.p10]}>
|
||||
<Text>KEGIATAN</Text>
|
||||
{
|
||||
dataProject.map((item, index) => (
|
||||
<BorderBottomItem
|
||||
key={index}
|
||||
borderType="bottom"
|
||||
icon={
|
||||
<View style={[Styles.iconContent, ColorsStatus.primary]}>
|
||||
<AntDesign name="areachart" size={25} color="white" />
|
||||
</View>
|
||||
}
|
||||
title={item.title}
|
||||
subtitle={item.group}
|
||||
onPress={() => {
|
||||
router.push(`/project/${item.id}`)
|
||||
}}
|
||||
/>
|
||||
))
|
||||
}
|
||||
</View>
|
||||
}
|
||||
</ScrollView>
|
||||
:
|
||||
<View style={[Styles.contentItemCenter, Styles.mt10]}>
|
||||
<Text style={[Styles.textInformation, { color: colors.icon }]}>Tidak ada data</Text>
|
||||
</View>
|
||||
}
|
||||
|
||||
</View>
|
||||
</SafeAreaView>
|
||||
</>
|
||||
|
||||
{/* Filter tabs */}
|
||||
{hasSearch && totalResults > 0 && (
|
||||
<View style={{ marginTop: 10, flexShrink: 0 }}>
|
||||
<ScrollView
|
||||
horizontal
|
||||
showsHorizontalScrollIndicator={false}
|
||||
contentContainerStyle={[Styles.ph15, { paddingRight: 5, alignItems: 'center' }]}
|
||||
>
|
||||
{filters.map((f) => {
|
||||
const isActive = activeFilter === f.key
|
||||
return (
|
||||
<TouchableOpacity
|
||||
key={f.key}
|
||||
onPress={() => setActiveFilter(f.key)}
|
||||
style={{
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
paddingVertical: 6,
|
||||
paddingHorizontal: 14,
|
||||
borderRadius: 20,
|
||||
marginRight: 8,
|
||||
borderWidth: 1,
|
||||
borderColor: isActive ? colors.tabActive : colors.icon + '40',
|
||||
backgroundColor: isActive ? colors.tabActive + '20' : 'transparent',
|
||||
}}
|
||||
>
|
||||
<Text style={{
|
||||
fontSize: 13,
|
||||
color: isActive ? colors.tabActive : colors.dimmed,
|
||||
fontWeight: isActive ? '600' : 'normal',
|
||||
}}>
|
||||
{f.label}
|
||||
</Text>
|
||||
{f.count > 0 && (
|
||||
<View style={{
|
||||
marginLeft: 5,
|
||||
backgroundColor: isActive ? colors.tabActive : colors.icon + '30',
|
||||
borderRadius: 10,
|
||||
minWidth: 18,
|
||||
height: 18,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
paddingHorizontal: 4,
|
||||
}}>
|
||||
<Text style={{ fontSize: 11, color: isActive ? 'white' : colors.dimmed, fontWeight: '600' }}>
|
||||
{f.count}
|
||||
</Text>
|
||||
</View>
|
||||
)}
|
||||
</TouchableOpacity>
|
||||
)
|
||||
})}
|
||||
</ScrollView>
|
||||
</View>
|
||||
)}
|
||||
|
||||
{/* Content */}
|
||||
<View style={[Styles.flex1]}>
|
||||
{!hasSearch ? (
|
||||
<View style={[Styles.contentItemCenter, Styles.mt30]}>
|
||||
<Feather name="search" size={42} color={colors.icon + '40'} />
|
||||
<Text style={[Styles.mt10, { color: colors.dimmed, fontSize: 14 }]}>
|
||||
Ketik minimal 3 karakter untuk mencari
|
||||
</Text>
|
||||
</View>
|
||||
) : totalResults === 0 ? (
|
||||
<View style={[Styles.contentItemCenter, Styles.mt30]}>
|
||||
<Feather name="inbox" size={42} color={colors.icon + '40'} />
|
||||
<Text style={[Styles.mt10, { color: colors.dimmed, fontSize: 14 }]}>
|
||||
Tidak ada hasil untuk "{search}"
|
||||
</Text>
|
||||
</View>
|
||||
) : (
|
||||
<ScrollView
|
||||
style={[Styles.flex1]}
|
||||
contentContainerStyle={[Styles.ph15, { paddingTop: 14, paddingBottom: 30 }]}
|
||||
showsVerticalScrollIndicator={false}
|
||||
refreshControl={
|
||||
<RefreshControl
|
||||
refreshing={refreshing}
|
||||
onRefresh={handleRefresh}
|
||||
tintColor={colors.icon}
|
||||
/>
|
||||
}
|
||||
>
|
||||
{/* Anggota */}
|
||||
{showUser && dataUser.length > 0 && (
|
||||
<View style={[Styles.mb15]}>
|
||||
<SectionHeader label="Anggota" count={dataUser.length} colors={colors} />
|
||||
{dataUser.map((item, index) => (
|
||||
<View key={index} style={index < dataUser.length - 1 ? Styles.mb05 : undefined}>
|
||||
<BorderBottomItem
|
||||
borderType="all"
|
||||
icon={<ImageUser src={`${ConstEnv.url_storage}/files/${item.img}`} />}
|
||||
title={item.name}
|
||||
subtitle={`${item.group} · ${item.position}`}
|
||||
onPress={() => router.push(`/member/${item.id}`)}
|
||||
colorPress
|
||||
/>
|
||||
</View>
|
||||
))}
|
||||
</View>
|
||||
)}
|
||||
|
||||
{/* Divisi */}
|
||||
{showDivision && dataDivisi.length > 0 && (
|
||||
<View style={[Styles.mb15]}>
|
||||
<SectionHeader label="Divisi" count={dataDivisi.length} colors={colors} />
|
||||
{dataDivisi.map((item, index) => (
|
||||
<View key={index} style={index < dataDivisi.length - 1 ? Styles.mb05 : undefined}>
|
||||
<BorderBottomItem
|
||||
borderType="all"
|
||||
icon={
|
||||
<View style={[Styles.iconContent, ColorsStatus.primary]}>
|
||||
<MaterialIcons name="group" size={25} color="white" />
|
||||
</View>
|
||||
}
|
||||
title={item.name}
|
||||
subtitle={item.group}
|
||||
onPress={() => router.push(`/division/${item.id}`)}
|
||||
colorPress
|
||||
/>
|
||||
</View>
|
||||
))}
|
||||
</View>
|
||||
)}
|
||||
|
||||
{/* Kegiatan */}
|
||||
{showProject && dataProject.length > 0 && (
|
||||
<View style={[Styles.mb15]}>
|
||||
<SectionHeader label="Kegiatan" count={dataProject.length} colors={colors} />
|
||||
{dataProject.map((item, index) => (
|
||||
<View key={index} style={index < dataProject.length - 1 ? Styles.mb05 : undefined}>
|
||||
<BorderBottomItem
|
||||
borderType="all"
|
||||
icon={
|
||||
<View style={[Styles.iconContent, ColorsStatus.primary]}>
|
||||
<AntDesign name="areachart" size={25} color="white" />
|
||||
</View>
|
||||
}
|
||||
title={item.title}
|
||||
subtitle={item.group}
|
||||
onPress={() => router.push(`/project/${item.id}`)}
|
||||
colorPress
|
||||
/>
|
||||
</View>
|
||||
))}
|
||||
</View>
|
||||
)}
|
||||
|
||||
{/* Empty state untuk filter aktif */}
|
||||
{activeFilter !== "all" && activeFilterEmpty && (
|
||||
<View style={[Styles.contentItemCenter, Styles.mt30]}>
|
||||
<Feather name="inbox" size={42} color={colors.icon + '40'} />
|
||||
<Text style={[Styles.mt10, { color: colors.dimmed, fontSize: 14 }]}>
|
||||
Tidak ada hasil di kategori ini
|
||||
</Text>
|
||||
</View>
|
||||
)}
|
||||
</ScrollView>
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
</SafeAreaView>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
import { Feather, Ionicons } from "@expo/vector-icons";
|
||||
import AsyncStorage from "@react-native-async-storage/async-storage";
|
||||
import Constants from "expo-constants";
|
||||
import { router } from "expo-router";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import { AppState, AppStateStatus, Pressable, View } from "react-native";
|
||||
@@ -196,6 +197,10 @@ export default function ListSetting() {
|
||||
<ThemeOption label="Gelap" value="dark" icon="moon-outline" />
|
||||
<ThemeOption label="Sistem" value="system" icon="phone-portrait-outline" />
|
||||
</DrawerBottom>
|
||||
|
||||
<Text style={{ color: colors.icon, textAlign: 'center', marginTop: 'auto', fontSize: 12 }}>
|
||||
Versi {Constants.expoConfig?.version}
|
||||
</Text>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
304
app/(application)/village-calendar/index.tsx
Normal file
304
app/(application)/village-calendar/index.tsx
Normal file
@@ -0,0 +1,304 @@
|
||||
import AppHeader from "@/components/AppHeader";
|
||||
import ItemDateCalendar from "@/components/calendar/itemDateCalendar";
|
||||
import GuideOverlay from "@/components/GuideOverlay";
|
||||
import Skeleton from "@/components/skeleton";
|
||||
import Text from "@/components/Text";
|
||||
import Styles from "@/constants/Styles";
|
||||
import { apiGetVillageCalendarByDate, apiGetVillageCalendarIndicator } from "@/lib/api";
|
||||
import { GUIDE_VILLAGE_CALENDAR } from "@/lib/guideSteps";
|
||||
import { useGuide } from "@/lib/useGuide";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
import { Feather } from "@expo/vector-icons";
|
||||
import { router, Stack } from "expo-router";
|
||||
import 'intl';
|
||||
import 'intl/locale-data/jsonp/id';
|
||||
import moment from "moment";
|
||||
import "moment/locale/id";
|
||||
import { useEffect, useState } from "react";
|
||||
import { Pressable, RefreshControl, SafeAreaView, ScrollView, View } from "react-native";
|
||||
import Datepicker, {
|
||||
CalendarComponents,
|
||||
CalendarDay
|
||||
} from "react-native-ui-datepicker";
|
||||
moment.locale('id');
|
||||
|
||||
type EventItem = {
|
||||
id: string;
|
||||
type: 'calendar' | 'task';
|
||||
title: string;
|
||||
desc: string;
|
||||
dateStart: string;
|
||||
dateEnd: string;
|
||||
timeStart: string | null;
|
||||
timeEnd: string | null;
|
||||
divisionName: string | null;
|
||||
projectName: string | null;
|
||||
idDivision: string | null;
|
||||
idRef: string;
|
||||
};
|
||||
|
||||
const TYPE_COLORS = {
|
||||
calendar: {
|
||||
light: { bg: '#A9B5DF', stick: '#7886C7' },
|
||||
dark: { bg: '#2D2B5E', stick: '#7886C7' },
|
||||
},
|
||||
task: {
|
||||
light: { bg: '#D6E6F2', stick: '#94B4C1' },
|
||||
dark: { bg: '#1C3347', stick: '#94B4C1' },
|
||||
},
|
||||
};
|
||||
|
||||
function VillageEventItem({ item, onPress }: { item: EventItem; onPress: () => void }) {
|
||||
const { activeTheme, colors } = useTheme();
|
||||
const palette = TYPE_COLORS[item.type][activeTheme === 'dark' ? 'dark' : 'light'];
|
||||
|
||||
return (
|
||||
<Pressable
|
||||
style={[Styles.itemEvent, { backgroundColor: palette.bg }]}
|
||||
onPress={onPress}
|
||||
>
|
||||
<View style={[Styles.dividerEvent, { backgroundColor: palette.stick }]} />
|
||||
<View style={[Styles.flex1]}>
|
||||
{item.timeStart ? (
|
||||
<Text style={[Styles.textMediumNormal, { color: activeTheme === 'dark' ? '#ffffff' : '#000000' }]}>
|
||||
{item.timeStart} - {item.timeEnd}
|
||||
</Text>
|
||||
) : (
|
||||
<Text style={[Styles.textMediumNormal, { color: activeTheme === 'dark' ? '#ffffff' : '#000000' }]}>
|
||||
{moment(item.dateStart).format('D MMM YYYY')} – {moment(item.dateEnd).format('D MMM YYYY')}
|
||||
</Text>
|
||||
)}
|
||||
<Text numberOfLines={1} ellipsizeMode="tail" style={[Styles.textDefaultSemiBold, { color: colors.text }]}>
|
||||
{item.title}
|
||||
</Text>
|
||||
<View style={[Styles.rowItemsCenter]}>
|
||||
<View style={[Styles.villageEventBadge, { backgroundColor: palette.stick }]}>
|
||||
<Text style={[Styles.textSmallSemiBold, { color: '#ffffff' }]}>
|
||||
{item.type === 'calendar' ? 'Divisi' : 'Kegiatan'}
|
||||
</Text>
|
||||
</View>
|
||||
<Text numberOfLines={1} ellipsizeMode="tail" style={[Styles.textMediumNormal, { color: activeTheme === 'dark' ? '#ffffff' : '#000000', flex: 1 }]}>
|
||||
{item.type === 'calendar' ? item.divisionName : item.projectName}
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
</Pressable>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
export default function VillageCalendar() {
|
||||
const { colors, activeTheme } = useTheme();
|
||||
const { token, decryptToken } = useAuthSession();
|
||||
const { visible: guideVisible, dismiss: dismissGuide } = useGuide('village-calendar');
|
||||
const [selected, setSelected] = useState<any>(new Date());
|
||||
const [data, setData] = useState<EventItem[]>([]);
|
||||
const [dataIndicator, setDataIndicator] = useState<{ calendar: string[], task: string[] }>({ calendar: [], task: [] });
|
||||
const [month, setMonth] = useState<number>(new Date().getMonth());
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [loadingBtn, setLoadingBtn] = useState(false);
|
||||
const [refreshing, setRefreshing] = useState(false);
|
||||
|
||||
async function handleLoad(showLoading: boolean) {
|
||||
try {
|
||||
setLoading(showLoading);
|
||||
const hasil = await decryptToken(String(token?.current));
|
||||
const response = await apiGetVillageCalendarByDate({
|
||||
user: hasil,
|
||||
date: moment(selected).format("YYYY-MM-DD"),
|
||||
});
|
||||
setData(response.data);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleLoadIndicator() {
|
||||
try {
|
||||
setLoadingBtn(true);
|
||||
const newDate = new Date(selected?.getFullYear(), month, 1);
|
||||
const hasil = await decryptToken(String(token?.current));
|
||||
const response = await apiGetVillageCalendarIndicator({
|
||||
user: hasil,
|
||||
date: moment(newDate).format("YYYY-MM-DD"),
|
||||
});
|
||||
setDataIndicator(response.data ?? { calendar: [], task: [] });
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
setTimeout(() => setLoadingBtn(false), 500);
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
handleLoad(true);
|
||||
}, [selected]);
|
||||
|
||||
useEffect(() => {
|
||||
handleLoadIndicator();
|
||||
}, [month]);
|
||||
|
||||
const handleRefresh = async () => {
|
||||
setRefreshing(true);
|
||||
handleLoad(false);
|
||||
handleLoadIndicator();
|
||||
await new Promise(resolve => setTimeout(resolve, 1500));
|
||||
setRefreshing(false);
|
||||
};
|
||||
|
||||
function handlePressEvent(item: EventItem) {
|
||||
if (item.type === 'calendar') {
|
||||
router.push(`/division/${item.idDivision}/calendar/${item.id}` as any);
|
||||
} else {
|
||||
router.push(`/project/${item.idRef}` as any);
|
||||
}
|
||||
}
|
||||
|
||||
const calendarEvents = data.filter(e => e.type === 'calendar');
|
||||
const taskEvents = data.filter(e => e.type === 'task');
|
||||
|
||||
const components: CalendarComponents = {
|
||||
Day: (day: CalendarDay) => {
|
||||
const today = moment(String(day.date)).format("YYYY-MM-DD");
|
||||
return (
|
||||
<ItemDateCalendar
|
||||
text={day.text}
|
||||
isSelected={day.isSelected}
|
||||
isSignCalendar={dataIndicator.calendar.includes(today)}
|
||||
isSignTask={dataIndicator.task.includes(today)}
|
||||
onPress={() => setSelected(new Date(today))}
|
||||
/>
|
||||
);
|
||||
},
|
||||
IconNext: (
|
||||
<Pressable onPress={() => !loadingBtn && setMonth(month + 1)}>
|
||||
<Feather name="chevron-right" size={20} color={loadingBtn ? 'gray' : colors.text} />
|
||||
</Pressable>
|
||||
),
|
||||
IconPrev: (
|
||||
<Pressable onPress={() => !loadingBtn && setMonth(month - 1)}>
|
||||
<Feather name="chevron-left" size={20} color={loadingBtn ? 'gray' : colors.text} />
|
||||
</Pressable>
|
||||
),
|
||||
};
|
||||
|
||||
return (
|
||||
<SafeAreaView style={{ flex: 1, backgroundColor: colors.background }}>
|
||||
<Stack.Screen
|
||||
options={{
|
||||
headerShown: true,
|
||||
header: () => (
|
||||
<AppHeader
|
||||
title="Kalender"
|
||||
showBack={true}
|
||||
onPressLeft={() => router.back()}
|
||||
/>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
<GuideOverlay
|
||||
visible={guideVisible}
|
||||
steps={GUIDE_VILLAGE_CALENDAR}
|
||||
onDismiss={dismissGuide}
|
||||
/>
|
||||
<ScrollView
|
||||
refreshControl={
|
||||
<RefreshControl
|
||||
refreshing={refreshing}
|
||||
onRefresh={handleRefresh}
|
||||
tintColor={colors.icon}
|
||||
/>
|
||||
}
|
||||
style={[Styles.h100]}
|
||||
>
|
||||
<View style={[Styles.p15]}>
|
||||
{/* Calendar grid */}
|
||||
<View style={[Styles.wrapPaper, Styles.p10, { backgroundColor: colors.card, borderColor: colors.background }]}>
|
||||
<Datepicker
|
||||
components={components}
|
||||
mode="single"
|
||||
date={selected}
|
||||
month={month}
|
||||
onMonthChange={(m) => setMonth(m)}
|
||||
styles={{
|
||||
selected: Styles.selectedDate,
|
||||
month_label: { color: colors.text },
|
||||
month_selector_label: { color: colors.text },
|
||||
year_label: { color: colors.text },
|
||||
year_selector_label: { color: colors.text },
|
||||
day_label: { color: colors.text },
|
||||
time_label: { color: colors.text },
|
||||
weekday_label: { color: colors.text },
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
|
||||
{/* Legend */}
|
||||
<View style={[Styles.rowItemsCenter, Styles.villageEventLegendRow]}>
|
||||
<View style={[Styles.rowItemsCenter, Styles.villageEventLegendItem]}>
|
||||
<View style={[Styles.villageEventLegendDot, { backgroundColor: '#7886C7' }]} />
|
||||
<Text style={[Styles.textMediumNormal, { color: colors.dimmed }]}>Acara Divisi</Text>
|
||||
</View>
|
||||
<View style={[Styles.rowItemsCenter, Styles.villageEventLegendItem]}>
|
||||
<View style={[Styles.villageEventLegendDot, { backgroundColor: '#94B4C1' }]} />
|
||||
<Text style={[Styles.textMediumNormal, { color: colors.dimmed }]}>Kegiatan</Text>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
{/* Calendar events */}
|
||||
<View style={[Styles.mb15, Styles.mt10]}>
|
||||
<Text style={[Styles.textDefaultSemiBold, Styles.mb05]}>Acara Divisi</Text>
|
||||
<View style={[Styles.wrapPaper, { backgroundColor: colors.card, borderColor: colors.background }]}>
|
||||
{loading ? (
|
||||
<>
|
||||
<Skeleton width={100} height={70} borderRadius={10} widthType="percent" />
|
||||
<Skeleton width={100} height={70} borderRadius={10} widthType="percent" />
|
||||
</>
|
||||
) : calendarEvents.length > 0 ? (
|
||||
calendarEvents.map((item, index) => (
|
||||
<VillageEventItem
|
||||
key={index}
|
||||
item={item}
|
||||
onPress={() => handlePressEvent(item)}
|
||||
/>
|
||||
))
|
||||
) : (
|
||||
<Text style={[Styles.textDefault, { textAlign: 'center', color: colors.dimmed }]}>
|
||||
Tidak ada acara
|
||||
</Text>
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
|
||||
{/* Task events */}
|
||||
<View style={[Styles.mb15]}>
|
||||
<Text style={[Styles.textDefaultSemiBold, Styles.mb05]}>Kegiatan</Text>
|
||||
<View style={[Styles.wrapPaper, { backgroundColor: colors.card, borderColor: colors.background }]}>
|
||||
{loading ? (
|
||||
<>
|
||||
<Skeleton width={100} height={70} borderRadius={10} widthType="percent" />
|
||||
<Skeleton width={100} height={70} borderRadius={10} widthType="percent" />
|
||||
</>
|
||||
) : taskEvents.length > 0 ? (
|
||||
taskEvents.map((item, index) => (
|
||||
<VillageEventItem
|
||||
key={index}
|
||||
item={item}
|
||||
onPress={() => handlePressEvent(item)}
|
||||
/>
|
||||
))
|
||||
) : (
|
||||
<Text style={[Styles.textDefault, { textAlign: 'center', color: colors.dimmed }]}>
|
||||
Tidak ada kegiatan
|
||||
</Text>
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
</ScrollView>
|
||||
</SafeAreaView>
|
||||
);
|
||||
}
|
||||
@@ -1,10 +1,14 @@
|
||||
import AuthProvider from '@/providers/AuthProvider';
|
||||
import ThemeProvider, { useTheme } from '@/providers/ThemeProvider';
|
||||
import QueryProvider from '@/providers/QueryProvider';
|
||||
import ErrorBoundary from '@/components/ErrorBoundary';
|
||||
import { flushErrorQueue } from '@/lib/errorLogger';
|
||||
import { useFonts } from 'expo-font';
|
||||
import { Stack } from 'expo-router';
|
||||
import * as SplashScreen from 'expo-splash-screen';
|
||||
import { StatusBar } from 'expo-status-bar';
|
||||
import { useEffect } from 'react';
|
||||
import { AppState } from 'react-native';
|
||||
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
||||
import { NotifierWrapper } from 'react-native-notifier';
|
||||
import 'react-native-reanimated';
|
||||
@@ -21,7 +25,6 @@ function AppStack() {
|
||||
<>
|
||||
<Stack screenOptions={{ contentStyle: { backgroundColor: colors.header } }}>
|
||||
<Stack.Screen name="index" options={{ headerShown: false }} />
|
||||
<Stack.Screen name="verification" options={{ headerShown: false }} />
|
||||
<Stack.Screen name="(application)" options={{ headerShown: false }} />
|
||||
</Stack>
|
||||
<StatusBar style="auto" />
|
||||
@@ -37,22 +40,34 @@ export default function RootLayout() {
|
||||
useEffect(() => {
|
||||
if (loaded) {
|
||||
SplashScreen.hideAsync();
|
||||
flushErrorQueue();
|
||||
}
|
||||
}, [loaded]);
|
||||
|
||||
useEffect(() => {
|
||||
const sub = AppState.addEventListener('change', (state) => {
|
||||
if (state === 'active') flushErrorQueue();
|
||||
});
|
||||
return () => sub.remove();
|
||||
}, []);
|
||||
|
||||
if (!loaded) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<GestureHandlerRootView style={Styles.flex1}>
|
||||
<NotifierWrapper>
|
||||
<ThemeProvider>
|
||||
<AuthProvider>
|
||||
<AppStack />
|
||||
</AuthProvider>
|
||||
</ThemeProvider>
|
||||
</NotifierWrapper>
|
||||
<ErrorBoundary>
|
||||
<NotifierWrapper>
|
||||
<ThemeProvider>
|
||||
<QueryProvider>
|
||||
<AuthProvider>
|
||||
<AppStack />
|
||||
</AuthProvider>
|
||||
</QueryProvider>
|
||||
</ThemeProvider>
|
||||
</NotifierWrapper>
|
||||
</ErrorBoundary>
|
||||
</GestureHandlerRootView>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
import { ButtonForm } from "@/components/buttonForm";
|
||||
import Text from '@/components/Text';
|
||||
import { ConstEnv } from "@/constants/ConstEnv";
|
||||
import Styles from "@/constants/Styles";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
import CryptoES from "crypto-es";
|
||||
import React, { useState } from "react";
|
||||
import { Image, View } from "react-native";
|
||||
import { CodeField, Cursor, useBlurOnFulfill, useClearByFocusCell, } from 'react-native-confirmation-code-field';
|
||||
|
||||
export default function Index() {
|
||||
const [value, setValue] = useState('');
|
||||
const ref = useBlurOnFulfill({ value, cellCount: 4 });
|
||||
const [props, getCellOnLayoutHandler] = useClearByFocusCell({
|
||||
value,
|
||||
setValue,
|
||||
});
|
||||
const { colors } = useTheme();
|
||||
|
||||
const { signIn } = useAuthSession();
|
||||
const login = (): void => {
|
||||
// WARNING: This is a hardcoded bypass for development purposes.
|
||||
// It should be removed or secured before production release.
|
||||
if (__DEV__) {
|
||||
const random: string = 'contohLoginMobileDarmasaba';
|
||||
var mytexttoEncryption = "contohLoginMobileDarmasaba"
|
||||
const encrypted = CryptoES.AES.encrypt(mytexttoEncryption, ConstEnv.pass_encrypt).toString();
|
||||
signIn(encrypted);
|
||||
} else {
|
||||
console.warn("Bypass login disabled in production.");
|
||||
}
|
||||
}
|
||||
return (
|
||||
<View style={[Styles.wrapLogin, { backgroundColor: colors.background }]} >
|
||||
<View style={[Styles.rowItemsCenter, Styles.mv50]}>
|
||||
<Image
|
||||
source={require("../assets/images/logo.png")}
|
||||
style={[{ width: 300, height: 150 }]}
|
||||
width={270}
|
||||
height={110}
|
||||
/>
|
||||
{/* <Text style={[Styles.textSubtitle]}>PERBEKEL DARMASABA</Text> */}
|
||||
</View>
|
||||
<View style={[Styles.mb30]}>
|
||||
<Text style={[Styles.textDefaultSemiBold]}>Verifikasi Nomor Telepon</Text>
|
||||
<Text style={[Styles.textMediumNormal]}>Masukkan kode yang kami kirimkan melalui WhatsApp</Text>
|
||||
<Text style={[Styles.textMediumSemiBold]}>+628980185458</Text>
|
||||
</View>
|
||||
<CodeField
|
||||
ref={ref}
|
||||
{...props}
|
||||
value={value}
|
||||
rootStyle={{ width: '80%', alignSelf: 'center' }}
|
||||
onChangeText={setValue}
|
||||
cellCount={4}
|
||||
keyboardType="number-pad"
|
||||
renderCell={({ index, symbol, isFocused }) => (
|
||||
<Text
|
||||
key={index}
|
||||
style={[Styles.verificationCell, isFocused && Styles.verificationFocusCell, { borderColor: isFocused ? colors.tint : colors.icon, color: colors.text }]}
|
||||
onLayout={getCellOnLayoutHandler(index)}>
|
||||
{symbol || (isFocused ? <Cursor /> : null)}
|
||||
</Text>
|
||||
)}
|
||||
/>
|
||||
<ButtonForm
|
||||
text="SUBMIT"
|
||||
// onPress={() => { router.push("/home") }}
|
||||
onPress={login}
|
||||
/>
|
||||
<Text style={[Styles.textInformation, Styles.mt05, Styles.cDefault, { textAlign: 'center', color: colors.tint }]}>
|
||||
Tidak Menerima kode verifikasi? Kirim Ulang
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
170
bun.lock
170
bun.lock
@@ -11,12 +11,16 @@
|
||||
"@react-native-clipboard/clipboard": "^1.16.3",
|
||||
"@react-native-community/cli": "^19.1.0",
|
||||
"@react-native-community/datetimepicker": "8.4.1",
|
||||
"@react-native-community/netinfo": "^12.0.1",
|
||||
"@react-native-firebase/app": "^22.4.0",
|
||||
"@react-native-firebase/database": "^22.4.0",
|
||||
"@react-native-firebase/messaging": "^22.2.1",
|
||||
"@react-navigation/bottom-tabs": "^7.2.0",
|
||||
"@react-navigation/native": "^7.0.14",
|
||||
"@reduxjs/toolkit": "^2.7.0",
|
||||
"@tanstack/query-async-storage-persister": "^5.99.2",
|
||||
"@tanstack/react-query": "^5.99.2",
|
||||
"@tanstack/react-query-persist-client": "^5.99.2",
|
||||
"@types/formidable": "^3.4.5",
|
||||
"axios": "^1.8.4",
|
||||
"crypto-es": "^2.1.0",
|
||||
@@ -42,6 +46,7 @@
|
||||
"expo-modules-core": "^2.5.0",
|
||||
"expo-notifications": "~0.31.3",
|
||||
"expo-router": "~5.1.4",
|
||||
"expo-secure-store": "~14.2.4",
|
||||
"expo-sharing": "^13.1.5",
|
||||
"expo-splash-screen": "~0.30.8",
|
||||
"expo-status-bar": "~2.2.3",
|
||||
@@ -84,13 +89,14 @@
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.25.2",
|
||||
"@react-native-community/cli-platform-ios": "^18.0.0",
|
||||
"@testing-library/react-native": "^13.3.3",
|
||||
"@types/crypto-js": "^4.2.2",
|
||||
"@types/jest": "^29.5.12",
|
||||
"@types/react": "~19.0.10",
|
||||
"@types/react-test-renderer": "^18.3.0",
|
||||
"jest": "^29.2.1",
|
||||
"jest-expo": "~53.0.5",
|
||||
"react-test-renderer": "18.3.1",
|
||||
"react-test-renderer": "19.0.0",
|
||||
"typescript": "^5.3.3",
|
||||
},
|
||||
},
|
||||
@@ -456,6 +462,8 @@
|
||||
|
||||
"@jest/create-cache-key-function": ["@jest/create-cache-key-function@29.7.0", "", { "dependencies": { "@jest/types": "^29.6.3" } }, "sha512-4QqS3LY5PBmTRHj9sAg1HLoPzqAI0uOX6wI/TRqHIcOxlFidy6YEmCQJk6FSZjNLGCeubDMfmkWL+qaLKhSGQA=="],
|
||||
|
||||
"@jest/diff-sequences": ["@jest/diff-sequences@30.3.0", "", {}, "sha512-cG51MVnLq1ecVUaQ3fr6YuuAOitHK1S4WUJHnsPFE/quQr33ADUx1FfrTCpMCRxvy0Yr9BThKpDjSlcTi91tMA=="],
|
||||
|
||||
"@jest/environment": ["@jest/environment@29.7.0", "", { "dependencies": { "@jest/fake-timers": "^29.7.0", "@jest/types": "^29.6.3", "@types/node": "*", "jest-mock": "^29.7.0" } }, "sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw=="],
|
||||
|
||||
"@jest/expect": ["@jest/expect@29.7.0", "", { "dependencies": { "expect": "^29.7.0", "jest-snapshot": "^29.7.0" } }, "sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ=="],
|
||||
@@ -464,11 +472,13 @@
|
||||
|
||||
"@jest/fake-timers": ["@jest/fake-timers@29.7.0", "", { "dependencies": { "@jest/types": "^29.6.3", "@sinonjs/fake-timers": "^10.0.2", "@types/node": "*", "jest-message-util": "^29.7.0", "jest-mock": "^29.7.0", "jest-util": "^29.7.0" } }, "sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ=="],
|
||||
|
||||
"@jest/get-type": ["@jest/get-type@30.1.0", "", {}, "sha512-eMbZE2hUnx1WV0pmURZY9XoXPkUYjpc55mb0CrhtdWLtzMQPFvu/rZkTLZFTsdaVQa+Tr4eWAteqcUzoawq/uA=="],
|
||||
|
||||
"@jest/globals": ["@jest/globals@29.7.0", "", { "dependencies": { "@jest/environment": "^29.7.0", "@jest/expect": "^29.7.0", "@jest/types": "^29.6.3", "jest-mock": "^29.7.0" } }, "sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ=="],
|
||||
|
||||
"@jest/reporters": ["@jest/reporters@29.7.0", "", { "dependencies": { "@bcoe/v8-coverage": "^0.2.3", "@jest/console": "^29.7.0", "@jest/test-result": "^29.7.0", "@jest/transform": "^29.7.0", "@jest/types": "^29.6.3", "@jridgewell/trace-mapping": "^0.3.18", "@types/node": "*", "chalk": "^4.0.0", "collect-v8-coverage": "^1.0.0", "exit": "^0.1.2", "glob": "^7.1.3", "graceful-fs": "^4.2.9", "istanbul-lib-coverage": "^3.0.0", "istanbul-lib-instrument": "^6.0.0", "istanbul-lib-report": "^3.0.0", "istanbul-lib-source-maps": "^4.0.0", "istanbul-reports": "^3.1.3", "jest-message-util": "^29.7.0", "jest-util": "^29.7.0", "jest-worker": "^29.7.0", "slash": "^3.0.0", "string-length": "^4.0.1", "strip-ansi": "^6.0.0", "v8-to-istanbul": "^9.0.1" }, "peerDependencies": { "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" }, "optionalPeers": ["node-notifier"] }, "sha512-DApq0KJbJOEzAFYjHADNNxAE3KbhxQB1y5Kplb5Waqw6zVbuWatSnMjE5gs8FUgEPmNsnZA3NCWl9NG0ia04Pg=="],
|
||||
|
||||
"@jest/schemas": ["@jest/schemas@29.6.3", "", { "dependencies": { "@sinclair/typebox": "^0.27.8" } }, "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA=="],
|
||||
"@jest/schemas": ["@jest/schemas@30.0.5", "", { "dependencies": { "@sinclair/typebox": "^0.34.0" } }, "sha512-DmdYgtezMkh3cpU8/1uyXakv3tJRcmcXxBOcO0tbaozPwpmh4YMsnWrQm9ZmZMfa5ocbxzbFk6O4bDPEc/iAnA=="],
|
||||
|
||||
"@jest/source-map": ["@jest/source-map@29.6.3", "", { "dependencies": { "@jridgewell/trace-mapping": "^0.3.18", "callsites": "^3.0.0", "graceful-fs": "^4.2.9" } }, "sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw=="],
|
||||
|
||||
@@ -566,6 +576,8 @@
|
||||
|
||||
"@react-native-community/datetimepicker": ["@react-native-community/datetimepicker@8.4.1", "", { "dependencies": { "invariant": "^2.2.4" }, "peerDependencies": { "expo": ">=52.0.0", "react": "*", "react-native": "*", "react-native-windows": "*" }, "optionalPeers": ["expo", "react-native-windows"] }, "sha512-DrK+CUS5fZnz8dhzBezirkzQTcNDdaXer3oDLh0z4nc2tbdIdnzwvXCvi8IEOIvleoc9L95xS5tKUl0/Xv71Mg=="],
|
||||
|
||||
"@react-native-community/netinfo": ["@react-native-community/netinfo@12.0.1", "", { "peerDependencies": { "react": "*", "react-native": ">=0.59" } }, "sha512-P/3caXIvfYSJG8AWJVefukg+ZGRPs+M4Lp3pNJtgcTYoJxCjWrKQGNnCkj/Cz//zWa/avGed0i/wzm0T8vV2IQ=="],
|
||||
|
||||
"@react-native-firebase/app": ["@react-native-firebase/app@22.4.0", "", { "dependencies": { "firebase": "11.10.0" }, "peerDependencies": { "expo": ">=47.0.0", "react": "*", "react-native": "*" }, "optionalPeers": ["expo"] }, "sha512-mW49qYioddRZjCRiF4XMpt7pyPoh84pqU2obnFY0pWD9K0aFRv6+BfLBYrsAFY3xqA5cqf0uj+Nne0vrvmuAyw=="],
|
||||
|
||||
"@react-native-firebase/database": ["@react-native-firebase/database@22.4.0", "", { "peerDependencies": { "@react-native-firebase/app": "22.4.0" } }, "sha512-iY+676RTwntRqq0CqcbGhidaegt/a6eKaoLTXeAxvtPYQaYXQL1fCDuZKfoy6uBfNsAGDxx2z4jYJuU+kOv4pA=="],
|
||||
@@ -614,7 +626,7 @@
|
||||
|
||||
"@sideway/pinpoint": ["@sideway/pinpoint@2.0.0", "", {}, "sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ=="],
|
||||
|
||||
"@sinclair/typebox": ["@sinclair/typebox@0.27.10", "", {}, "sha512-MTBk/3jGLNB2tVxv6uLlFh1iu64iYOQ2PbdOSK3NW8JZsmlaOh2q6sdtKowBhfw8QFLmYNzTW4/oK4uATIi6ZA=="],
|
||||
"@sinclair/typebox": ["@sinclair/typebox@0.34.49", "", {}, "sha512-brySQQs7Jtn0joV8Xh9ZV/hZb9Ozb0pmazDIASBkYKCjXrXU3mpcFahmK/z4YDhGkQvP9mWJbVyahdtU5wQA+A=="],
|
||||
|
||||
"@sinonjs/commons": ["@sinonjs/commons@3.0.1", "", { "dependencies": { "type-detect": "4.0.8" } }, "sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ=="],
|
||||
|
||||
@@ -624,6 +636,18 @@
|
||||
|
||||
"@standard-schema/utils": ["@standard-schema/utils@0.3.0", "", {}, "sha512-e7Mew686owMaPJVNNLs55PUvgz371nKgwsc4vxE49zsODpJEnxgxRo2y/OKrqueavXgZNMDVj3DdHFlaSAeU8g=="],
|
||||
|
||||
"@tanstack/query-async-storage-persister": ["@tanstack/query-async-storage-persister@5.99.2", "", { "dependencies": { "@tanstack/query-core": "5.99.2", "@tanstack/query-persist-client-core": "5.99.2" } }, "sha512-FIr13Zv7GiMZGrdxoxOuzolT4xfyLrKWVBMfTZLMGJTc9IceFu2RT+EfH+j5jcKfvjB4T2no3qWSPGHxYmKKWg=="],
|
||||
|
||||
"@tanstack/query-core": ["@tanstack/query-core@5.99.2", "", {}, "sha512-1HunU0bXVsR1ZJMZbcOPE6VtaBJxsW809RE9xPe4Gz7MlB0GWwQvuTPhMoEmQ/hIzFKJ/DWAuttIe7BOaWx0tA=="],
|
||||
|
||||
"@tanstack/query-persist-client-core": ["@tanstack/query-persist-client-core@5.99.2", "", { "dependencies": { "@tanstack/query-core": "5.99.2" } }, "sha512-YYuLGBDGCsUbfN2LuYrfkRCpg1vOUZnK2bn4j7zAZv+m1B4CnLAv58Z3A43d5Cruxvld5udYFeYXw9F6g/pZcQ=="],
|
||||
|
||||
"@tanstack/react-query": ["@tanstack/react-query@5.99.2", "", { "dependencies": { "@tanstack/query-core": "5.99.2" }, "peerDependencies": { "react": "^18 || ^19" } }, "sha512-vM91UEe45QUS9ED6OklsVL15i8qKcRqNwpWzPTVWvRPRSEgDudDgHpvyTjcdlwHcrKNa80T+xXYcchT2noPnZA=="],
|
||||
|
||||
"@tanstack/react-query-persist-client": ["@tanstack/react-query-persist-client@5.99.2", "", { "dependencies": { "@tanstack/query-persist-client-core": "5.99.2" }, "peerDependencies": { "@tanstack/react-query": "^5.99.2", "react": "^18 || ^19" } }, "sha512-7+y5+kpaR26X2gdaEv0yQSFLZjqXz4Kn7wqzuYDQrb203b9MlYS3baML1M9hJTiLgi4QGGF2eJDdW8lHAazUow=="],
|
||||
|
||||
"@testing-library/react-native": ["@testing-library/react-native@13.3.3", "", { "dependencies": { "jest-matcher-utils": "^30.0.5", "picocolors": "^1.1.1", "pretty-format": "^30.0.5", "redent": "^3.0.0" }, "peerDependencies": { "jest": ">=29.0.0", "react": ">=18.2.0", "react-native": ">=0.71", "react-test-renderer": ">=18.2.0" }, "optionalPeers": ["jest"] }, "sha512-k6Mjsd9dbZgvY4Bl7P1NIpePQNi+dfYtlJ5voi9KQlynxSyQkfOgJmYGCYmw/aSgH/rUcFvG8u5gd4npzgRDyg=="],
|
||||
|
||||
"@tootallnate/once": ["@tootallnate/once@2.0.0", "", {}, "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A=="],
|
||||
|
||||
"@types/babel__core": ["@types/babel__core@7.20.5", "", { "dependencies": { "@babel/parser": "^7.20.7", "@babel/types": "^7.20.7", "@types/babel__generator": "*", "@types/babel__template": "*", "@types/babel__traverse": "*" } }, "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA=="],
|
||||
@@ -1080,6 +1104,8 @@
|
||||
|
||||
"expo-router": ["expo-router@5.1.11", "", { "dependencies": { "@expo/metro-runtime": "5.0.5", "@expo/schema-utils": "^0.1.0", "@expo/server": "^0.6.3", "@radix-ui/react-slot": "1.2.0", "@react-navigation/bottom-tabs": "^7.3.10", "@react-navigation/native": "^7.1.6", "@react-navigation/native-stack": "^7.3.10", "client-only": "^0.0.1", "invariant": "^2.2.4", "react-fast-compare": "^3.2.2", "react-native-is-edge-to-edge": "^1.1.6", "semver": "~7.6.3", "server-only": "^0.0.1", "shallowequal": "^1.1.0" }, "peerDependencies": { "@react-navigation/drawer": "^7.3.9", "expo": "*", "expo-constants": "*", "expo-linking": "*", "react-native-reanimated": "*", "react-native-safe-area-context": "*", "react-native-screens": "*", "react-server-dom-webpack": "~19.0.4 || ~19.1.5 || ~19.2.4" }, "optionalPeers": ["@react-navigation/drawer", "react-native-reanimated", "react-server-dom-webpack"] }, "sha512-6YQGqQM2rviVSiU6++hrJDPMByHZ7Oiux4XmgoSaGdaHku5QOn9911f2puEUZh2H9ALKBipw5v3ZkrECBd6Zbw=="],
|
||||
|
||||
"expo-secure-store": ["expo-secure-store@14.2.4", "", { "peerDependencies": { "expo": "*" } }, "sha512-ePaz4fnTitJJZjAiybaVYGfLWWyaEtepZC+vs9ZBMhQMfG5HUotIcVsDaSo3FnwpHmgwsLVPY2qFeryI6AtULw=="],
|
||||
|
||||
"expo-sharing": ["expo-sharing@13.1.5", "", { "peerDependencies": { "expo": "*" } }, "sha512-X/5sAEiWXL2kdoGE3NO5KmbfcmaCWuWVZXHu8OQef7Yig4ZgHFkGD11HKJ5KqDrDg+SRZe4ISd6MxE7vGUgm4w=="],
|
||||
|
||||
"expo-splash-screen": ["expo-splash-screen@0.30.10", "", { "dependencies": { "@expo/prebuild-config": "^9.0.10" }, "peerDependencies": { "expo": "*" } }, "sha512-Tt9va/sLENQDQYeOQ6cdLdGvTZ644KR3YG9aRlnpcs2/beYjOX1LHT510EGzVN9ljUTg+1ebEo5GGt2arYtPjw=="],
|
||||
@@ -1230,6 +1256,8 @@
|
||||
|
||||
"imurmurhash": ["imurmurhash@0.1.4", "", {}, "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA=="],
|
||||
|
||||
"indent-string": ["indent-string@4.0.0", "", {}, "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg=="],
|
||||
|
||||
"inflight": ["inflight@1.0.6", "", { "dependencies": { "once": "^1.3.0", "wrappy": "1" } }, "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA=="],
|
||||
|
||||
"inherits": ["inherits@2.0.4", "", {}, "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="],
|
||||
@@ -1310,7 +1338,7 @@
|
||||
|
||||
"jest-config": ["jest-config@29.7.0", "", { "dependencies": { "@babel/core": "^7.11.6", "@jest/test-sequencer": "^29.7.0", "@jest/types": "^29.6.3", "babel-jest": "^29.7.0", "chalk": "^4.0.0", "ci-info": "^3.2.0", "deepmerge": "^4.2.2", "glob": "^7.1.3", "graceful-fs": "^4.2.9", "jest-circus": "^29.7.0", "jest-environment-node": "^29.7.0", "jest-get-type": "^29.6.3", "jest-regex-util": "^29.6.3", "jest-resolve": "^29.7.0", "jest-runner": "^29.7.0", "jest-util": "^29.7.0", "jest-validate": "^29.7.0", "micromatch": "^4.0.4", "parse-json": "^5.2.0", "pretty-format": "^29.7.0", "slash": "^3.0.0", "strip-json-comments": "^3.1.1" }, "peerDependencies": { "@types/node": "*", "ts-node": ">=9.0.0" }, "optionalPeers": ["@types/node", "ts-node"] }, "sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ=="],
|
||||
|
||||
"jest-diff": ["jest-diff@29.7.0", "", { "dependencies": { "chalk": "^4.0.0", "diff-sequences": "^29.6.3", "jest-get-type": "^29.6.3", "pretty-format": "^29.7.0" } }, "sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw=="],
|
||||
"jest-diff": ["jest-diff@30.3.0", "", { "dependencies": { "@jest/diff-sequences": "30.3.0", "@jest/get-type": "30.1.0", "chalk": "^4.1.2", "pretty-format": "30.3.0" } }, "sha512-n3q4PDQjS4LrKxfWB3Z5KNk1XjXtZTBwQp71OP0Jo03Z6V60x++K5L8k6ZrW8MY8pOFylZvHM0zsjS1RqlHJZQ=="],
|
||||
|
||||
"jest-docblock": ["jest-docblock@29.7.0", "", { "dependencies": { "detect-newline": "^3.0.0" } }, "sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g=="],
|
||||
|
||||
@@ -1328,7 +1356,7 @@
|
||||
|
||||
"jest-leak-detector": ["jest-leak-detector@29.7.0", "", { "dependencies": { "jest-get-type": "^29.6.3", "pretty-format": "^29.7.0" } }, "sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw=="],
|
||||
|
||||
"jest-matcher-utils": ["jest-matcher-utils@29.7.0", "", { "dependencies": { "chalk": "^4.0.0", "jest-diff": "^29.7.0", "jest-get-type": "^29.6.3", "pretty-format": "^29.7.0" } }, "sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g=="],
|
||||
"jest-matcher-utils": ["jest-matcher-utils@30.3.0", "", { "dependencies": { "@jest/get-type": "30.1.0", "chalk": "^4.1.2", "jest-diff": "30.3.0", "pretty-format": "30.3.0" } }, "sha512-HEtc9uFQgaUHkC7nLSlQL3Tph4Pjxt/yiPvkIrrDCt9jhoLIgxaubo1G+CFOnmHYMxHwwdaSN7mkIFs6ZK8OhA=="],
|
||||
|
||||
"jest-message-util": ["jest-message-util@29.7.0", "", { "dependencies": { "@babel/code-frame": "^7.12.13", "@jest/types": "^29.6.3", "@types/stack-utils": "^2.0.0", "chalk": "^4.0.0", "graceful-fs": "^4.2.9", "micromatch": "^4.0.4", "pretty-format": "^29.7.0", "slash": "^3.0.0", "stack-utils": "^2.0.3" } }, "sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w=="],
|
||||
|
||||
@@ -1496,6 +1524,8 @@
|
||||
|
||||
"mimic-fn": ["mimic-fn@2.1.0", "", {}, "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg=="],
|
||||
|
||||
"min-indent": ["min-indent@1.0.1", "", {}, "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg=="],
|
||||
|
||||
"minimatch": ["minimatch@9.0.8", "", { "dependencies": { "brace-expansion": "^5.0.2" } }, "sha512-reYkDYtj/b19TeqbNZCV4q9t+Yxylf/rYBsLb42SXJatTv4/ylq5lEiAmhA/IToxO7NI2UzNMghHoHuaqDkAjw=="],
|
||||
|
||||
"minimist": ["minimist@1.2.8", "", {}, "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA=="],
|
||||
@@ -1616,7 +1646,7 @@
|
||||
|
||||
"pretty-bytes": ["pretty-bytes@5.6.0", "", {}, "sha512-FFw039TmrBqFK8ma/7OL3sDz/VytdtJr044/QUJtH0wK9lb9jLq9tJyIxUwtQJHwar2BqtiA4iCWSwo9JLkzFg=="],
|
||||
|
||||
"pretty-format": ["pretty-format@29.7.0", "", { "dependencies": { "@jest/schemas": "^29.6.3", "ansi-styles": "^5.0.0", "react-is": "^18.0.0" } }, "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ=="],
|
||||
"pretty-format": ["pretty-format@30.3.0", "", { "dependencies": { "@jest/schemas": "30.0.5", "ansi-styles": "^5.2.0", "react-is": "^18.3.1" } }, "sha512-oG4T3wCbfeuvljnyAzhBvpN45E8iOTXCU/TD3zXW80HA3dQ4ahdqMkWGiPWZvjpQwlbyHrPTWUAqUzGzv4l1JQ=="],
|
||||
|
||||
"proc-log": ["proc-log@4.2.0", "", {}, "sha512-g8+OnU/L2v+wyiVK+D5fA34J7EH8jZ8DDlvwhRCMxmMj7UCBvxiO1mGeN+36JXIKF4zevU4kRBd8lVgG9vLelA=="],
|
||||
|
||||
@@ -1668,7 +1698,7 @@
|
||||
|
||||
"react-freeze": ["react-freeze@1.0.4", "", { "peerDependencies": { "react": ">=17.0.0" } }, "sha512-r4F0Sec0BLxWicc7HEyo2x3/2icUTrRmDjaaRyzzn+7aDyFZliszMDOgLVwSnQnYENOlL1o569Ze2HZefk8clA=="],
|
||||
|
||||
"react-is": ["react-is@18.3.1", "", {}, "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg=="],
|
||||
"react-is": ["react-is@19.2.4", "", {}, "sha512-W+EWGn2v0ApPKgKKCy/7s7WHXkboGcsrXE+2joLyVxkbyVQfO3MUEaUQDHoSmb8TFFrSKYa9mw64WZHNHSDzYA=="],
|
||||
|
||||
"react-native": ["react-native@0.79.5", "", { "dependencies": { "@jest/create-cache-key-function": "^29.7.0", "@react-native/assets-registry": "0.79.5", "@react-native/codegen": "0.79.5", "@react-native/community-cli-plugin": "0.79.5", "@react-native/gradle-plugin": "0.79.5", "@react-native/js-polyfills": "0.79.5", "@react-native/normalize-colors": "0.79.5", "@react-native/virtualized-lists": "0.79.5", "abort-controller": "^3.0.0", "anser": "^1.4.9", "ansi-regex": "^5.0.0", "babel-jest": "^29.7.0", "babel-plugin-syntax-hermes-parser": "0.25.1", "base64-js": "^1.5.1", "chalk": "^4.0.0", "commander": "^12.0.0", "event-target-shim": "^5.0.1", "flow-enums-runtime": "^0.0.6", "glob": "^7.1.1", "invariant": "^2.2.4", "jest-environment-node": "^29.7.0", "memoize-one": "^5.0.0", "metro-runtime": "^0.82.0", "metro-source-map": "^0.82.0", "nullthrows": "^1.1.1", "pretty-format": "^29.7.0", "promise": "^8.3.0", "react-devtools-core": "^6.1.1", "react-refresh": "^0.14.0", "regenerator-runtime": "^0.13.2", "scheduler": "0.25.0", "semver": "^7.1.3", "stacktrace-parser": "^0.1.10", "whatwg-fetch": "^3.0.0", "ws": "^6.2.3", "yargs": "^17.6.2" }, "peerDependencies": { "@types/react": "^19.0.0", "react": "^19.0.0" }, "optionalPeers": ["@types/react"], "bin": { "react-native": "cli.js" } }, "sha512-jVihwsE4mWEHZ9HkO1J2eUZSwHyDByZOqthwnGrVZCh6kTQBCm4v8dicsyDa6p0fpWNE5KicTcpX/XXl0ASJFg=="],
|
||||
|
||||
@@ -1728,12 +1758,12 @@
|
||||
|
||||
"react-refresh": ["react-refresh@0.14.2", "", {}, "sha512-jCvmsr+1IUSMUyzOkRcvnVbX3ZYC6g9TDrDbFuFmRDq7PD4yaGbLKNQL6k2jnArV8hjYxh7hVhAZB6s9HDGpZA=="],
|
||||
|
||||
"react-shallow-renderer": ["react-shallow-renderer@16.15.0", "", { "dependencies": { "object-assign": "^4.1.1", "react-is": "^16.12.0 || ^17.0.0 || ^18.0.0" }, "peerDependencies": { "react": "^16.0.0 || ^17.0.0 || ^18.0.0" } }, "sha512-oScf2FqQ9LFVQgA73vr86xl2NaOIX73rh+YFqcOp68CWj56tSfgtGKrEbyhCj0rSijyG9M1CYprTh39fBi5hzA=="],
|
||||
|
||||
"react-test-renderer": ["react-test-renderer@18.3.1", "", { "dependencies": { "react-is": "^18.3.1", "react-shallow-renderer": "^16.15.0", "scheduler": "^0.23.2" }, "peerDependencies": { "react": "^18.3.1" } }, "sha512-KkAgygexHUkQqtvvx/otwxtuFu5cVjfzTCtjXLH9boS19/Nbtg84zS7wIQn39G8IlrhThBpQsMKkq5ZHZIYFXA=="],
|
||||
"react-test-renderer": ["react-test-renderer@19.0.0", "", { "dependencies": { "react-is": "^19.0.0", "scheduler": "^0.25.0" }, "peerDependencies": { "react": "^19.0.0" } }, "sha512-oX5u9rOQlHzqrE/64CNr0HB0uWxkCQmZNSfozlYvwE71TLVgeZxVf0IjouGEr1v7r1kcDifdAJBeOhdhxsG/DA=="],
|
||||
|
||||
"readable-stream": ["readable-stream@3.6.2", "", { "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", "util-deprecate": "^1.0.1" } }, "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA=="],
|
||||
|
||||
"redent": ["redent@3.0.0", "", { "dependencies": { "indent-string": "^4.0.0", "strip-indent": "^3.0.0" } }, "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg=="],
|
||||
|
||||
"redux": ["redux@5.0.1", "", {}, "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w=="],
|
||||
|
||||
"redux-thunk": ["redux-thunk@3.1.0", "", { "peerDependencies": { "redux": "^5.0.0" } }, "sha512-NW2r5T6ksUKXCabzhL9z+h206HQw/NJkcLm1GPImRQ8IzfXwRGqjVhKJGauHirT0DAuyy6hjdnMZaRoAcy0Klw=="],
|
||||
@@ -1790,7 +1820,7 @@
|
||||
|
||||
"saxes": ["saxes@6.0.0", "", { "dependencies": { "xmlchars": "^2.2.0" } }, "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA=="],
|
||||
|
||||
"scheduler": ["scheduler@0.23.2", "", { "dependencies": { "loose-envify": "^1.1.0" } }, "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ=="],
|
||||
"scheduler": ["scheduler@0.25.0", "", {}, "sha512-xFVuu11jh+xcO7JOAGJNOXld8/TcEHK/4CituBUeUb5hqxJLj9YuemAEuvm9gQ/+pgXYfbQuqAkiYu+u7YEsNA=="],
|
||||
|
||||
"semver": ["semver@6.3.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="],
|
||||
|
||||
@@ -1888,6 +1918,8 @@
|
||||
|
||||
"strip-final-newline": ["strip-final-newline@2.0.0", "", {}, "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA=="],
|
||||
|
||||
"strip-indent": ["strip-indent@3.0.0", "", { "dependencies": { "min-indent": "^1.0.0" } }, "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ=="],
|
||||
|
||||
"strip-json-comments": ["strip-json-comments@3.1.1", "", {}, "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig=="],
|
||||
|
||||
"strnum": ["strnum@1.1.2", "", {}, "sha512-vrN+B7DBIoTTZjnPNewwhx6cBA/H+IS7rfW68n7XxC1y7uoiGQBxaKzqucGUgavX15dJgiGztLJ8vxuEzwqBdA=="],
|
||||
@@ -2070,6 +2102,8 @@
|
||||
|
||||
"@expo/cli/ora": ["ora@3.4.0", "", { "dependencies": { "chalk": "^2.4.2", "cli-cursor": "^2.1.0", "cli-spinners": "^2.0.0", "log-symbols": "^2.2.0", "strip-ansi": "^5.2.0", "wcwidth": "^1.0.1" } }, "sha512-eNwHudNbO1folBP3JsZ19v9azXWtQZjICdr3Q0TDPIaeBQ3mXLrh54wM+er0+hSp+dWKf+Z8KM58CYzEyIYxYg=="],
|
||||
|
||||
"@expo/cli/pretty-format": ["pretty-format@29.7.0", "", { "dependencies": { "@jest/schemas": "^29.6.3", "ansi-styles": "^5.0.0", "react-is": "^18.0.0" } }, "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ=="],
|
||||
|
||||
"@expo/cli/semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="],
|
||||
|
||||
"@expo/cli/undici": ["undici@6.23.0", "", {}, "sha512-VfQPToRA5FZs/qJxLIinmU59u0r7LXqoJkCzinq3ckNJp3vKEh7jTWN589YQ5+aoAC/TGRLyJLCPKcLQbM8r9g=="],
|
||||
@@ -2112,10 +2146,14 @@
|
||||
|
||||
"@istanbuljs/load-nyc-config/js-yaml": ["js-yaml@3.14.2", "", { "dependencies": { "argparse": "^1.0.7", "esprima": "^4.0.0" }, "bin": { "js-yaml": "bin/js-yaml.js" } }, "sha512-PMSmkqxr106Xa156c2M265Z+FTrPl+oxd/rgOQy2tijQeK5TxQ43psO1ZCwhVOSdnn+RzkzlRz/eY4BgJBYVpg=="],
|
||||
|
||||
"@jest/core/pretty-format": ["pretty-format@29.7.0", "", { "dependencies": { "@jest/schemas": "^29.6.3", "ansi-styles": "^5.0.0", "react-is": "^18.0.0" } }, "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ=="],
|
||||
|
||||
"@jest/reporters/glob": ["glob@7.2.3", "", { "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q=="],
|
||||
|
||||
"@jest/reporters/string-length": ["string-length@4.0.2", "", { "dependencies": { "char-regex": "^1.0.2", "strip-ansi": "^6.0.0" } }, "sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ=="],
|
||||
|
||||
"@jest/types/@jest/schemas": ["@jest/schemas@29.6.3", "", { "dependencies": { "@sinclair/typebox": "^0.27.8" } }, "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA=="],
|
||||
|
||||
"@react-native-community/cli/semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="],
|
||||
|
||||
"@react-native-community/cli-config-apple/@react-native-community/cli-tools": ["@react-native-community/cli-tools@18.0.1", "", { "dependencies": { "@vscode/sudo-prompt": "^9.0.0", "appdirsjs": "^1.2.4", "chalk": "^4.1.2", "execa": "^5.0.0", "find-up": "^5.0.0", "launch-editor": "^2.9.1", "mime": "^2.4.1", "ora": "^5.4.1", "prompts": "^2.4.2", "semver": "^7.5.2" } }, "sha512-WxWFXwfYhHR2eYiB4lkHZVC/PmIkRWeVHBQKmn0h1mecr3GrHYO4BzW1jpD5Xt6XZ9jojQ9wE5xrCqXjiMSAIQ=="],
|
||||
@@ -2146,7 +2184,7 @@
|
||||
|
||||
"@react-native/dev-middleware/open": ["open@7.4.2", "", { "dependencies": { "is-docker": "^2.0.0", "is-wsl": "^2.1.1" } }, "sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q=="],
|
||||
|
||||
"@react-navigation/core/react-is": ["react-is@19.2.4", "", {}, "sha512-W+EWGn2v0ApPKgKKCy/7s7WHXkboGcsrXE+2joLyVxkbyVQfO3MUEaUQDHoSmb8TFFrSKYa9mw64WZHNHSDzYA=="],
|
||||
"@types/jest/pretty-format": ["pretty-format@29.7.0", "", { "dependencies": { "@jest/schemas": "^29.6.3", "ansi-styles": "^5.0.0", "react-is": "^18.0.0" } }, "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ=="],
|
||||
|
||||
"@types/react-test-renderer/@types/react": ["@types/react@18.3.28", "", { "dependencies": { "@types/prop-types": "*", "csstype": "^3.2.2" } }, "sha512-z9VXpC7MWrhfWipitjNdgCauoMLRdIILQsAEV+ZesIzBq/oUlxk0m3ApZuMFCXdnS4U7KrI+l3WRUEGQ8K1QKw=="],
|
||||
|
||||
@@ -2190,6 +2228,8 @@
|
||||
|
||||
"error-ex/is-arrayish": ["is-arrayish@0.2.1", "", {}, "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg=="],
|
||||
|
||||
"expect/jest-matcher-utils": ["jest-matcher-utils@29.7.0", "", { "dependencies": { "chalk": "^4.0.0", "jest-diff": "^29.7.0", "jest-get-type": "^29.6.3", "pretty-format": "^29.7.0" } }, "sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g=="],
|
||||
|
||||
"expo-modules-autolinking/commander": ["commander@7.2.0", "", {}, "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw=="],
|
||||
|
||||
"expo-router/semver": ["semver@7.6.3", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A=="],
|
||||
@@ -2216,18 +2256,36 @@
|
||||
|
||||
"istanbul-lib-instrument/semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="],
|
||||
|
||||
"jest-circus/jest-matcher-utils": ["jest-matcher-utils@29.7.0", "", { "dependencies": { "chalk": "^4.0.0", "jest-diff": "^29.7.0", "jest-get-type": "^29.6.3", "pretty-format": "^29.7.0" } }, "sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g=="],
|
||||
|
||||
"jest-circus/pretty-format": ["pretty-format@29.7.0", "", { "dependencies": { "@jest/schemas": "^29.6.3", "ansi-styles": "^5.0.0", "react-is": "^18.0.0" } }, "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ=="],
|
||||
|
||||
"jest-config/glob": ["glob@7.2.3", "", { "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q=="],
|
||||
|
||||
"jest-expo/react-test-renderer": ["react-test-renderer@19.0.0", "", { "dependencies": { "react-is": "^19.0.0", "scheduler": "^0.25.0" }, "peerDependencies": { "react": "^19.0.0" } }, "sha512-oX5u9rOQlHzqrE/64CNr0HB0uWxkCQmZNSfozlYvwE71TLVgeZxVf0IjouGEr1v7r1kcDifdAJBeOhdhxsG/DA=="],
|
||||
"jest-config/pretty-format": ["pretty-format@29.7.0", "", { "dependencies": { "@jest/schemas": "^29.6.3", "ansi-styles": "^5.0.0", "react-is": "^18.0.0" } }, "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ=="],
|
||||
|
||||
"jest-each/pretty-format": ["pretty-format@29.7.0", "", { "dependencies": { "@jest/schemas": "^29.6.3", "ansi-styles": "^5.0.0", "react-is": "^18.0.0" } }, "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ=="],
|
||||
|
||||
"jest-leak-detector/pretty-format": ["pretty-format@29.7.0", "", { "dependencies": { "@jest/schemas": "^29.6.3", "ansi-styles": "^5.0.0", "react-is": "^18.0.0" } }, "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ=="],
|
||||
|
||||
"jest-message-util/pretty-format": ["pretty-format@29.7.0", "", { "dependencies": { "@jest/schemas": "^29.6.3", "ansi-styles": "^5.0.0", "react-is": "^18.0.0" } }, "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ=="],
|
||||
|
||||
"jest-runner/source-map-support": ["source-map-support@0.5.13", "", { "dependencies": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" } }, "sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w=="],
|
||||
|
||||
"jest-runtime/glob": ["glob@7.2.3", "", { "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q=="],
|
||||
|
||||
"jest-snapshot/jest-diff": ["jest-diff@29.7.0", "", { "dependencies": { "chalk": "^4.0.0", "diff-sequences": "^29.6.3", "jest-get-type": "^29.6.3", "pretty-format": "^29.7.0" } }, "sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw=="],
|
||||
|
||||
"jest-snapshot/jest-matcher-utils": ["jest-matcher-utils@29.7.0", "", { "dependencies": { "chalk": "^4.0.0", "jest-diff": "^29.7.0", "jest-get-type": "^29.6.3", "pretty-format": "^29.7.0" } }, "sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g=="],
|
||||
|
||||
"jest-snapshot/pretty-format": ["pretty-format@29.7.0", "", { "dependencies": { "@jest/schemas": "^29.6.3", "ansi-styles": "^5.0.0", "react-is": "^18.0.0" } }, "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ=="],
|
||||
|
||||
"jest-snapshot/semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="],
|
||||
|
||||
"jest-util/picomatch": ["picomatch@2.3.1", "", {}, "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="],
|
||||
|
||||
"jest-validate/pretty-format": ["pretty-format@29.7.0", "", { "dependencies": { "@jest/schemas": "^29.6.3", "ansi-styles": "^5.0.0", "react-is": "^18.0.0" } }, "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ=="],
|
||||
|
||||
"jest-watch-select-projects/chalk": ["chalk@3.0.0", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg=="],
|
||||
|
||||
"jest-watch-typeahead/ansi-escapes": ["ansi-escapes@6.2.1", "", {}, "sha512-4nJ3yixlEthEJ9Rk4vPcdBRkZvQZlYyu8j4/Mqz5sgIkddmEnH2Yj2ZrnP9S3tQOvSNRUIgVNF/1yPpRAGNRig=="],
|
||||
@@ -2280,21 +2338,21 @@
|
||||
|
||||
"pkg-dir/find-up": ["find-up@4.1.0", "", { "dependencies": { "locate-path": "^5.0.0", "path-exists": "^4.0.0" } }, "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw=="],
|
||||
|
||||
"pretty-format/react-is": ["react-is@18.3.1", "", {}, "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg=="],
|
||||
|
||||
"prop-types/react-is": ["react-is@16.13.1", "", {}, "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="],
|
||||
|
||||
"rc/strip-json-comments": ["strip-json-comments@2.0.1", "", {}, "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ=="],
|
||||
|
||||
"react-devtools-core/ws": ["ws@7.5.10", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": "^5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ=="],
|
||||
|
||||
"react-dom/scheduler": ["scheduler@0.25.0", "", {}, "sha512-xFVuu11jh+xcO7JOAGJNOXld8/TcEHK/4CituBUeUb5hqxJLj9YuemAEuvm9gQ/+pgXYfbQuqAkiYu+u7YEsNA=="],
|
||||
|
||||
"react-native/@react-native/normalize-colors": ["@react-native/normalize-colors@0.79.5", "", {}, "sha512-nGXMNMclZgzLUxijQQ38Dm3IAEhgxuySAWQHnljFtfB0JdaMwpe0Ox9H7Tp2OgrEA+EMEv+Od9ElKlHwGKmmvQ=="],
|
||||
|
||||
"react-native/commander": ["commander@12.1.0", "", {}, "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA=="],
|
||||
|
||||
"react-native/glob": ["glob@7.2.3", "", { "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q=="],
|
||||
|
||||
"react-native/scheduler": ["scheduler@0.25.0", "", {}, "sha512-xFVuu11jh+xcO7JOAGJNOXld8/TcEHK/4CituBUeUb5hqxJLj9YuemAEuvm9gQ/+pgXYfbQuqAkiYu+u7YEsNA=="],
|
||||
"react-native/pretty-format": ["pretty-format@29.7.0", "", { "dependencies": { "@jest/schemas": "^29.6.3", "ansi-styles": "^5.0.0", "react-is": "^18.0.0" } }, "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ=="],
|
||||
|
||||
"react-native/semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="],
|
||||
|
||||
@@ -2358,6 +2416,10 @@
|
||||
|
||||
"@expo/cli/ora/strip-ansi": ["strip-ansi@5.2.0", "", { "dependencies": { "ansi-regex": "^4.1.0" } }, "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA=="],
|
||||
|
||||
"@expo/cli/pretty-format/@jest/schemas": ["@jest/schemas@29.6.3", "", { "dependencies": { "@sinclair/typebox": "^0.27.8" } }, "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA=="],
|
||||
|
||||
"@expo/cli/pretty-format/react-is": ["react-is@18.3.1", "", {}, "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg=="],
|
||||
|
||||
"@expo/package-manager/ora/chalk": ["chalk@2.4.2", "", { "dependencies": { "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", "supports-color": "^5.3.0" } }, "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ=="],
|
||||
|
||||
"@expo/package-manager/ora/cli-cursor": ["cli-cursor@2.1.0", "", { "dependencies": { "restore-cursor": "^2.0.0" } }, "sha512-8lgKz8LmCRYZZQDpRyT2m5rKJ08TnU4tR9FFFW2rxpxR1FzWi4PQ/NfyODchAatHaUgnSPVcx/R5w6NuTBzFiw=="],
|
||||
@@ -2376,10 +2438,16 @@
|
||||
|
||||
"@istanbuljs/load-nyc-config/js-yaml/argparse": ["argparse@1.0.10", "", { "dependencies": { "sprintf-js": "~1.0.2" } }, "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg=="],
|
||||
|
||||
"@jest/core/pretty-format/@jest/schemas": ["@jest/schemas@29.6.3", "", { "dependencies": { "@sinclair/typebox": "^0.27.8" } }, "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA=="],
|
||||
|
||||
"@jest/core/pretty-format/react-is": ["react-is@18.3.1", "", {}, "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg=="],
|
||||
|
||||
"@jest/reporters/glob/minimatch": ["minimatch@3.1.5", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w=="],
|
||||
|
||||
"@jest/reporters/string-length/char-regex": ["char-regex@1.0.2", "", {}, "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw=="],
|
||||
|
||||
"@jest/types/@jest/schemas/@sinclair/typebox": ["@sinclair/typebox@0.27.10", "", {}, "sha512-MTBk/3jGLNB2tVxv6uLlFh1iu64iYOQ2PbdOSK3NW8JZsmlaOh2q6sdtKowBhfw8QFLmYNzTW4/oK4uATIi6ZA=="],
|
||||
|
||||
"@react-native-community/cli-config-apple/@react-native-community/cli-tools/semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="],
|
||||
|
||||
"@react-native-community/cli-doctor/@react-native-community/cli-platform-apple/@react-native-community/cli-config-apple": ["@react-native-community/cli-config-apple@19.1.2", "", { "dependencies": { "@react-native-community/cli-tools": "19.1.2", "chalk": "^4.1.2", "execa": "^5.0.0", "fast-glob": "^3.3.2" } }, "sha512-91upuYMLgEtJE6foWQFgGDpT3ZDTc5bX6rMY5cJMqiAE5svgh1q0kbbpRuv/ptBYzcxLplL7wZWpA77TlJdm9A=="],
|
||||
@@ -2406,6 +2474,10 @@
|
||||
|
||||
"@react-native/dev-middleware/open/is-wsl": ["is-wsl@2.2.0", "", { "dependencies": { "is-docker": "^2.0.0" } }, "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww=="],
|
||||
|
||||
"@types/jest/pretty-format/@jest/schemas": ["@jest/schemas@29.6.3", "", { "dependencies": { "@sinclair/typebox": "^0.27.8" } }, "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA=="],
|
||||
|
||||
"@types/jest/pretty-format/react-is": ["react-is@18.3.1", "", {}, "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg=="],
|
||||
|
||||
"ansi-fragments/strip-ansi/ansi-regex": ["ansi-regex@4.1.1", "", {}, "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g=="],
|
||||
|
||||
"better-opn/open/is-wsl": ["is-wsl@2.2.0", "", { "dependencies": { "is-docker": "^2.0.0" } }, "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww=="],
|
||||
@@ -2418,16 +2490,46 @@
|
||||
|
||||
"css-select/domutils/dom-serializer": ["dom-serializer@2.0.0", "", { "dependencies": { "domelementtype": "^2.3.0", "domhandler": "^5.0.2", "entities": "^4.2.0" } }, "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg=="],
|
||||
|
||||
"expect/jest-matcher-utils/jest-diff": ["jest-diff@29.7.0", "", { "dependencies": { "chalk": "^4.0.0", "diff-sequences": "^29.6.3", "jest-get-type": "^29.6.3", "pretty-format": "^29.7.0" } }, "sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw=="],
|
||||
|
||||
"expect/jest-matcher-utils/pretty-format": ["pretty-format@29.7.0", "", { "dependencies": { "@jest/schemas": "^29.6.3", "ansi-styles": "^5.0.0", "react-is": "^18.0.0" } }, "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ=="],
|
||||
|
||||
"finalhandler/debug/ms": ["ms@2.0.0", "", {}, "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="],
|
||||
|
||||
"jest-circus/jest-matcher-utils/jest-diff": ["jest-diff@29.7.0", "", { "dependencies": { "chalk": "^4.0.0", "diff-sequences": "^29.6.3", "jest-get-type": "^29.6.3", "pretty-format": "^29.7.0" } }, "sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw=="],
|
||||
|
||||
"jest-circus/pretty-format/@jest/schemas": ["@jest/schemas@29.6.3", "", { "dependencies": { "@sinclair/typebox": "^0.27.8" } }, "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA=="],
|
||||
|
||||
"jest-circus/pretty-format/react-is": ["react-is@18.3.1", "", {}, "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg=="],
|
||||
|
||||
"jest-config/glob/minimatch": ["minimatch@3.1.5", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w=="],
|
||||
|
||||
"jest-expo/react-test-renderer/react-is": ["react-is@19.2.4", "", {}, "sha512-W+EWGn2v0ApPKgKKCy/7s7WHXkboGcsrXE+2joLyVxkbyVQfO3MUEaUQDHoSmb8TFFrSKYa9mw64WZHNHSDzYA=="],
|
||||
"jest-config/pretty-format/@jest/schemas": ["@jest/schemas@29.6.3", "", { "dependencies": { "@sinclair/typebox": "^0.27.8" } }, "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA=="],
|
||||
|
||||
"jest-expo/react-test-renderer/scheduler": ["scheduler@0.25.0", "", {}, "sha512-xFVuu11jh+xcO7JOAGJNOXld8/TcEHK/4CituBUeUb5hqxJLj9YuemAEuvm9gQ/+pgXYfbQuqAkiYu+u7YEsNA=="],
|
||||
"jest-config/pretty-format/react-is": ["react-is@18.3.1", "", {}, "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg=="],
|
||||
|
||||
"jest-each/pretty-format/@jest/schemas": ["@jest/schemas@29.6.3", "", { "dependencies": { "@sinclair/typebox": "^0.27.8" } }, "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA=="],
|
||||
|
||||
"jest-each/pretty-format/react-is": ["react-is@18.3.1", "", {}, "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg=="],
|
||||
|
||||
"jest-leak-detector/pretty-format/@jest/schemas": ["@jest/schemas@29.6.3", "", { "dependencies": { "@sinclair/typebox": "^0.27.8" } }, "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA=="],
|
||||
|
||||
"jest-leak-detector/pretty-format/react-is": ["react-is@18.3.1", "", {}, "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg=="],
|
||||
|
||||
"jest-message-util/pretty-format/@jest/schemas": ["@jest/schemas@29.6.3", "", { "dependencies": { "@sinclair/typebox": "^0.27.8" } }, "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA=="],
|
||||
|
||||
"jest-message-util/pretty-format/react-is": ["react-is@18.3.1", "", {}, "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg=="],
|
||||
|
||||
"jest-runtime/glob/minimatch": ["minimatch@3.1.5", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w=="],
|
||||
|
||||
"jest-snapshot/pretty-format/@jest/schemas": ["@jest/schemas@29.6.3", "", { "dependencies": { "@sinclair/typebox": "^0.27.8" } }, "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA=="],
|
||||
|
||||
"jest-snapshot/pretty-format/react-is": ["react-is@18.3.1", "", {}, "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg=="],
|
||||
|
||||
"jest-validate/pretty-format/@jest/schemas": ["@jest/schemas@29.6.3", "", { "dependencies": { "@sinclair/typebox": "^0.27.8" } }, "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA=="],
|
||||
|
||||
"jest-validate/pretty-format/react-is": ["react-is@18.3.1", "", {}, "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg=="],
|
||||
|
||||
"jest-watch-select-projects/chalk/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="],
|
||||
|
||||
"jest-watch-typeahead/strip-ansi/ansi-regex": ["ansi-regex@6.2.2", "", {}, "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg=="],
|
||||
@@ -2464,6 +2566,10 @@
|
||||
|
||||
"react-native/glob/minimatch": ["minimatch@3.1.5", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w=="],
|
||||
|
||||
"react-native/pretty-format/@jest/schemas": ["@jest/schemas@29.6.3", "", { "dependencies": { "@sinclair/typebox": "^0.27.8" } }, "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA=="],
|
||||
|
||||
"react-native/pretty-format/react-is": ["react-is@18.3.1", "", {}, "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg=="],
|
||||
|
||||
"rimraf/glob/minimatch": ["minimatch@3.1.5", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w=="],
|
||||
|
||||
"send/debug/ms": ["ms@2.0.0", "", {}, "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="],
|
||||
@@ -2488,6 +2594,8 @@
|
||||
|
||||
"@expo/cli/ora/strip-ansi/ansi-regex": ["ansi-regex@4.1.1", "", {}, "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g=="],
|
||||
|
||||
"@expo/cli/pretty-format/@jest/schemas/@sinclair/typebox": ["@sinclair/typebox@0.27.10", "", {}, "sha512-MTBk/3jGLNB2tVxv6uLlFh1iu64iYOQ2PbdOSK3NW8JZsmlaOh2q6sdtKowBhfw8QFLmYNzTW4/oK4uATIi6ZA=="],
|
||||
|
||||
"@expo/package-manager/ora/chalk/ansi-styles": ["ansi-styles@3.2.1", "", { "dependencies": { "color-convert": "^1.9.0" } }, "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA=="],
|
||||
|
||||
"@expo/package-manager/ora/chalk/escape-string-regexp": ["escape-string-regexp@1.0.5", "", {}, "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg=="],
|
||||
@@ -2500,6 +2608,8 @@
|
||||
|
||||
"@istanbuljs/load-nyc-config/find-up/locate-path/p-locate": ["p-locate@4.1.0", "", { "dependencies": { "p-limit": "^2.2.0" } }, "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A=="],
|
||||
|
||||
"@jest/core/pretty-format/@jest/schemas/@sinclair/typebox": ["@sinclair/typebox@0.27.10", "", {}, "sha512-MTBk/3jGLNB2tVxv6uLlFh1iu64iYOQ2PbdOSK3NW8JZsmlaOh2q6sdtKowBhfw8QFLmYNzTW4/oK4uATIi6ZA=="],
|
||||
|
||||
"@jest/reporters/glob/minimatch/brace-expansion": ["brace-expansion@1.1.12", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg=="],
|
||||
|
||||
"@react-native-community/cli-server-api/pretty-format/@jest/types/@types/yargs": ["@types/yargs@15.0.20", "", { "dependencies": { "@types/yargs-parser": "*" } }, "sha512-KIkX+/GgfFitlASYCGoSF+T4XRXhOubJLhkLVtSfsRTe9jWMmuM2g28zQ41BtPTG7TRBb2xHW+LCNVE9QR/vsg=="],
|
||||
@@ -2510,12 +2620,32 @@
|
||||
|
||||
"@react-native/community-cli-plugin/@react-native/dev-middleware/open/is-wsl": ["is-wsl@2.2.0", "", { "dependencies": { "is-docker": "^2.0.0" } }, "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww=="],
|
||||
|
||||
"@types/jest/pretty-format/@jest/schemas/@sinclair/typebox": ["@sinclair/typebox@0.27.10", "", {}, "sha512-MTBk/3jGLNB2tVxv6uLlFh1iu64iYOQ2PbdOSK3NW8JZsmlaOh2q6sdtKowBhfw8QFLmYNzTW4/oK4uATIi6ZA=="],
|
||||
|
||||
"css-select/domutils/dom-serializer/entities": ["entities@4.5.0", "", {}, "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw=="],
|
||||
|
||||
"expect/jest-matcher-utils/pretty-format/@jest/schemas": ["@jest/schemas@29.6.3", "", { "dependencies": { "@sinclair/typebox": "^0.27.8" } }, "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA=="],
|
||||
|
||||
"expect/jest-matcher-utils/pretty-format/react-is": ["react-is@18.3.1", "", {}, "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg=="],
|
||||
|
||||
"jest-circus/pretty-format/@jest/schemas/@sinclair/typebox": ["@sinclair/typebox@0.27.10", "", {}, "sha512-MTBk/3jGLNB2tVxv6uLlFh1iu64iYOQ2PbdOSK3NW8JZsmlaOh2q6sdtKowBhfw8QFLmYNzTW4/oK4uATIi6ZA=="],
|
||||
|
||||
"jest-config/glob/minimatch/brace-expansion": ["brace-expansion@1.1.12", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg=="],
|
||||
|
||||
"jest-config/pretty-format/@jest/schemas/@sinclair/typebox": ["@sinclair/typebox@0.27.10", "", {}, "sha512-MTBk/3jGLNB2tVxv6uLlFh1iu64iYOQ2PbdOSK3NW8JZsmlaOh2q6sdtKowBhfw8QFLmYNzTW4/oK4uATIi6ZA=="],
|
||||
|
||||
"jest-each/pretty-format/@jest/schemas/@sinclair/typebox": ["@sinclair/typebox@0.27.10", "", {}, "sha512-MTBk/3jGLNB2tVxv6uLlFh1iu64iYOQ2PbdOSK3NW8JZsmlaOh2q6sdtKowBhfw8QFLmYNzTW4/oK4uATIi6ZA=="],
|
||||
|
||||
"jest-leak-detector/pretty-format/@jest/schemas/@sinclair/typebox": ["@sinclair/typebox@0.27.10", "", {}, "sha512-MTBk/3jGLNB2tVxv6uLlFh1iu64iYOQ2PbdOSK3NW8JZsmlaOh2q6sdtKowBhfw8QFLmYNzTW4/oK4uATIi6ZA=="],
|
||||
|
||||
"jest-message-util/pretty-format/@jest/schemas/@sinclair/typebox": ["@sinclair/typebox@0.27.10", "", {}, "sha512-MTBk/3jGLNB2tVxv6uLlFh1iu64iYOQ2PbdOSK3NW8JZsmlaOh2q6sdtKowBhfw8QFLmYNzTW4/oK4uATIi6ZA=="],
|
||||
|
||||
"jest-runtime/glob/minimatch/brace-expansion": ["brace-expansion@1.1.12", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg=="],
|
||||
|
||||
"jest-snapshot/pretty-format/@jest/schemas/@sinclair/typebox": ["@sinclair/typebox@0.27.10", "", {}, "sha512-MTBk/3jGLNB2tVxv6uLlFh1iu64iYOQ2PbdOSK3NW8JZsmlaOh2q6sdtKowBhfw8QFLmYNzTW4/oK4uATIi6ZA=="],
|
||||
|
||||
"jest-validate/pretty-format/@jest/schemas/@sinclair/typebox": ["@sinclair/typebox@0.27.10", "", {}, "sha512-MTBk/3jGLNB2tVxv6uLlFh1iu64iYOQ2PbdOSK3NW8JZsmlaOh2q6sdtKowBhfw8QFLmYNzTW4/oK4uATIi6ZA=="],
|
||||
|
||||
"logkitty/yargs/cliui/wrap-ansi": ["wrap-ansi@6.2.0", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA=="],
|
||||
|
||||
"logkitty/yargs/find-up/locate-path": ["locate-path@5.0.0", "", { "dependencies": { "p-locate": "^4.1.0" } }, "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g=="],
|
||||
@@ -2530,6 +2660,8 @@
|
||||
|
||||
"react-native/glob/minimatch/brace-expansion": ["brace-expansion@1.1.12", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg=="],
|
||||
|
||||
"react-native/pretty-format/@jest/schemas/@sinclair/typebox": ["@sinclair/typebox@0.27.10", "", {}, "sha512-MTBk/3jGLNB2tVxv6uLlFh1iu64iYOQ2PbdOSK3NW8JZsmlaOh2q6sdtKowBhfw8QFLmYNzTW4/oK4uATIi6ZA=="],
|
||||
|
||||
"rimraf/glob/minimatch/brace-expansion": ["brace-expansion@1.1.12", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg=="],
|
||||
|
||||
"slice-ansi/ansi-styles/color-convert/color-name": ["color-name@1.1.3", "", {}, "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw=="],
|
||||
@@ -2558,6 +2690,8 @@
|
||||
|
||||
"@react-native/codegen/glob/minimatch/brace-expansion/balanced-match": ["balanced-match@1.0.2", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="],
|
||||
|
||||
"expect/jest-matcher-utils/pretty-format/@jest/schemas/@sinclair/typebox": ["@sinclair/typebox@0.27.10", "", {}, "sha512-MTBk/3jGLNB2tVxv6uLlFh1iu64iYOQ2PbdOSK3NW8JZsmlaOh2q6sdtKowBhfw8QFLmYNzTW4/oK4uATIi6ZA=="],
|
||||
|
||||
"jest-config/glob/minimatch/brace-expansion/balanced-match": ["balanced-match@1.0.2", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="],
|
||||
|
||||
"jest-runtime/glob/minimatch/brace-expansion/balanced-match": ["balanced-match@1.0.2", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="],
|
||||
|
||||
79
components/ErrorBoundary.tsx
Normal file
79
components/ErrorBoundary.tsx
Normal file
@@ -0,0 +1,79 @@
|
||||
import React, { Component, ReactNode } from 'react';
|
||||
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
|
||||
|
||||
type Props = {
|
||||
children: ReactNode;
|
||||
fallback?: ReactNode;
|
||||
};
|
||||
|
||||
type State = {
|
||||
hasError: boolean;
|
||||
error: Error | null;
|
||||
};
|
||||
|
||||
export default class ErrorBoundary extends Component<Props, State> {
|
||||
state: State = { hasError: false, error: null };
|
||||
|
||||
static getDerivedStateFromError(error: Error): State {
|
||||
return { hasError: true, error };
|
||||
}
|
||||
|
||||
componentDidCatch(error: Error): void {
|
||||
const { logError } = require('@/lib/errorLogger');
|
||||
logError(error.message, error);
|
||||
}
|
||||
|
||||
handleReset = () => {
|
||||
this.setState({ hasError: false, error: null });
|
||||
};
|
||||
|
||||
render() {
|
||||
if (this.state.hasError) {
|
||||
if (this.props.fallback) return this.props.fallback;
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<Text style={styles.title}>Terjadi Kesalahan</Text>
|
||||
<Text style={styles.message}>
|
||||
Silahkan coba lagi beberapa saat lagi atau hubungi admin untuk bantuan.
|
||||
</Text>
|
||||
<TouchableOpacity style={styles.button} onPress={this.handleReset}>
|
||||
<Text style={styles.buttonText}>Coba Lagi</Text>
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
return this.props.children;
|
||||
}
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
padding: 24,
|
||||
backgroundColor: '#f7f7f7',
|
||||
},
|
||||
title: {
|
||||
fontSize: 18,
|
||||
fontWeight: '600',
|
||||
marginBottom: 8,
|
||||
color: '#11181C',
|
||||
},
|
||||
message: {
|
||||
fontSize: 14,
|
||||
color: '#707887',
|
||||
textAlign: 'center',
|
||||
marginBottom: 24,
|
||||
},
|
||||
button: {
|
||||
backgroundColor: '#19345E',
|
||||
paddingHorizontal: 24,
|
||||
paddingVertical: 12,
|
||||
borderRadius: 8,
|
||||
},
|
||||
buttonText: {
|
||||
color: '#fff',
|
||||
fontWeight: '600',
|
||||
},
|
||||
});
|
||||
42
components/ErrorView.tsx
Normal file
42
components/ErrorView.tsx
Normal file
@@ -0,0 +1,42 @@
|
||||
import Text from '@/components/Text';
|
||||
import Styles from '@/constants/Styles';
|
||||
import { useTheme } from '@/providers/ThemeProvider';
|
||||
import { MaterialCommunityIcons } from "@expo/vector-icons";
|
||||
import React from 'react';
|
||||
import { View } from 'react-native';
|
||||
|
||||
interface ErrorViewProps {
|
||||
title?: string;
|
||||
message?: string;
|
||||
icon?: keyof typeof MaterialCommunityIcons.glyphMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* ErrorView component to display error or empty states.
|
||||
* Used when data is not found, deleted, or an error occurs during fetching.
|
||||
*/
|
||||
export default function ErrorView({
|
||||
title = "Terjadi Kesalahan",
|
||||
message = "Data tidak ditemukan atau sudah dihapus.",
|
||||
icon = "alert-circle-outline"
|
||||
}: ErrorViewProps) {
|
||||
const { colors } = useTheme();
|
||||
|
||||
return (
|
||||
<View style={[Styles.flex1, Styles.contentItemCenter, Styles.ph20]}>
|
||||
<View style={[Styles.mb10]}>
|
||||
<MaterialCommunityIcons
|
||||
name={icon}
|
||||
size={40}
|
||||
color={colors.dimmed}
|
||||
/>
|
||||
</View>
|
||||
<Text style={[Styles.textDefaultSemiBold, { color: colors.text, textAlign: 'center' }]}>
|
||||
{title}
|
||||
</Text>
|
||||
<Text style={[Styles.textMediumNormal, { color: colors.dimmed, textAlign: 'center', marginTop: 4 }]}>
|
||||
{message}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
159
components/GuideOverlay.tsx
Normal file
159
components/GuideOverlay.tsx
Normal file
@@ -0,0 +1,159 @@
|
||||
import Text from '@/components/Text';
|
||||
import Styles from '@/constants/Styles';
|
||||
import { useTheme } from '@/providers/ThemeProvider';
|
||||
import { Feather } from '@expo/vector-icons';
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import {
|
||||
Animated,
|
||||
Dimensions,
|
||||
Modal,
|
||||
TouchableOpacity,
|
||||
View,
|
||||
} from 'react-native';
|
||||
|
||||
export type GuideStep = {
|
||||
title: string;
|
||||
description: string;
|
||||
// posisi card: pixel absolut atau rasio layar (0.0-1.0), rasio lebih aman untuk layout dinamis
|
||||
cardTop?: number;
|
||||
cardTopRatio?: number;
|
||||
// arrow menunjuk ke atas (elemen ada di atas card) atau ke bawah (elemen ada di bawah card)
|
||||
arrowDirection?: 'up' | 'down' | 'none';
|
||||
// offset horizontal arrow dari kiri card (0.0-1.0), default 0.5 = tengah
|
||||
arrowOffset?: number;
|
||||
};
|
||||
|
||||
type Props = {
|
||||
visible: boolean;
|
||||
steps: GuideStep[];
|
||||
onDismiss: () => void;
|
||||
};
|
||||
|
||||
const { height: SCREEN_H } = Dimensions.get('window');
|
||||
const CARD_MARGIN = 24;
|
||||
|
||||
export default function GuideOverlay({ visible, steps, onDismiss }: Props) {
|
||||
const { colors } = useTheme();
|
||||
const [currentStep, setCurrentStep] = useState(0);
|
||||
const fadeAnim = useRef(new Animated.Value(0)).current;
|
||||
const slideAnim = useRef(new Animated.Value(20)).current;
|
||||
|
||||
const step = steps[currentStep];
|
||||
const isLast = currentStep === steps.length - 1;
|
||||
|
||||
const arrowDirection = step?.arrowDirection ?? 'none';
|
||||
const arrowOffset = step?.arrowOffset ?? 0.5;
|
||||
const cardTop = step?.cardTopRatio != null
|
||||
? SCREEN_H * step.cardTopRatio
|
||||
: (step?.cardTop ?? SCREEN_H * 0.35);
|
||||
|
||||
const cardPositionStyle = { top: cardTop };
|
||||
|
||||
useEffect(() => {
|
||||
if (visible) {
|
||||
setCurrentStep(0);
|
||||
Animated.parallel([
|
||||
Animated.timing(fadeAnim, { toValue: 1, duration: 300, useNativeDriver: true }),
|
||||
Animated.timing(slideAnim, { toValue: 0, duration: 300, useNativeDriver: true }),
|
||||
]).start();
|
||||
} else {
|
||||
fadeAnim.setValue(0);
|
||||
slideAnim.setValue(20);
|
||||
}
|
||||
}, [visible]);
|
||||
|
||||
function animateStep(next: number) {
|
||||
Animated.sequence([
|
||||
Animated.timing(slideAnim, { toValue: 12, duration: 120, useNativeDriver: true }),
|
||||
Animated.timing(slideAnim, { toValue: 0, duration: 180, useNativeDriver: true }),
|
||||
]).start();
|
||||
setCurrentStep(next);
|
||||
}
|
||||
|
||||
if (!visible) return null;
|
||||
|
||||
return (
|
||||
<Modal transparent visible={visible} animationType="none" onRequestClose={onDismiss}>
|
||||
<Animated.View style={[Styles.guideOverlay, { opacity: fadeAnim }]}>
|
||||
<Animated.View
|
||||
style={[
|
||||
Styles.guideCard,
|
||||
{ backgroundColor: colors.modalBackground, transform: [{ translateY: slideAnim }] },
|
||||
cardPositionStyle,
|
||||
]}
|
||||
>
|
||||
{/* Arrow atas — menunjuk ke elemen di atas card */}
|
||||
{arrowDirection === 'up' && (
|
||||
<View style={[Styles.guideArrowUp, {
|
||||
left: `${arrowOffset * 100}%` as any,
|
||||
borderBottomColor: colors.modalBackground,
|
||||
}]} />
|
||||
)}
|
||||
|
||||
{/* Header */}
|
||||
<View style={[Styles.rowItemsCenter, Styles.rowSpaceBetween, Styles.mb10]}>
|
||||
<View style={[Styles.guideBadge, { backgroundColor: colors.icon + '20' }]}>
|
||||
<Text style={[Styles.textSmallSemiBold, { color: colors.icon }]}>
|
||||
{currentStep + 1} / {steps.length}
|
||||
</Text>
|
||||
</View>
|
||||
<TouchableOpacity onPress={onDismiss} hitSlop={{ top: 8, bottom: 8, left: 8, right: 8 }}>
|
||||
<Feather name="x" size={18} color={colors.dimmed} />
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
|
||||
{/* Content */}
|
||||
<Text style={[Styles.textDefaultSemiBold, Styles.mb05, { color: colors.text }]}>
|
||||
{step.title}
|
||||
</Text>
|
||||
<Text style={[Styles.textMediumNormal, { color: colors.text, lineHeight: 20 }]}>
|
||||
{step.description}
|
||||
</Text>
|
||||
|
||||
{/* Dot indicator */}
|
||||
<View style={[Styles.rowItemsCenter, Styles.guideDotRow]}>
|
||||
{steps.map((_, i) => (
|
||||
<View
|
||||
key={i}
|
||||
style={[Styles.guideDot, {
|
||||
backgroundColor: i === currentStep ? colors.icon : colors.icon + '30',
|
||||
}]}
|
||||
/>
|
||||
))}
|
||||
</View>
|
||||
|
||||
{/* Footer */}
|
||||
<View style={[Styles.rowItemsCenter, Styles.rowSpaceBetween, Styles.mt10]}>
|
||||
{currentStep > 0 ? (
|
||||
<TouchableOpacity onPress={() => animateStep(currentStep - 1)} style={Styles.guideButtonSecondary}>
|
||||
<Text style={[Styles.textMediumNormal, { color: colors.dimmed }]}>Kembali</Text>
|
||||
</TouchableOpacity>
|
||||
) : (
|
||||
<TouchableOpacity onPress={onDismiss}>
|
||||
<Text style={[Styles.textMediumNormal, { color: colors.dimmed }]}>Lewati</Text>
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
|
||||
<TouchableOpacity
|
||||
onPress={() => isLast ? onDismiss() : animateStep(currentStep + 1)}
|
||||
style={[Styles.guideButtonPrimary, { backgroundColor: colors.icon }]}
|
||||
>
|
||||
<Text style={[Styles.textMediumSemiBold, { color: '#ffffff' }]}>
|
||||
{isLast ? 'Selesai' : 'Lanjut'}
|
||||
</Text>
|
||||
{!isLast && <Feather name="arrow-right" size={14} color="#ffffff" style={{ marginLeft: 4 }} />}
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
|
||||
{/* Arrow bawah — menunjuk ke elemen di bawah card */}
|
||||
{arrowDirection === 'down' && (
|
||||
<View style={[Styles.guideArrowDown, {
|
||||
left: `${arrowOffset * 100}%` as any,
|
||||
borderTopColor: colors.modalBackground,
|
||||
}]} />
|
||||
)}
|
||||
</Animated.View>
|
||||
</Animated.View>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
140
components/ModalRiwayatApproval.tsx
Normal file
140
components/ModalRiwayatApproval.tsx
Normal file
@@ -0,0 +1,140 @@
|
||||
import Styles from "@/constants/Styles"
|
||||
import { useTheme } from "@/providers/ThemeProvider"
|
||||
import { MaterialCommunityIcons } from "@expo/vector-icons"
|
||||
import { useRef, useState } from "react"
|
||||
import { ScrollView, View } from "react-native"
|
||||
import DrawerBottom from "./drawerBottom"
|
||||
import Skeleton from "./skeleton"
|
||||
import Text from "./Text"
|
||||
|
||||
type ApprovalRecord = {
|
||||
id: string
|
||||
status: number // 0=pending, 1=approved, 2=rejected
|
||||
note?: string
|
||||
submitter: { name: string }
|
||||
approver?: { name: string }
|
||||
createdAt: string
|
||||
}
|
||||
|
||||
type Props = {
|
||||
isVisible: boolean
|
||||
setVisible: (value: boolean) => void
|
||||
data: ApprovalRecord[]
|
||||
loading: boolean
|
||||
}
|
||||
|
||||
function ApprovalStatusBadge({ status }: { status: number }) {
|
||||
const { colors } = useTheme()
|
||||
const config =
|
||||
status === 1
|
||||
? { label: 'Disetujui', color: colors.success }
|
||||
: status === 2
|
||||
? { label: 'Ditolak', color: colors.error }
|
||||
: { label: 'Menunggu', color: '#FFA94D' }
|
||||
|
||||
return (
|
||||
<View style={{
|
||||
backgroundColor: config.color + '20',
|
||||
borderRadius: 20,
|
||||
paddingHorizontal: 10,
|
||||
paddingVertical: 3,
|
||||
alignSelf: 'flex-start',
|
||||
}}>
|
||||
<Text style={[Styles.textSmallSemiBold, { color: config.color }]}>
|
||||
{config.label}
|
||||
</Text>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
export default function ModalRiwayatApproval({ isVisible, setVisible, data, loading }: Props) {
|
||||
const { colors } = useTheme()
|
||||
const arrSkeleton = Array.from({ length: 3 })
|
||||
const scrollRef = useRef<ScrollView>(null)
|
||||
const [scrollOffset, setScrollOffset] = useState(0)
|
||||
|
||||
return (
|
||||
<DrawerBottom
|
||||
isVisible={isVisible}
|
||||
setVisible={setVisible}
|
||||
title="Riwayat Persetujuan"
|
||||
animation="slide"
|
||||
height={60}
|
||||
scrollOffset={scrollOffset}
|
||||
scrollTo={(p) => scrollRef.current?.scrollTo(p)}
|
||||
>
|
||||
<ScrollView
|
||||
ref={scrollRef}
|
||||
showsVerticalScrollIndicator={false}
|
||||
onScroll={({ nativeEvent }) => setScrollOffset(nativeEvent.contentOffset.y)}
|
||||
scrollEventThrottle={16}
|
||||
>
|
||||
{loading ? (
|
||||
arrSkeleton.map((_, i) => (
|
||||
<View key={i} style={[Styles.mb10]}>
|
||||
<Skeleton width={100} widthType="percent" height={80} borderRadius={10} />
|
||||
</View>
|
||||
))
|
||||
) : data.length > 0 ? (
|
||||
data.map((item, index) => (
|
||||
<View
|
||||
key={item.id}
|
||||
style={{
|
||||
borderWidth: 1,
|
||||
borderColor: colors.icon + '30',
|
||||
borderRadius: 10,
|
||||
padding: 12,
|
||||
marginBottom: 10,
|
||||
}}
|
||||
>
|
||||
{/* Status + tanggal */}
|
||||
<View style={[Styles.rowItemsCenter, { justifyContent: 'space-between', marginBottom: 8 }]}>
|
||||
<ApprovalStatusBadge status={item.status} />
|
||||
<Text style={[Styles.textSmallSemiBold, { color: colors.dimmed }]}>
|
||||
{item.createdAt}
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
{/* Pengaju */}
|
||||
<View style={[Styles.rowItemsCenter, Styles.mb05]}>
|
||||
<MaterialCommunityIcons name="account-arrow-up-outline" size={15} color={colors.dimmed} style={{ marginRight: 6 }} />
|
||||
<Text style={[Styles.textMediumSemiBold, { color: colors.dimmed }]}>Diajukan Oleh: </Text>
|
||||
<Text style={[Styles.textMediumNormal]}>{item.submitter.name}</Text>
|
||||
</View>
|
||||
|
||||
{/* Approver */}
|
||||
<View style={[Styles.rowItemsCenter, item.note ? Styles.mb05 : {}]}>
|
||||
<MaterialCommunityIcons name="account-check-outline" size={15} color={colors.dimmed} style={{ marginRight: 6 }} />
|
||||
<Text style={[Styles.textMediumSemiBold, { color: colors.dimmed }]}>Disetujui Oleh: </Text>
|
||||
<Text style={[Styles.textMediumNormal]}>
|
||||
{item.approver?.name ?? '-'}
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
{/* Catatan penolakan */}
|
||||
{item.note && (
|
||||
<View style={{
|
||||
backgroundColor: colors.error + '12',
|
||||
borderRadius: 8,
|
||||
padding: 8,
|
||||
marginTop: 4,
|
||||
}}>
|
||||
<Text style={[Styles.textSmallSemiBold, { color: colors.error, marginBottom: 2 }]}>
|
||||
Alasan Penolakan
|
||||
</Text>
|
||||
<Text style={[Styles.textMediumNormal, { color: colors.text }]}>
|
||||
{item.note}
|
||||
</Text>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
))
|
||||
) : (
|
||||
<Text style={[Styles.textDefault, { textAlign: 'center', color: colors.dimmed }]}>
|
||||
Belum ada riwayat persetujuan
|
||||
</Text>
|
||||
)}
|
||||
</ScrollView>
|
||||
</DrawerBottom>
|
||||
)
|
||||
}
|
||||
78
components/ModalTolakApproval.tsx
Normal file
78
components/ModalTolakApproval.tsx
Normal file
@@ -0,0 +1,78 @@
|
||||
import Styles from "@/constants/Styles"
|
||||
import { useTheme } from "@/providers/ThemeProvider"
|
||||
import { useState } from "react"
|
||||
import { TouchableOpacity, View } from "react-native"
|
||||
import DrawerBottom from "./drawerBottom"
|
||||
import { InputForm } from "./inputForm"
|
||||
import Text from "./Text"
|
||||
|
||||
type Props = {
|
||||
isVisible: boolean
|
||||
setVisible: (value: boolean) => void
|
||||
onTolak: (note: string) => void
|
||||
loading?: boolean
|
||||
}
|
||||
|
||||
export default function ModalTolakApproval({ isVisible, setVisible, onTolak, loading }: Props) {
|
||||
const { colors } = useTheme()
|
||||
const [note, setNote] = useState('')
|
||||
const [error, setError] = useState(false)
|
||||
|
||||
function handleClose(value: boolean) {
|
||||
setNote('')
|
||||
setError(false)
|
||||
setVisible(value)
|
||||
}
|
||||
|
||||
function handleSubmit() {
|
||||
if (!note.trim()) {
|
||||
setError(true)
|
||||
return
|
||||
}
|
||||
onTolak(note.trim())
|
||||
setNote('')
|
||||
setError(false)
|
||||
}
|
||||
|
||||
return (
|
||||
<DrawerBottom
|
||||
isVisible={isVisible}
|
||||
setVisible={handleClose}
|
||||
title="Tolak Tugas"
|
||||
animation="slide"
|
||||
height={45}
|
||||
keyboard
|
||||
>
|
||||
<View style={{ flex: 1 }}>
|
||||
<InputForm
|
||||
label="Alasan Penolakan"
|
||||
placeholder="Tuliskan alasan penolakan..."
|
||||
type="default"
|
||||
multiline
|
||||
bg="transparent"
|
||||
value={note}
|
||||
onChange={setNote}
|
||||
error={error}
|
||||
errorText="Alasan penolakan wajib diisi"
|
||||
required
|
||||
/>
|
||||
</View>
|
||||
|
||||
<TouchableOpacity
|
||||
onPress={handleSubmit}
|
||||
disabled={loading}
|
||||
style={{
|
||||
backgroundColor: loading ? colors.error + '60' : colors.error,
|
||||
borderRadius: 30,
|
||||
paddingVertical: 10,
|
||||
alignItems: 'center',
|
||||
marginTop: 8,
|
||||
}}
|
||||
>
|
||||
<Text style={[Styles.textDefaultSemiBold, Styles.cWhite]}>
|
||||
{loading ? 'Memproses...' : 'Tolak Tugas'}
|
||||
</Text>
|
||||
</TouchableOpacity>
|
||||
</DrawerBottom>
|
||||
)
|
||||
}
|
||||
@@ -14,11 +14,11 @@ export function ButtonFiturMenu({ onPress, icon, text }: Props) {
|
||||
const { colors } = useTheme();
|
||||
return (
|
||||
<TouchableWithoutFeedback onPress={onPress}>
|
||||
<View style={{ alignItems: 'center' }}>
|
||||
<View style={{ alignItems: 'center', width: '25%' }}>
|
||||
<View style={[Styles.btnFiturMenu, { backgroundColor: colors.card, borderColor: colors.icon + '20', shadowColor: colors.text }]}>
|
||||
{icon}
|
||||
</View>
|
||||
<Text style={[Styles.mt05, { color: colors.text }]}>{text}</Text>
|
||||
<Text style={[Styles.mt05, { color: colors.text, textAlign: 'center', fontSize: 12 }]}>{text}</Text>
|
||||
</View>
|
||||
</TouchableWithoutFeedback>
|
||||
)
|
||||
|
||||
@@ -10,20 +10,22 @@ type Props = {
|
||||
round?: boolean
|
||||
error?: boolean
|
||||
errorText?: string
|
||||
disabled?: boolean
|
||||
}
|
||||
|
||||
export default function ButtonSelect({ value, onPress, round, error, errorText }: Props) {
|
||||
export default function ButtonSelect({ value, onPress, round, error, errorText, disabled }: Props) {
|
||||
const { colors } = useTheme();
|
||||
return (
|
||||
<View style={[Styles.mv05]}>
|
||||
<Pressable onPress={onPress}>
|
||||
<Pressable onPress={onPress} disabled={disabled}>
|
||||
<View style={[
|
||||
Styles.inputRoundForm,
|
||||
Styles.inputRoundFormRight,
|
||||
round && Styles.round30,
|
||||
Styles.pv10,
|
||||
{ borderColor: colors.icon + '20', backgroundColor: colors.input },
|
||||
error && { borderColor: "red" }
|
||||
error && { borderColor: "red" },
|
||||
disabled && { opacity: 0.4 }
|
||||
]}>
|
||||
<Feather name="arrow-right-circle" size={20} color={colors.text} />
|
||||
<Text style={[{ color: colors.text }]}>{value}</Text>
|
||||
|
||||
@@ -6,19 +6,28 @@ import Text from "../Text";
|
||||
type Props = {
|
||||
text: string;
|
||||
isSelected: boolean;
|
||||
isSign: boolean;
|
||||
isSign?: boolean;
|
||||
isSignCalendar?: boolean;
|
||||
isSignTask?: boolean;
|
||||
onPress?: () => void;
|
||||
}
|
||||
|
||||
|
||||
export default function ItemDateCalendar({ text, isSelected, isSign, onPress }: Props) {
|
||||
export default function ItemDateCalendar({ text, isSelected, isSign, isSignCalendar, isSignTask, onPress }: Props) {
|
||||
const { colors } = useTheme()
|
||||
|
||||
const showMulti = isSignCalendar !== undefined || isSignTask !== undefined;
|
||||
|
||||
return (
|
||||
<>
|
||||
<Pressable style={{ alignItems: 'center' }} onPress={onPress}>
|
||||
<Text style={[isSelected ? Styles.cWhite : { color: colors.text }]}>{text}</Text>
|
||||
<View style={[Styles.signDate, { backgroundColor: isSign ? 'red' : 'transparent' }]}></View>
|
||||
</Pressable>
|
||||
</>
|
||||
<Pressable style={Styles.contentItemCenter} onPress={onPress}>
|
||||
<Text style={[isSelected ? Styles.cWhite : { color: colors.text }]}>{text}</Text>
|
||||
{showMulti ? (
|
||||
<View style={Styles.calendarDotRow}>
|
||||
<View style={[Styles.calendarDot, { backgroundColor: isSignCalendar ? (isSelected ? 'white' : '#7886C7') : 'transparent' }]} />
|
||||
<View style={[Styles.calendarDot, { backgroundColor: isSignTask ? (isSelected ? 'white' : '#94B4C1') : 'transparent' }]} />
|
||||
</View>
|
||||
) : (
|
||||
<View style={[Styles.signDate, { backgroundColor: isSign ? 'red' : 'transparent' }]} />
|
||||
)}
|
||||
</Pressable>
|
||||
)
|
||||
}
|
||||
@@ -33,7 +33,7 @@ export default function HeaderRightDivisionList() {
|
||||
}}
|
||||
/>
|
||||
{
|
||||
(entityUser.role == "userRole" || entityUser.role == "developer") &&
|
||||
(entityUser.role == "supadmin" || entityUser.role == "developer") &&
|
||||
<MenuItemRow
|
||||
icon={<AntDesign name="filter" color={colors.text} size={25} />}
|
||||
title="Filter"
|
||||
|
||||
@@ -2,44 +2,54 @@ import Styles from "@/constants/Styles";
|
||||
import { Dimensions, View } from "react-native";
|
||||
import { BarChart } from "react-native-gifted-charts";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
import { useMemo } from "react";
|
||||
import Text from "../Text";
|
||||
|
||||
export default function ReportChartDocument({ data }: { data: { label: string; value: number; }[] }) {
|
||||
const { colors } = useTheme();
|
||||
const maxValue = Math.max(...data.map(i => i.value))
|
||||
const barData = [
|
||||
{ value: 23, label: 'Gambar', },
|
||||
{ value: 12, label: 'Dokumen' },
|
||||
];
|
||||
const width = Dimensions.get("window").width;
|
||||
|
||||
const maxValue = useMemo(() => {
|
||||
const maxVal = data.reduce((max: number, obj: { value: number; }) => Math.max(max, obj.value), 0);
|
||||
if (maxVal === 0) return 10;
|
||||
if (maxVal < 5) return 5;
|
||||
return Math.ceil(maxVal / 10) * 10;
|
||||
}, [data]);
|
||||
|
||||
const barData = useMemo(() => {
|
||||
return data.map(item => ({
|
||||
...item,
|
||||
frontColor: item.value > 0 ? "#fac858" : "transparent",
|
||||
topLabelComponent: () => (
|
||||
<View style={{ marginBottom: 5 }}>
|
||||
<View
|
||||
style={{
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
width: width * 0.25
|
||||
}}>
|
||||
<Text style={{ color: colors.text, fontSize: 12 }}>{item.value > 0 ? item.value : ""}</Text>
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
}))
|
||||
}, [data, colors.text]);
|
||||
|
||||
return (
|
||||
<View style={[Styles.wrapPaper, Styles.contentItemCenter, Styles.mb15, { backgroundColor: colors.card, borderColor: colors.background }]}>
|
||||
<Text style={[Styles.textSubtitle, Styles.mv15]}>JUMLAH DOKUMEN</Text>
|
||||
<BarChart
|
||||
key={JSON.stringify(data)}
|
||||
xAxisLabelTextStyle={{ color: colors.text }}
|
||||
yAxisTextStyle={{ color: colors.text }}
|
||||
showFractionalValues={false}
|
||||
showYAxisIndices
|
||||
noOfSections={maxValue < 5 ? 2 : 4}
|
||||
noOfSections={maxValue < 5 ? (maxValue === 0 ? 4 : maxValue) : 4}
|
||||
maxValue={maxValue}
|
||||
data={data}
|
||||
data={barData}
|
||||
isAnimated
|
||||
width={width - 140}
|
||||
barWidth={width * 0.25}
|
||||
frontColor="#fac858"
|
||||
renderTooltip={(item: any, index: any) => {
|
||||
return (
|
||||
<View
|
||||
style={{
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
width: width * 0.25
|
||||
}}>
|
||||
<Text style={{ color: colors.text }}>{item.value}</Text>
|
||||
</View>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
)
|
||||
|
||||
@@ -2,44 +2,54 @@ import Styles from "@/constants/Styles";
|
||||
import { Dimensions, View } from "react-native";
|
||||
import { BarChart } from "react-native-gifted-charts";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
import { useMemo } from "react";
|
||||
import Text from "../Text";
|
||||
|
||||
export default function ReportChartEvent({ data }: { data: { label: string; value: number; }[] }) {
|
||||
const { colors } = useTheme();
|
||||
const width = Dimensions.get("window").width;
|
||||
const maxValue = Math.max(...data.map(i => i.value))
|
||||
const barData = [
|
||||
{ value: 23, label: 'Akan Datang', },
|
||||
{ value: 12, label: 'Selesai' },
|
||||
];
|
||||
|
||||
const maxValue = useMemo(() => {
|
||||
const maxVal = data.reduce((max: number, obj: { value: number; }) => Math.max(max, obj.value), 0);
|
||||
if (maxVal === 0) return 10;
|
||||
if (maxVal < 5) return 5;
|
||||
return Math.ceil(maxVal / 10) * 10;
|
||||
}, [data]);
|
||||
|
||||
const barData = useMemo(() => {
|
||||
return data.map(item => ({
|
||||
...item,
|
||||
frontColor: item.value > 0 ? "#177AD5" : "transparent",
|
||||
topLabelComponent: () => (
|
||||
<View style={{ marginBottom: 5 }}>
|
||||
<View
|
||||
style={{
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
width: width * 0.25
|
||||
}}>
|
||||
<Text style={{ color: colors.text, fontSize: 12 }}>{item.value > 0 ? item.value : ""}</Text>
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
}))
|
||||
}, [data, colors.text]);
|
||||
|
||||
return (
|
||||
<View style={[Styles.wrapPaper, Styles.contentItemCenter, Styles.mb15, { backgroundColor: colors.card, borderColor: colors.background }]}>
|
||||
<Text style={[Styles.textSubtitle, Styles.mv15]}>ACARA DIVISI</Text>
|
||||
<BarChart
|
||||
key={JSON.stringify(data)}
|
||||
xAxisLabelTextStyle={{ color: colors.text }}
|
||||
yAxisTextStyle={{ color: colors.text }}
|
||||
showFractionalValues={false}
|
||||
showYAxisIndices
|
||||
noOfSections={maxValue < 5 ? 2 : 4}
|
||||
noOfSections={maxValue < 5 ? (maxValue === 0 ? 4 : maxValue) : 4}
|
||||
maxValue={maxValue}
|
||||
frontColor="#177AD5"
|
||||
data={data}
|
||||
data={barData}
|
||||
isAnimated
|
||||
width={width - 140}
|
||||
barWidth={width * 0.25}
|
||||
renderTooltip={(item: any, index: any) => {
|
||||
return (
|
||||
<View
|
||||
style={{
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
width: width * 0.25
|
||||
}}>
|
||||
<Text style={{ color: colors.text }}>{item.value}</Text>
|
||||
</View>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
)
|
||||
|
||||
@@ -14,9 +14,11 @@ type Props = {
|
||||
height?: number
|
||||
backdropPressable?: boolean
|
||||
keyboard?: boolean
|
||||
scrollOffset?: number
|
||||
scrollTo?: (p: any) => void
|
||||
}
|
||||
|
||||
export default function DrawerBottom({ isVisible, setVisible, title, children, animation, height, backdropPressable = true, keyboard = false }: Props) {
|
||||
export default function DrawerBottom({ isVisible, setVisible, title, children, animation, height, backdropPressable = true, keyboard = false, scrollOffset, scrollTo }: Props) {
|
||||
const tinggiScreen = Dimensions.get("window").height;
|
||||
const { colors } = useTheme();
|
||||
const tinggiInput = height != undefined ? height : 25
|
||||
@@ -38,6 +40,9 @@ export default function DrawerBottom({ isVisible, setVisible, title, children, a
|
||||
backdropTransitionOutTiming={500}
|
||||
useNativeDriverForBackdrop={true}
|
||||
propagateSwipe={true}
|
||||
scrollTo={scrollTo}
|
||||
scrollOffset={scrollOffset}
|
||||
scrollOffsetMax={200}
|
||||
>
|
||||
{
|
||||
keyboard ?
|
||||
|
||||
@@ -17,16 +17,16 @@ export default function EventItem({ category, title, user, jamAwal, jamAkhir, on
|
||||
|
||||
const getBackgroundColor = (cat: 'purple' | 'orange') => {
|
||||
if (activeTheme === 'dark') {
|
||||
return cat === 'orange' ? '#547792' : '#1D546D';
|
||||
return cat === 'purple' ? '#2D2B5E' : '#1C3347';
|
||||
}
|
||||
return cat === 'orange' ? '#D6E6F2' : '#A9B5DF';
|
||||
return cat === 'purple' ? '#A9B5DF' : '#D6E6F2';
|
||||
};
|
||||
|
||||
const getStickColor = (cat: 'purple' | 'orange') => {
|
||||
if (activeTheme === 'dark') {
|
||||
return cat === 'orange' ? '#94B4C1' : '#5F9598';
|
||||
return cat === 'purple' ? '#7886C7' : '#94B4C1';
|
||||
}
|
||||
return cat === 'orange' ? '#F5F5F5' : '#7886C7';
|
||||
return cat === 'purple' ? '#7886C7' : '#94B4C1';
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -36,7 +36,7 @@ export default function CaraouselHome({ refreshing }: { refreshing: boolean }) {
|
||||
async function handleUser() {
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiGetProfile({ id: hasil })
|
||||
dispatch(setEntityUser({ role: response.data.idUserRole, admin: false }))
|
||||
dispatch(setEntityUser({ role: response.data.idUserRole, admin: false, isApprover: response.data.isApprover ?? false }))
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -5,7 +5,8 @@ import { setEntities } from "@/lib/bannerSlice";
|
||||
import { setEntityUser } from "@/lib/userSlice";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
import { AntDesign, Feather, FontAwesome5, Ionicons, MaterialCommunityIcons, MaterialIcons, } from "@expo/vector-icons";
|
||||
import { Feather, Ionicons } from "@expo/vector-icons";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { router } from "expo-router";
|
||||
import React, { useEffect } from "react";
|
||||
import { Dimensions, Image, View } from "react-native";
|
||||
@@ -23,37 +24,44 @@ export default function CaraouselHome2({ refreshing }: { refreshing: boolean })
|
||||
const progress = useSharedValue<number>(0);
|
||||
const dispatch = useDispatch()
|
||||
const entities = useSelector((state: any) => state.banner)
|
||||
const entityUser = useSelector((state: any) => state.user)
|
||||
|
||||
async function handleBannerView() {
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
apiGetBanner({ user: hasil }).then((data) => {
|
||||
if (data.data.length > 0) {
|
||||
dispatch(setEntities(data.data))
|
||||
} else {
|
||||
dispatch(setEntities([]))
|
||||
}
|
||||
})
|
||||
}
|
||||
// Query for Banners
|
||||
const { data: banners } = useQuery({
|
||||
queryKey: ['banners'],
|
||||
queryFn: async () => {
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const data = await apiGetBanner({ user: hasil })
|
||||
return data.data || []
|
||||
},
|
||||
enabled: !!token?.current,
|
||||
staleTime: 0,
|
||||
})
|
||||
|
||||
async function handleUser() {
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiGetProfile({ id: hasil })
|
||||
dispatch(setEntityUser({ role: response.data.idUserRole, admin: false }))
|
||||
}
|
||||
// Query for Profile (Role Check)
|
||||
const { data: profile } = useQuery({
|
||||
queryKey: ['profile'], // Shares same key as Home.tsx
|
||||
queryFn: async () => {
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const data = await apiGetProfile({ id: hasil })
|
||||
return data.data
|
||||
},
|
||||
enabled: !!token?.current,
|
||||
staleTime: 0,
|
||||
})
|
||||
|
||||
// Sync Banners to Redux
|
||||
useEffect(() => {
|
||||
if (refreshing)
|
||||
handleBannerView()
|
||||
}, [refreshing]);
|
||||
if (banners) {
|
||||
dispatch(setEntities(banners))
|
||||
}
|
||||
}, [banners, dispatch])
|
||||
|
||||
// Sync User Role to Redux
|
||||
useEffect(() => {
|
||||
handleBannerView()
|
||||
}, [dispatch]);
|
||||
|
||||
useEffect(() => {
|
||||
handleUser()
|
||||
}, []);
|
||||
if (profile) {
|
||||
dispatch(setEntityUser({ role: profile.idUserRole, admin: false, isApprover: profile.isApprover ?? false }))
|
||||
}
|
||||
}, [profile, dispatch])
|
||||
|
||||
return (
|
||||
<View
|
||||
|
||||
@@ -2,7 +2,8 @@ import Styles from "@/constants/Styles";
|
||||
import { apiGetDataHome } from "@/lib/api";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { useMemo } from "react";
|
||||
import { Dimensions, View } from "react-native";
|
||||
import { BarChart } from "react-native-gifted-charts";
|
||||
import Skeleton from "../skeleton";
|
||||
@@ -15,80 +16,69 @@ type Props = {
|
||||
}[]
|
||||
|
||||
export default function ChartDokumenHome({ refreshing }: { refreshing: boolean }) {
|
||||
const [loading, setLoading] = useState(true)
|
||||
const { decryptToken, token } = useAuthSession()
|
||||
const { colors } = useTheme();
|
||||
const [data, setData] = useState<Props>([])
|
||||
const [maxValue, setMaxValue] = useState(5)
|
||||
const barData = [
|
||||
{ value: 23, label: 'Gambar', frontColor: '#fac858' },
|
||||
{ value: 12, label: 'Dokumen', frontColor: '#92cc76' },
|
||||
];
|
||||
const width = Dimensions.get("window").width;
|
||||
|
||||
|
||||
async function handleData(loading: boolean) {
|
||||
try {
|
||||
setLoading(loading)
|
||||
// TanStack Query for Document Chart data
|
||||
const { data: chartData = [], isLoading, isFetching } = useQuery({
|
||||
queryKey: ['homeData', 'dokumen'],
|
||||
queryFn: async () => {
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiGetDataHome({ cat: "dokumen", user: hasil })
|
||||
const maxValue = response.data.reduce((max: number, obj: { value: number; }) => Math.max(max, obj.value), -Infinity);
|
||||
const roundUp = Math.ceil(maxValue / 10) * 10
|
||||
setMaxValue(roundUp)
|
||||
const convertedArray = response.data.map((item: { color: any; label: any; value: any; }) => ({
|
||||
frontColor: item.color,
|
||||
label: item.label,
|
||||
value: Number(item.value)
|
||||
}));
|
||||
setData(convertedArray)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}
|
||||
return response.data.map((item: { color: any; label: any; value: any; }) => {
|
||||
const val = Number(item.value) || 0;
|
||||
return {
|
||||
frontColor: val > 0 ? (item.color || '#fac858') : 'transparent',
|
||||
label: item.label,
|
||||
value: val,
|
||||
}
|
||||
}) as Props
|
||||
},
|
||||
enabled: !!token?.current,
|
||||
staleTime: 0,
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
if (refreshing)
|
||||
handleData(false)
|
||||
}, [refreshing]);
|
||||
|
||||
useEffect(() => {
|
||||
handleData(true)
|
||||
}, []);
|
||||
// Derived state for maxValue
|
||||
const maxValue = useMemo(() => {
|
||||
const maxVal = chartData.reduce((max: number, obj: { value: number; }) => Math.max(max, obj.value), 0);
|
||||
// Adjust maxValue and intervals based on the data
|
||||
if (maxVal === 0) return 10;
|
||||
if (maxVal < 5) return 5;
|
||||
return Math.ceil(maxVal / 10) * 10;
|
||||
}, [chartData]);
|
||||
|
||||
const barData = useMemo(() => {
|
||||
return chartData.map(item => ({
|
||||
...item,
|
||||
topLabelComponent: () => (
|
||||
<View style={{ marginBottom: 5 }}>
|
||||
<Text style={{ color: colors.text, fontSize: 12 }}>{item.value > 0 ? item.value : ""}</Text>
|
||||
</View>
|
||||
)
|
||||
}))
|
||||
}, [chartData, colors.text]);
|
||||
|
||||
return (
|
||||
<View style={[Styles.wrapPaper, Styles.contentItemCenter, Styles.mb15, { backgroundColor: colors.card, borderColor: colors.icon + '20' }]}>
|
||||
<Text style={[Styles.textSubtitle, Styles.mv15]}>JUMLAH DOKUMEN</Text>
|
||||
{
|
||||
loading ? <Skeleton width={100} height={200} borderRadius={10} widthType="percent" />
|
||||
isLoading || (refreshing && isFetching) ? <Skeleton width={100} height={200} borderRadius={10} widthType="percent" />
|
||||
:
|
||||
<BarChart
|
||||
key={JSON.stringify(chartData)}
|
||||
showFractionalValues={false}
|
||||
showYAxisIndices
|
||||
noOfSections={4}
|
||||
noOfSections={maxValue < 5 ? (maxValue === 0 ? 4 : maxValue) : 4}
|
||||
maxValue={maxValue}
|
||||
data={data}
|
||||
data={barData}
|
||||
isAnimated
|
||||
width={width - 140}
|
||||
barWidth={width * 0.25}
|
||||
yAxisTextStyle={{ color: colors.text }}
|
||||
xAxisLabelTextStyle={{ color: colors.text }}
|
||||
renderTooltip={(item: any, index: any) => {
|
||||
return (
|
||||
<View
|
||||
style={{
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
width: width * 0.25
|
||||
}}>
|
||||
<Text>{item.value}</Text>
|
||||
</View>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
}
|
||||
|
||||
</View>
|
||||
)
|
||||
}
|
||||
@@ -2,7 +2,7 @@ import Styles from "@/constants/Styles";
|
||||
import { apiGetDataHome } from "@/lib/api";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { View } from "react-native";
|
||||
import { PieChart } from "react-native-gifted-charts";
|
||||
import Skeleton from "../skeleton";
|
||||
@@ -17,45 +17,32 @@ type Props = {
|
||||
export default function ChartProgresHome({ refreshing }: { refreshing: boolean }) {
|
||||
const { decryptToken, token } = useAuthSession()
|
||||
const { colors } = useTheme();
|
||||
const [data, setData] = useState<Props>([])
|
||||
const [loading, setLoading] = useState(true)
|
||||
|
||||
async function handleData(loading: boolean) {
|
||||
try {
|
||||
setLoading(loading)
|
||||
// TanStack Query for Progress Chart data
|
||||
const { data: chartData = [], isLoading } = useQuery({
|
||||
queryKey: ['homeData', 'progress'],
|
||||
queryFn: async () => {
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiGetDataHome({ cat: "progress", user: hasil })
|
||||
const convertedArray = response.data.map((item: { color: any; text: any; value: any; }) => ({
|
||||
return response.data.map((item: { color: any; text: any; value: any; }) => ({
|
||||
color: item.color,
|
||||
text: item.text,
|
||||
value: Number(item.value)
|
||||
}));
|
||||
setData(convertedArray)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (refreshing)
|
||||
handleData(false)
|
||||
}, [refreshing]);
|
||||
|
||||
useEffect(() => {
|
||||
handleData(true)
|
||||
}, []);
|
||||
})) as Props
|
||||
},
|
||||
enabled: !!token?.current,
|
||||
staleTime: 0,
|
||||
})
|
||||
|
||||
return (
|
||||
<View style={[Styles.wrapPaper, Styles.contentItemCenter, Styles.mb15, { backgroundColor: colors.card, borderColor: colors.icon + '20' }]}>
|
||||
<Text style={[Styles.textSubtitle, Styles.mv15]}>PROGRES KEGIATAN</Text>
|
||||
{
|
||||
loading ? <Skeleton width={100} height={200} borderRadius={10} widthType="percent" />
|
||||
isLoading ? <Skeleton width={100} height={200} borderRadius={10} widthType="percent" />
|
||||
:
|
||||
<>
|
||||
<PieChart
|
||||
data={data}
|
||||
data={chartData}
|
||||
showText
|
||||
showValuesAsTooltipText
|
||||
textColor={'black'}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import Styles from "@/constants/Styles";
|
||||
import { apiGetDataHome } from "@/lib/api";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { router } from "expo-router";
|
||||
import { useEffect, useState } from "react";
|
||||
import { View } from "react-native";
|
||||
import DiscussionItem from "../discussionItem";
|
||||
import Skeleton from "../skeleton";
|
||||
import Text from "../Text";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
|
||||
type Props = {
|
||||
id: string
|
||||
@@ -20,46 +20,33 @@ type Props = {
|
||||
|
||||
export default function DisccussionHome({ refreshing }: { refreshing: boolean }) {
|
||||
const { decryptToken, token } = useAuthSession()
|
||||
const [data, setData] = useState<Props[]>([])
|
||||
const [loading, setLoading] = useState(true)
|
||||
const { colors } = useTheme();
|
||||
|
||||
|
||||
async function handleData(loading: boolean) {
|
||||
try {
|
||||
setLoading(loading)
|
||||
// TanStack Query for Discussion data
|
||||
const { data: homeDiscussions = [], isLoading } = useQuery({
|
||||
queryKey: ['homeData', 'discussion'],
|
||||
queryFn: async () => {
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiGetDataHome({ cat: "discussion", user: hasil })
|
||||
setData(response.data)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (refreshing)
|
||||
handleData(false)
|
||||
}, [refreshing]);
|
||||
|
||||
useEffect(() => {
|
||||
handleData(true)
|
||||
}, []);
|
||||
return response.data as Props[]
|
||||
},
|
||||
enabled: !!token?.current,
|
||||
staleTime: 0,
|
||||
})
|
||||
|
||||
return (
|
||||
<View style={[Styles.mb15]}>
|
||||
<Text style={[Styles.textDefaultSemiBold, Styles.mv10]}>Diskusi</Text>
|
||||
<View style={[Styles.wrapPaper, { backgroundColor: colors.card, borderColor: colors.icon + '20' }, Styles.p0]}>
|
||||
{
|
||||
loading ?
|
||||
isLoading ?
|
||||
<>
|
||||
<Skeleton width={100} height={70} borderRadius={10} widthType="percent" />
|
||||
<Skeleton width={100} height={70} borderRadius={10} widthType="percent" />
|
||||
</>
|
||||
:
|
||||
data.length > 0 ?
|
||||
data.map((item, index) => {
|
||||
homeDiscussions.length > 0 ?
|
||||
homeDiscussions.map((item: Props, index: number) => {
|
||||
return (
|
||||
<DiscussionItem key={index} title={item.desc} user={item.user} date={item.date} onPress={() => { router.push(`/division/${item.idDivision}/discussion/${item.id}`) }} />
|
||||
)
|
||||
|
||||
@@ -3,8 +3,9 @@ import { apiGetDataHome } from "@/lib/api";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
import { Feather } from "@expo/vector-icons";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { router } from "expo-router";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import React from "react";
|
||||
import { Dimensions, Pressable, View } from "react-native";
|
||||
import { ICarouselInstance } from "react-native-reanimated-carousel";
|
||||
import Skeleton from "../skeleton";
|
||||
@@ -21,45 +22,31 @@ export default function DivisionHome({ refreshing }: { refreshing: boolean }) {
|
||||
const { colors } = useTheme();
|
||||
const ref = React.useRef<ICarouselInstance>(null)
|
||||
const width = Dimensions.get("window").width
|
||||
const [data, setData] = useState<Props[]>([])
|
||||
const [loading, setLoading] = useState(true)
|
||||
const arrSkeleton = Array.from({ length: 2 }, (_, index) => index)
|
||||
|
||||
async function handleData(loading: boolean) {
|
||||
try {
|
||||
setLoading(loading)
|
||||
// TanStack Query for Division data
|
||||
const { data: homeDivisions = [], isLoading } = useQuery({
|
||||
queryKey: ['homeData', 'division'],
|
||||
queryFn: async () => {
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiGetDataHome({ cat: "division", user: hasil })
|
||||
setData(response.data)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (refreshing)
|
||||
handleData(false)
|
||||
}, [refreshing]);
|
||||
|
||||
useEffect(() => {
|
||||
handleData(true)
|
||||
}, []);
|
||||
|
||||
|
||||
return response.data as Props[]
|
||||
},
|
||||
enabled: !!token?.current,
|
||||
staleTime: 0,
|
||||
})
|
||||
|
||||
return (
|
||||
<View style={[Styles.mb15]}>
|
||||
<Text style={[Styles.textDefaultSemiBold, Styles.mb10]}>Divisi Teraktif</Text>
|
||||
{
|
||||
loading ?
|
||||
isLoading ?
|
||||
arrSkeleton.map((item, index) => (
|
||||
<Skeleton key={index} width={100} height={80} borderRadius={10} widthType="percent" />
|
||||
))
|
||||
:
|
||||
data.length > 0 ?
|
||||
data.map((item, index) => (
|
||||
homeDivisions.length > 0 ?
|
||||
homeDivisions.map((item, index) => (
|
||||
<Pressable style={[Styles.wrapPaper, Styles.mb05, { backgroundColor: colors.card, borderColor: colors.icon + '20' }]} key={index} onPress={() => { router.push(`/division/${item.id}`) }}>
|
||||
<View style={[Styles.rowSpaceBetween, { alignItems: 'center' }]}>
|
||||
<View>
|
||||
|
||||
@@ -2,8 +2,8 @@ import Styles from "@/constants/Styles";
|
||||
import { apiGetDataHome } from "@/lib/api";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { router } from "expo-router";
|
||||
import { useEffect, useState } from "react";
|
||||
import { View } from "react-native";
|
||||
import EventItem from "../eventItem";
|
||||
import Skeleton from "../skeleton";
|
||||
@@ -26,30 +26,18 @@ type Props = {
|
||||
export default function EventHome({ refreshing }: { refreshing: boolean }) {
|
||||
const { decryptToken, token } = useAuthSession()
|
||||
const { colors } = useTheme();
|
||||
const [data, setData] = useState<Props[]>([])
|
||||
const [loading, setLoading] = useState(true)
|
||||
|
||||
async function handleData(loading: boolean) {
|
||||
try {
|
||||
setLoading(loading)
|
||||
// TanStack Query for Event data
|
||||
const { data: homeEvents = [], isLoading } = useQuery({
|
||||
queryKey: ['homeData', 'event'],
|
||||
queryFn: async () => {
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiGetDataHome({ cat: "event", user: hasil })
|
||||
setData(response.data)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (refreshing)
|
||||
handleData(false)
|
||||
}, [refreshing]);
|
||||
|
||||
useEffect(() => {
|
||||
handleData(true)
|
||||
}, []);
|
||||
return response.data as Props[]
|
||||
},
|
||||
enabled: !!token?.current,
|
||||
staleTime: 0,
|
||||
})
|
||||
|
||||
return (
|
||||
<View style={[Styles.mb15]}>
|
||||
@@ -57,14 +45,14 @@ export default function EventHome({ refreshing }: { refreshing: boolean }) {
|
||||
<View style={[Styles.wrapPaper, { backgroundColor: colors.card, borderColor: colors.icon + '20' }]}>
|
||||
|
||||
{
|
||||
loading ?
|
||||
isLoading ?
|
||||
<>
|
||||
<Skeleton width={100} height={70} borderRadius={10} widthType="percent" />
|
||||
<Skeleton width={100} height={70} borderRadius={10} widthType="percent" />
|
||||
</>
|
||||
:
|
||||
data.length > 0 ?
|
||||
data.map((item, index) => {
|
||||
homeEvents.length > 0 ?
|
||||
homeEvents.map((item: Props, index: number) => {
|
||||
return (
|
||||
<EventItem key={index} category={index % 2 == 0 ? 'purple' : 'orange'} onPress={() => { router.push(`/division/${item.idDivision}/calendar/${item.id}`) }} title={item.title} user={item.user_name} jamAwal={item.timeStart} jamAkhir={item.timeEnd} />
|
||||
)
|
||||
|
||||
@@ -2,8 +2,9 @@ import Styles from "@/constants/Styles";
|
||||
import { apiGetDataHome } from "@/lib/api";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { router } from "expo-router";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import React from "react";
|
||||
import { Dimensions, View } from "react-native";
|
||||
import Carousel, { ICarouselInstance } from "react-native-reanimated-carousel";
|
||||
import LabelStatus from "../labelStatus";
|
||||
@@ -25,45 +26,33 @@ export default function ProjectHome({ refreshing }: { refreshing: boolean }) {
|
||||
const { decryptToken, token } = useAuthSession()
|
||||
const ref = React.useRef<ICarouselInstance>(null);
|
||||
const width = Dimensions.get("window").width;
|
||||
const [data, setData] = useState<Props[]>([])
|
||||
const [loading, setLoading] = useState(true)
|
||||
const { colors } = useTheme();
|
||||
|
||||
async function handleData(loading: boolean) {
|
||||
try {
|
||||
setLoading(loading)
|
||||
// TanStack Query for Projects data
|
||||
const { data: homeProjects = [], isLoading } = useQuery({
|
||||
queryKey: ['homeData', 'kegiatan'],
|
||||
queryFn: async () => {
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiGetDataHome({ cat: "kegiatan", user: hasil })
|
||||
setData(response.data)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (refreshing)
|
||||
handleData(false)
|
||||
}, [refreshing]);
|
||||
|
||||
useEffect(() => {
|
||||
handleData(true)
|
||||
}, []);
|
||||
return response.data as Props[]
|
||||
},
|
||||
enabled: !!token?.current,
|
||||
staleTime: 0,
|
||||
})
|
||||
|
||||
return (
|
||||
<View style={[Styles.mb05]}>
|
||||
<Text style={[Styles.textDefaultSemiBold, Styles.mb10]}>Kegiatan Terupdate</Text>
|
||||
{
|
||||
loading ? (<Skeleton width={100} height={150} borderRadius={10} widthType="percent" />)
|
||||
isLoading ? (<Skeleton width={100} height={150} borderRadius={10} widthType="percent" />)
|
||||
:
|
||||
data.length > 0 ?
|
||||
homeProjects.length > 0 ?
|
||||
<Carousel
|
||||
ref={ref}
|
||||
style={{ width: "100%" }}
|
||||
width={width * 0.8}
|
||||
height={220}
|
||||
data={data}
|
||||
data={homeProjects}
|
||||
loop={false}
|
||||
autoPlay={false}
|
||||
autoPlayReverse={false}
|
||||
@@ -71,24 +60,24 @@ export default function ProjectHome({ refreshing }: { refreshing: boolean }) {
|
||||
snapEnabled={true}
|
||||
vertical={false}
|
||||
renderItem={({ index }) => (
|
||||
<PaperGridContent titleTail={1} content="carousel" onPress={() => { router.push(`/project/${data[index].id}`) }} title={data[index].title} headerColor="primary">
|
||||
<ProgressBar value={data[index].progress} category="carousel" />
|
||||
<PaperGridContent titleTail={1} content="carousel" onPress={() => { router.push(`/project/${homeProjects[index].id}`) }} title={homeProjects[index].title} headerColor="primary">
|
||||
<ProgressBar value={homeProjects[index].progress} category="carousel" />
|
||||
<View style={[Styles.rowSpaceBetween]}>
|
||||
<Text style={[Styles.textDefault, { color: colors.dimmed }]}>{data[index].createdAt}</Text>
|
||||
<Text style={[Styles.textDefault, { color: colors.dimmed }]}>{homeProjects[index].createdAt}</Text>
|
||||
<LabelStatus
|
||||
size="default"
|
||||
category={
|
||||
data[index].status === 0 ? 'secondary' :
|
||||
data[index].status === 1 ? 'warning' :
|
||||
data[index].status === 2 ? 'success' :
|
||||
data[index].status === 3 ? 'error' :
|
||||
homeProjects[index].status === 0 ? 'secondary' :
|
||||
homeProjects[index].status === 1 ? 'warning' :
|
||||
homeProjects[index].status === 2 ? 'success' :
|
||||
homeProjects[index].status === 3 ? 'error' :
|
||||
'secondary'
|
||||
}
|
||||
text={
|
||||
data[index].status === 0 ? 'SEGERA' :
|
||||
data[index].status === 1 ? 'DIKERJAKAN' :
|
||||
data[index].status === 2 ? 'SELESAI' :
|
||||
data[index].status === 3 ? 'DIBATALKAN' :
|
||||
homeProjects[index].status === 0 ? 'SEGERA' :
|
||||
homeProjects[index].status === 1 ? 'DIKERJAKAN' :
|
||||
homeProjects[index].status === 2 ? 'SELESAI' :
|
||||
homeProjects[index].status === 3 ? 'DIBATALKAN' :
|
||||
'SEGERA'
|
||||
}
|
||||
/>
|
||||
|
||||
@@ -30,6 +30,10 @@ export function InputForm({ label, value, placeholder, onChange, info, disable,
|
||||
const { colors } = useTheme();
|
||||
|
||||
if (itemLeft != undefined || itemRight != undefined) {
|
||||
const hasBothItems = itemLeft != undefined && itemRight != undefined;
|
||||
const baseInputWidth = width ? lebar * width / 100 : lebar * 0.78;
|
||||
// When both icons present, shrink TextInput by right icon size to keep container width stable
|
||||
const textInputWidth = hasBothItems ? baseInputWidth - 30 : baseInputWidth;
|
||||
return (
|
||||
<View style={[mb && Styles.mb10]}>
|
||||
{
|
||||
@@ -42,7 +46,7 @@ export function InputForm({ label, value, placeholder, onChange, info, disable,
|
||||
}
|
||||
<View style={[
|
||||
Styles.inputRoundForm,
|
||||
itemRight != undefined ? Styles.inputRoundFormRight : Styles.inputRoundFormLeft,
|
||||
hasBothItems ? Styles.inputRoundFormLeft : itemRight != undefined ? Styles.inputRoundFormRight : Styles.inputRoundFormLeft,
|
||||
multiline && { alignItems: 'flex-end' },
|
||||
round && Styles.round30,
|
||||
{
|
||||
@@ -50,12 +54,11 @@ export function InputForm({ label, value, placeholder, onChange, info, disable,
|
||||
},
|
||||
error ? { borderColor: colors.error } : { borderColor: colors.icon + '20' },
|
||||
Platform.OS == 'ios' ? { paddingVertical: 10 } : { paddingVertical: 0, minHeight: 40 },
|
||||
{ alignItems: 'center' },
|
||||
multiline
|
||||
? { alignItems: "flex-end" }
|
||||
: { alignItems: "center" },
|
||||
]}>
|
||||
{itemRight != undefined ? itemRight : itemLeft}
|
||||
{hasBothItems ? itemLeft : (itemRight != undefined ? itemRight : itemLeft)}
|
||||
<TextInput
|
||||
editable={!disable}
|
||||
value={value}
|
||||
@@ -68,10 +71,11 @@ export function InputForm({ label, value, placeholder, onChange, info, disable,
|
||||
style={[
|
||||
Styles.mh05,
|
||||
multiline && { height: '100%', maxHeight: 100 },
|
||||
{ width: width ? lebar * width / 100 : lebar * 0.78, color: colors.text },
|
||||
{ width: textInputWidth, color: colors.text },
|
||||
Platform.OS == 'ios' ? { paddingVertical: 1, paddingTop: 4 } : { paddingVertical: 0 },
|
||||
]}
|
||||
/>
|
||||
{hasBothItems && itemRight}
|
||||
</View>
|
||||
{error && (<Text style={[Styles.textInformation, { color: colors.error }, Styles.mt05]}>{errorText}</Text>)}
|
||||
{info != undefined && (<Text style={[Styles.textInformation, { color: colors.dimmed }, Styles.mt05]}>{info}</Text>)}
|
||||
|
||||
@@ -1,19 +1,42 @@
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
import { Feather } from "@expo/vector-icons";
|
||||
import { useState } from "react";
|
||||
import { TouchableOpacity } from "react-native";
|
||||
import { InputForm } from "./inputForm";
|
||||
|
||||
export default function InputSearch({ onChange, width, value, bg }: { onChange?: (val: string) => void, width?: number, value?: string, bg?: string }) {
|
||||
const { colors } = useTheme();
|
||||
const [internalValue, setInternalValue] = useState(value ?? "");
|
||||
|
||||
const displayValue = value !== undefined ? value : internalValue;
|
||||
|
||||
const handleChange = (val: string) => {
|
||||
setInternalValue(val);
|
||||
onChange?.(val);
|
||||
};
|
||||
|
||||
const handleClear = () => {
|
||||
setInternalValue("");
|
||||
onChange?.("");
|
||||
};
|
||||
|
||||
return (
|
||||
<InputForm
|
||||
type="default"
|
||||
placeholder="Pencarian"
|
||||
round
|
||||
itemLeft={<Feather name="search" size={20} color={colors.dimmed} />}
|
||||
onChange={onChange}
|
||||
itemRight={
|
||||
displayValue ? (
|
||||
<TouchableOpacity onPress={handleClear}>
|
||||
<Feather name="x" size={20} color={colors.dimmed} />
|
||||
</TouchableOpacity>
|
||||
) : undefined
|
||||
}
|
||||
onChange={handleChange}
|
||||
width={width}
|
||||
bg={bg}
|
||||
value={value}
|
||||
value={displayValue}
|
||||
mb={false}
|
||||
/>
|
||||
)
|
||||
|
||||
@@ -1,62 +1,192 @@
|
||||
import Styles from "@/constants/Styles";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
import { MaterialCommunityIcons } from "@expo/vector-icons";
|
||||
import { Pressable, View } from "react-native";
|
||||
import { useState } from "react";
|
||||
import { LayoutChangeEvent, Pressable, View } from "react-native";
|
||||
import Text from "./Text";
|
||||
|
||||
type FileItem = {
|
||||
name: string
|
||||
extension: string
|
||||
}
|
||||
|
||||
type Props = {
|
||||
done?: boolean
|
||||
status?: number // 0=belum selesai, 1=selesai, 2=menunggu persetujuan
|
||||
title: string
|
||||
dateStart: string
|
||||
dateEnd: string
|
||||
files?: FileItem[]
|
||||
onPress?: () => void
|
||||
}
|
||||
|
||||
export default function ItemSectionTanggalTugas({ done, title, dateStart, dateEnd, onPress }: Props) {
|
||||
const { colors } = useTheme();
|
||||
const CHAR_W = 6.5
|
||||
const ICON_W = 17
|
||||
const PAD_H = 16
|
||||
const GAP = 6
|
||||
const PLUS_W = 72
|
||||
|
||||
function estimateChipWidth(label: string) {
|
||||
return PAD_H + ICON_W + label.length * CHAR_W
|
||||
}
|
||||
|
||||
function getVisibleChips(files: FileItem[], containerWidth: number) {
|
||||
if (containerWidth === 0) return { visible: [], extra: files.length }
|
||||
|
||||
let used = 0
|
||||
const visible: FileItem[] = []
|
||||
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
const label = `${files[i].name}.${files[i].extension}`
|
||||
const chipW = estimateChipWidth(label)
|
||||
const isLast = i === files.length - 1
|
||||
const plusChipW = isLast ? 0 : PLUS_W + GAP
|
||||
const gapW = visible.length > 0 ? GAP : 0
|
||||
|
||||
if (used + gapW + chipW + plusChipW <= containerWidth) {
|
||||
visible.push(files[i])
|
||||
used += gapW + chipW
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return { visible, extra: files.length - visible.length }
|
||||
}
|
||||
|
||||
function getFileIcon(extension: string): keyof typeof MaterialCommunityIcons.glyphMap {
|
||||
const ext = extension.toLowerCase()
|
||||
if (['jpg', 'jpeg', 'png', 'gif', 'webp', 'heic', 'heif'].includes(ext)) return 'image-outline'
|
||||
if (ext === 'pdf') return 'file-pdf-box'
|
||||
if (['mp4', 'mov', 'avi', 'mkv'].includes(ext)) return 'video-outline'
|
||||
if (['doc', 'docx'].includes(ext)) return 'file-word-outline'
|
||||
if (['xls', 'xlsx'].includes(ext)) return 'file-excel-outline'
|
||||
if (['zip', 'rar', '7z'].includes(ext)) return 'zip-box-outline'
|
||||
return 'file-outline'
|
||||
}
|
||||
|
||||
const AMBER = '#FFA94D'
|
||||
|
||||
function getStatusStyle(status: number | undefined, successColor: string, dimmed: string) {
|
||||
if (status === 1) return { accent: successColor, badge: successColor + '25', text: successColor, label: 'Selesai' }
|
||||
if (status === 2) return { accent: AMBER, badge: AMBER + '25', text: AMBER, label: 'Menunggu Persetujuan' }
|
||||
return { accent: dimmed + '80', badge: dimmed + '18', text: dimmed, label: 'Belum Selesai' }
|
||||
}
|
||||
|
||||
export default function ItemSectionTanggalTugas({ status, title, dateStart, dateEnd, files = [], onPress }: Props) {
|
||||
const { colors, activeTheme } = useTheme()
|
||||
const [containerWidth, setContainerWidth] = useState(0)
|
||||
|
||||
const { visible, extra } = getVisibleChips(files, containerWidth)
|
||||
|
||||
function onChipsLayout(e: LayoutChangeEvent) {
|
||||
const w = e.nativeEvent.layout.width
|
||||
if (w !== containerWidth) setContainerWidth(w)
|
||||
}
|
||||
|
||||
const dimmed = colors.dimmed.slice(0, 7)
|
||||
const successColor = activeTheme === 'dark' ? '#51CF66' : colors.success
|
||||
const statusStyle = getStatusStyle(status, successColor, dimmed)
|
||||
|
||||
return (
|
||||
<Pressable style={[Styles.mb15, { borderBottomColor: colors.icon + '20', borderBottomWidth: 1 }]} onPress={onPress}>
|
||||
<View style={[Styles.rowItemsCenter]}>
|
||||
{
|
||||
done != undefined ?
|
||||
done ?
|
||||
<>
|
||||
<MaterialCommunityIcons name="checkbox-marked-circle-outline" size={22} color={colors.text} style={[Styles.mr10]} />
|
||||
<Text>Selesai</Text>
|
||||
</>
|
||||
:
|
||||
<>
|
||||
<MaterialCommunityIcons name="checkbox-blank-circle-outline" size={22} color={colors.text} style={[Styles.mr10]} />
|
||||
<Text>Belum Selesai</Text>
|
||||
</>
|
||||
:
|
||||
<></>
|
||||
}
|
||||
<Pressable
|
||||
onPress={onPress}
|
||||
style={{
|
||||
flexDirection: 'row',
|
||||
borderRadius: 10,
|
||||
overflow: 'hidden',
|
||||
borderWidth: 1,
|
||||
borderColor: colors.icon + '18',
|
||||
backgroundColor: colors.card,
|
||||
marginBottom: 10,
|
||||
}}
|
||||
>
|
||||
{/* Accent bar kiri */}
|
||||
{status !== undefined && (
|
||||
<View style={{ width: 4, backgroundColor: statusStyle.accent }} />
|
||||
)}
|
||||
|
||||
</View>
|
||||
<View style={[Styles.wrapPaper, Styles.noShadow, Styles.borderAll, Styles.mv10, Styles.p10, { backgroundColor: colors.card, borderColor: colors.icon + '20' }]}>
|
||||
<View style={[Styles.rowItemsCenter, { alignItems: 'flex-start' }]}>
|
||||
<MaterialCommunityIcons name="file-table-outline" size={25} color={colors.text} style={[Styles.mr10]} />
|
||||
<View style={[Styles.w90]}>
|
||||
<Text style={[Styles.textDefault]}>{title}</Text>
|
||||
</View>
|
||||
{/* Konten */}
|
||||
<View style={{ flex: 1, padding: 12 }}>
|
||||
|
||||
{/* Judul + badge status */}
|
||||
<View style={{ flexDirection: 'row', justifyContent: 'space-between', alignItems: 'flex-start', marginBottom: 8 }}>
|
||||
<Text style={[Styles.textDefault, { flex: 1, marginRight: 8 }]}>{title}</Text>
|
||||
{status !== undefined && (
|
||||
<View style={{
|
||||
backgroundColor: statusStyle.badge,
|
||||
borderRadius: 20,
|
||||
paddingHorizontal: 8,
|
||||
paddingVertical: 3,
|
||||
alignSelf: 'flex-start',
|
||||
}}>
|
||||
<Text style={[Styles.textSmallSemiBold, { color: statusStyle.text }]}>
|
||||
{statusStyle.label}
|
||||
</Text>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
<View style={[Styles.rowSpaceBetween, Styles.mb15]}>
|
||||
<View style={[{ width: '48%' }]}>
|
||||
<Text style={[Styles.mb05]}>Tanggal Mulai</Text>
|
||||
<View style={[Styles.wrapPaper, Styles.noShadow, Styles.borderAll, Styles.p10, { backgroundColor: colors.card, borderColor: colors.icon + '20' }]}>
|
||||
<Text style={{ textAlign: 'center' }}>{dateStart}</Text>
|
||||
</View>
|
||||
|
||||
{/* Tanggal */}
|
||||
<View style={{ flexDirection: 'row', alignItems: 'center', marginBottom: files.length > 0 ? 8 : 0 }}>
|
||||
<MaterialCommunityIcons name="calendar-outline" size={13} color={colors.dimmed} style={{ marginRight: 4 }} />
|
||||
<Text style={[Styles.textSmallSemiBold, { color: colors.dimmed }]}>{dateStart}</Text>
|
||||
<MaterialCommunityIcons name="arrow-right" size={13} color={colors.dimmed} style={{ marginHorizontal: 4 }} />
|
||||
<Text style={[Styles.textSmallSemiBold, { color: colors.dimmed }]}>{dateEnd}</Text>
|
||||
</View>
|
||||
<View style={[{ width: '48%' }]}>
|
||||
<Text style={[Styles.mb05]}>Tanggal Berakhir</Text>
|
||||
<View style={[Styles.wrapPaper, Styles.noShadow, Styles.borderAll, Styles.p10, { backgroundColor: colors.card, borderColor: colors.icon + '20' }]}>
|
||||
<Text style={{ textAlign: 'center' }}>{dateEnd}</Text>
|
||||
|
||||
{/* Chips lampiran */}
|
||||
{files.length > 0 && (
|
||||
<View
|
||||
style={{ flexDirection: 'row', gap: GAP, overflow: 'hidden' }}
|
||||
onLayout={onChipsLayout}
|
||||
>
|
||||
{visible.map((file, index) => {
|
||||
const label = `${file.name}.${file.extension}`
|
||||
const chipW = Math.min(estimateChipWidth(label), containerWidth * 0.55)
|
||||
return (
|
||||
<View
|
||||
key={index}
|
||||
style={{
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
backgroundColor: dimmed + '18',
|
||||
borderRadius: 6,
|
||||
paddingHorizontal: 8,
|
||||
paddingVertical: 3,
|
||||
width: chipW,
|
||||
}}
|
||||
>
|
||||
<MaterialCommunityIcons
|
||||
name={getFileIcon(file.extension)}
|
||||
size={13}
|
||||
color={colors.dimmed}
|
||||
style={{ marginRight: 4 }}
|
||||
/>
|
||||
<Text
|
||||
style={[Styles.textSmallSemiBold, { color: colors.dimmed, flex: 1 }]}
|
||||
numberOfLines={1}
|
||||
ellipsizeMode="tail"
|
||||
>
|
||||
{label}
|
||||
</Text>
|
||||
</View>
|
||||
)
|
||||
})}
|
||||
{extra > 0 && (
|
||||
<View style={{
|
||||
backgroundColor: dimmed + '18',
|
||||
borderRadius: 6,
|
||||
paddingHorizontal: 8,
|
||||
paddingVertical: 3,
|
||||
}}>
|
||||
<Text style={[Styles.textSmallSemiBold, { color: colors.dimmed }]}>
|
||||
+{extra} lainnya
|
||||
</Text>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
</Pressable>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Styles from "@/constants/Styles"
|
||||
import { apiDeleteUser } from "@/lib/api"
|
||||
import { apiDeleteUser, apiToggleApprover } from "@/lib/api"
|
||||
import { setUpdateMember } from "@/lib/memberSlice"
|
||||
import { useAuthSession } from "@/providers/AuthProvider"
|
||||
import { useTheme } from "@/providers/ThemeProvider"
|
||||
@@ -16,14 +16,17 @@ import MenuItemRow from "../menuItemRow"
|
||||
|
||||
type Props = {
|
||||
active: any,
|
||||
id: string
|
||||
id: string,
|
||||
isApprover: boolean,
|
||||
}
|
||||
|
||||
export default function HeaderRightMemberDetail({ active, id }: Props) {
|
||||
export default function HeaderRightMemberDetail({ active, id, isApprover }: Props) {
|
||||
const { token, decryptToken } = useAuthSession()
|
||||
const [isVisible, setVisible] = useState(false)
|
||||
const update = useSelector((state: any) => state.memberUpdate)
|
||||
const [showModal, setShowModal] = useState(false)
|
||||
const entityUser = useSelector((state: any) => state.user)
|
||||
const [showModalActive, setShowModalActive] = useState(false)
|
||||
const [showModalApprover, setShowModalApprover] = useState(false)
|
||||
const { colors } = useTheme();
|
||||
const dispatch = useDispatch()
|
||||
|
||||
@@ -37,17 +40,36 @@ export default function HeaderRightMemberDetail({ active, id }: Props) {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error : any ) {
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal mengupdate data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setVisible(false)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async function handleToggleApprover() {
|
||||
try {
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiToggleApprover({ user: hasil, isApprover: !isApprover }, id)
|
||||
if (response.success) {
|
||||
Toast.show({ type: 'small', text1: response.message })
|
||||
dispatch(setUpdateMember(!update))
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message })
|
||||
}
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal mengupdate data"
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setShowModalApprover(false)
|
||||
}
|
||||
}
|
||||
|
||||
const canManageApprover = ['supadmin', 'developer'].includes(entityUser.role)
|
||||
|
||||
return (
|
||||
<>
|
||||
<ButtonMenuHeader onPress={() => { setVisible(true) }} />
|
||||
@@ -55,12 +77,10 @@ export default function HeaderRightMemberDetail({ active, id }: Props) {
|
||||
<View style={Styles.rowItemsCenter}>
|
||||
<MenuItemRow
|
||||
icon={<MaterialCommunityIcons name="toggle-switch-off-outline" color={colors.text} size={25} />}
|
||||
title={active ? "Non Aktifkan" : "Aktifkan"}
|
||||
title={active ? "Nonaktifkan" : "Aktifkan"}
|
||||
onPress={() => {
|
||||
setVisible(false)
|
||||
setTimeout(() => {
|
||||
setShowModal(true)
|
||||
}, 600)
|
||||
setTimeout(() => setShowModalActive(true), 600)
|
||||
}}
|
||||
/>
|
||||
<MenuItemRow
|
||||
@@ -71,18 +91,39 @@ export default function HeaderRightMemberDetail({ active, id }: Props) {
|
||||
router.push(`/member/edit/${id}`)
|
||||
}}
|
||||
/>
|
||||
{canManageApprover && (
|
||||
<MenuItemRow
|
||||
icon={<MaterialCommunityIcons name="shield-check-outline" color={colors.text} size={25} />}
|
||||
title={isApprover ? "Revoke Approver" : "Jadikan Approver"}
|
||||
color={colors.text}
|
||||
onPress={() => {
|
||||
setVisible(false)
|
||||
setTimeout(() => setShowModalApprover(true), 600)
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</View>
|
||||
</DrawerBottom>
|
||||
|
||||
<ModalConfirmation
|
||||
visible={showModal}
|
||||
visible={showModalActive}
|
||||
title="Konfirmasi"
|
||||
message={active ? 'Apakah anda yakin ingin menonaktifkan user?' : 'Apakah anda yakin ingin mengaktifkan user?'}
|
||||
message={active ? 'Apakah anda yakin ingin menonaktifkan anggota ini?' : 'Apakah anda yakin ingin mengaktifkan anggota ini?'}
|
||||
onConfirm={() => {
|
||||
setShowModal(false)
|
||||
setShowModalActive(false)
|
||||
handleActive()
|
||||
}}
|
||||
onCancel={() => setShowModal(false)}
|
||||
onCancel={() => setShowModalActive(false)}
|
||||
confirmText="Konfirmasi"
|
||||
cancelText="Batal"
|
||||
/>
|
||||
|
||||
<ModalConfirmation
|
||||
visible={showModalApprover}
|
||||
title="Konfirmasi"
|
||||
message={isApprover ? 'Apakah anda yakin ingin mencabut status approver user ini?' : 'Apakah anda yakin ingin menjadikan user ini sebagai approver?'}
|
||||
onConfirm={handleToggleApprover}
|
||||
onCancel={() => setShowModalApprover(false)}
|
||||
confirmText="Konfirmasi"
|
||||
cancelText="Batal"
|
||||
/>
|
||||
|
||||
@@ -108,12 +108,12 @@ export default function ModalSelect({ open, close, title, category, idParent, on
|
||||
setChooseValue({ ...chooseValue, val: valChoose })
|
||||
}, [dispatch, open, search]);
|
||||
|
||||
function onChoose(val: string, label: string, img?: string) {
|
||||
function onChoose(val: string, label: string, img?: string, position?: string) {
|
||||
if (category == "member") {
|
||||
if (selectMember.some((i: any) => i.idUser == val)) {
|
||||
setSelectMember(selectMember.filter((i: any) => i.idUser != val))
|
||||
} else {
|
||||
setSelectMember([...selectMember, { idUser: val, name: label, img }])
|
||||
setSelectMember([...selectMember, { idUser: val, name: label, img, position }])
|
||||
}
|
||||
} else {
|
||||
setChooseValue({ val, label })
|
||||
@@ -144,7 +144,7 @@ export default function ModalSelect({ open, close, title, category, idParent, on
|
||||
key={index}
|
||||
label={item.name}
|
||||
src={`${ConstEnv.url_storage}/files/${item.img}`}
|
||||
onClick={() => onChoose(item.idUser, item.name, item.img)}
|
||||
onClick={() => onChoose(item.idUser, item.name, item.img, item.position)}
|
||||
/>
|
||||
))
|
||||
}
|
||||
@@ -162,7 +162,7 @@ export default function ModalSelect({ open, close, title, category, idParent, on
|
||||
category != 'status-task' ?
|
||||
data.length > 0 ?
|
||||
data.map((item: any, index: any) => (
|
||||
<Pressable key={index} style={[Styles.itemSelectModal, {borderColor:colors.icon+'20'}]} onPress={() => { onChoose(item.id, item.name, item.img) }}>
|
||||
<Pressable key={index} style={[Styles.itemSelectModal, {borderColor:colors.icon+'20'}]} onPress={() => { onChoose(item.id, item.name, item.img, item.position) }}>
|
||||
{
|
||||
category == 'member'
|
||||
?
|
||||
|
||||
100
components/project/itemSectionLink.tsx
Normal file
100
components/project/itemSectionLink.tsx
Normal file
@@ -0,0 +1,100 @@
|
||||
import { urlCompleted } from "@/lib/fun_urlCompleted";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
import { MaterialCommunityIcons } from "@expo/vector-icons";
|
||||
import { Linking, Pressable, View } from "react-native";
|
||||
import Text from "../Text";
|
||||
import Styles from "@/constants/Styles";
|
||||
|
||||
type Props = {
|
||||
link: string
|
||||
canDelete: boolean
|
||||
onLongPress: () => void
|
||||
}
|
||||
|
||||
type DomainConfig = {
|
||||
icon: keyof typeof MaterialCommunityIcons.glyphMap
|
||||
color: string
|
||||
label: string
|
||||
}
|
||||
|
||||
function getDomainConfig(url: string): DomainConfig {
|
||||
try {
|
||||
const hostname = new URL(urlCompleted(url)).hostname.replace('www.', '')
|
||||
if (hostname.includes('youtube.com') || hostname.includes('youtu.be'))
|
||||
return { icon: 'youtube', color: '#FF0000', label: 'YouTube' }
|
||||
if (hostname.includes('drive.google.com'))
|
||||
return { icon: 'google-drive', color: '#4285F4', label: 'Google Drive' }
|
||||
if (hostname.includes('docs.google.com'))
|
||||
return { icon: 'google', color: '#4285F4', label: 'Google Docs' }
|
||||
if (hostname.includes('sheets.google.com'))
|
||||
return { icon: 'google-spreadsheet', color: '#0F9D58', label: 'Google Sheets' }
|
||||
if (hostname.includes('github.com'))
|
||||
return { icon: 'github', color: '#24292E', label: 'GitHub' }
|
||||
if (hostname.includes('wa.me') || hostname.includes('whatsapp.com'))
|
||||
return { icon: 'whatsapp', color: '#25D366', label: 'WhatsApp' }
|
||||
if (hostname.includes('instagram.com'))
|
||||
return { icon: 'instagram', color: '#E1306C', label: 'Instagram' }
|
||||
if (hostname.includes('facebook.com'))
|
||||
return { icon: 'facebook', color: '#1877F2', label: 'Facebook' }
|
||||
if (hostname.includes('figma.com'))
|
||||
return { icon: 'vector-bezier', color: '#F24E1E', label: 'Figma' }
|
||||
if (hostname.includes('notion.so'))
|
||||
return { icon: 'notebook-outline', color: '#000000', label: 'Notion' }
|
||||
return { icon: 'link-variant', color: '#6366F1', label: hostname }
|
||||
} catch {
|
||||
return { icon: 'link-variant', color: '#6366F1', label: url }
|
||||
}
|
||||
}
|
||||
|
||||
function getDisplayUrl(url: string) {
|
||||
try {
|
||||
const full = urlCompleted(url)
|
||||
const parsed = new URL(full)
|
||||
const path = parsed.pathname + parsed.search
|
||||
return path.length > 1 ? path : ''
|
||||
} catch {
|
||||
return ''
|
||||
}
|
||||
}
|
||||
|
||||
export default function ItemSectionLink({ link, canDelete, onLongPress }: Props) {
|
||||
const { colors, activeTheme } = useTheme()
|
||||
const config = getDomainConfig(link)
|
||||
const displayPath = getDisplayUrl(link)
|
||||
|
||||
const iconBg = activeTheme === 'dark' ? config.color + '25' : config.color + '15'
|
||||
const iconColor = activeTheme === 'dark' && config.color === '#24292E' ? '#ECEDEE' : config.color
|
||||
|
||||
return (
|
||||
<Pressable
|
||||
onPress={() => Linking.openURL(urlCompleted(link))}
|
||||
onLongPress={canDelete ? onLongPress : undefined}
|
||||
style={({ pressed }) => ([
|
||||
Styles.fileCard,
|
||||
{
|
||||
width: '100%',
|
||||
marginBottom: 10,
|
||||
borderColor: colors.icon + '18',
|
||||
backgroundColor: pressed ? colors.icon + '10' : colors.card,
|
||||
},
|
||||
])}
|
||||
>
|
||||
<View style={[Styles.sectionIconBox, { backgroundColor: iconBg }]}>
|
||||
<MaterialCommunityIcons name={config.icon} size={18} color={iconColor} />
|
||||
</View>
|
||||
|
||||
<View style={Styles.flex1}>
|
||||
<Text style={[Styles.textDefaultSemiBold, { color: colors.text }]} numberOfLines={1}>
|
||||
{config.label}
|
||||
</Text>
|
||||
{displayPath.length > 0 && (
|
||||
<Text style={[Styles.textSmallSemiBold, { color: colors.dimmed, marginTop: 2 }]} numberOfLines={1} ellipsizeMode="tail">
|
||||
{displayPath}
|
||||
</Text>
|
||||
)}
|
||||
</View>
|
||||
|
||||
<MaterialCommunityIcons name="arrow-top-right" size={16} color={colors.dimmed} />
|
||||
</Pressable>
|
||||
)
|
||||
}
|
||||
@@ -10,19 +10,17 @@ import { startActivityAsync } from 'expo-intent-launcher';
|
||||
import { useLocalSearchParams } from "expo-router";
|
||||
import * as Sharing from 'expo-sharing';
|
||||
import { useEffect, useState } from "react";
|
||||
import { Alert, Platform, View } from "react-native";
|
||||
import { Alert, Platform, Pressable, View } from "react-native";
|
||||
import * as mime from 'react-native-mime-types';
|
||||
import Toast from "react-native-toast-message";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import ModalConfirmation from "../ModalConfirmation";
|
||||
import BorderBottomItem from "../borderBottomItem";
|
||||
import DrawerBottom from "../drawerBottom";
|
||||
import MenuItemRow from "../menuItemRow";
|
||||
import ModalConfirmation from "../ModalConfirmation";
|
||||
import ModalLoading from "../modalLoading";
|
||||
import Skeleton from "../skeleton";
|
||||
import Text from "../Text";
|
||||
|
||||
|
||||
type Props = {
|
||||
id: string
|
||||
name: string
|
||||
@@ -30,6 +28,28 @@ type Props = {
|
||||
idStorage: string
|
||||
}
|
||||
|
||||
function getFileIcon(extension: string): keyof typeof MaterialCommunityIcons.glyphMap {
|
||||
const ext = extension.toLowerCase()
|
||||
if (['jpg', 'jpeg', 'png', 'gif', 'webp', 'heic', 'heif'].includes(ext)) return 'image-outline'
|
||||
if (ext === 'pdf') return 'file-pdf-box'
|
||||
if (['mp4', 'mov', 'avi', 'mkv'].includes(ext)) return 'video-outline'
|
||||
if (['doc', 'docx'].includes(ext)) return 'file-word-outline'
|
||||
if (['xls', 'xlsx'].includes(ext)) return 'file-excel-outline'
|
||||
if (['zip', 'rar', '7z'].includes(ext)) return 'zip-box-outline'
|
||||
return 'file-outline'
|
||||
}
|
||||
|
||||
function getFileColor(extension: string): string {
|
||||
const ext = extension.toLowerCase()
|
||||
if (['jpg', 'jpeg', 'png', 'gif', 'webp', 'heic', 'heif'].includes(ext)) return '#339AF0'
|
||||
if (ext === 'pdf') return '#F03E3E'
|
||||
if (['mp4', 'mov', 'avi', 'mkv'].includes(ext)) return '#AE3EC9'
|
||||
if (['doc', 'docx'].includes(ext)) return '#1C7ED6'
|
||||
if (['xls', 'xlsx'].includes(ext)) return '#2F9E44'
|
||||
if (['zip', 'rar', '7z'].includes(ext)) return '#E8590C'
|
||||
return '#868E96'
|
||||
}
|
||||
|
||||
export default function SectionFile({ status, member, refreshing }: { status: number | undefined, member: boolean, refreshing?: boolean }) {
|
||||
const { colors } = useTheme();
|
||||
const entityUser = useSelector((state: any) => state.user)
|
||||
@@ -40,7 +60,7 @@ export default function SectionFile({ status, member, refreshing }: { status: nu
|
||||
const update = useSelector((state: any) => state.projectUpdate)
|
||||
const dispatch = useDispatch()
|
||||
const [loading, setLoading] = useState(true)
|
||||
const arrSkeleton = Array.from({ length: 3 })
|
||||
const arrSkeleton = Array.from({ length: 4 })
|
||||
const [selectFile, setSelectFile] = useState<Props | null>(null)
|
||||
const [showDeleteModal, setShowDeleteModal] = useState(false)
|
||||
const [loadingOpen, setLoadingOpen] = useState(false)
|
||||
@@ -49,11 +69,7 @@ export default function SectionFile({ status, member, refreshing }: { status: nu
|
||||
try {
|
||||
setLoading(loading)
|
||||
const hasil = await decryptToken(String(token?.current));
|
||||
const response = await apiGetProjectOne({
|
||||
user: hasil,
|
||||
cat: "file",
|
||||
id: id,
|
||||
});
|
||||
const response = await apiGetProjectOne({ user: hasil, cat: "file", id });
|
||||
setData(response.data);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
@@ -62,110 +78,90 @@ export default function SectionFile({ status, member, refreshing }: { status: nu
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
handleLoad(false);
|
||||
}, [update.file]);
|
||||
|
||||
useEffect(() => {
|
||||
if (refreshing)
|
||||
handleLoad(false);
|
||||
}, [refreshing]);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
handleLoad(true);
|
||||
}, []);
|
||||
useEffect(() => { handleLoad(false) }, [update.file]);
|
||||
useEffect(() => { if (refreshing) handleLoad(false) }, [refreshing]);
|
||||
useEffect(() => { handleLoad(true) }, []);
|
||||
|
||||
async function handleDelete() {
|
||||
try {
|
||||
const hasil = await decryptToken(String(token?.current));
|
||||
const response = await apiDeleteFileProject({ user: hasil }, String(selectFile?.id));
|
||||
if (response.success) {
|
||||
Toast.show({ type: 'small', text1: 'Berhasil menghapus file', })
|
||||
Toast.show({ type: 'small', text1: 'Berhasil menghapus file' })
|
||||
dispatch(setUpdateProject({ ...update, file: !update.file }))
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
Toast.show({ type: 'small', text1: response.message })
|
||||
}
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal menghapus file"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} catch (error: any) {
|
||||
Toast.show({ type: 'small', text1: error?.response?.data?.message || "Gagal menghapus file" })
|
||||
} finally {
|
||||
setModal(false)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const openFile = () => {
|
||||
setModal(false)
|
||||
setLoadingOpen(true)
|
||||
let remoteUrl = ConstEnv.url_storage + '/files/' + selectFile?.idStorage;
|
||||
const fileName = selectFile?.name + '.' + selectFile?.extension;
|
||||
let localPath = `${FileSystem.documentDirectory}/${fileName}`;
|
||||
const remoteUrl = ConstEnv.url_storage + '/files/' + selectFile?.idStorage
|
||||
const fileName = selectFile?.name + '.' + selectFile?.extension
|
||||
const localPath = `${FileSystem.documentDirectory}/${fileName}`
|
||||
const mimeType = mime.lookup(fileName)
|
||||
|
||||
FileSystem.downloadAsync(remoteUrl, localPath).then(async ({ uri }) => {
|
||||
const contentURL = await FileSystem.getContentUriAsync(uri);
|
||||
const contentURL = await FileSystem.getContentUriAsync(uri)
|
||||
try {
|
||||
|
||||
if (Platform.OS == 'android') {
|
||||
// open with android intent
|
||||
await startActivityAsync(
|
||||
'android.intent.action.VIEW',
|
||||
{
|
||||
data: contentURL,
|
||||
flags: 1,
|
||||
type: mimeType as string,
|
||||
}
|
||||
);
|
||||
// or
|
||||
// Sharing.shareAsync(localPath);
|
||||
|
||||
} else if (Platform.OS == 'ios') {
|
||||
Sharing.shareAsync(localPath);
|
||||
if (Platform.OS === 'android') {
|
||||
await startActivityAsync('android.intent.action.VIEW', { data: contentURL, flags: 1, type: mimeType as string })
|
||||
} else {
|
||||
Sharing.shareAsync(localPath)
|
||||
}
|
||||
} catch (error) {
|
||||
Alert.alert('INFO', 'Gagal membuka file, tidak ada aplikasi yang dapat membuka file ini');
|
||||
} catch {
|
||||
Alert.alert('INFO', 'Gagal membuka file, tidak ada aplikasi yang dapat membuka file ini')
|
||||
} finally {
|
||||
setLoadingOpen(false)
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<ModalLoading isVisible={loadingOpen} setVisible={setLoadingOpen} />
|
||||
<View style={[Styles.mb15]}>
|
||||
<Text style={[Styles.textDefaultSemiBold, Styles.mv05]}>File</Text>
|
||||
<View style={[Styles.wrapPaper, { backgroundColor: colors.card, borderColor: colors.background }]}>
|
||||
{
|
||||
loading ?
|
||||
arrSkeleton.map((item, index) => {
|
||||
return (
|
||||
<Skeleton key={index} width={100} height={40} widthType="percent" borderRadius={10} />
|
||||
)
|
||||
})
|
||||
:
|
||||
data.length > 0 ?
|
||||
data.map((item, index) => {
|
||||
return (
|
||||
<BorderBottomItem
|
||||
key={index}
|
||||
borderType="all"
|
||||
icon={<MaterialCommunityIcons name="file-outline" size={25} color={colors.text} />}
|
||||
title={item.name + '.' + item.extension}
|
||||
titleWeight="normal"
|
||||
onPress={() => { setSelectFile(item); setModal(true) }}
|
||||
/>
|
||||
)
|
||||
})
|
||||
:
|
||||
<Text style={[Styles.textDefault, { textAlign: 'center', color: colors.dimmed }]}>Tidak ada file</Text>
|
||||
}
|
||||
</View>
|
||||
|
||||
{loading ? (
|
||||
<View style={Styles.fileGrid}>
|
||||
{arrSkeleton.map((_, index) => (
|
||||
<Skeleton key={index} width={48} height={68} widthType="percent" borderRadius={10} />
|
||||
))}
|
||||
</View>
|
||||
) : data.length > 0 ? (
|
||||
<View style={Styles.fileGrid}>
|
||||
{data.map((item, index) => {
|
||||
const iconName = getFileIcon(item.extension)
|
||||
const iconColor = getFileColor(item.extension)
|
||||
return (
|
||||
<Pressable
|
||||
key={index}
|
||||
onPress={() => { setSelectFile(item); setModal(true) }}
|
||||
style={[Styles.fileCard, { backgroundColor: colors.card, borderColor: colors.icon + '18' }]}
|
||||
>
|
||||
<View style={[Styles.sectionIconBox, { backgroundColor: iconColor + '20' }]}>
|
||||
<MaterialCommunityIcons name={iconName} size={18} color={iconColor} />
|
||||
</View>
|
||||
<View style={Styles.flex1}>
|
||||
<Text style={Styles.textDefault} numberOfLines={1}>{item.name}</Text>
|
||||
<Text style={[Styles.textSmallSemiBold, { color: colors.dimmed }]}>
|
||||
{item.extension.toUpperCase()}
|
||||
</Text>
|
||||
</View>
|
||||
</Pressable>
|
||||
)
|
||||
})}
|
||||
</View>
|
||||
) : (
|
||||
<Text style={[Styles.textDefault, { textAlign: 'center', color: colors.dimmed }]}>Tidak ada file</Text>
|
||||
)}
|
||||
</View>
|
||||
|
||||
<DrawerBottom animation="slide" isVisible={isModal} setVisible={setModal} title="Menu">
|
||||
@@ -173,26 +169,20 @@ export default function SectionFile({ status, member, refreshing }: { status: nu
|
||||
<MenuItemRow
|
||||
icon={<MaterialCommunityIcons name="file-eye" color={colors.text} size={25} />}
|
||||
title="Lihat / Share"
|
||||
onPress={() => {
|
||||
openFile()
|
||||
}}
|
||||
onPress={openFile}
|
||||
/>
|
||||
{
|
||||
!member && (entityUser.role == "user" || entityUser.role == "coadmin") ? <></>
|
||||
:
|
||||
<MenuItemRow
|
||||
icon={<Ionicons name="trash-outline" color={colors.text} size={25} />}
|
||||
title="Hapus"
|
||||
disabled={status == 3}
|
||||
onPress={() => {
|
||||
if (status == 3) return
|
||||
setModal(false)
|
||||
setTimeout(() => {
|
||||
setShowDeleteModal(true)
|
||||
}, 600)
|
||||
}}
|
||||
/>
|
||||
}
|
||||
{(!member && (entityUser.role === "user" || entityUser.role === "coadmin")) ? null : (
|
||||
<MenuItemRow
|
||||
icon={<Ionicons name="trash-outline" color={colors.text} size={25} />}
|
||||
title="Hapus"
|
||||
disabled={status === 3}
|
||||
onPress={() => {
|
||||
if (status === 3) return
|
||||
setModal(false)
|
||||
setTimeout(() => setShowDeleteModal(true), 600)
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</View>
|
||||
</DrawerBottom>
|
||||
|
||||
@@ -200,14 +190,11 @@ export default function SectionFile({ status, member, refreshing }: { status: nu
|
||||
visible={showDeleteModal}
|
||||
title="Konfirmasi"
|
||||
message="Apakah Anda yakin ingin menghapus file ini? File yang dihapus tidak dapat dikembalikan"
|
||||
onConfirm={() => {
|
||||
setShowDeleteModal(false)
|
||||
handleDelete()
|
||||
}}
|
||||
onConfirm={() => { setShowDeleteModal(false); handleDelete() }}
|
||||
onCancel={() => setShowDeleteModal(false)}
|
||||
confirmText="Hapus"
|
||||
cancelText="Batal"
|
||||
/>
|
||||
</>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,19 @@
|
||||
import Styles from "@/constants/Styles";
|
||||
import { apiDeleteLinkProject, apiGetProjectOne } from "@/lib/api";
|
||||
import { urlCompleted } from "@/lib/fun_urlCompleted";
|
||||
import { setUpdateProject } from "@/lib/projectUpdate";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
import { Feather, Ionicons } from "@expo/vector-icons";
|
||||
import { Ionicons } from "@expo/vector-icons";
|
||||
import { useLocalSearchParams } from "expo-router";
|
||||
import { useEffect, useState } from "react";
|
||||
import { Linking, View } from "react-native";
|
||||
import { View } from "react-native";
|
||||
import Toast from "react-native-toast-message";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import ModalConfirmation from "../ModalConfirmation";
|
||||
import BorderBottomItem from "../borderBottomItem";
|
||||
import DrawerBottom from "../drawerBottom";
|
||||
import MenuItemRow from "../menuItemRow";
|
||||
import Text from "../Text";
|
||||
import ItemSectionLink from "./itemSectionLink";
|
||||
|
||||
|
||||
type Props = {
|
||||
@@ -87,17 +86,16 @@ export default function SectionLink({ status, member, refreshing }: { status: nu
|
||||
<>
|
||||
<View style={[Styles.mb15]}>
|
||||
<Text style={[Styles.textDefaultSemiBold, Styles.mv05]}>Link</Text>
|
||||
<View style={[Styles.wrapPaper, { backgroundColor: colors.card, borderColor: colors.background }]}>
|
||||
<View>
|
||||
{
|
||||
data.map((item, index) => {
|
||||
const canDelete = member || (entityUser.role !== "user" && entityUser.role !== "coadmin")
|
||||
return (
|
||||
<BorderBottomItem
|
||||
<ItemSectionLink
|
||||
key={index}
|
||||
borderType="all"
|
||||
icon={<Feather name="link" size={25} color={colors.text} />}
|
||||
title={item.link}
|
||||
titleWeight="normal"
|
||||
onPress={() => { setSelectLink(item); setModal(true) }}
|
||||
link={item.link}
|
||||
canDelete={canDelete && status !== 3}
|
||||
onLongPress={() => { setSelectLink(item); setModal(true) }}
|
||||
/>
|
||||
)
|
||||
})
|
||||
@@ -108,28 +106,13 @@ export default function SectionLink({ status, member, refreshing }: { status: nu
|
||||
<DrawerBottom animation="slide" isVisible={isModal} setVisible={setModal} title="Menu">
|
||||
<View style={Styles.rowItemsCenter}>
|
||||
<MenuItemRow
|
||||
icon={<Feather name="external-link" color={colors.text} size={25} />}
|
||||
title="Buka Link"
|
||||
icon={<Ionicons name="trash-outline" color={colors.text} size={25} />}
|
||||
title="Hapus Link"
|
||||
onPress={() => {
|
||||
Linking.openURL(urlCompleted(String(selectLink?.link)))
|
||||
setModal(false)
|
||||
setTimeout(() => setShowDeleteModal(true), 600)
|
||||
}}
|
||||
/>
|
||||
{
|
||||
!member && (entityUser.role == "user" || entityUser.role == "coadmin") ? <></>
|
||||
:
|
||||
<MenuItemRow
|
||||
icon={<Ionicons name="trash-outline" color={colors.text} size={25} />}
|
||||
title="Hapus"
|
||||
disabled={status == 3}
|
||||
onPress={() => {
|
||||
if (status == 3) return
|
||||
setModal(false)
|
||||
setTimeout(() => {
|
||||
setShowDeleteModal(true)
|
||||
}, 600)
|
||||
}}
|
||||
/>
|
||||
}
|
||||
</View>
|
||||
</DrawerBottom>
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import ItemSectionTanggalTugas from "../itemSectionTanggalTugas";
|
||||
import MenuItemRow from "../menuItemRow";
|
||||
import Text from "../Text";
|
||||
|
||||
export default function SectionListAddTask() {
|
||||
export default function SectionListAddTask({ showTitle = true }: { showTitle?: boolean }) {
|
||||
const { colors } = useTheme();
|
||||
const taskCreate = useSelector((state: any) => state.taskCreate)
|
||||
const [select, setSelect] = useState<any>(null)
|
||||
@@ -22,42 +22,32 @@ export default function SectionListAddTask() {
|
||||
setModal(false)
|
||||
}
|
||||
|
||||
const items = taskCreate.map((item: { status: number; title: string; dateStart: string; dateEnd: string; }, index: Key | null | undefined) => (
|
||||
<ItemSectionTanggalTugas
|
||||
key={index}
|
||||
title={item.title}
|
||||
dateStart={item.dateStart}
|
||||
dateEnd={item.dateEnd}
|
||||
onPress={() => {
|
||||
setSelect(index)
|
||||
setModal(true)
|
||||
}}
|
||||
/>
|
||||
))
|
||||
|
||||
return (
|
||||
<>
|
||||
{
|
||||
taskCreate.length > 0
|
||||
&&
|
||||
{taskCreate.length > 0 && (
|
||||
<>
|
||||
<View style={[Styles.mb15, Styles.mt10]}>
|
||||
<Text style={[Styles.textDefaultSemiBold, Styles.mv05]}>
|
||||
Tanggal & Tugas
|
||||
</Text>
|
||||
<View style={[Styles.wrapPaper, { backgroundColor: colors.card, borderColor: colors.background }]}>
|
||||
{
|
||||
taskCreate.map((item: { status: number; title: string; dateStart: string; dateEnd: string; }, index: Key | null | undefined) => {
|
||||
return (
|
||||
<ItemSectionTanggalTugas
|
||||
key={index}
|
||||
title={item.title}
|
||||
dateStart={item.dateStart}
|
||||
dateEnd={item.dateEnd}
|
||||
onPress={() => {
|
||||
setSelect(index)
|
||||
setModal(true)
|
||||
}}
|
||||
/>
|
||||
);
|
||||
})
|
||||
}
|
||||
|
||||
{showTitle ? (
|
||||
<View style={[Styles.mb15, Styles.mt10]}>
|
||||
<Text style={[Styles.textDefaultSemiBold, Styles.mv05]}>Tanggal & Tugas</Text>
|
||||
{items}
|
||||
</View>
|
||||
</View>
|
||||
<DrawerBottom
|
||||
animation="slide"
|
||||
isVisible={isModal}
|
||||
setVisible={setModal}
|
||||
title="Menu"
|
||||
>
|
||||
) : (
|
||||
<View>{items}</View>
|
||||
)}
|
||||
<DrawerBottom animation="slide" isVisible={isModal} setVisible={setModal} title="Menu">
|
||||
<View style={Styles.rowItemsCenter}>
|
||||
<MenuItemRow
|
||||
icon={<Ionicons name="trash-outline" color={colors.text} size={25} />}
|
||||
@@ -67,7 +57,7 @@ export default function SectionListAddTask() {
|
||||
</View>
|
||||
</DrawerBottom>
|
||||
</>
|
||||
}
|
||||
)}
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -7,15 +7,14 @@ import { useTheme } from "@/providers/ThemeProvider";
|
||||
import { MaterialCommunityIcons } from "@expo/vector-icons";
|
||||
import { router, useLocalSearchParams } from "expo-router";
|
||||
import { useEffect, useState } from "react";
|
||||
import { View } from "react-native";
|
||||
import { Pressable, View } from "react-native";
|
||||
import Toast from "react-native-toast-message";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import ModalConfirmation from "../ModalConfirmation";
|
||||
import BorderBottomItem from "../borderBottomItem";
|
||||
import DrawerBottom from "../drawerBottom";
|
||||
import ImageUser from "../imageNew";
|
||||
import MenuItemRow from "../menuItemRow";
|
||||
import SkeletonTwoItem from "../skeletonTwoItem";
|
||||
import ModalConfirmation from "../ModalConfirmation";
|
||||
import Skeleton from "../skeleton";
|
||||
import Text from "../Text";
|
||||
|
||||
type Props = {
|
||||
@@ -35,26 +34,17 @@ export default function SectionMember({ status, refreshing }: { status: number |
|
||||
const [isModal, setModal] = useState(false);
|
||||
const { token, decryptToken } = useAuthSession();
|
||||
const { id } = useLocalSearchParams<{ id: string }>();
|
||||
const [selectLink, setSelectLink] = useState<Props | null>(null);
|
||||
const [showDeleteModal, setShowDeleteModal] = useState(false);
|
||||
const [data, setData] = useState<Props[]>([]);
|
||||
const [loading, setLoading] = useState(true)
|
||||
const arrSkeleton = Array.from({ length: 3 })
|
||||
const [memberChoose, setMemberChoose] = useState({
|
||||
id: '',
|
||||
name: '',
|
||||
})
|
||||
|
||||
const arrSkeleton = Array.from({ length: 4 })
|
||||
const [memberChoose, setMemberChoose] = useState({ id: '', name: '' })
|
||||
|
||||
async function handleLoad(loading: boolean) {
|
||||
try {
|
||||
setLoading(loading)
|
||||
const hasil = await decryptToken(String(token?.current));
|
||||
const response = await apiGetProjectOne({
|
||||
user: hasil,
|
||||
cat: "member",
|
||||
id: id,
|
||||
});
|
||||
const response = await apiGetProjectOne({ user: hasil, cat: "member", id });
|
||||
setData(response.data);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
@@ -63,36 +53,21 @@ export default function SectionMember({ status, refreshing }: { status: number |
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
handleLoad(false);
|
||||
}, [update.member]);
|
||||
|
||||
useEffect(() => {
|
||||
if (refreshing)
|
||||
handleLoad(false);
|
||||
}, [refreshing]);
|
||||
|
||||
useEffect(() => {
|
||||
handleLoad(true);
|
||||
}, []);
|
||||
useEffect(() => { handleLoad(false) }, [update.member]);
|
||||
useEffect(() => { if (refreshing) handleLoad(false) }, [refreshing]);
|
||||
useEffect(() => { handleLoad(true) }, []);
|
||||
|
||||
async function handleDeleteMember() {
|
||||
try {
|
||||
const hasil = await decryptToken(String(token?.current));
|
||||
const response = await apiDeleteProjectMember({
|
||||
user: hasil,
|
||||
idUser: memberChoose.id,
|
||||
}, id)
|
||||
const response = await apiDeleteProjectMember({ user: hasil, idUser: memberChoose.id }, id)
|
||||
if (response.success) {
|
||||
Toast.show({ type: 'small', text1: 'Berhasil menghapus anggota', })
|
||||
Toast.show({ type: 'small', text1: 'Berhasil menghapus anggota' })
|
||||
dispatch(setUpdateProject({ ...update, member: !update.member }))
|
||||
setModal(false);
|
||||
}
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal menghapus anggota"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} catch (error: any) {
|
||||
Toast.show({ type: 'small', text1: error?.response?.data?.message || "Gagal menghapus anggota" })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,84 +76,85 @@ export default function SectionMember({ status, refreshing }: { status: number |
|
||||
<View style={[Styles.mb15]}>
|
||||
<View style={[Styles.rowSpaceBetween, Styles.mv05]}>
|
||||
<Text style={[Styles.textDefaultSemiBold]}>Anggota</Text>
|
||||
<Text style={[Styles.textDefault]}>Total {data.length} Anggota</Text>
|
||||
{!loading && data.length > 0 && (
|
||||
<Text style={[Styles.textDefault, { color: colors.dimmed }]}>{data.length} orang</Text>
|
||||
)}
|
||||
</View>
|
||||
|
||||
<View style={[Styles.wrapPaper, { backgroundColor: colors.card, borderColor: colors.background }]}>
|
||||
{
|
||||
loading ?
|
||||
arrSkeleton.map((item, index) => {
|
||||
return (
|
||||
<SkeletonTwoItem key={index} />
|
||||
)
|
||||
})
|
||||
:
|
||||
data.length > 0
|
||||
?
|
||||
data.map((item, index) => {
|
||||
return (
|
||||
<BorderBottomItem
|
||||
key={index}
|
||||
borderType="bottom"
|
||||
icon={<ImageUser src={`${ConstEnv.url_storage}/files/${item.img}`} />}
|
||||
title={item.name}
|
||||
onPress={() => {
|
||||
if (status == 3) return
|
||||
setMemberChoose({
|
||||
id: item.idUser,
|
||||
name: item.name,
|
||||
})
|
||||
setModal(true);
|
||||
}}
|
||||
/>
|
||||
);
|
||||
})
|
||||
:
|
||||
<Text style={[Styles.textDefault, { textAlign: 'center', color: colors.dimmed }]}>Tidak ada anggota</Text>
|
||||
}
|
||||
<View style={{ gap: 6 }}>
|
||||
{loading ? (
|
||||
arrSkeleton.map((_, index) => (
|
||||
<View key={index} style={{ flexDirection: 'row', alignItems: 'center', gap: 10 }}>
|
||||
<Skeleton width={40} height={40} borderRadius={20} />
|
||||
<View style={{ flex: 1, gap: 5 }}>
|
||||
<Skeleton width={60} height={12} widthType="percent" borderRadius={6} />
|
||||
<Skeleton width={35} height={10} widthType="percent" borderRadius={6} />
|
||||
</View>
|
||||
</View>
|
||||
))
|
||||
) : data.length > 0 ? (
|
||||
data.map((item, index) => (
|
||||
<Pressable
|
||||
key={index}
|
||||
onPress={() => {
|
||||
if (status === 3) return
|
||||
setMemberChoose({ id: item.idUser, name: item.name })
|
||||
setModal(true)
|
||||
}}
|
||||
style={{
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
backgroundColor: colors.card,
|
||||
borderRadius: 10,
|
||||
borderWidth: 1,
|
||||
borderColor: colors.icon + '18',
|
||||
paddingHorizontal: 12,
|
||||
paddingVertical: 10,
|
||||
gap: 12,
|
||||
}}
|
||||
>
|
||||
<ImageUser src={`${ConstEnv.url_storage}/files/${item.img}`} size="xs" />
|
||||
<View style={{ flex: 1 }}>
|
||||
<Text style={[Styles.textDefault]} numberOfLines={1}>{item.name}</Text>
|
||||
</View>
|
||||
<View style={{
|
||||
backgroundColor: colors.dimmed + '15',
|
||||
borderRadius: 20,
|
||||
paddingHorizontal: 8,
|
||||
paddingVertical: 3,
|
||||
}}>
|
||||
<Text style={[Styles.textSmallSemiBold, { color: colors.dimmed }]} numberOfLines={1}>
|
||||
{item.position}
|
||||
</Text>
|
||||
</View>
|
||||
</Pressable>
|
||||
))
|
||||
) : (
|
||||
<Text style={[Styles.textDefault, { textAlign: 'center', color: colors.dimmed }]}>Tidak ada anggota</Text>
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<DrawerBottom
|
||||
animation="slide"
|
||||
isVisible={isModal}
|
||||
setVisible={setModal}
|
||||
title={memberChoose.name}
|
||||
>
|
||||
<DrawerBottom animation="slide" isVisible={isModal} setVisible={setModal} title={memberChoose.name}>
|
||||
<View style={Styles.rowItemsCenter}>
|
||||
<MenuItemRow
|
||||
icon={
|
||||
<MaterialCommunityIcons
|
||||
name="account-eye"
|
||||
color={colors.text}
|
||||
size={25}
|
||||
/>
|
||||
}
|
||||
icon={<MaterialCommunityIcons name="account-eye" color={colors.text} size={25} />}
|
||||
title="Lihat Profil"
|
||||
onPress={() => {
|
||||
setModal(false);
|
||||
router.push(`/member/${memberChoose.id}`);
|
||||
setModal(false)
|
||||
router.push(`/member/${memberChoose.id}`)
|
||||
}}
|
||||
/>
|
||||
{
|
||||
entityUser.role != "user" && entityUser.role != "coadmin" &&
|
||||
{entityUser.role !== "user" && entityUser.role !== "coadmin" && (
|
||||
<MenuItemRow
|
||||
icon={
|
||||
<MaterialCommunityIcons
|
||||
name="account-remove"
|
||||
color={colors.text}
|
||||
size={25}
|
||||
/>
|
||||
}
|
||||
icon={<MaterialCommunityIcons name="account-remove" color={colors.text} size={25} />}
|
||||
title="Keluarkan"
|
||||
onPress={() => {
|
||||
setModal(false)
|
||||
setTimeout(() => {
|
||||
setShowDeleteModal(true)
|
||||
}, 600)
|
||||
setTimeout(() => setShowDeleteModal(true), 600)
|
||||
}}
|
||||
/>
|
||||
}
|
||||
)}
|
||||
</View>
|
||||
</DrawerBottom>
|
||||
|
||||
@@ -186,10 +162,7 @@ export default function SectionMember({ status, refreshing }: { status: number |
|
||||
visible={showDeleteModal}
|
||||
title="Konfirmasi"
|
||||
message="Apakah Anda yakin ingin mengeluarkan anggota?"
|
||||
onConfirm={() => {
|
||||
setShowDeleteModal(false)
|
||||
handleDeleteMember()
|
||||
}}
|
||||
onConfirm={() => { setShowDeleteModal(false); handleDeleteMember() }}
|
||||
onCancel={() => setShowDeleteModal(false)}
|
||||
confirmText="Keluarkan"
|
||||
cancelText="Batal"
|
||||
|
||||
@@ -2,6 +2,7 @@ import Styles from "@/constants/Styles";
|
||||
import { apiGetProjectOne } from "@/lib/api";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
import { MaterialCommunityIcons } from "@expo/vector-icons";
|
||||
import { useLocalSearchParams } from "expo-router";
|
||||
import { useEffect, useState } from "react";
|
||||
import { View } from "react-native";
|
||||
@@ -19,39 +20,37 @@ export default function SectionReportProject({ refreshing }: { refreshing?: bool
|
||||
async function handleLoad() {
|
||||
try {
|
||||
const hasil = await decryptToken(String(token?.current));
|
||||
const response = await apiGetProjectOne({
|
||||
user: hasil,
|
||||
cat: "data",
|
||||
id: id,
|
||||
});
|
||||
const response = await apiGetProjectOne({ user: hasil, cat: "data", id: id });
|
||||
setData(response.data.report);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
handleLoad();
|
||||
}, [update.report]);
|
||||
useEffect(() => { handleLoad() }, [update.report]);
|
||||
useEffect(() => { if (refreshing) handleLoad() }, [refreshing]);
|
||||
|
||||
useEffect(() => {
|
||||
if (refreshing)
|
||||
handleLoad();
|
||||
}, [refreshing]);
|
||||
if (!data || data === "") return null;
|
||||
|
||||
return (
|
||||
<>
|
||||
{
|
||||
data != "" && data != null &&
|
||||
<View style={[Styles.mb15, Styles.mt10]}>
|
||||
<Text style={[Styles.textDefaultSemiBold, Styles.mv05]}>
|
||||
Laporan Kegiatan
|
||||
</Text>
|
||||
<View style={[Styles.wrapPaper, { backgroundColor: colors.card, borderColor: colors.background }]}>
|
||||
<TextExpandable content={data} maxLines={2} />
|
||||
</View>
|
||||
<View style={[
|
||||
Styles.wrapPaper,
|
||||
Styles.mb15,
|
||||
Styles.sectionCard,
|
||||
{ backgroundColor: colors.card, borderColor: colors.icon + '18' },
|
||||
]}>
|
||||
<View style={Styles.sectionHeader}>
|
||||
<View style={[Styles.sectionIconBox, Styles.mr10, { backgroundColor: colors.tabActive + '18' }]}>
|
||||
<MaterialCommunityIcons name="text-box-outline" size={18} color={colors.tabActive} />
|
||||
</View>
|
||||
}
|
||||
</>
|
||||
<Text style={[Styles.textDefaultSemiBold, { color: colors.text }]}>
|
||||
Laporan Kegiatan
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
<View style={[Styles.reportContent, { borderLeftColor: colors.tabActive + '50' }]}>
|
||||
<TextExpandable content={data} maxLines={2} />
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Styles from "@/constants/Styles";
|
||||
import { apiDeleteProjectTask, apiGetProjectOne, apiUpdateStatusProjectTask } from "@/lib/api";
|
||||
import { apiApproveRejectProjectTask, apiDeleteProjectTask, apiGetProjectOne, apiGetProjectTaskApprovals, apiSubmitProjectTask } from "@/lib/api";
|
||||
import { setUpdateProject } from "@/lib/projectUpdate";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
@@ -9,11 +9,12 @@ import { useEffect, useState } from "react";
|
||||
import { View } from "react-native";
|
||||
import Toast from "react-native-toast-message";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import ModalConfirmation from "../ModalConfirmation";
|
||||
import DrawerBottom from "../drawerBottom";
|
||||
import ItemSectionTanggalTugas from "../itemSectionTanggalTugas";
|
||||
import MenuItemRow from "../menuItemRow";
|
||||
import ModalSelect from "../modalSelect";
|
||||
import ModalConfirmation from "../ModalConfirmation";
|
||||
import ModalRiwayatApproval from "../ModalRiwayatApproval";
|
||||
import ModalTolakApproval from "../ModalTolakApproval";
|
||||
import SkeletonTask from "../skeletonTask";
|
||||
import Text from "../Text";
|
||||
import ModalListDetailTugasProject from "./modalListDetailTugasProject";
|
||||
@@ -22,40 +23,52 @@ type Props = {
|
||||
id: string;
|
||||
title: string;
|
||||
desc: string;
|
||||
status: 1;
|
||||
status: number;
|
||||
dateStart: string;
|
||||
dateEnd: string;
|
||||
createdAt: string;
|
||||
files?: { name: string; extension: string }[];
|
||||
};
|
||||
|
||||
type ApprovalRecord = {
|
||||
id: string
|
||||
status: number
|
||||
note?: string
|
||||
submitter: { name: string }
|
||||
approver?: { name: string }
|
||||
createdAt: string
|
||||
}
|
||||
|
||||
export default function SectionTanggalTugasProject({ status, member, refreshing }: { status: number | undefined, member: boolean, refreshing?: boolean }) {
|
||||
const { colors } = useTheme();
|
||||
const entityUser = useSelector((state: any) => state.user)
|
||||
const dispatch = useDispatch()
|
||||
const update = useSelector((state: any) => state.projectUpdate)
|
||||
const [isModal, setModal] = useState(false);
|
||||
const [isSelect, setSelect] = useState(false);
|
||||
const { token, decryptToken } = useAuthSession();
|
||||
const [modalDetail, setModalDetail] = useState(false)
|
||||
const [modalRiwayat, setModalRiwayat] = useState(false)
|
||||
const [modalTolak, setModalTolak] = useState(false)
|
||||
const [modalKonfirmasiSetujui, setModalKonfirmasiSetujui] = useState(false)
|
||||
const [modalPersetujuan, setModalPersetujuan] = useState(false)
|
||||
const { id } = useLocalSearchParams<{ id: string }>();
|
||||
const [data, setData] = useState<Props[]>([]);
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [loadingAction, setLoadingAction] = useState(false)
|
||||
const [loadingRiwayat, setLoadingRiwayat] = useState(false)
|
||||
const [riwayatData, setRiwayatData] = useState<ApprovalRecord[]>([])
|
||||
const arrSkeleton = Array.from({ length: 5 });
|
||||
const [tugas, setTugas] = useState({
|
||||
id: '',
|
||||
status: 0,
|
||||
})
|
||||
const [tugas, setTugas] = useState({ id: '', status: 0 })
|
||||
const [showDeleteModal, setShowDeleteModal] = useState(false)
|
||||
|
||||
const isApprover = entityUser.isApprover || ['supadmin', 'developer'].includes(entityUser.role)
|
||||
const isAdmin = entityUser.role !== 'user' && entityUser.role !== 'coadmin'
|
||||
|
||||
async function handleLoad(loading: boolean) {
|
||||
try {
|
||||
setLoading(loading)
|
||||
const hasil = await decryptToken(String(token?.current));
|
||||
const response = await apiGetProjectOne({
|
||||
user: hasil,
|
||||
cat: "task",
|
||||
id: id,
|
||||
});
|
||||
const response = await apiGetProjectOne({ user: hasil, cat: "task", id: id });
|
||||
setData(response.data);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
@@ -64,167 +77,231 @@ export default function SectionTanggalTugasProject({ status, member, refreshing
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
handleLoad(false);
|
||||
}, [update.task]);
|
||||
useEffect(() => { handleLoad(false) }, [update.task]);
|
||||
useEffect(() => { if (refreshing) handleLoad(false) }, [refreshing]);
|
||||
useEffect(() => { handleLoad(true) }, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (refreshing)
|
||||
handleLoad(false);
|
||||
}, [refreshing]);
|
||||
|
||||
useEffect(() => {
|
||||
handleLoad(true);
|
||||
}, []);
|
||||
|
||||
|
||||
async function handleUpdate(status: number) {
|
||||
async function handleLoadRiwayat() {
|
||||
try {
|
||||
const hasil = await decryptToken(String(token?.current));
|
||||
const response = await apiUpdateStatusProjectTask({
|
||||
user: hasil,
|
||||
idProject: id,
|
||||
status: status,
|
||||
}, tugas.id);
|
||||
setLoadingRiwayat(true)
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiGetProjectTaskApprovals({ user: hasil, id: tugas.id })
|
||||
setRiwayatData(response.data ?? [])
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
setLoadingRiwayat(false)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSubmitAjukan() {
|
||||
try {
|
||||
setLoadingAction(true)
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiSubmitProjectTask({ user: hasil, id: tugas.id })
|
||||
if (response.success) {
|
||||
dispatch(setUpdateProject({ ...update, progress: !update.progress, task: !update.task }))
|
||||
setSelect(false);
|
||||
Toast.show({ type: 'small', text1: 'Berhasil mengubah data', })
|
||||
Toast.show({ type: 'small', text1: 'Berhasil mengajukan task untuk persetujuan' })
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message })
|
||||
}
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal mengubah data"
|
||||
|
||||
} catch (error: any) {
|
||||
const message = error?.response?.data?.message || "Gagal mengajukan persetujuan"
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoadingAction(false)
|
||||
setModal(false)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSetujui() {
|
||||
try {
|
||||
setLoadingAction(true)
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiApproveRejectProjectTask({ user: hasil, id: tugas.id, action: 'approve' })
|
||||
if (response.success) {
|
||||
dispatch(setUpdateProject({ ...update, progress: !update.progress, task: !update.task }))
|
||||
Toast.show({ type: 'small', text1: 'Tugas berhasil disetujui' })
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message })
|
||||
}
|
||||
} catch (error: any) {
|
||||
const message = error?.response?.data?.message || "Gagal menyetujui tugas"
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoadingAction(false)
|
||||
setModalKonfirmasiSetujui(false)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleTolak(note: string) {
|
||||
try {
|
||||
setLoadingAction(true)
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiApproveRejectProjectTask({ user: hasil, id: tugas.id, action: 'reject', note })
|
||||
if (response.success) {
|
||||
dispatch(setUpdateProject({ ...update, progress: !update.progress, task: !update.task }))
|
||||
Toast.show({ type: 'small', text1: 'Tugas berhasil ditolak' })
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message })
|
||||
}
|
||||
} catch (error: any) {
|
||||
const message = error?.response?.data?.message || "Gagal menolak tugas"
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoadingAction(false)
|
||||
setModalTolak(false)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleDelete() {
|
||||
try {
|
||||
const hasil = await decryptToken(String(token?.current));
|
||||
const response = await apiDeleteProjectTask({
|
||||
user: hasil,
|
||||
idProject: id,
|
||||
}, tugas.id);
|
||||
const response = await apiDeleteProjectTask({ user: hasil, idProject: id }, tugas.id);
|
||||
if (response.success) {
|
||||
dispatch(setUpdateProject({ ...update, progress: !update.progress, task: !update.task }))
|
||||
setModal(false);
|
||||
Toast.show({ type: 'small', text1: 'Berhasil menghapus data', })
|
||||
Toast.show({ type: 'small', text1: 'Berhasil menghapus data' })
|
||||
}
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
} catch (error: any) {
|
||||
const message = error?.response?.data?.message || "Gagal menghapus data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
}
|
||||
}
|
||||
|
||||
const canTakeAction = member || isAdmin
|
||||
const showAjukan = (member || isApprover) && tugas.status === 0 && status !== 3
|
||||
const showApproverActions = isApprover && tugas.status === 2
|
||||
|
||||
return (
|
||||
<>
|
||||
<View style={[Styles.mb15, Styles.mt10]}>
|
||||
<Text style={[Styles.textDefaultSemiBold, Styles.mv05]}>
|
||||
Tanggal & Tugas
|
||||
</Text>
|
||||
<View style={[Styles.wrapPaper, { backgroundColor: colors.card, borderColor: colors.background }]}>
|
||||
{
|
||||
loading ?
|
||||
arrSkeleton.map((item, index) => {
|
||||
return (
|
||||
<SkeletonTask key={index} />
|
||||
)
|
||||
})
|
||||
:
|
||||
data.length > 0
|
||||
?
|
||||
data.map((item, index) => {
|
||||
return (
|
||||
<ItemSectionTanggalTugas
|
||||
key={index}
|
||||
done={item.status === 1}
|
||||
title={item.title}
|
||||
dateStart={item.dateStart}
|
||||
dateEnd={item.dateEnd}
|
||||
onPress={() => {
|
||||
if (status == 3 || (!member && (entityUser.role == "user" || entityUser.role == "coadmin"))) return
|
||||
setTugas({
|
||||
id: item.id,
|
||||
status: item.status
|
||||
})
|
||||
setModal(true)
|
||||
}}
|
||||
/>
|
||||
);
|
||||
})
|
||||
:
|
||||
<Text style={[Styles.textDefault, { textAlign: 'center', color: colors.dimmed }]}>Tidak ada tugas</Text>
|
||||
<Text style={[Styles.textDefaultSemiBold, Styles.mv05]}>Tanggal & Tugas</Text>
|
||||
<View>
|
||||
{loading
|
||||
? arrSkeleton.map((_, index) => <SkeletonTask key={index} />)
|
||||
: data.length > 0
|
||||
? data.map((item, index) => (
|
||||
<ItemSectionTanggalTugas
|
||||
key={index}
|
||||
status={item.status}
|
||||
title={item.title}
|
||||
dateStart={item.dateStart}
|
||||
dateEnd={item.dateEnd}
|
||||
files={item.files ?? []}
|
||||
onPress={() => {
|
||||
setTugas({ id: item.id, status: item.status })
|
||||
setModal(true)
|
||||
}}
|
||||
/>
|
||||
))
|
||||
: <Text style={[Styles.textDefault, { textAlign: 'center', color: colors.dimmed }]}>Tidak ada tugas</Text>
|
||||
}
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<DrawerBottom
|
||||
animation="slide"
|
||||
isVisible={isModal}
|
||||
setVisible={setModal}
|
||||
title="Menu"
|
||||
>
|
||||
<View style={Styles.rowItemsCenter}>
|
||||
{/* Drawer menu */}
|
||||
<DrawerBottom animation="slide" isVisible={isModal} setVisible={setModal} title="Menu" height={40}>
|
||||
<View style={{ flexDirection: 'row', flexWrap: 'wrap' }}>
|
||||
|
||||
{/* Baris 1 — selalu tampil */}
|
||||
<MenuItemRow
|
||||
icon={
|
||||
<MaterialCommunityIcons
|
||||
name="list-status"
|
||||
color={colors.text}
|
||||
size={25}
|
||||
/>
|
||||
}
|
||||
title="Update Status"
|
||||
icon={<MaterialCommunityIcons name="file-multiple-outline" color={colors.text} size={25} />}
|
||||
title="File Tugas"
|
||||
onPress={() => {
|
||||
setModal(false);
|
||||
setTimeout(() => {
|
||||
setSelect(true);
|
||||
}, 600)
|
||||
setModal(false)
|
||||
router.push(`/project/${id}/tugas-file/${tugas.id}?member=${member}`)
|
||||
}}
|
||||
/>
|
||||
<MenuItemRow
|
||||
icon={
|
||||
<MaterialCommunityIcons
|
||||
name="pencil-outline"
|
||||
color={colors.text}
|
||||
size={25}
|
||||
/>
|
||||
}
|
||||
title="Edit Tugas"
|
||||
icon={<MaterialCommunityIcons name="clock-time-three-outline" color={colors.text} size={25} />}
|
||||
title="Detail Waktu"
|
||||
onPress={() => {
|
||||
setModal(false);
|
||||
router.push(`/project/update/${tugas.id}`);
|
||||
setModal(false)
|
||||
setTimeout(() => setModalDetail(true), 600)
|
||||
}}
|
||||
/>
|
||||
<MenuItemRow
|
||||
icon={<MaterialCommunityIcons name="history" color={colors.text} size={25} />}
|
||||
title="Riwayat"
|
||||
onPress={() => {
|
||||
setModal(false)
|
||||
handleLoadRiwayat()
|
||||
setTimeout(() => setModalRiwayat(true), 600)
|
||||
}}
|
||||
/>
|
||||
|
||||
<MenuItemRow
|
||||
icon={
|
||||
<MaterialCommunityIcons
|
||||
name="clock-time-three-outline"
|
||||
color={colors.text}
|
||||
size={25}
|
||||
{/* Separator antar baris */}
|
||||
{(showAjukan || showApproverActions || (canTakeAction && isAdmin && status !== 3)) && (
|
||||
<View style={{ width: '100%', height: 15 }} />
|
||||
)}
|
||||
|
||||
{/* Baris 2 — semua aksi kondisional dalam satu baris */}
|
||||
{showAjukan && (
|
||||
<MenuItemRow
|
||||
icon={<MaterialCommunityIcons name="check-circle-outline" color={colors.text} size={25} />}
|
||||
title="Ajukan Selesai"
|
||||
disabled={loadingAction}
|
||||
onPress={() => {
|
||||
setModal(false)
|
||||
setTimeout(() => handleSubmitAjukan(), 600)
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{showApproverActions && (
|
||||
<MenuItemRow
|
||||
icon={<MaterialCommunityIcons name="shield-check-outline" color={colors.text} size={25} />}
|
||||
title="Persetujuan"
|
||||
disabled={loadingAction}
|
||||
onPress={() => {
|
||||
setModal(false)
|
||||
setTimeout(() => setModalPersetujuan(true), 600)
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{canTakeAction && isAdmin && status !== 3 && (
|
||||
<>
|
||||
<MenuItemRow
|
||||
icon={<MaterialCommunityIcons name="pencil-outline" color={colors.text} size={25} />}
|
||||
title="Edit Tugas"
|
||||
onPress={() => {
|
||||
setModal(false)
|
||||
router.push(`/project/update/${tugas.id}`)
|
||||
}}
|
||||
/>
|
||||
}
|
||||
title="Detail Waktu"
|
||||
<MenuItemRow
|
||||
icon={<Ionicons name="trash-outline" color={colors.text} size={25} />}
|
||||
title="Hapus Tugas"
|
||||
onPress={() => {
|
||||
setModal(false)
|
||||
setTimeout(() => setShowDeleteModal(true), 600)
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</View>
|
||||
</DrawerBottom>
|
||||
|
||||
{/* Drawer persetujuan */}
|
||||
<DrawerBottom animation="slide" isVisible={modalPersetujuan} setVisible={setModalPersetujuan} title="Persetujuan Tugas" height={25}>
|
||||
<View style={{ flexDirection: 'row', flexWrap: 'wrap' }}>
|
||||
<MenuItemRow
|
||||
icon={<MaterialCommunityIcons name="check-circle" color={colors.success} size={25} />}
|
||||
title="Setujui"
|
||||
color={colors.success}
|
||||
disabled={loadingAction}
|
||||
onPress={() => {
|
||||
setModal(false);
|
||||
setTimeout(() => {
|
||||
setModalDetail(true)
|
||||
}, 600)
|
||||
setModalPersetujuan(false)
|
||||
setTimeout(() => setModalKonfirmasiSetujui(true), 600)
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
<View style={[Styles.rowItemsCenter, Styles.mt15]}>
|
||||
<MenuItemRow
|
||||
icon={<Ionicons name="trash-outline" color={colors.text} size={25} />}
|
||||
title="Hapus Tugas"
|
||||
icon={<MaterialCommunityIcons name="close-circle-outline" color={colors.error} size={25} />}
|
||||
title="Tolak"
|
||||
color={colors.error}
|
||||
disabled={loadingAction}
|
||||
onPress={() => {
|
||||
setModal(false)
|
||||
setTimeout(() => {
|
||||
setShowDeleteModal(true)
|
||||
}, 600)
|
||||
setModalPersetujuan(false)
|
||||
setTimeout(() => setModalTolak(true), 600)
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
@@ -234,24 +311,34 @@ export default function SectionTanggalTugasProject({ status, member, refreshing
|
||||
visible={showDeleteModal}
|
||||
title="Konfirmasi"
|
||||
message="Apakah anda yakin ingin menghapus data ini?"
|
||||
onConfirm={() => {
|
||||
setShowDeleteModal(false)
|
||||
handleDelete()
|
||||
}}
|
||||
onConfirm={() => { setShowDeleteModal(false); handleDelete() }}
|
||||
onCancel={() => setShowDeleteModal(false)}
|
||||
confirmText="Hapus"
|
||||
cancelText="Batal"
|
||||
/>
|
||||
|
||||
<ModalSelect
|
||||
category="status-task"
|
||||
close={() => { setSelect(false) }}
|
||||
onSelect={(value) => {
|
||||
handleUpdate(Number(value.val))
|
||||
}}
|
||||
title="Status"
|
||||
open={isSelect}
|
||||
valChoose={String(tugas.status)}
|
||||
<ModalConfirmation
|
||||
visible={modalKonfirmasiSetujui}
|
||||
title="Konfirmasi"
|
||||
message="Apakah anda yakin ingin menyetujui tugas ini?"
|
||||
onConfirm={handleSetujui}
|
||||
onCancel={() => setModalKonfirmasiSetujui(false)}
|
||||
confirmText="Setujui"
|
||||
cancelText="Batal"
|
||||
/>
|
||||
|
||||
<ModalRiwayatApproval
|
||||
isVisible={modalRiwayat}
|
||||
setVisible={setModalRiwayat}
|
||||
data={riwayatData}
|
||||
loading={loadingRiwayat}
|
||||
/>
|
||||
|
||||
<ModalTolakApproval
|
||||
isVisible={modalTolak}
|
||||
setVisible={setModalTolak}
|
||||
onTolak={handleTolak}
|
||||
loading={loadingAction}
|
||||
/>
|
||||
|
||||
<ModalListDetailTugasProject
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import { ColorsStatus } from "@/constants/ColorsStatus";
|
||||
import Styles from "@/constants/Styles";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
import { AntDesign } from "@expo/vector-icons";
|
||||
import Text from "./Text";
|
||||
import { MaterialCommunityIcons } from "@expo/vector-icons";
|
||||
import { View } from "react-native";
|
||||
import Text from "./Text";
|
||||
|
||||
type Props = {
|
||||
text?: string,
|
||||
text?: string
|
||||
title?: string
|
||||
}
|
||||
|
||||
@@ -14,18 +13,26 @@ export default function SectionCancel({ text, title }: Props) {
|
||||
const { colors } = useTheme();
|
||||
|
||||
return (
|
||||
<View style={[Styles.p10, Styles.round05, Styles.mb15, { backgroundColor: colors.error + '70' }]}>
|
||||
<View style={[Styles.rowItemsCenter]}>
|
||||
<AntDesign name="warning" size={22} style={[Styles.mr10]} color={colors.text} />
|
||||
<Text style={[Styles.textDefaultSemiBold]}>{title ? title : 'Kegiatan Dibatalkan'}</Text>
|
||||
<View style={[
|
||||
Styles.wrapPaper,
|
||||
Styles.mb15,
|
||||
Styles.sectionCard,
|
||||
{ backgroundColor: colors.error + '12', borderColor: colors.error + '40' },
|
||||
]}>
|
||||
<View style={[Styles.sectionHeader, !text && { marginBottom: 0 }]}>
|
||||
<View style={[Styles.sectionIconBox, Styles.mr10, { backgroundColor: colors.error + '20' }]}>
|
||||
<MaterialCommunityIcons name="close-circle-outline" size={18} color={colors.error} />
|
||||
</View>
|
||||
<Text style={[Styles.textDefaultSemiBold, { color: colors.error }]}>
|
||||
{title ?? 'Kegiatan Dibatalkan'}
|
||||
</Text>
|
||||
</View>
|
||||
{
|
||||
text && (
|
||||
<View>
|
||||
<Text style={[Styles.mt05]}>{text}</Text>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
{text && (
|
||||
<View style={[Styles.reportContent, { borderLeftColor: colors.error + '50' }]}>
|
||||
<Text style={[Styles.textDefault, { color: colors.text }]}>{text}</Text>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,27 +1,87 @@
|
||||
import Styles from "@/constants/Styles";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
import { AntDesign } from "@expo/vector-icons";
|
||||
import { View } from "react-native";
|
||||
import ProgressBar from "./progressBar";
|
||||
import { MaterialCommunityIcons } from "@expo/vector-icons";
|
||||
import { useEffect, useRef } from "react";
|
||||
import { Animated, View } from "react-native";
|
||||
import Text from "./Text";
|
||||
|
||||
type Props = {
|
||||
text: string,
|
||||
progress: number
|
||||
doneCount?: number
|
||||
totalCount?: number
|
||||
}
|
||||
|
||||
export default function SectionProgress({ text, progress }: Props) {
|
||||
export default function SectionProgress({ progress, doneCount, totalCount }: Props) {
|
||||
const { colors } = useTheme();
|
||||
const animatedWidth = useRef(new Animated.Value(0)).current;
|
||||
|
||||
const progressColor = colors.tabActive;
|
||||
|
||||
const statusLabel = progress === 100
|
||||
? 'Selesai'
|
||||
: progress > 0
|
||||
? 'Sedang berlangsung'
|
||||
: 'Belum ada tugas yang diselesaikan';
|
||||
|
||||
useEffect(() => {
|
||||
animatedWidth.setValue(0);
|
||||
Animated.timing(animatedWidth, {
|
||||
toValue: progress,
|
||||
duration: 900,
|
||||
useNativeDriver: false,
|
||||
}).start();
|
||||
}, [progress]);
|
||||
|
||||
return (
|
||||
<View style={[Styles.wrapPaper, Styles.rowItemsCenter, { backgroundColor: colors.card }]}>
|
||||
<View style={[Styles.iconContent]}>
|
||||
<AntDesign name="areachart" size={30} color={'black'} />
|
||||
<View style={[
|
||||
Styles.wrapPaper,
|
||||
Styles.mb15,
|
||||
Styles.sectionCard,
|
||||
{ backgroundColor: colors.card, borderColor: progressColor + '30' },
|
||||
]}>
|
||||
<View style={Styles.sectionHeaderRow}>
|
||||
<View style={Styles.flex1}>
|
||||
<View style={Styles.rowItemsCenter}>
|
||||
<View style={[Styles.sectionIconBox, Styles.mr10, { backgroundColor: progressColor + '22' }]}>
|
||||
<MaterialCommunityIcons name="chart-line" size={18} color={progressColor} />
|
||||
</View>
|
||||
<Text style={[Styles.textDefaultSemiBold, { color: colors.text }]}>
|
||||
Kemajuan Kegiatan
|
||||
</Text>
|
||||
</View>
|
||||
<Text style={[Styles.textMediumNormal, { color: colors.dimmed, marginLeft: 42 }]}>
|
||||
{statusLabel}
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
<View style={Styles.badgeCol}>
|
||||
<View style={[Styles.progressBadge, { backgroundColor: progressColor + '18', borderColor: progressColor + '45' }]}>
|
||||
<Text style={[Styles.textProgressPercent, { color: progressColor }]}>
|
||||
{progress}%
|
||||
</Text>
|
||||
</View>
|
||||
{totalCount !== undefined && doneCount !== undefined && (
|
||||
<View style={[Styles.taskCountBadge, { backgroundColor: progressColor + '18' }]}>
|
||||
<Text style={[Styles.textSmallSemiBold, { color: progressColor }]}>
|
||||
{doneCount}/{totalCount} tugas
|
||||
</Text>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
<View style={[Styles.ml10, { flex: 1 }]}>
|
||||
<Text style={[Styles.mb05]}>{text}</Text>
|
||||
<ProgressBar margin={0} category="page" value={progress} />
|
||||
|
||||
<View style={[Styles.progressTrack, { backgroundColor: colors.icon + '20' }]}>
|
||||
<Animated.View style={[
|
||||
Styles.progressFill,
|
||||
{
|
||||
backgroundColor: progressColor,
|
||||
width: animatedWidth.interpolate({
|
||||
inputRange: [0, 100],
|
||||
outputRange: ['0%', '100%'],
|
||||
}),
|
||||
},
|
||||
]} />
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -10,15 +10,13 @@ import { startActivityAsync } from 'expo-intent-launcher';
|
||||
import { useLocalSearchParams } from "expo-router";
|
||||
import * as Sharing from 'expo-sharing';
|
||||
import { useEffect, useState } from "react";
|
||||
import { Alert, Platform, View } from "react-native";
|
||||
import { Alert, Platform, Pressable, View } from "react-native";
|
||||
import * as mime from 'react-native-mime-types';
|
||||
import Toast from "react-native-toast-message";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import ModalConfirmation from "../ModalConfirmation";
|
||||
import ButtonMenuHeader from "../buttonMenuHeader";
|
||||
import BorderBottomItem from "../borderBottomItem";
|
||||
import DrawerBottom from "../drawerBottom";
|
||||
import MenuItemRow from "../menuItemRow";
|
||||
import ModalConfirmation from "../ModalConfirmation";
|
||||
import ModalLoading from "../modalLoading";
|
||||
import Skeleton from "../skeleton";
|
||||
import Text from "../Text";
|
||||
@@ -30,6 +28,28 @@ type Props = {
|
||||
idStorage: string
|
||||
}
|
||||
|
||||
function getFileIcon(extension: string): keyof typeof MaterialCommunityIcons.glyphMap {
|
||||
const ext = extension.toLowerCase()
|
||||
if (['jpg', 'jpeg', 'png', 'gif', 'webp', 'heic', 'heif'].includes(ext)) return 'image-outline'
|
||||
if (ext === 'pdf') return 'file-pdf-box'
|
||||
if (['mp4', 'mov', 'avi', 'mkv'].includes(ext)) return 'video-outline'
|
||||
if (['doc', 'docx'].includes(ext)) return 'file-word-outline'
|
||||
if (['xls', 'xlsx'].includes(ext)) return 'file-excel-outline'
|
||||
if (['zip', 'rar', '7z'].includes(ext)) return 'zip-box-outline'
|
||||
return 'file-outline'
|
||||
}
|
||||
|
||||
function getFileColor(extension: string): string {
|
||||
const ext = extension.toLowerCase()
|
||||
if (['jpg', 'jpeg', 'png', 'gif', 'webp', 'heic', 'heif'].includes(ext)) return '#339AF0'
|
||||
if (ext === 'pdf') return '#F03E3E'
|
||||
if (['mp4', 'mov', 'avi', 'mkv'].includes(ext)) return '#AE3EC9'
|
||||
if (['doc', 'docx'].includes(ext)) return '#1C7ED6'
|
||||
if (['xls', 'xlsx'].includes(ext)) return '#2F9E44'
|
||||
if (['zip', 'rar', '7z'].includes(ext)) return '#E8590C'
|
||||
return '#868E96'
|
||||
}
|
||||
|
||||
export default function SectionFileTask({ refreshing, isMemberDivision }: { refreshing: boolean, isMemberDivision: boolean }) {
|
||||
const { colors } = useTheme()
|
||||
const [isModal, setModal] = useState(false)
|
||||
@@ -119,7 +139,7 @@ export default function SectionFileTask({ refreshing, isMemberDivision }: { refr
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error : any ) {
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal menghapus file"
|
||||
|
||||
@@ -134,32 +154,39 @@ export default function SectionFileTask({ refreshing, isMemberDivision }: { refr
|
||||
<ModalLoading isVisible={loadingOpen} setVisible={setLoadingOpen} />
|
||||
<View style={[Styles.mb15]}>
|
||||
<Text style={[Styles.textDefaultSemiBold, Styles.mv05]}>File</Text>
|
||||
<View style={[Styles.wrapPaper, { backgroundColor: colors.card, borderColor: colors.background }]}>
|
||||
{
|
||||
loading ?
|
||||
arrSkeleton.map((item, index) => {
|
||||
return (
|
||||
<Skeleton key={index} width={100} height={40} widthType="percent" borderRadius={10} />
|
||||
)
|
||||
})
|
||||
:
|
||||
data.length > 0 ?
|
||||
data.map((item, index) => {
|
||||
return (
|
||||
<BorderBottomItem
|
||||
key={index}
|
||||
borderType="all"
|
||||
icon={<MaterialCommunityIcons name="file-outline" size={25} color={colors.text} />}
|
||||
title={item.name + '.' + item.extension}
|
||||
titleWeight="normal"
|
||||
onPress={() => { setSelectFile(item); setModal(true) }}
|
||||
/>
|
||||
)
|
||||
})
|
||||
:
|
||||
<Text style={[Styles.textDefault, { textAlign: 'center', color: colors.dimmed }]}>Tidak ada file</Text>
|
||||
}
|
||||
</View>
|
||||
{loading ? (
|
||||
<View style={Styles.fileGrid}>
|
||||
{arrSkeleton.map((_, index) => (
|
||||
<Skeleton key={index} width={48} height={68} widthType="percent" borderRadius={10} />
|
||||
))}
|
||||
</View>
|
||||
) : data.length > 0 ? (
|
||||
<View style={Styles.fileGrid}>
|
||||
{data.map((item, index) => {
|
||||
const iconName = getFileIcon(item.extension)
|
||||
const iconColor = getFileColor(item.extension)
|
||||
return (
|
||||
<Pressable
|
||||
key={index}
|
||||
onPress={() => { setSelectFile(item); setModal(true) }}
|
||||
style={[Styles.fileCard, { backgroundColor: colors.card, borderColor: colors.icon + '18' }]}
|
||||
>
|
||||
<View style={[Styles.sectionIconBox, { backgroundColor: iconColor + '20' }]}>
|
||||
<MaterialCommunityIcons name={iconName} size={18} color={iconColor} />
|
||||
</View>
|
||||
<View style={Styles.flex1}>
|
||||
<Text style={Styles.textDefault} numberOfLines={1}>{item.name}</Text>
|
||||
<Text style={[Styles.textSmallSemiBold, { color: colors.dimmed }]}>
|
||||
{item.extension.toUpperCase()}
|
||||
</Text>
|
||||
</View>
|
||||
</Pressable>
|
||||
)
|
||||
})}
|
||||
</View>
|
||||
) : (
|
||||
<Text style={[Styles.textDefault, { textAlign: 'center', color: colors.dimmed }]}>Tidak ada file</Text>
|
||||
)}
|
||||
</View>
|
||||
|
||||
<DrawerBottom animation="slide" isVisible={isModal} setVisible={setModal} title="Menu">
|
||||
|
||||
@@ -1,20 +1,19 @@
|
||||
import Styles from "@/constants/Styles";
|
||||
import { apiDeleteLinkTask, apiGetTaskOne } from "@/lib/api";
|
||||
import { urlCompleted } from "@/lib/fun_urlCompleted";
|
||||
import { setUpdateTask } from "@/lib/taskUpdate";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
import { Feather, Ionicons } from "@expo/vector-icons";
|
||||
import { Ionicons } from "@expo/vector-icons";
|
||||
import { useLocalSearchParams } from "expo-router";
|
||||
import { useEffect, useState } from "react";
|
||||
import { Linking, View } from "react-native";
|
||||
import { View } from "react-native";
|
||||
import Toast from "react-native-toast-message";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import ModalConfirmation from "../ModalConfirmation";
|
||||
import BorderBottomItem from "../borderBottomItem";
|
||||
import DrawerBottom from "../drawerBottom";
|
||||
import MenuItemRow from "../menuItemRow";
|
||||
import Text from "../Text";
|
||||
import ItemSectionLink from "../project/itemSectionLink";
|
||||
|
||||
type Props = {
|
||||
id: string
|
||||
@@ -62,84 +61,60 @@ export default function SectionLinkTask({ refreshing, isMemberDivision }: { refr
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error : any ) {
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal menghapus link"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setModal(false)
|
||||
}
|
||||
}
|
||||
|
||||
if (data.length === 0) return null;
|
||||
|
||||
const canDelete = (entityUser.role !== "user" && entityUser.role !== "coadmin") || isMemberDivision;
|
||||
|
||||
return (
|
||||
<>
|
||||
{
|
||||
data.length > 0 &&
|
||||
<>
|
||||
<View style={[Styles.mb15]}>
|
||||
<Text style={[Styles.textDefaultSemiBold, Styles.mv05]}>Link</Text>
|
||||
<View style={[Styles.wrapPaper, { backgroundColor: colors.card, borderColor: colors.background }]}>
|
||||
{
|
||||
data.map((item, index) => {
|
||||
return (
|
||||
<BorderBottomItem
|
||||
key={index}
|
||||
borderType="all"
|
||||
icon={<Feather name="link" size={25} color={colors.text} />}
|
||||
title={item.link}
|
||||
titleWeight="normal"
|
||||
onPress={() => { setSelectLink(item); setModal(true) }}
|
||||
/>
|
||||
)
|
||||
})
|
||||
}
|
||||
</View>
|
||||
</View>
|
||||
<View style={[Styles.mb15]}>
|
||||
<Text style={[Styles.textDefaultSemiBold, Styles.mv05]}>Link</Text>
|
||||
<View>
|
||||
{data.map((item, index) => (
|
||||
<ItemSectionLink
|
||||
key={index}
|
||||
link={item.link}
|
||||
canDelete={canDelete}
|
||||
onLongPress={() => { setSelectLink(item); setModal(true) }}
|
||||
/>
|
||||
))}
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<DrawerBottom animation="slide" isVisible={isModal} setVisible={setModal} title="Menu">
|
||||
<View style={Styles.rowItemsCenter}>
|
||||
<MenuItemRow
|
||||
icon={<Feather name="external-link" color={colors.text} size={25} />}
|
||||
title="Buka Link"
|
||||
onPress={() => {
|
||||
Linking.openURL(urlCompleted(String(selectLink?.link)))
|
||||
}}
|
||||
/>
|
||||
{
|
||||
(entityUser.role != "user" && entityUser.role != "coadmin") || isMemberDivision
|
||||
?
|
||||
<MenuItemRow
|
||||
icon={<Ionicons name="trash-outline" color={colors.text} size={25} />}
|
||||
title="Hapus"
|
||||
onPress={() => {
|
||||
setModal(false)
|
||||
setTimeout(() => {
|
||||
setShowDeleteModal(true)
|
||||
}, 600)
|
||||
}}
|
||||
/>
|
||||
:
|
||||
<></>
|
||||
}
|
||||
|
||||
</View>
|
||||
</DrawerBottom>
|
||||
|
||||
<ModalConfirmation
|
||||
visible={showDeleteModal}
|
||||
title="Konfirmasi"
|
||||
message="Apakah Anda yakin ingin menghapus link ini? Link yang dihapus tidak dapat dikembalikan"
|
||||
onConfirm={() => {
|
||||
setShowDeleteModal(false)
|
||||
handleDelete()
|
||||
<DrawerBottom animation="slide" isVisible={isModal} setVisible={setModal} title="Menu">
|
||||
<View style={Styles.rowItemsCenter}>
|
||||
<MenuItemRow
|
||||
icon={<Ionicons name="trash-outline" color={colors.text} size={25} />}
|
||||
title="Hapus Link"
|
||||
onPress={() => {
|
||||
setModal(false)
|
||||
setTimeout(() => setShowDeleteModal(true), 600)
|
||||
}}
|
||||
onCancel={() => setShowDeleteModal(false)}
|
||||
confirmText="Hapus"
|
||||
cancelText="Batal"
|
||||
/>
|
||||
</>
|
||||
}
|
||||
</View>
|
||||
</DrawerBottom>
|
||||
|
||||
<ModalConfirmation
|
||||
visible={showDeleteModal}
|
||||
title="Konfirmasi"
|
||||
message="Apakah Anda yakin ingin menghapus link ini? Link yang dihapus tidak dapat dikembalikan"
|
||||
onConfirm={() => {
|
||||
setShowDeleteModal(false)
|
||||
handleDelete()
|
||||
}}
|
||||
onCancel={() => setShowDeleteModal(false)}
|
||||
confirmText="Hapus"
|
||||
cancelText="Batal"
|
||||
/>
|
||||
</>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,15 +7,14 @@ import { useTheme } from "@/providers/ThemeProvider";
|
||||
import { MaterialCommunityIcons } from "@expo/vector-icons";
|
||||
import { router, useLocalSearchParams } from "expo-router";
|
||||
import { useEffect, useState } from "react";
|
||||
import { View } from "react-native";
|
||||
import { Pressable, View } from "react-native";
|
||||
import Toast from "react-native-toast-message";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import ModalConfirmation from "../ModalConfirmation";
|
||||
import BorderBottomItem from "../borderBottomItem";
|
||||
import DrawerBottom from "../drawerBottom";
|
||||
import ImageUser from "../imageNew";
|
||||
import MenuItemRow from "../menuItemRow";
|
||||
import SkeletonTwoItem from "../skeletonTwoItem";
|
||||
import ModalConfirmation from "../ModalConfirmation";
|
||||
import Skeleton from "../skeleton";
|
||||
import Text from "../Text";
|
||||
|
||||
type Props = {
|
||||
@@ -88,7 +87,7 @@ export default function SectionMemberTask({ refreshing, isAdminDivision }: { ref
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error : any ) {
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal menghapus anggota"
|
||||
|
||||
@@ -103,28 +102,46 @@ export default function SectionMemberTask({ refreshing, isAdminDivision }: { ref
|
||||
<View style={[Styles.mb15]}>
|
||||
<View style={[Styles.rowSpaceBetween, Styles.mv05]}>
|
||||
<Text style={[Styles.textDefaultSemiBold]}>Anggota</Text>
|
||||
<Text style={[Styles.textDefault]}>Total {data.length} Anggota</Text>
|
||||
{!loading && data.length > 0 && (
|
||||
<Text style={[Styles.textDefault, { color: colors.dimmed }]}>{data.length} orang</Text>
|
||||
)}
|
||||
</View>
|
||||
|
||||
<View style={[Styles.wrapPaper, { backgroundColor: colors.card, borderColor: colors.background }]}>
|
||||
<View style={{ gap: 6 }}>
|
||||
{
|
||||
loading ?
|
||||
arrSkeleton.map((item, index) => {
|
||||
return (
|
||||
<SkeletonTwoItem key={index} />
|
||||
<View key={index} style={{ flexDirection: 'row', alignItems: 'center', gap: 10 }}>
|
||||
<Skeleton width={40} height={40} borderRadius={20} />
|
||||
<View style={{ flex: 1, gap: 5 }}>
|
||||
<Skeleton width={60} height={12} widthType="percent" borderRadius={6} />
|
||||
<Skeleton width={35} height={10} widthType="percent" borderRadius={6} />
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
})
|
||||
:
|
||||
data.length > 0 ? (
|
||||
data.map((item, index) => {
|
||||
return (
|
||||
<BorderBottomItem
|
||||
// <BorderBottomItem
|
||||
// key={index}
|
||||
// borderType="bottom"
|
||||
// icon={
|
||||
// <ImageUser src={`${ConstEnv.url_storage}/files/${item.img}`} />
|
||||
// }
|
||||
// title={item.name}
|
||||
// onPress={() => {
|
||||
// setMemberChoose({
|
||||
// id: item.idUser,
|
||||
// name: item.name,
|
||||
// });
|
||||
// setModal(true);
|
||||
// }}
|
||||
// />
|
||||
<Pressable
|
||||
key={index}
|
||||
borderType="bottom"
|
||||
icon={
|
||||
<ImageUser src={`${ConstEnv.url_storage}/files/${item.img}`} />
|
||||
}
|
||||
title={item.name}
|
||||
onPress={() => {
|
||||
setMemberChoose({
|
||||
id: item.idUser,
|
||||
@@ -132,7 +149,33 @@ export default function SectionMemberTask({ refreshing, isAdminDivision }: { ref
|
||||
});
|
||||
setModal(true);
|
||||
}}
|
||||
/>
|
||||
style={{
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
backgroundColor: colors.card,
|
||||
borderRadius: 10,
|
||||
borderWidth: 1,
|
||||
borderColor: colors.icon + '18',
|
||||
paddingHorizontal: 12,
|
||||
paddingVertical: 10,
|
||||
gap: 12,
|
||||
}}
|
||||
>
|
||||
<ImageUser src={`${ConstEnv.url_storage}/files/${item.img}`} size="xs" />
|
||||
<View style={{ flex: 1 }}>
|
||||
<Text style={[Styles.textDefault]} numberOfLines={1}>{item.name}</Text>
|
||||
</View>
|
||||
<View style={{
|
||||
backgroundColor: colors.dimmed + '15',
|
||||
borderRadius: 20,
|
||||
paddingHorizontal: 8,
|
||||
paddingVertical: 3,
|
||||
}}>
|
||||
<Text style={[Styles.textSmallSemiBold, { color: colors.dimmed }]} numberOfLines={1}>
|
||||
{item.position}
|
||||
</Text>
|
||||
</View>
|
||||
</Pressable>
|
||||
);
|
||||
})
|
||||
) : (
|
||||
|
||||
@@ -2,6 +2,7 @@ import Styles from "@/constants/Styles";
|
||||
import { apiGetTaskOne } from "@/lib/api";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
import { MaterialCommunityIcons } from "@expo/vector-icons";
|
||||
import { useLocalSearchParams } from "expo-router";
|
||||
import { useEffect, useState } from "react";
|
||||
import { View } from "react-native";
|
||||
@@ -9,7 +10,6 @@ import { useSelector } from "react-redux";
|
||||
import Text from "../Text";
|
||||
import TextExpandable from "../textExpandable";
|
||||
|
||||
|
||||
export default function SectionReportTask({ refreshing }: { refreshing: boolean }) {
|
||||
const { colors } = useTheme()
|
||||
const update = useSelector((state: any) => state.taskUpdate)
|
||||
@@ -27,29 +27,30 @@ export default function SectionReportTask({ refreshing }: { refreshing: boolean
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
handleLoad()
|
||||
}, [update.report])
|
||||
|
||||
useEffect(() => {
|
||||
if (refreshing)
|
||||
handleLoad();
|
||||
}, [refreshing]);
|
||||
useEffect(() => { handleLoad() }, [update.report])
|
||||
useEffect(() => { if (refreshing) handleLoad() }, [refreshing])
|
||||
|
||||
if (!data || data === "") return null;
|
||||
|
||||
return (
|
||||
<>
|
||||
{
|
||||
data != "" && data != null &&
|
||||
<View style={[Styles.mb15, Styles.mt10]}>
|
||||
<Text style={[Styles.textDefaultSemiBold, Styles.mv05]}>
|
||||
Laporan Kegiatan
|
||||
</Text>
|
||||
<View style={[Styles.wrapPaper, { backgroundColor: colors.card, borderColor: colors.background }]}>
|
||||
<TextExpandable content={data} maxLines={2} />
|
||||
</View>
|
||||
<View style={[
|
||||
Styles.wrapPaper,
|
||||
Styles.mb15,
|
||||
Styles.sectionCard,
|
||||
{ backgroundColor: colors.card, borderColor: colors.icon + '18' },
|
||||
]}>
|
||||
<View style={Styles.sectionHeader}>
|
||||
<View style={[Styles.sectionIconBox, Styles.mr10, { backgroundColor: colors.tabActive + '18' }]}>
|
||||
<MaterialCommunityIcons name="text-box-outline" size={18} color={colors.tabActive} />
|
||||
</View>
|
||||
}
|
||||
</>
|
||||
<Text style={[Styles.textDefaultSemiBold, { color: colors.text }]}>
|
||||
Laporan Kegiatan
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
<View style={[Styles.reportContent, { borderLeftColor: colors.tabActive + '50' }]}>
|
||||
<TextExpandable content={data} maxLines={2} />
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Styles from "@/constants/Styles";
|
||||
import { apiDeleteTaskTugas, apiGetTaskOne, apiUpdateStatusTaskDivision } from "@/lib/api";
|
||||
import { apiApproveRejectTaskTugas, apiDeleteTaskTugas, apiGetTaskOne, apiGetTaskTugasApprovals, apiSubmitTaskTugas } from "@/lib/api";
|
||||
import { setUpdateTask } from "@/lib/taskUpdate";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
@@ -9,11 +9,12 @@ import { useEffect, useState } from "react";
|
||||
import { View } from "react-native";
|
||||
import Toast from "react-native-toast-message";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import ModalConfirmation from "../ModalConfirmation";
|
||||
import DrawerBottom from "../drawerBottom";
|
||||
import ItemSectionTanggalTugas from "../itemSectionTanggalTugas";
|
||||
import MenuItemRow from "../menuItemRow";
|
||||
import ModalSelect from "../modalSelect";
|
||||
import ModalConfirmation from "../ModalConfirmation";
|
||||
import ModalRiwayatApproval from "../ModalRiwayatApproval";
|
||||
import ModalTolakApproval from "../ModalTolakApproval";
|
||||
import SkeletonTask from "../skeletonTask";
|
||||
import Text from "../Text";
|
||||
import ModalListDetailTugasTask from "./modalListDetailTugasTask";
|
||||
@@ -25,27 +26,44 @@ type Props = {
|
||||
status: number;
|
||||
dateStart: string;
|
||||
dateEnd: string;
|
||||
files?: { name: string; extension: string }[];
|
||||
}
|
||||
|
||||
export default function SectionTanggalTugasTask({ refreshing, isMemberDivision }: { refreshing: boolean, isMemberDivision: boolean }) {
|
||||
type ApprovalRecord = {
|
||||
id: string
|
||||
status: number
|
||||
note?: string
|
||||
submitter: { name: string }
|
||||
approver?: { name: string }
|
||||
createdAt: string
|
||||
}
|
||||
|
||||
export default function SectionTanggalTugasTask({ refreshing, isMemberDivision, isAdminDivision, status }: { refreshing: boolean, isMemberDivision: boolean, isAdminDivision: boolean, status?: number }) {
|
||||
const { colors } = useTheme()
|
||||
const dispatch = useDispatch()
|
||||
const entityUser = useSelector((state: any) => state.user);
|
||||
const update = useSelector((state: any) => state.taskUpdate)
|
||||
const [isModal, setModal] = useState(false)
|
||||
const [isSelect, setSelect] = useState(false)
|
||||
const { token, decryptToken } = useAuthSession()
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [loadingAction, setLoadingAction] = useState(false)
|
||||
const [loadingRiwayat, setLoadingRiwayat] = useState(false)
|
||||
const arrSkeleton = Array.from({ length: 5 })
|
||||
const [modalDetail, setModalDetail] = useState(false)
|
||||
const [modalRiwayat, setModalRiwayat] = useState(false)
|
||||
const [modalTolak, setModalTolak] = useState(false)
|
||||
const [modalKonfirmasiSetujui, setModalKonfirmasiSetujui] = useState(false)
|
||||
const [modalPersetujuan, setModalPersetujuan] = useState(false)
|
||||
const [riwayatData, setRiwayatData] = useState<ApprovalRecord[]>([])
|
||||
const { id, detail } = useLocalSearchParams<{ id: string, detail: string }>();
|
||||
const [data, setData] = useState<Props[]>([])
|
||||
const [tugas, setTugas] = useState({
|
||||
id: '',
|
||||
status: 0,
|
||||
})
|
||||
const [tugas, setTugas] = useState({ id: '', status: 0 })
|
||||
const [showDeleteModal, setShowDeleteModal] = useState(false)
|
||||
|
||||
const isApprover = entityUser.isApprover || ['supadmin', 'developer'].includes(entityUser.role)
|
||||
const isAdmin = entityUser.role !== 'user' && entityUser.role !== 'coadmin'
|
||||
const canTakeAction = isMemberDivision || isAdmin
|
||||
|
||||
async function handleLoad(loading: boolean) {
|
||||
try {
|
||||
setLoading(loading)
|
||||
@@ -59,194 +77,266 @@ export default function SectionTanggalTugasTask({ refreshing, isMemberDivision }
|
||||
}
|
||||
}
|
||||
|
||||
async function handleUpdate(status: number) {
|
||||
try {
|
||||
const hasil = await decryptToken(String(token?.current));
|
||||
const response = await apiUpdateStatusTaskDivision({
|
||||
user: hasil,
|
||||
idProject: detail,
|
||||
status: status,
|
||||
}, tugas.id);
|
||||
if (response.success) {
|
||||
dispatch(setUpdateTask({ ...update, progress: !update.progress, task: !update.task }))
|
||||
Toast.show({ type: 'small', text1: 'Berhasil mengubah data', })
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal mengubah data"
|
||||
useEffect(() => { handleLoad(false) }, [update.task])
|
||||
useEffect(() => { if (refreshing) handleLoad(false) }, [refreshing])
|
||||
useEffect(() => { handleLoad(true) }, [])
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
async function handleLoadRiwayat() {
|
||||
try {
|
||||
setLoadingRiwayat(true)
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiGetTaskTugasApprovals({ user: hasil, id: tugas.id })
|
||||
setRiwayatData(response.data ?? [])
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
setSelect(false)
|
||||
setLoadingRiwayat(false)
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
handleLoad(false)
|
||||
}, [update.task])
|
||||
async function handleSubmitAjukan() {
|
||||
try {
|
||||
setLoadingAction(true)
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiSubmitTaskTugas({ user: hasil, id: tugas.id })
|
||||
if (response.success) {
|
||||
dispatch(setUpdateTask({ ...update, progress: !update.progress, task: !update.task }))
|
||||
Toast.show({ type: 'small', text1: 'Berhasil mengajukan task untuk persetujuan' })
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message })
|
||||
}
|
||||
} catch (error: any) {
|
||||
Toast.show({ type: 'small', text1: error?.response?.data?.message || "Gagal mengajukan persetujuan" })
|
||||
} finally {
|
||||
setLoadingAction(false)
|
||||
setModal(false)
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (refreshing)
|
||||
handleLoad(false);
|
||||
}, [refreshing]);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
handleLoad(true)
|
||||
}, [])
|
||||
async function handleSetujui() {
|
||||
try {
|
||||
setLoadingAction(true)
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiApproveRejectTaskTugas({ user: hasil, id: tugas.id, action: 'approve' })
|
||||
if (response.success) {
|
||||
dispatch(setUpdateTask({ ...update, progress: !update.progress, task: !update.task }))
|
||||
Toast.show({ type: 'small', text1: 'Tugas berhasil disetujui' })
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message })
|
||||
}
|
||||
} catch (error: any) {
|
||||
Toast.show({ type: 'small', text1: error?.response?.data?.message || "Gagal menyetujui tugas" })
|
||||
} finally {
|
||||
setLoadingAction(false)
|
||||
setModalKonfirmasiSetujui(false)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleTolak(note: string) {
|
||||
try {
|
||||
setLoadingAction(true)
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiApproveRejectTaskTugas({ user: hasil, id: tugas.id, action: 'reject', note })
|
||||
if (response.success) {
|
||||
dispatch(setUpdateTask({ ...update, progress: !update.progress, task: !update.task }))
|
||||
Toast.show({ type: 'small', text1: 'Tugas berhasil ditolak' })
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message })
|
||||
}
|
||||
} catch (error: any) {
|
||||
Toast.show({ type: 'small', text1: error?.response?.data?.message || "Gagal menolak tugas" })
|
||||
} finally {
|
||||
setLoadingAction(false)
|
||||
setModalTolak(false)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleDelete() {
|
||||
try {
|
||||
const hasil = await decryptToken(String(token?.current));
|
||||
const response = await apiDeleteTaskTugas({
|
||||
user: hasil,
|
||||
idProject: detail,
|
||||
}, tugas.id);
|
||||
const response = await apiDeleteTaskTugas({ user: hasil, idProject: detail }, tugas.id);
|
||||
if (response.success) {
|
||||
dispatch(setUpdateTask({ ...update, progress: !update.progress, task: !update.task }))
|
||||
Toast.show({ type: 'small', text1: 'Berhasil menghapus data', })
|
||||
Toast.show({ type: 'small', text1: 'Berhasil menghapus data' })
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
Toast.show({ type: 'small', text1: response.message })
|
||||
}
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal menghapus data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setModal(false);
|
||||
} catch (error: any) {
|
||||
Toast.show({ type: 'small', text1: error?.response?.data?.message || "Gagal menghapus data" })
|
||||
}
|
||||
}
|
||||
|
||||
const canApprove = isApprover || isAdminDivision
|
||||
const showAjukan = (isMemberDivision || canApprove) && tugas.status === 0 && status !== 3
|
||||
const showApproverActions = canApprove && tugas.status === 2
|
||||
|
||||
return (
|
||||
<>
|
||||
<View style={[Styles.mb15, Styles.mt10]}>
|
||||
<Text style={[Styles.textDefaultSemiBold, Styles.mv05]}>Tanggal & Tugas</Text>
|
||||
<View style={[Styles.wrapPaper, { backgroundColor: colors.card, borderColor: colors.background }]}>
|
||||
{
|
||||
loading ?
|
||||
arrSkeleton.map((item, index) => {
|
||||
return (
|
||||
<SkeletonTask key={index} />
|
||||
)
|
||||
})
|
||||
:
|
||||
data.length > 0
|
||||
?
|
||||
data.map((item, index) => {
|
||||
return (
|
||||
<ItemSectionTanggalTugas
|
||||
key={index}
|
||||
done={item.status === 1}
|
||||
title={item.title}
|
||||
dateStart={item.dateStart}
|
||||
dateEnd={item.dateEnd}
|
||||
onPress={() => {
|
||||
setTugas({
|
||||
id: item.id,
|
||||
status: item.status
|
||||
})
|
||||
setModal(true)
|
||||
}}
|
||||
/>
|
||||
);
|
||||
})
|
||||
:
|
||||
<Text style={[Styles.textDefault, { textAlign: 'center', color: colors.dimmed }]}>Tidak ada tugas</Text>
|
||||
<View>
|
||||
{loading
|
||||
? arrSkeleton.map((_, index) => <SkeletonTask key={index} />)
|
||||
: data.length > 0
|
||||
? data.map((item, index) => (
|
||||
<ItemSectionTanggalTugas
|
||||
key={index}
|
||||
status={item.status}
|
||||
title={item.title}
|
||||
dateStart={item.dateStart}
|
||||
dateEnd={item.dateEnd}
|
||||
files={item.files ?? []}
|
||||
onPress={() => {
|
||||
setTugas({ id: item.id, status: item.status })
|
||||
setModal(true)
|
||||
}}
|
||||
/>
|
||||
))
|
||||
: <Text style={[Styles.textDefault, { textAlign: 'center', color: colors.dimmed }]}>Tidak ada tugas</Text>
|
||||
}
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<DrawerBottom animation="slide" isVisible={isModal} setVisible={setModal} title="Menu">
|
||||
<View style={Styles.rowItemsCenter}>
|
||||
{/* Drawer menu */}
|
||||
<DrawerBottom animation="slide" isVisible={isModal} setVisible={setModal} title="Menu" height={40}>
|
||||
<View style={{ flexDirection: 'row', flexWrap: 'wrap' }}>
|
||||
|
||||
{/* Baris 1 — selalu tampil */}
|
||||
<MenuItemRow
|
||||
icon={
|
||||
<MaterialCommunityIcons
|
||||
name="clock-time-three-outline"
|
||||
color={colors.text}
|
||||
size={25}
|
||||
/>
|
||||
}
|
||||
title="Detail Waktu"
|
||||
icon={<MaterialCommunityIcons name="file-multiple-outline" color={colors.text} size={25} />}
|
||||
title="File Tugas"
|
||||
onPress={() => {
|
||||
setModal(false);
|
||||
setTimeout(() => {
|
||||
setModalDetail(true)
|
||||
}, 600)
|
||||
setModal(false)
|
||||
router.push(`/division/${id}/task/${detail}/tugas-file/${tugas.id}?member=${isMemberDivision}`)
|
||||
}}
|
||||
/>
|
||||
<MenuItemRow
|
||||
icon={<MaterialCommunityIcons name="clock-time-three-outline" color={colors.text} size={25} />}
|
||||
title="Detail Waktu"
|
||||
onPress={() => {
|
||||
setModal(false)
|
||||
setTimeout(() => setModalDetail(true), 600)
|
||||
}}
|
||||
/>
|
||||
<MenuItemRow
|
||||
icon={<MaterialCommunityIcons name="history" color={colors.text} size={25} />}
|
||||
title="Riwayat"
|
||||
onPress={() => {
|
||||
setModal(false)
|
||||
handleLoadRiwayat()
|
||||
setTimeout(() => setModalRiwayat(true), 600)
|
||||
}}
|
||||
/>
|
||||
{
|
||||
(entityUser.role != "user" && entityUser.role != "coadmin") || isMemberDivision
|
||||
?
|
||||
<>
|
||||
<MenuItemRow
|
||||
icon={<MaterialCommunityIcons name="list-status" color={colors.text} size={25} />}
|
||||
title="Update Status"
|
||||
onPress={() => {
|
||||
setModal(false)
|
||||
setTimeout(() => {
|
||||
setSelect(true)
|
||||
}, 600);
|
||||
}}
|
||||
/>
|
||||
<MenuItemRow
|
||||
icon={<MaterialCommunityIcons name="pencil-outline" color={colors.text} size={25} />}
|
||||
title="Edit Tugas"
|
||||
onPress={() => {
|
||||
setModal(false)
|
||||
router.push(`./update/${tugas.id}`)
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
:
|
||||
<></>
|
||||
}
|
||||
|
||||
</View>
|
||||
{
|
||||
(entityUser.role != "user" && entityUser.role != "coadmin") || isMemberDivision
|
||||
?
|
||||
<View style={[Styles.rowItemsCenter, Styles.mt15]}>
|
||||
{/* Separator */}
|
||||
{(showAjukan || showApproverActions || (canTakeAction && isAdmin && status !== 3)) && (
|
||||
<View style={{ width: '100%', height: 15 }} />
|
||||
)}
|
||||
|
||||
{/* Baris 2 — aksi kondisional */}
|
||||
{showAjukan && (
|
||||
<MenuItemRow
|
||||
icon={<MaterialCommunityIcons name="check-circle-outline" color={colors.text} size={25} />}
|
||||
title="Ajukan Selesai"
|
||||
disabled={loadingAction}
|
||||
onPress={() => {
|
||||
setModal(false)
|
||||
setTimeout(() => handleSubmitAjukan(), 600)
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{showApproverActions && (
|
||||
<MenuItemRow
|
||||
icon={<MaterialCommunityIcons name="shield-check-outline" color={colors.text} size={25} />}
|
||||
title="Persetujuan"
|
||||
disabled={loadingAction}
|
||||
onPress={() => {
|
||||
setModal(false)
|
||||
setTimeout(() => setModalPersetujuan(true), 600)
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{canTakeAction && isAdmin && status !== 3 && (
|
||||
<>
|
||||
<MenuItemRow
|
||||
icon={<MaterialCommunityIcons name="pencil-outline" color={colors.text} size={25} />}
|
||||
title="Edit Tugas"
|
||||
onPress={() => {
|
||||
setModal(false)
|
||||
router.push(`./update/${tugas.id}`)
|
||||
}}
|
||||
/>
|
||||
<MenuItemRow
|
||||
icon={<Ionicons name="trash-outline" color={colors.text} size={25} />}
|
||||
title="Hapus Tugas"
|
||||
onPress={() => {
|
||||
setModal(false)
|
||||
setTimeout(() => {
|
||||
setShowDeleteModal(true)
|
||||
}, 600)
|
||||
setTimeout(() => setShowDeleteModal(true), 600)
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
:
|
||||
<></>
|
||||
}
|
||||
</>
|
||||
)}
|
||||
</View>
|
||||
</DrawerBottom>
|
||||
|
||||
{/* Drawer persetujuan */}
|
||||
<DrawerBottom animation="slide" isVisible={modalPersetujuan} setVisible={setModalPersetujuan} title="Persetujuan Tugas" height={25}>
|
||||
<View style={{ flexDirection: 'row', flexWrap: 'wrap' }}>
|
||||
<MenuItemRow
|
||||
icon={<MaterialCommunityIcons name="check-circle" color={colors.success} size={25} />}
|
||||
title="Setujui"
|
||||
color={colors.success}
|
||||
disabled={loadingAction}
|
||||
onPress={() => {
|
||||
setModalPersetujuan(false)
|
||||
setTimeout(() => setModalKonfirmasiSetujui(true), 600)
|
||||
}}
|
||||
/>
|
||||
<MenuItemRow
|
||||
icon={<MaterialCommunityIcons name="close-circle-outline" color={colors.error} size={25} />}
|
||||
title="Tolak"
|
||||
color={colors.error}
|
||||
disabled={loadingAction}
|
||||
onPress={() => {
|
||||
setModalPersetujuan(false)
|
||||
setTimeout(() => setModalTolak(true), 600)
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
</DrawerBottom>
|
||||
|
||||
<ModalConfirmation
|
||||
visible={showDeleteModal}
|
||||
title="Konfirmasi"
|
||||
message="Apakah anda yakin ingin menghapus data ini?"
|
||||
onConfirm={() => {
|
||||
setShowDeleteModal(false)
|
||||
handleDelete()
|
||||
}}
|
||||
onConfirm={() => { setShowDeleteModal(false); handleDelete() }}
|
||||
onCancel={() => setShowDeleteModal(false)}
|
||||
confirmText="Hapus"
|
||||
cancelText="Batal"
|
||||
/>
|
||||
|
||||
<ModalSelect
|
||||
category="status-task"
|
||||
close={() => setSelect(false)}
|
||||
onSelect={(value) => { handleUpdate(Number(value.val)) }}
|
||||
title="Status"
|
||||
open={isSelect}
|
||||
valChoose={String(tugas.status)}
|
||||
<ModalConfirmation
|
||||
visible={modalKonfirmasiSetujui}
|
||||
title="Konfirmasi"
|
||||
message="Apakah anda yakin ingin menyetujui tugas ini?"
|
||||
onConfirm={handleSetujui}
|
||||
onCancel={() => setModalKonfirmasiSetujui(false)}
|
||||
confirmText="Setujui"
|
||||
cancelText="Batal"
|
||||
/>
|
||||
|
||||
<ModalRiwayatApproval
|
||||
isVisible={modalRiwayat}
|
||||
setVisible={setModalRiwayat}
|
||||
data={riwayatData}
|
||||
loading={loadingRiwayat}
|
||||
/>
|
||||
|
||||
<ModalTolakApproval
|
||||
isVisible={modalTolak}
|
||||
setVisible={setModalTolak}
|
||||
onTolak={handleTolak}
|
||||
loading={loadingAction}
|
||||
/>
|
||||
|
||||
<ModalListDetailTugasTask
|
||||
@@ -256,4 +346,4 @@ export default function SectionTanggalTugasTask({ refreshing, isMemberDivision }
|
||||
/>
|
||||
</>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,32 +1,38 @@
|
||||
import Styles from "@/constants/Styles";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
import { MaterialCommunityIcons } from "@expo/vector-icons";
|
||||
import { useRef, useState, useEffect } from "react";
|
||||
import { Animated, Pressable, View } from "react-native";
|
||||
import Text from "./Text";
|
||||
|
||||
export default function TextExpandable({ content, maxLines }: { content: string, maxLines: number }) {
|
||||
const { colors } = useTheme();
|
||||
const [isExpanded, setIsExpanded] = useState(false);
|
||||
const [shouldShowMore, setShouldShowMore] = useState(false);
|
||||
const [collapsedHeight, setCollapsedHeight] = useState(0);
|
||||
const [fullHeight, setFullHeight] = useState(0);
|
||||
const animatedHeight = useRef(new Animated.Value(0)).current;
|
||||
|
||||
useEffect(() => {
|
||||
setCollapsedHeight(0);
|
||||
setFullHeight(0);
|
||||
setShouldShowMore(false);
|
||||
setIsExpanded(false);
|
||||
}, [content]);
|
||||
|
||||
const measureCollapsed = (e: any) => {
|
||||
if (collapsedHeight === 0) {
|
||||
setCollapsedHeight(e.nativeEvent.layout.height);
|
||||
animatedHeight.setValue(e.nativeEvent.layout.height);
|
||||
}
|
||||
const h = e.nativeEvent.layout.height;
|
||||
setCollapsedHeight(h);
|
||||
animatedHeight.setValue(h);
|
||||
};
|
||||
|
||||
const measureFull = (e: any) => {
|
||||
if (fullHeight === 0) {
|
||||
setFullHeight(e.nativeEvent.layout.height);
|
||||
}
|
||||
setFullHeight(e.nativeEvent.layout.height);
|
||||
};
|
||||
|
||||
// Cek apakah memang perlu "View More"
|
||||
useEffect(() => {
|
||||
if (collapsedHeight > 0 && fullHeight > 0) {
|
||||
setShouldShowMore(fullHeight > collapsedHeight + 1); // +1 untuk toleransi float
|
||||
setShouldShowMore(fullHeight > collapsedHeight + 1);
|
||||
}
|
||||
}, [collapsedHeight, fullHeight]);
|
||||
|
||||
@@ -41,41 +47,34 @@ export default function TextExpandable({ content, maxLines }: { content: string,
|
||||
|
||||
return (
|
||||
<View>
|
||||
{/* Hidden full text for measurement */}
|
||||
<View style={Styles.hidden}>
|
||||
<Text style={Styles.textDefault} onLayout={measureFull}>
|
||||
{content}
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
{/* Collapsed text for measurement */}
|
||||
<View style={Styles.hidden}>
|
||||
<Text
|
||||
numberOfLines={maxLines}
|
||||
style={Styles.textDefault}
|
||||
onLayout={measureCollapsed}
|
||||
ellipsizeMode="tail"
|
||||
>
|
||||
<Text numberOfLines={maxLines} style={Styles.textDefault} onLayout={measureCollapsed} ellipsizeMode="tail">
|
||||
{content}
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
{/* Animated visible text */}
|
||||
<Animated.View style={{ height: animatedHeight, overflow: 'hidden' }}>
|
||||
<Text
|
||||
style={Styles.textDefault}
|
||||
numberOfLines={isExpanded ? undefined : maxLines}
|
||||
ellipsizeMode="tail"
|
||||
>
|
||||
<Text style={Styles.textDefault} numberOfLines={isExpanded ? undefined : maxLines} ellipsizeMode="tail">
|
||||
{content}
|
||||
</Text>
|
||||
</Animated.View>
|
||||
|
||||
{shouldShowMore && (
|
||||
<Pressable onPress={toggleExpand}>
|
||||
<Text style={Styles.textLink}>
|
||||
{isExpanded ? 'View Less' : 'View More'}
|
||||
<Pressable onPress={toggleExpand} style={Styles.expandBtn}>
|
||||
<Text style={[Styles.textMediumSemiBold, { color: colors.tabActive }]}>
|
||||
{isExpanded ? 'Sembunyikan' : 'Lihat selengkapnya'}
|
||||
</Text>
|
||||
<MaterialCommunityIcons
|
||||
name={isExpanded ? 'chevron-up' : 'chevron-down'}
|
||||
size={16}
|
||||
color={colors.tabActive}
|
||||
/>
|
||||
</Pressable>
|
||||
)}
|
||||
</View>
|
||||
|
||||
@@ -13,7 +13,7 @@ export const Colors = {
|
||||
tabActive: '#2563EB',
|
||||
header: '#234881',
|
||||
homeGradient: '#346CC4',
|
||||
dimmed: '#707887ff',
|
||||
dimmed: '#707887',
|
||||
success: '#40C057',
|
||||
warning: '#FBBF24',
|
||||
error: '#F87171',
|
||||
|
||||
@@ -3,6 +3,8 @@ import Constants from 'expo-constants';
|
||||
export const ConstEnv = {
|
||||
url_storage: Constants?.expoConfig?.extra?.URL_STORAGE,
|
||||
pass_encrypt: Constants?.expoConfig?.extra?.PASS_ENC,
|
||||
url_monitoring: Constants?.expoConfig?.extra?.URL_MONITORING,
|
||||
key_api_monitoring: Constants?.expoConfig?.extra?.KEY_API_MONITORING,
|
||||
firebase: {
|
||||
apiKey: Constants?.expoConfig?.extra?.FIREBASE_API_KEY,
|
||||
authDomain: Constants?.expoConfig?.extra?.FIREBASE_AUTH_DOMAIN,
|
||||
|
||||
@@ -1,970 +1 @@
|
||||
import { StyleSheet } from "react-native";
|
||||
|
||||
const Styles = StyleSheet.create({
|
||||
wrapLogin: {
|
||||
flex: 1,
|
||||
justifyContent: "flex-start",
|
||||
alignItems: "stretch",
|
||||
padding: 20,
|
||||
},
|
||||
textHeaderHome: {
|
||||
fontSize: 18,
|
||||
fontWeight: 'bold',
|
||||
flex: 1,
|
||||
color: 'white'
|
||||
},
|
||||
textDefault: {
|
||||
fontSize: 15,
|
||||
lineHeight: 24,
|
||||
},
|
||||
textDefaultSemiBold: {
|
||||
fontSize: 15,
|
||||
lineHeight: 24,
|
||||
fontWeight: '600',
|
||||
},
|
||||
textMediumNormal: {
|
||||
fontSize: 13,
|
||||
lineHeight: 24,
|
||||
},
|
||||
textMediumSemiBold: {
|
||||
fontSize: 13,
|
||||
lineHeight: 24,
|
||||
fontWeight: '600',
|
||||
},
|
||||
textSmallSemiBold: {
|
||||
fontSize: 10,
|
||||
fontWeight: '600',
|
||||
},
|
||||
textTitle: {
|
||||
fontSize: 32,
|
||||
fontWeight: 'bold',
|
||||
lineHeight: 32,
|
||||
},
|
||||
textSubtitle: {
|
||||
fontSize: 20,
|
||||
fontWeight: 'bold',
|
||||
},
|
||||
textSubtitle2: {
|
||||
fontSize: 20,
|
||||
},
|
||||
textLink: {
|
||||
fontSize: 14,
|
||||
color: '#0a7ea4',
|
||||
},
|
||||
textInformation: {
|
||||
fontSize: 12,
|
||||
fontWeight: 'light',
|
||||
},
|
||||
cError: {
|
||||
color: '#DB1514'
|
||||
},
|
||||
cGray: {
|
||||
color: 'gray'
|
||||
},
|
||||
cWhite: {
|
||||
color: 'white'
|
||||
},
|
||||
cBlack: {
|
||||
color: 'black'
|
||||
},
|
||||
cDefault: {
|
||||
color: '#19345E'
|
||||
},
|
||||
cFolder: {
|
||||
color: '#f9cc40'
|
||||
},
|
||||
mb05: {
|
||||
marginBottom: 5
|
||||
},
|
||||
mb10: {
|
||||
marginBottom: 10
|
||||
},
|
||||
mb12: {
|
||||
marginBottom: 12
|
||||
},
|
||||
mb13: {
|
||||
marginBottom: 13
|
||||
},
|
||||
mb15: {
|
||||
marginBottom: 15
|
||||
},
|
||||
mb20: {
|
||||
marginBottom: 20
|
||||
},
|
||||
mb30: {
|
||||
marginBottom: 30
|
||||
},
|
||||
mb50: {
|
||||
marginBottom: 50
|
||||
},
|
||||
mb100: {
|
||||
marginBottom: 100
|
||||
},
|
||||
mv05: {
|
||||
marginVertical: 5
|
||||
},
|
||||
mv15: {
|
||||
marginVertical: 15
|
||||
},
|
||||
mh03: {
|
||||
marginHorizontal: 3
|
||||
},
|
||||
mh05: {
|
||||
marginHorizontal: 5
|
||||
},
|
||||
mh10: {
|
||||
marginHorizontal: 10
|
||||
},
|
||||
mh15: {
|
||||
marginHorizontal: 15
|
||||
},
|
||||
mv50: {
|
||||
marginVertical: 50
|
||||
},
|
||||
mv10: {
|
||||
marginVertical: 10
|
||||
},
|
||||
mt02: {
|
||||
marginTop: 2
|
||||
},
|
||||
mt05: {
|
||||
marginTop: 5
|
||||
},
|
||||
mt10: {
|
||||
marginTop: 10
|
||||
},
|
||||
mt15: {
|
||||
marginTop: 15
|
||||
},
|
||||
mt30: {
|
||||
marginTop: 30
|
||||
},
|
||||
mr05: {
|
||||
marginRight: 5
|
||||
},
|
||||
mr10: {
|
||||
marginRight: 10
|
||||
},
|
||||
ml05: {
|
||||
marginLeft: 5
|
||||
},
|
||||
ml10: {
|
||||
marginLeft: 10
|
||||
},
|
||||
ml15: {
|
||||
marginLeft: 15
|
||||
},
|
||||
ml20: {
|
||||
marginLeft: 20
|
||||
},
|
||||
ml25: {
|
||||
marginLeft: 25
|
||||
},
|
||||
p0: {
|
||||
padding: 0
|
||||
},
|
||||
pb05: {
|
||||
paddingBottom: 5
|
||||
},
|
||||
pb07: {
|
||||
paddingBottom: 7
|
||||
},
|
||||
pb10: {
|
||||
paddingBottom: 10
|
||||
},
|
||||
pb50: {
|
||||
paddingBottom: 50
|
||||
},
|
||||
pb100: {
|
||||
paddingBottom: 100
|
||||
},
|
||||
pb13: {
|
||||
paddingBottom: 13
|
||||
},
|
||||
pb15: {
|
||||
paddingBottom: 15
|
||||
},
|
||||
pb20: {
|
||||
paddingBottom: 20
|
||||
},
|
||||
ph05: {
|
||||
paddingHorizontal: 5,
|
||||
},
|
||||
ph10: {
|
||||
paddingHorizontal: 10,
|
||||
},
|
||||
ph15: {
|
||||
paddingHorizontal: 15,
|
||||
},
|
||||
ph20: {
|
||||
paddingHorizontal: 20,
|
||||
},
|
||||
pv03: {
|
||||
paddingVertical: 3
|
||||
},
|
||||
pv05: {
|
||||
paddingVertical: 5
|
||||
},
|
||||
pv10: {
|
||||
paddingVertical: 10
|
||||
},
|
||||
pv15: {
|
||||
paddingVertical: 15
|
||||
},
|
||||
pv20: {
|
||||
paddingVertical: 20
|
||||
},
|
||||
p05: {
|
||||
padding: 5
|
||||
},
|
||||
p15: {
|
||||
padding: 15
|
||||
},
|
||||
p10: {
|
||||
padding: 10
|
||||
},
|
||||
p20: {
|
||||
padding: 20
|
||||
},
|
||||
round05: {
|
||||
borderRadius: 5
|
||||
},
|
||||
round08: {
|
||||
borderRadius: 8
|
||||
},
|
||||
round10: {
|
||||
borderRadius: 10
|
||||
},
|
||||
round15: {
|
||||
borderRadius: 15
|
||||
},
|
||||
round20: {
|
||||
borderRadius: 20
|
||||
},
|
||||
h100: {
|
||||
height: '100%'
|
||||
},
|
||||
w100: {
|
||||
width: '100%'
|
||||
},
|
||||
w48: {
|
||||
width: '48%'
|
||||
},
|
||||
w95: {
|
||||
width: '95%'
|
||||
},
|
||||
w90: {
|
||||
width: '90%'
|
||||
},
|
||||
w80: {
|
||||
width: '80%'
|
||||
},
|
||||
w70: {
|
||||
width: '70%'
|
||||
},
|
||||
w60: {
|
||||
width: '60%'
|
||||
},
|
||||
w50: {
|
||||
width: '50%'
|
||||
},
|
||||
w45: {
|
||||
width: '45%'
|
||||
},
|
||||
w40: {
|
||||
width: '40%'
|
||||
},
|
||||
w30: {
|
||||
width: '30%'
|
||||
},
|
||||
round30: {
|
||||
borderRadius: 30
|
||||
},
|
||||
labelStatus: {
|
||||
paddingHorizontal: 15,
|
||||
borderRadius: 10
|
||||
},
|
||||
labelStatusSmall: {
|
||||
paddingHorizontal: 10,
|
||||
borderRadius: 10
|
||||
},
|
||||
rowSpaceBetween: {
|
||||
justifyContent: 'space-between',
|
||||
flexDirection: 'row'
|
||||
},
|
||||
justifySpaceBetween: {
|
||||
justifyContent: 'space-between'
|
||||
},
|
||||
rowSpaceBetweenReverse: {
|
||||
justifyContent: 'space-between',
|
||||
flexDirection: 'row-reverse'
|
||||
},
|
||||
rowItemsCenter: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center'
|
||||
},
|
||||
rowOnly: {
|
||||
flexDirection: 'row'
|
||||
},
|
||||
btnIconHeader: {
|
||||
padding: 3,
|
||||
},
|
||||
btnFiturMenu: {
|
||||
padding: 13,
|
||||
borderRadius: 15,
|
||||
borderWidth: 1,
|
||||
},
|
||||
btnRound: {
|
||||
backgroundColor: '#1F3C88',
|
||||
borderWidth: 0,
|
||||
borderColor: '#1F3C88',
|
||||
alignItems: 'center',
|
||||
borderRadius: 30,
|
||||
marginTop: 15,
|
||||
paddingVertical: 10
|
||||
},
|
||||
btnTab: {
|
||||
alignItems: 'center',
|
||||
paddingVertical: 5,
|
||||
paddingHorizontal: 15,
|
||||
borderRadius: 20,
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'center'
|
||||
},
|
||||
btnLainnya: {
|
||||
alignSelf: 'flex-start',
|
||||
backgroundColor: '#1F3C88',
|
||||
paddingVertical: 5,
|
||||
marginVertical: 5
|
||||
},
|
||||
btnDisabled: {
|
||||
backgroundColor: '#d6d8f6',
|
||||
},
|
||||
btnMenuRow: {
|
||||
width: '33%',
|
||||
alignItems: 'center'
|
||||
},
|
||||
btnMenuRowMany: {
|
||||
alignItems: 'center',
|
||||
marginHorizontal: 10
|
||||
},
|
||||
inputRoundForm: {
|
||||
borderRadius: 5,
|
||||
borderColor: '#d6d8f6',
|
||||
borderWidth: 1,
|
||||
paddingVertical: 10,
|
||||
paddingHorizontal: 15,
|
||||
},
|
||||
inputRoundFormLeft: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
paddingVertical: 0,
|
||||
},
|
||||
inputRoundFormRight: {
|
||||
flexDirection: 'row-reverse',
|
||||
alignItems: 'center',
|
||||
paddingVertical: 0,
|
||||
justifyContent: 'space-between'
|
||||
},
|
||||
verificationCell: {
|
||||
width: 50,
|
||||
height: 50,
|
||||
lineHeight: 45,
|
||||
fontSize: 24,
|
||||
borderWidth: 1,
|
||||
borderRadius: 15,
|
||||
borderColor: 'gray',
|
||||
textAlign: 'center',
|
||||
},
|
||||
verificationFocusCell: {
|
||||
borderColor: '#19345E',
|
||||
},
|
||||
caraoselContent: {
|
||||
flex: 1,
|
||||
justifyContent: "center",
|
||||
marginHorizontal: 15,
|
||||
borderRadius: 15,
|
||||
backgroundColor: '#19345E',
|
||||
display: 'flex',
|
||||
width: '92%',
|
||||
resizeMode: 'stretch',
|
||||
overflow: 'hidden',
|
||||
},
|
||||
wrapGridContent: {
|
||||
shadowColor: '#171717',
|
||||
shadowOffset: { width: 0, height: 0 },
|
||||
shadowOpacity: 0.1,
|
||||
shadowRadius: 5,
|
||||
elevation: 2,
|
||||
borderRadius: 5,
|
||||
marginBottom: 15
|
||||
},
|
||||
wrapGridCaraousel: {
|
||||
width: '95%',
|
||||
height: 200,
|
||||
shadowColor: '#171717',
|
||||
shadowOffset: { width: 0, height: 0 },
|
||||
shadowOpacity: 0.1,
|
||||
shadowRadius: 5,
|
||||
elevation: 2,
|
||||
borderRadius: 5,
|
||||
marginLeft: 5,
|
||||
display: 'flex',
|
||||
},
|
||||
headerPaperGrid: {
|
||||
paddingVertical: 25,
|
||||
paddingHorizontal: 20,
|
||||
alignItems: 'center',
|
||||
borderTopStartRadius: 5,
|
||||
borderTopEndRadius: 5
|
||||
},
|
||||
contentPaperGrid: {
|
||||
height: 125,
|
||||
borderBottomEndRadius: 5,
|
||||
borderBottomStartRadius: 5,
|
||||
paddingHorizontal: 20,
|
||||
justifyContent: 'space-evenly'
|
||||
},
|
||||
contentPaperGrid2: {
|
||||
height: 100,
|
||||
borderBottomEndRadius: 5,
|
||||
borderBottomStartRadius: 5,
|
||||
paddingHorizontal: 20,
|
||||
paddingVertical: 15,
|
||||
justifyContent: 'flex-start'
|
||||
},
|
||||
wrapBar: {
|
||||
height: 20,
|
||||
backgroundColor: '#ccc',
|
||||
borderRadius: 10,
|
||||
margin: 0,
|
||||
width: '100%'
|
||||
},
|
||||
contentBar: {
|
||||
height: 20,
|
||||
backgroundColor: '#3B82F6',
|
||||
borderRadius: 10,
|
||||
},
|
||||
wrapPaper: {
|
||||
padding: 10,
|
||||
backgroundColor: 'white',
|
||||
borderRadius: 5,
|
||||
// borderWidth: 1,
|
||||
// borderColor: '#d6d8f6',
|
||||
shadowColor: '#171717',
|
||||
shadowOffset: { width: 0, height: 0 },
|
||||
shadowOpacity: 0.1,
|
||||
shadowRadius: 5,
|
||||
elevation: 2,
|
||||
},
|
||||
noShadow: {
|
||||
shadowColor: 'transparent',
|
||||
shadowOffset: { width: 0, height: 0 },
|
||||
shadowOpacity: 0,
|
||||
shadowRadius: 0,
|
||||
elevation: 0,
|
||||
},
|
||||
shadowBox: {
|
||||
shadowColor: '#171717',
|
||||
shadowOffset: { width: 0, height: 0 },
|
||||
shadowOpacity: 0.1,
|
||||
shadowRadius: 5,
|
||||
elevation: 2,
|
||||
},
|
||||
contentItemCenter: {
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center'
|
||||
},
|
||||
itemEvent: {
|
||||
padding: 10,
|
||||
borderRadius: 10,
|
||||
flexDirection: 'row',
|
||||
alignContent: 'stretch',
|
||||
marginBottom: 10
|
||||
},
|
||||
dividerEvent: {
|
||||
width: 7,
|
||||
borderRadius: 5,
|
||||
marginRight: 10
|
||||
},
|
||||
wrapItemDiscussion: {
|
||||
padding: 15,
|
||||
borderRadius: 5,
|
||||
// borderColor: '#d6d8f6',
|
||||
borderBottomWidth: 1,
|
||||
},
|
||||
wrapItemBorderBottom: {
|
||||
padding: 10,
|
||||
// borderColor: '#d6d8f6',
|
||||
borderBottomWidth: 1,
|
||||
},
|
||||
wrapItemBorderAll: {
|
||||
padding: 10,
|
||||
// borderColor: '#d6d8f6',
|
||||
borderWidth: 1,
|
||||
borderRadius: 5,
|
||||
marginBottom: 5
|
||||
},
|
||||
wrapItemBorderNone: {
|
||||
padding: 10,
|
||||
marginBottom: 5
|
||||
},
|
||||
userProfileExtraSmall: {
|
||||
width: 35,
|
||||
height: 35,
|
||||
borderRadius: 100
|
||||
},
|
||||
userProfileSmall: {
|
||||
width: 48,
|
||||
height: 48,
|
||||
borderRadius: 100
|
||||
},
|
||||
userProfileBig: {
|
||||
width: 100,
|
||||
height: 100,
|
||||
borderRadius: 100
|
||||
},
|
||||
imgListBanner: {
|
||||
width: 100,
|
||||
height: 50,
|
||||
borderRadius: 5
|
||||
},
|
||||
iconContent: {
|
||||
padding: 10,
|
||||
borderRadius: 100,
|
||||
backgroundColor: '#E5E7EB'
|
||||
},
|
||||
wrapHeadViewMember: {
|
||||
backgroundColor: '#19345E',
|
||||
paddingVertical: 30,
|
||||
paddingHorizontal: 15,
|
||||
alignItems: 'center',
|
||||
borderBottomLeftRadius: 25,
|
||||
borderBottomRightRadius: 25
|
||||
},
|
||||
modalBgTransparant: {
|
||||
backgroundColor: 'rgba(0, 0, 0, 0.3)',
|
||||
flex: 1
|
||||
},
|
||||
modalContent: {
|
||||
width: '100%',
|
||||
paddingBottom: 20,
|
||||
backgroundColor: 'white',
|
||||
borderTopRightRadius: 18,
|
||||
borderTopLeftRadius: 18,
|
||||
position: 'absolute',
|
||||
bottom: 0,
|
||||
},
|
||||
titleContainer: {
|
||||
backgroundColor: 'white',
|
||||
borderTopRightRadius: 10,
|
||||
borderTopLeftRadius: 10,
|
||||
paddingHorizontal: 20,
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'space-between',
|
||||
paddingVertical: 10
|
||||
},
|
||||
contentContainer: {
|
||||
height: '90%'
|
||||
},
|
||||
modalContentNew: {
|
||||
width: '100%',
|
||||
backgroundColor: 'white',
|
||||
borderTopRightRadius: 18,
|
||||
borderTopLeftRadius: 18,
|
||||
paddingTop: 5,
|
||||
paddingBottom: 5,
|
||||
paddingHorizontal: 20
|
||||
},
|
||||
titleContainerNew: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'space-between',
|
||||
paddingVertical: 10,
|
||||
},
|
||||
modalFloatContent: {
|
||||
backgroundColor: 'white',
|
||||
borderRadius: 18,
|
||||
paddingTop: 5,
|
||||
paddingBottom: 10,
|
||||
paddingHorizontal: 20
|
||||
},
|
||||
titleContainerModalFloat: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
paddingVertical: 10,
|
||||
},
|
||||
wrapBtnTab: {
|
||||
justifyContent: 'space-between',
|
||||
flexDirection: 'row',
|
||||
marginBottom: 10,
|
||||
borderRadius: 20,
|
||||
padding: 5,
|
||||
borderWidth: 1,
|
||||
},
|
||||
itemSelectModal: {
|
||||
padding: 10,
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'space-between',
|
||||
borderBottomWidth: 1,
|
||||
alignItems: 'center'
|
||||
},
|
||||
signDate: {
|
||||
width: 20,
|
||||
height: 2,
|
||||
borderRadius: 3,
|
||||
marginTop: 3
|
||||
},
|
||||
selectedDate: {
|
||||
backgroundColor: '#238be6',
|
||||
borderRadius: 5
|
||||
},
|
||||
selectRangeDate: {
|
||||
backgroundColor: '#228be61f',
|
||||
},
|
||||
bottomMenuSelectDocument: {
|
||||
paddingVertical: 10,
|
||||
position: 'absolute',
|
||||
width: '100%',
|
||||
bottom: 0,
|
||||
},
|
||||
animatedView: {
|
||||
width: '100%',
|
||||
overflow: 'hidden',
|
||||
},
|
||||
wrapperAccordion: {
|
||||
width: '100%',
|
||||
position: 'absolute',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
},
|
||||
borderRight: {
|
||||
borderRightWidth: 1,
|
||||
borderRightColor: '#d6d8f6'
|
||||
},
|
||||
borderLeft: {
|
||||
borderLeftWidth: 1,
|
||||
borderLeftColor: '#d6d8f6'
|
||||
},
|
||||
borderBottom: {
|
||||
borderBottomWidth: 1,
|
||||
borderBottomColor: '#d6d8f6'
|
||||
},
|
||||
borderTop: {
|
||||
borderTopWidth: 1,
|
||||
borderTopColor: '#d6d8f6'
|
||||
},
|
||||
borderAll: {
|
||||
borderWidth: 1,
|
||||
borderColor: '#d6d8f6'
|
||||
},
|
||||
absolute0: {
|
||||
position: 'absolute',
|
||||
bottom: 0
|
||||
},
|
||||
absoluteIcon: {
|
||||
top: 18,
|
||||
left: 20,
|
||||
position: 'absolute'
|
||||
},
|
||||
toastContainer: {
|
||||
backgroundColor: 'white',
|
||||
borderRadius: 10,
|
||||
padding: 10,
|
||||
width: '90%',
|
||||
borderWidth: 1,
|
||||
borderColor: '#d6d8f6',
|
||||
},
|
||||
absoluteIconPicker: {
|
||||
backgroundColor: '#384288',
|
||||
padding: 5,
|
||||
borderRadius: 100,
|
||||
bottom: 5,
|
||||
right: 5,
|
||||
position: 'absolute'
|
||||
},
|
||||
hidden: {
|
||||
position: 'absolute',
|
||||
opacity: 0,
|
||||
zIndex: -1,
|
||||
},
|
||||
headerContainer: {
|
||||
backgroundColor: '#19345E',
|
||||
},
|
||||
headerApp: {
|
||||
// height: 40,
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'space-between',
|
||||
paddingHorizontal: 16,
|
||||
},
|
||||
headerTitle: {
|
||||
color: '#fff',
|
||||
fontSize: 18,
|
||||
fontWeight: '600',
|
||||
},
|
||||
headerSide: {
|
||||
width: 40,
|
||||
alignItems: 'center',
|
||||
},
|
||||
chip: {
|
||||
paddingVertical: 5,
|
||||
paddingHorizontal: 15,
|
||||
borderRadius: 5,
|
||||
// backgroundColor: "#F3F4F6",
|
||||
borderWidth: 1,
|
||||
borderColor: "transparent",
|
||||
marginRight: 10,
|
||||
marginBottom: 10,
|
||||
},
|
||||
chipSelected: {
|
||||
backgroundColor: "#f2f6ffff",
|
||||
borderColor: "#384288",
|
||||
borderWidth: 1,
|
||||
},
|
||||
chipText: {
|
||||
fontSize: 16,
|
||||
color: "#222",
|
||||
},
|
||||
chipTextSelected: {
|
||||
color: "white",
|
||||
},
|
||||
checkIcon: {
|
||||
position: "absolute",
|
||||
top: -6,
|
||||
left: -6,
|
||||
backgroundColor: "#384288",
|
||||
borderRadius: 10,
|
||||
padding: 2,
|
||||
},
|
||||
headerModalViewImg: {
|
||||
paddingTop: 50,
|
||||
paddingHorizontal: 16,
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'space-between',
|
||||
alignItems: 'center',
|
||||
},
|
||||
wrapHomeCarousel: {
|
||||
shadowColor: '#171717',
|
||||
shadowOffset: { width: 0, height: 4 },
|
||||
shadowOpacity: 0.15,
|
||||
shadowRadius: 8,
|
||||
elevation: 5,
|
||||
},
|
||||
modalOverlay: {
|
||||
flex: 1,
|
||||
backgroundColor: 'rgba(0, 0, 0, 0.6)',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
},
|
||||
modalConfirmContainer: {
|
||||
width: '80%',
|
||||
borderRadius: 14,
|
||||
overflow: 'hidden',
|
||||
elevation: 2,
|
||||
shadowColor: '#000',
|
||||
shadowOffset: { width: 0, height: 2 },
|
||||
shadowOpacity: 0.25,
|
||||
shadowRadius: 3.84,
|
||||
},
|
||||
modalConfirmContent: {
|
||||
padding: 20,
|
||||
alignItems: 'center',
|
||||
},
|
||||
modalConfirmTitle: {
|
||||
fontSize: 18,
|
||||
fontWeight: 'bold',
|
||||
marginBottom: 8,
|
||||
textAlign: 'center',
|
||||
},
|
||||
modalConfirmMessage: {
|
||||
fontSize: 14,
|
||||
textAlign: 'center',
|
||||
lineHeight: 20,
|
||||
},
|
||||
modalConfirmDivider: {
|
||||
height: 1,
|
||||
width: '100%',
|
||||
},
|
||||
modalConfirmFooter: {
|
||||
flexDirection: 'row',
|
||||
height: 50,
|
||||
},
|
||||
modalConfirmButton: {
|
||||
flex: 1,
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
},
|
||||
modalConfirmButtonText: {
|
||||
fontSize: 16,
|
||||
},
|
||||
modalConfirmVerticalDivider: {
|
||||
width: 1,
|
||||
height: '100%',
|
||||
},
|
||||
wrapGridItem: {
|
||||
borderWidth: 1,
|
||||
borderRadius: 5,
|
||||
padding: 10,
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
width: '48.5%',
|
||||
marginBottom: 10,
|
||||
},
|
||||
flex1: {
|
||||
flex: 1
|
||||
},
|
||||
flex2: {
|
||||
flex: 2
|
||||
},
|
||||
flexColumn: {
|
||||
flexDirection: 'column'
|
||||
},
|
||||
textCenter: {
|
||||
textAlign: 'center'
|
||||
},
|
||||
posAbsolute: {
|
||||
position: 'absolute'
|
||||
},
|
||||
zIndex1: {
|
||||
zIndex: 1
|
||||
},
|
||||
zIndexMinus1: {
|
||||
zIndex: -1
|
||||
},
|
||||
alignCenter: {
|
||||
alignItems: 'center'
|
||||
},
|
||||
itemsCenter: {
|
||||
alignItems: 'center'
|
||||
},
|
||||
justifyCenter: {
|
||||
justifyContent: 'center'
|
||||
},
|
||||
resizeContain: {
|
||||
resizeMode: 'contain'
|
||||
},
|
||||
resizeCover: {
|
||||
resizeMode: 'cover'
|
||||
},
|
||||
resizeStretch: {
|
||||
resizeMode: 'stretch'
|
||||
},
|
||||
textWhite: {
|
||||
color: 'white'
|
||||
},
|
||||
font16: {
|
||||
fontSize: 16
|
||||
},
|
||||
font26: {
|
||||
fontSize: 26
|
||||
},
|
||||
ph16: {
|
||||
paddingHorizontal: 16
|
||||
},
|
||||
alignStart: {
|
||||
alignItems: 'flex-start'
|
||||
},
|
||||
loadingCenter: {
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
zIndex: 999,
|
||||
backgroundColor: 'rgba(0,0,0,0.3)',
|
||||
},
|
||||
loadingBox: {
|
||||
paddingVertical: 15,
|
||||
paddingHorizontal: 40,
|
||||
borderRadius: 5,
|
||||
alignItems: 'center',
|
||||
gap: 10,
|
||||
},
|
||||
modalUpdateContainer: {
|
||||
flex: 1,
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
paddingHorizontal: 30,
|
||||
overflow: 'hidden',
|
||||
},
|
||||
modalUpdateDecorativeCircle1: {
|
||||
position: 'absolute',
|
||||
width: 300,
|
||||
height: 300,
|
||||
borderRadius: 150,
|
||||
backgroundColor: 'rgba(255, 255, 255, 0.05)',
|
||||
top: -50,
|
||||
right: -50,
|
||||
},
|
||||
modalUpdateDecorativeCircle2: {
|
||||
position: 'absolute',
|
||||
width: 200,
|
||||
height: 200,
|
||||
borderRadius: 100,
|
||||
backgroundColor: 'rgba(255, 255, 255, 0.03)',
|
||||
bottom: -30,
|
||||
left: -30,
|
||||
},
|
||||
modalUpdateContent: {
|
||||
width: '100%',
|
||||
alignItems: 'flex-start',
|
||||
zIndex: 1,
|
||||
},
|
||||
modalUpdateLogo: {
|
||||
width: 200,
|
||||
height: 100,
|
||||
marginBottom: 40,
|
||||
alignSelf: 'center',
|
||||
},
|
||||
modalUpdateTextContainer: {
|
||||
marginBottom: 40,
|
||||
},
|
||||
modalUpdateTitle: {
|
||||
fontSize: 32,
|
||||
fontWeight: 'bold',
|
||||
color: 'white',
|
||||
marginBottom: 20,
|
||||
lineHeight: 38,
|
||||
},
|
||||
modalUpdateDescription: {
|
||||
fontSize: 16,
|
||||
color: 'white',
|
||||
lineHeight: 24,
|
||||
},
|
||||
modalUpdateButtonContainer: {
|
||||
width: '100%',
|
||||
alignItems: 'center',
|
||||
},
|
||||
modalUpdatePrimaryButton: {
|
||||
width: '100%',
|
||||
paddingVertical: 15,
|
||||
borderRadius: 12,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
marginBottom: 15,
|
||||
shadowColor: '#000',
|
||||
shadowOffset: { width: 0, height: 2 },
|
||||
shadowOpacity: 0.2,
|
||||
shadowRadius: 4,
|
||||
elevation: 3,
|
||||
},
|
||||
modalUpdatePrimaryButtonText: {
|
||||
fontSize: 16,
|
||||
fontWeight: 'bold',
|
||||
},
|
||||
modalUpdateSecondaryButton: {
|
||||
paddingVertical: 10,
|
||||
},
|
||||
modalUpdateSecondaryButtonText: {
|
||||
fontSize: 16,
|
||||
color: 'white',
|
||||
fontWeight: '500',
|
||||
},
|
||||
})
|
||||
|
||||
export default Styles;
|
||||
export { default } from './styles/index';
|
||||
|
||||
17
constants/styles/border.styles.ts
Normal file
17
constants/styles/border.styles.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { StyleSheet } from "react-native";
|
||||
|
||||
const BorderStyles = StyleSheet.create({
|
||||
round05: { borderRadius: 5 },
|
||||
round08: { borderRadius: 8 },
|
||||
round10: { borderRadius: 10 },
|
||||
round15: { borderRadius: 15 },
|
||||
round20: { borderRadius: 20 },
|
||||
round30: { borderRadius: 30 },
|
||||
borderRight: { borderRightWidth: 1, borderRightColor: '#d6d8f6' },
|
||||
borderLeft: { borderLeftWidth: 1, borderLeftColor: '#d6d8f6' },
|
||||
borderBottom: { borderBottomWidth: 1, borderBottomColor: '#d6d8f6' },
|
||||
borderTop: { borderTopWidth: 1, borderTopColor: '#d6d8f6' },
|
||||
borderAll: { borderWidth: 1, borderColor: '#d6d8f6' },
|
||||
});
|
||||
|
||||
export default BorderStyles;
|
||||
44
constants/styles/button.styles.ts
Normal file
44
constants/styles/button.styles.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
import { StyleSheet } from "react-native";
|
||||
|
||||
const ButtonStyles = StyleSheet.create({
|
||||
btnIconHeader: { padding: 3 },
|
||||
btnFiturMenu: { padding: 13, borderRadius: 15, borderWidth: 1 },
|
||||
btnRound: {
|
||||
backgroundColor: '#1F3C88',
|
||||
borderWidth: 0,
|
||||
borderColor: '#1F3C88',
|
||||
alignItems: 'center',
|
||||
borderRadius: 30,
|
||||
marginTop: 15,
|
||||
paddingVertical: 10,
|
||||
},
|
||||
btnTab: {
|
||||
alignItems: 'center',
|
||||
paddingVertical: 5,
|
||||
paddingHorizontal: 15,
|
||||
borderRadius: 20,
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'center',
|
||||
},
|
||||
btnLainnya: {
|
||||
alignSelf: 'flex-start',
|
||||
backgroundColor: '#1F3C88',
|
||||
paddingVertical: 5,
|
||||
marginVertical: 5,
|
||||
},
|
||||
btnDisabled: { backgroundColor: '#d6d8f6' },
|
||||
btnMenuRow: { width: '33%', alignItems: 'center' },
|
||||
btnMenuRowMany: { alignItems: 'center', marginHorizontal: 10 },
|
||||
wrapBtnTab: {
|
||||
justifyContent: 'space-between',
|
||||
flexDirection: 'row',
|
||||
marginBottom: 10,
|
||||
borderRadius: 20,
|
||||
padding: 5,
|
||||
borderWidth: 1,
|
||||
},
|
||||
labelStatus: { paddingHorizontal: 15, borderRadius: 10 },
|
||||
labelStatusSmall: { paddingHorizontal: 10, borderRadius: 10 },
|
||||
});
|
||||
|
||||
export default ButtonStyles;
|
||||
159
constants/styles/card.styles.ts
Normal file
159
constants/styles/card.styles.ts
Normal file
@@ -0,0 +1,159 @@
|
||||
import { StyleSheet } from "react-native";
|
||||
|
||||
const CardStyles = StyleSheet.create({
|
||||
wrapPaper: {
|
||||
padding: 10,
|
||||
backgroundColor: 'white',
|
||||
borderRadius: 5,
|
||||
shadowColor: '#171717',
|
||||
shadowOffset: { width: 0, height: 0 },
|
||||
shadowOpacity: 0.1,
|
||||
shadowRadius: 5,
|
||||
elevation: 2,
|
||||
},
|
||||
shadowBox: {
|
||||
shadowColor: '#171717',
|
||||
shadowOffset: { width: 0, height: 0 },
|
||||
shadowOpacity: 0.1,
|
||||
shadowRadius: 5,
|
||||
elevation: 2,
|
||||
},
|
||||
noShadow: {
|
||||
shadowColor: 'transparent',
|
||||
shadowOffset: { width: 0, height: 0 },
|
||||
shadowOpacity: 0,
|
||||
shadowRadius: 0,
|
||||
elevation: 0,
|
||||
},
|
||||
wrapGridContent: {
|
||||
shadowColor: '#171717',
|
||||
shadowOffset: { width: 0, height: 0 },
|
||||
shadowOpacity: 0.1,
|
||||
shadowRadius: 5,
|
||||
elevation: 2,
|
||||
borderRadius: 5,
|
||||
marginBottom: 15,
|
||||
},
|
||||
wrapGridCaraousel: {
|
||||
width: '95%',
|
||||
height: 200,
|
||||
shadowColor: '#171717',
|
||||
shadowOffset: { width: 0, height: 0 },
|
||||
shadowOpacity: 0.1,
|
||||
shadowRadius: 5,
|
||||
elevation: 2,
|
||||
borderRadius: 5,
|
||||
marginLeft: 5,
|
||||
display: 'flex',
|
||||
},
|
||||
wrapHomeCarousel: {
|
||||
shadowColor: '#171717',
|
||||
shadowOffset: { width: 0, height: 4 },
|
||||
shadowOpacity: 0.15,
|
||||
shadowRadius: 8,
|
||||
elevation: 5,
|
||||
},
|
||||
headerPaperGrid: {
|
||||
paddingVertical: 25,
|
||||
paddingHorizontal: 20,
|
||||
alignItems: 'center',
|
||||
borderTopStartRadius: 5,
|
||||
borderTopEndRadius: 5,
|
||||
},
|
||||
contentPaperGrid: {
|
||||
height: 125,
|
||||
borderBottomEndRadius: 5,
|
||||
borderBottomStartRadius: 5,
|
||||
paddingHorizontal: 20,
|
||||
justifyContent: 'space-evenly',
|
||||
},
|
||||
contentPaperGrid2: {
|
||||
height: 100,
|
||||
borderBottomEndRadius: 5,
|
||||
borderBottomStartRadius: 5,
|
||||
paddingHorizontal: 20,
|
||||
paddingVertical: 15,
|
||||
justifyContent: 'flex-start',
|
||||
},
|
||||
wrapGridItem: {
|
||||
borderWidth: 1,
|
||||
borderRadius: 5,
|
||||
padding: 10,
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
width: '48.5%',
|
||||
marginBottom: 10,
|
||||
},
|
||||
listItemCard: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
backgroundColor: 'transparent',
|
||||
borderRadius: 10,
|
||||
borderWidth: 1,
|
||||
paddingHorizontal: 12,
|
||||
paddingVertical: 10,
|
||||
gap: 12,
|
||||
},
|
||||
sectionCard: { borderRadius: 12, padding: 16, borderWidth: 1 },
|
||||
sectionHeader: { flexDirection: 'row', alignItems: 'center', marginBottom: 12 },
|
||||
sectionHeaderRow: {
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'space-between',
|
||||
alignItems: 'center',
|
||||
marginBottom: 10,
|
||||
},
|
||||
sectionIconBox: {
|
||||
width: 30,
|
||||
height: 30,
|
||||
borderRadius: 8,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
},
|
||||
sectionActionRow: { flexDirection: 'row', alignItems: 'center', gap: 10 },
|
||||
sectionBadge: { borderRadius: 10, paddingHorizontal: 8, paddingVertical: 2 },
|
||||
wrapBar: { height: 20, backgroundColor: '#ccc', borderRadius: 10, margin: 0, width: '100%' },
|
||||
contentBar: { height: 20, backgroundColor: '#3B82F6', borderRadius: 10 },
|
||||
toastContainer: {
|
||||
backgroundColor: 'white',
|
||||
borderRadius: 10,
|
||||
padding: 10,
|
||||
width: '90%',
|
||||
borderWidth: 1,
|
||||
borderColor: '#d6d8f6',
|
||||
},
|
||||
loadingCenter: {
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
zIndex: 999,
|
||||
backgroundColor: 'rgba(0,0,0,0.3)',
|
||||
},
|
||||
loadingBox: {
|
||||
paddingVertical: 15,
|
||||
paddingHorizontal: 40,
|
||||
borderRadius: 5,
|
||||
alignItems: 'center',
|
||||
gap: 10,
|
||||
},
|
||||
caraoselContent: {
|
||||
flex: 1,
|
||||
justifyContent: "center",
|
||||
marginHorizontal: 15,
|
||||
borderRadius: 15,
|
||||
backgroundColor: '#19345E',
|
||||
display: 'flex',
|
||||
width: '92%',
|
||||
resizeMode: 'stretch',
|
||||
overflow: 'hidden',
|
||||
},
|
||||
wrapItemDiscussion: { padding: 15, borderRadius: 5, borderBottomWidth: 1 },
|
||||
wrapItemBorderBottom: { padding: 10, borderBottomWidth: 1 },
|
||||
wrapItemBorderAll: { padding: 10, borderWidth: 1, borderRadius: 5, marginBottom: 5 },
|
||||
wrapItemBorderNone: { padding: 10, marginBottom: 5 },
|
||||
});
|
||||
|
||||
export default CardStyles;
|
||||
135
constants/styles/component.styles.ts
Normal file
135
constants/styles/component.styles.ts
Normal file
@@ -0,0 +1,135 @@
|
||||
import { StyleSheet } from "react-native";
|
||||
|
||||
const ComponentStyles = StyleSheet.create({
|
||||
// avatar
|
||||
userProfileExtraSmall: { width: 35, height: 35, borderRadius: 100 },
|
||||
userProfileSmall: { width: 48, height: 48, borderRadius: 100 },
|
||||
userProfileBig: { width: 100, height: 100, borderRadius: 100 },
|
||||
imgListBanner: { width: 100, height: 50, borderRadius: 5 },
|
||||
iconContent: { padding: 10, borderRadius: 100, backgroundColor: '#E5E7EB' },
|
||||
|
||||
// chip
|
||||
chip: {
|
||||
paddingVertical: 5,
|
||||
paddingHorizontal: 15,
|
||||
borderRadius: 5,
|
||||
borderWidth: 1,
|
||||
borderColor: "transparent",
|
||||
marginRight: 10,
|
||||
marginBottom: 10,
|
||||
},
|
||||
chipSelected: { backgroundColor: "#f2f6ffff", borderColor: "#384288", borderWidth: 1 },
|
||||
chipText: { fontSize: 16, color: "#222" },
|
||||
chipTextSelected: { color: "white" },
|
||||
checkIcon: {
|
||||
position: "absolute",
|
||||
top: -6,
|
||||
left: -6,
|
||||
backgroundColor: "#384288",
|
||||
borderRadius: 10,
|
||||
padding: 2,
|
||||
},
|
||||
|
||||
// badge & progress
|
||||
badgeCol: { alignItems: 'center', gap: 6 },
|
||||
progressBadge: { borderRadius: 10, paddingHorizontal: 12, paddingVertical: 5, borderWidth: 1, alignItems: 'center' },
|
||||
taskCountBadge: { borderRadius: 6, paddingHorizontal: 7, paddingVertical: 2 },
|
||||
positionBadge: { borderRadius: 20, paddingHorizontal: 8, paddingVertical: 3 },
|
||||
textProgressPercent: { fontSize: 22, fontWeight: 'bold', lineHeight: 28 },
|
||||
progressTrack: { height: 8, borderRadius: 4, overflow: 'hidden' },
|
||||
progressFill: { height: '100%', borderRadius: 4 },
|
||||
reportContent: { borderLeftWidth: 3, paddingLeft: 12 },
|
||||
expandBtn: { flexDirection: 'row', alignItems: 'center', alignSelf: 'flex-start', marginTop: 8, gap: 4 },
|
||||
fileGrid: { flexDirection: 'row', flexWrap: 'wrap', gap: 8 },
|
||||
fileCard: { width: '48%', borderRadius: 10, borderWidth: 1, padding: 12, flexDirection: 'row', alignItems: 'center', gap: 10 },
|
||||
|
||||
// calendar
|
||||
signDate: { width: 20, height: 2, borderRadius: 3, marginTop: 3 },
|
||||
selectedDate: { backgroundColor: '#238be6', borderRadius: 5 },
|
||||
selectRangeDate: { backgroundColor: '#228be61f' },
|
||||
calendarDotRow: { flexDirection: 'row', gap: 2, height: 6, marginTop: 1 },
|
||||
calendarDot: { width: 5, height: 5, borderRadius: 3 },
|
||||
villageEventLegendRow: { marginTop: 10, marginBottom: 4, gap: 16 },
|
||||
villageEventLegendItem: { gap: 6 },
|
||||
villageEventLegendDot: { width: 10, height: 10, borderRadius: 5 },
|
||||
villageEventBadge: { paddingHorizontal: 6, paddingVertical: 2, borderRadius: 4, marginRight: 6 },
|
||||
|
||||
// event item
|
||||
itemEvent: { padding: 10, borderRadius: 10, flexDirection: 'row', alignContent: 'stretch', marginBottom: 10 },
|
||||
dividerEvent: { width: 7, borderRadius: 5, marginRight: 10 },
|
||||
|
||||
// member
|
||||
memberAvatarRing: { borderWidth: 3, borderColor: 'rgba(255,255,255,0.4)', borderRadius: 100 },
|
||||
memberBadgeRow: { flexDirection: 'row', gap: 8, marginTop: 12 },
|
||||
memberBadgeApprover: {
|
||||
paddingHorizontal: 10,
|
||||
paddingVertical: 4,
|
||||
borderRadius: 20,
|
||||
borderWidth: 1,
|
||||
borderColor: 'rgba(255,255,255,0.6)',
|
||||
backgroundColor: 'rgba(255,255,255,0.15)',
|
||||
},
|
||||
memberBadgePill: { paddingHorizontal: 10, paddingVertical: 4, borderRadius: 20 },
|
||||
memberInfoRow: { flexDirection: 'row', alignItems: 'center', paddingVertical: 14 },
|
||||
memberInfoIcon: { width: 36, alignItems: 'center' },
|
||||
memberInfoContent: { flex: 1, marginLeft: 10 },
|
||||
|
||||
// discussion
|
||||
discussionCard: { borderRadius: 10, borderWidth: 1, padding: 14 },
|
||||
discussionIconCircle: { width: 40, height: 40, borderRadius: 20, alignItems: 'center', justifyContent: 'center', flexShrink: 0 },
|
||||
discussionIconCircleLg: { width: 44, height: 44, borderRadius: 22, alignItems: 'center', justifyContent: 'center' },
|
||||
discussionStatusPill: { alignSelf: 'flex-start', marginTop: 3, paddingHorizontal: 8, paddingVertical: 2, borderRadius: 20, borderWidth: 1 },
|
||||
discussionStatusText: { fontSize: 11, fontWeight: '600' },
|
||||
discussionCardIndent: { marginLeft: 50 },
|
||||
discussionSeparator: { height: 8 },
|
||||
discussionCommentText: { fontSize: 12, marginLeft: 5 },
|
||||
discussionDateText: { fontSize: 11 },
|
||||
discussionCommentCard: { borderRadius: 10, borderWidth: 1, padding: 12, marginBottom: 8, flexDirection: 'row' },
|
||||
discussionEditedText: { fontSize: 10, fontStyle: 'italic' },
|
||||
|
||||
// guide overlay
|
||||
guideOverlay: { flex: 1, backgroundColor: 'rgba(0,0,0,0.6)', justifyContent: 'center', alignItems: 'center' },
|
||||
guideCard: {
|
||||
position: 'absolute',
|
||||
left: 24,
|
||||
right: 24,
|
||||
borderRadius: 16,
|
||||
padding: 20,
|
||||
shadowColor: '#000',
|
||||
shadowOffset: { width: 0, height: 4 },
|
||||
shadowOpacity: 0.2,
|
||||
shadowRadius: 12,
|
||||
elevation: 8,
|
||||
},
|
||||
guideBadge: { paddingHorizontal: 8, paddingVertical: 3, borderRadius: 20 },
|
||||
guideDotRow: { marginTop: 16, gap: 6, justifyContent: 'center' },
|
||||
guideDot: { width: 6, height: 6, borderRadius: 3 },
|
||||
guideButtonPrimary: { flexDirection: 'row', alignItems: 'center', paddingHorizontal: 16, paddingVertical: 8, borderRadius: 20 },
|
||||
guideButtonSecondary: { paddingHorizontal: 4, paddingVertical: 8 },
|
||||
guideArrowUp: {
|
||||
position: 'absolute',
|
||||
top: -10,
|
||||
marginLeft: -8,
|
||||
width: 0,
|
||||
height: 0,
|
||||
borderLeftWidth: 8,
|
||||
borderRightWidth: 8,
|
||||
borderBottomWidth: 10,
|
||||
borderLeftColor: 'transparent',
|
||||
borderRightColor: 'transparent',
|
||||
},
|
||||
guideArrowDown: {
|
||||
position: 'absolute',
|
||||
bottom: -10,
|
||||
marginLeft: -8,
|
||||
width: 0,
|
||||
height: 0,
|
||||
borderLeftWidth: 8,
|
||||
borderRightWidth: 8,
|
||||
borderTopWidth: 10,
|
||||
borderLeftColor: 'transparent',
|
||||
borderRightColor: 'transparent',
|
||||
},
|
||||
});
|
||||
|
||||
export default ComponentStyles;
|
||||
23
constants/styles/header.styles.ts
Normal file
23
constants/styles/header.styles.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { StyleSheet } from "react-native";
|
||||
|
||||
const HeaderStyles = StyleSheet.create({
|
||||
headerContainer: { backgroundColor: '#19345E' },
|
||||
headerApp: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'space-between',
|
||||
paddingHorizontal: 16,
|
||||
},
|
||||
headerTitle: { color: '#fff', fontSize: 18, fontWeight: '600' },
|
||||
headerSide: { width: 40, alignItems: 'center' },
|
||||
wrapHeadViewMember: {
|
||||
backgroundColor: '#19345E',
|
||||
paddingVertical: 30,
|
||||
paddingHorizontal: 15,
|
||||
alignItems: 'center',
|
||||
borderBottomLeftRadius: 25,
|
||||
borderBottomRightRadius: 25,
|
||||
},
|
||||
});
|
||||
|
||||
export default HeaderStyles;
|
||||
26
constants/styles/index.ts
Normal file
26
constants/styles/index.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { StyleSheet } from "react-native";
|
||||
import SpacingStyles from './spacing.styles';
|
||||
import TypographyStyles from './typography.styles';
|
||||
import LayoutStyles from './layout.styles';
|
||||
import BorderStyles from './border.styles';
|
||||
import ButtonStyles from './button.styles';
|
||||
import InputStyles from './input.styles';
|
||||
import CardStyles from './card.styles';
|
||||
import ModalStyles from './modal.styles';
|
||||
import HeaderStyles from './header.styles';
|
||||
import ComponentStyles from './component.styles';
|
||||
|
||||
const Styles = StyleSheet.create({
|
||||
...SpacingStyles,
|
||||
...TypographyStyles,
|
||||
...LayoutStyles,
|
||||
...BorderStyles,
|
||||
...ButtonStyles,
|
||||
...InputStyles,
|
||||
...CardStyles,
|
||||
...ModalStyles,
|
||||
...HeaderStyles,
|
||||
...ComponentStyles,
|
||||
});
|
||||
|
||||
export default Styles;
|
||||
35
constants/styles/input.styles.ts
Normal file
35
constants/styles/input.styles.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { StyleSheet } from "react-native";
|
||||
|
||||
const InputStyles = StyleSheet.create({
|
||||
inputRoundForm: {
|
||||
borderRadius: 5,
|
||||
borderColor: '#d6d8f6',
|
||||
borderWidth: 1,
|
||||
paddingVertical: 10,
|
||||
paddingHorizontal: 15,
|
||||
},
|
||||
inputRoundFormLeft: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
paddingVertical: 0,
|
||||
},
|
||||
inputRoundFormRight: {
|
||||
flexDirection: 'row-reverse',
|
||||
alignItems: 'center',
|
||||
paddingVertical: 0,
|
||||
justifyContent: 'space-between',
|
||||
},
|
||||
verificationCell: {
|
||||
width: 50,
|
||||
height: 50,
|
||||
lineHeight: 45,
|
||||
fontSize: 24,
|
||||
borderWidth: 1,
|
||||
borderRadius: 15,
|
||||
borderColor: 'gray',
|
||||
textAlign: 'center',
|
||||
},
|
||||
verificationFocusCell: { borderColor: '#19345E' },
|
||||
});
|
||||
|
||||
export default InputStyles;
|
||||
52
constants/styles/layout.styles.ts
Normal file
52
constants/styles/layout.styles.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
import { StyleSheet } from "react-native";
|
||||
|
||||
const LayoutStyles = StyleSheet.create({
|
||||
wrapLogin: { flex: 1, justifyContent: "flex-start", alignItems: "stretch", padding: 20 },
|
||||
flex1: { flex: 1 },
|
||||
flex2: { flex: 2 },
|
||||
flexColumn: { flexDirection: 'column' },
|
||||
rowOnly: { flexDirection: 'row' },
|
||||
rowSpaceBetween: { justifyContent: 'space-between', flexDirection: 'row' },
|
||||
rowSpaceBetweenReverse: { justifyContent: 'space-between', flexDirection: 'row-reverse' },
|
||||
rowItemsCenter: { flexDirection: 'row', alignItems: 'center' },
|
||||
justifySpaceBetween: { justifyContent: 'space-between' },
|
||||
justifyCenter: { justifyContent: 'center' },
|
||||
alignCenter: { alignItems: 'center' },
|
||||
itemsCenter: { alignItems: 'center' },
|
||||
alignStart: { alignItems: 'flex-start' },
|
||||
contentItemCenter: { justifyContent: 'center', alignItems: 'center' },
|
||||
h100: { height: '100%' },
|
||||
w30: { width: '30%' },
|
||||
w40: { width: '40%' },
|
||||
w45: { width: '45%' },
|
||||
w48: { width: '48%' },
|
||||
w50: { width: '50%' },
|
||||
w60: { width: '60%' },
|
||||
w70: { width: '70%' },
|
||||
w80: { width: '80%' },
|
||||
w90: { width: '90%' },
|
||||
w95: { width: '95%' },
|
||||
w100: { width: '100%' },
|
||||
posAbsolute: { position: 'absolute' },
|
||||
absolute0: { position: 'absolute', bottom: 0 },
|
||||
absoluteIcon: { top: 18, left: 20, position: 'absolute' },
|
||||
absoluteIconPicker: {
|
||||
backgroundColor: '#384288',
|
||||
padding: 5,
|
||||
borderRadius: 100,
|
||||
bottom: 5,
|
||||
right: 5,
|
||||
position: 'absolute',
|
||||
},
|
||||
hidden: { position: 'absolute', opacity: 0, zIndex: -1 },
|
||||
zIndex1: { zIndex: 1 },
|
||||
zIndexMinus1: { zIndex: -1 },
|
||||
resizeContain: { resizeMode: 'contain' },
|
||||
resizeCover: { resizeMode: 'cover' },
|
||||
resizeStretch: { resizeMode: 'stretch' },
|
||||
animatedView: { width: '100%', overflow: 'hidden' },
|
||||
wrapperAccordion: { width: '100%', position: 'absolute', display: 'flex', alignItems: 'center' },
|
||||
bottomMenuSelectDocument: { paddingVertical: 10, position: 'absolute', width: '100%', bottom: 0 },
|
||||
});
|
||||
|
||||
export default LayoutStyles;
|
||||
140
constants/styles/modal.styles.ts
Normal file
140
constants/styles/modal.styles.ts
Normal file
@@ -0,0 +1,140 @@
|
||||
import { StyleSheet } from "react-native";
|
||||
|
||||
const ModalStyles = StyleSheet.create({
|
||||
modalBgTransparant: { backgroundColor: 'rgba(0, 0, 0, 0.3)', flex: 1 },
|
||||
modalContent: {
|
||||
width: '100%',
|
||||
paddingBottom: 20,
|
||||
backgroundColor: 'white',
|
||||
borderTopRightRadius: 18,
|
||||
borderTopLeftRadius: 18,
|
||||
position: 'absolute',
|
||||
bottom: 0,
|
||||
},
|
||||
modalContentNew: {
|
||||
width: '100%',
|
||||
backgroundColor: 'white',
|
||||
borderTopRightRadius: 18,
|
||||
borderTopLeftRadius: 18,
|
||||
paddingTop: 5,
|
||||
paddingBottom: 5,
|
||||
paddingHorizontal: 20,
|
||||
},
|
||||
modalFloatContent: {
|
||||
backgroundColor: 'white',
|
||||
borderRadius: 18,
|
||||
paddingTop: 5,
|
||||
paddingBottom: 10,
|
||||
paddingHorizontal: 20,
|
||||
},
|
||||
titleContainer: {
|
||||
backgroundColor: 'white',
|
||||
borderTopRightRadius: 10,
|
||||
borderTopLeftRadius: 10,
|
||||
paddingHorizontal: 20,
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'space-between',
|
||||
paddingVertical: 10,
|
||||
},
|
||||
titleContainerNew: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'space-between',
|
||||
paddingVertical: 10,
|
||||
},
|
||||
titleContainerModalFloat: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
paddingVertical: 10,
|
||||
},
|
||||
contentContainer: { height: '90%' },
|
||||
itemSelectModal: {
|
||||
padding: 10,
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'space-between',
|
||||
borderBottomWidth: 1,
|
||||
alignItems: 'center',
|
||||
},
|
||||
modalOverlay: {
|
||||
flex: 1,
|
||||
backgroundColor: 'rgba(0, 0, 0, 0.6)',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
},
|
||||
modalConfirmContainer: {
|
||||
width: '80%',
|
||||
borderRadius: 14,
|
||||
overflow: 'hidden',
|
||||
elevation: 2,
|
||||
shadowColor: '#000',
|
||||
shadowOffset: { width: 0, height: 2 },
|
||||
shadowOpacity: 0.25,
|
||||
shadowRadius: 3.84,
|
||||
},
|
||||
modalConfirmContent: { padding: 20, alignItems: 'center' },
|
||||
modalConfirmTitle: { fontSize: 18, fontWeight: 'bold', marginBottom: 8, textAlign: 'center' },
|
||||
modalConfirmMessage: { fontSize: 14, textAlign: 'center', lineHeight: 20 },
|
||||
modalConfirmDivider: { height: 1, width: '100%' },
|
||||
modalConfirmFooter: { flexDirection: 'row', height: 50 },
|
||||
modalConfirmButton: { flex: 1, justifyContent: 'center', alignItems: 'center' },
|
||||
modalConfirmButtonText: { fontSize: 16 },
|
||||
modalConfirmVerticalDivider: { width: 1, height: '100%' },
|
||||
modalUpdateContainer: {
|
||||
flex: 1,
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
paddingHorizontal: 30,
|
||||
overflow: 'hidden',
|
||||
},
|
||||
modalUpdateDecorativeCircle1: {
|
||||
position: 'absolute',
|
||||
width: 300,
|
||||
height: 300,
|
||||
borderRadius: 150,
|
||||
backgroundColor: 'rgba(255, 255, 255, 0.05)',
|
||||
top: -50,
|
||||
right: -50,
|
||||
},
|
||||
modalUpdateDecorativeCircle2: {
|
||||
position: 'absolute',
|
||||
width: 200,
|
||||
height: 200,
|
||||
borderRadius: 100,
|
||||
backgroundColor: 'rgba(255, 255, 255, 0.03)',
|
||||
bottom: -30,
|
||||
left: -30,
|
||||
},
|
||||
modalUpdateContent: { width: '100%', alignItems: 'flex-start', zIndex: 1 },
|
||||
modalUpdateLogo: { width: 200, height: 100, marginBottom: 40, alignSelf: 'center' },
|
||||
modalUpdateTextContainer: { marginBottom: 40 },
|
||||
modalUpdateTitle: { fontSize: 32, fontWeight: 'bold', color: 'white', marginBottom: 20, lineHeight: 38 },
|
||||
modalUpdateDescription: { fontSize: 16, color: 'white', lineHeight: 24 },
|
||||
modalUpdateButtonContainer: { width: '100%', alignItems: 'center' },
|
||||
modalUpdatePrimaryButton: {
|
||||
width: '100%',
|
||||
paddingVertical: 15,
|
||||
borderRadius: 12,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
marginBottom: 15,
|
||||
shadowColor: '#000',
|
||||
shadowOffset: { width: 0, height: 2 },
|
||||
shadowOpacity: 0.2,
|
||||
shadowRadius: 4,
|
||||
elevation: 3,
|
||||
},
|
||||
modalUpdatePrimaryButtonText: { fontSize: 16, fontWeight: 'bold' },
|
||||
modalUpdateSecondaryButton: { paddingVertical: 10 },
|
||||
modalUpdateSecondaryButtonText: { fontSize: 16, color: 'white', fontWeight: '500' },
|
||||
headerModalViewImg: {
|
||||
paddingTop: 50,
|
||||
paddingHorizontal: 16,
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'space-between',
|
||||
alignItems: 'center',
|
||||
},
|
||||
});
|
||||
|
||||
export default ModalStyles;
|
||||
60
constants/styles/spacing.styles.ts
Normal file
60
constants/styles/spacing.styles.ts
Normal file
@@ -0,0 +1,60 @@
|
||||
import { StyleSheet } from "react-native";
|
||||
|
||||
const SpacingStyles = StyleSheet.create({
|
||||
mb05: { marginBottom: 5 },
|
||||
mb08: { marginBottom: 8 },
|
||||
mb10: { marginBottom: 10 },
|
||||
mb12: { marginBottom: 12 },
|
||||
mb13: { marginBottom: 13 },
|
||||
mb15: { marginBottom: 15 },
|
||||
mb20: { marginBottom: 20 },
|
||||
mb30: { marginBottom: 30 },
|
||||
mb50: { marginBottom: 50 },
|
||||
mb100: { marginBottom: 100 },
|
||||
mt02: { marginTop: 2 },
|
||||
mt05: { marginTop: 5 },
|
||||
mt10: { marginTop: 10 },
|
||||
mt15: { marginTop: 15 },
|
||||
mt30: { marginTop: 30 },
|
||||
mr05: { marginRight: 5 },
|
||||
mr10: { marginRight: 10 },
|
||||
ml05: { marginLeft: 5 },
|
||||
ml10: { marginLeft: 10 },
|
||||
ml15: { marginLeft: 15 },
|
||||
ml20: { marginLeft: 20 },
|
||||
ml25: { marginLeft: 25 },
|
||||
mv05: { marginVertical: 5 },
|
||||
mv10: { marginVertical: 10 },
|
||||
mv15: { marginVertical: 15 },
|
||||
mv50: { marginVertical: 50 },
|
||||
mh03: { marginHorizontal: 3 },
|
||||
mh05: { marginHorizontal: 5 },
|
||||
mh10: { marginHorizontal: 10 },
|
||||
mh15: { marginHorizontal: 15 },
|
||||
p0: { padding: 0 },
|
||||
p05: { padding: 5 },
|
||||
p10: { padding: 10 },
|
||||
p15: { padding: 15 },
|
||||
p20: { padding: 20 },
|
||||
pb05: { paddingBottom: 5 },
|
||||
pb07: { paddingBottom: 7 },
|
||||
pb10: { paddingBottom: 10 },
|
||||
pb13: { paddingBottom: 13 },
|
||||
pb15: { paddingBottom: 15 },
|
||||
pb20: { paddingBottom: 20 },
|
||||
pb50: { paddingBottom: 50 },
|
||||
pb100: { paddingBottom: 100 },
|
||||
ph05: { paddingHorizontal: 5 },
|
||||
ph10: { paddingHorizontal: 10 },
|
||||
ph15: { paddingHorizontal: 15 },
|
||||
ph16: { paddingHorizontal: 16 },
|
||||
ph20: { paddingHorizontal: 20 },
|
||||
pv03: { paddingVertical: 3 },
|
||||
pv05: { paddingVertical: 5 },
|
||||
pv10: { paddingVertical: 10 },
|
||||
pv14: { paddingVertical: 14 },
|
||||
pv15: { paddingVertical: 15 },
|
||||
pv20: { paddingVertical: 20 },
|
||||
});
|
||||
|
||||
export default SpacingStyles;
|
||||
28
constants/styles/typography.styles.ts
Normal file
28
constants/styles/typography.styles.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { StyleSheet } from "react-native";
|
||||
|
||||
const TypographyStyles = StyleSheet.create({
|
||||
textTitle: { fontSize: 32, fontWeight: 'bold', lineHeight: 32 },
|
||||
textSubtitle: { fontSize: 20, fontWeight: 'bold' },
|
||||
textSubtitle2: { fontSize: 20 },
|
||||
textHeaderHome: { fontSize: 18, fontWeight: 'bold', flex: 1, color: 'white' },
|
||||
textDefault: { fontSize: 15, lineHeight: 24 },
|
||||
textDefaultSemiBold: { fontSize: 15, lineHeight: 24, fontWeight: '600' },
|
||||
textMediumNormal: { fontSize: 13, lineHeight: 24 },
|
||||
textMediumSemiBold: { fontSize: 13, lineHeight: 24, fontWeight: '600' },
|
||||
textSmallSemiBold: { fontSize: 10, fontWeight: '600' },
|
||||
textInformation: { fontSize: 12, fontWeight: 'light' },
|
||||
textLink: { fontSize: 14, color: '#0a7ea4' },
|
||||
textCenter: { textAlign: 'center' },
|
||||
textWhite: { color: 'white' },
|
||||
font16: { fontSize: 16 },
|
||||
font26: { fontSize: 26 },
|
||||
cError: { color: '#DB1514' },
|
||||
cGray: { color: 'gray' },
|
||||
cWhite: { color: 'white' },
|
||||
cWhiteDimmed: { color: 'rgba(255,255,255,0.7)' },
|
||||
cBlack: { color: 'black' },
|
||||
cDefault: { color: '#19345E' },
|
||||
cFolder: { color: '#f9cc40' },
|
||||
});
|
||||
|
||||
export default TypographyStyles;
|
||||
32
docs/ARCHITECTURE.md
Normal file
32
docs/ARCHITECTURE.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# Architecture
|
||||
|
||||
## Routing (Expo Router — file-based)
|
||||
|
||||
- `app/index.tsx` — Login/splash (public); OTP verification is handled inline via `components/auth/viewVerification.tsx` (not a separate route)
|
||||
- `app/(application)/` — All authenticated screens; Expo Router enforces auth guard here
|
||||
- Deep-link navigation is handled by `lib/pushToPage.ts`, which maps notification payloads to routes
|
||||
|
||||
## State Management (three layers)
|
||||
|
||||
1. **Context** (`providers/`) — Auth (token encryption/decryption via CryptoES.AES), Theme (light/dark, persisted to AsyncStorage), and React Query client
|
||||
2. **Redux Toolkit** (`lib/store.ts` + slices) — Feature-level state for CRUD operations. Slices follow a naming pattern: `*Slice.ts` for read state, `*Update.ts`/`*Create.ts` for mutation state
|
||||
3. **TanStack React Query** — All server data fetching; configured with 5-min stale time, 24-hour cache retention, 2 retries, and AsyncStorage persistence for offline support
|
||||
|
||||
## API Layer (`lib/api.ts`)
|
||||
|
||||
Single file defining 50+ Axios-based endpoints. The Axios instance reads `baseURL` from `Constants.expoConfig.extra.URL_API` (set in `.env` via `app.config.js`). Authentication uses Bearer tokens in headers. File uploads use `FormData` with `multipart/form-data`.
|
||||
|
||||
Three separate backend services are integrated:
|
||||
- **REST API** (axios) — main business logic
|
||||
- **WhatsApp server** — OTP delivery (separate token in `.env`)
|
||||
- **Firebase** — real-time database (`lib/firebaseDatabase.ts`) and push notifications (`lib/useNotification.ts`, `lib/registerForPushNotificationsAsync.ts`)
|
||||
|
||||
## Providers Initialization Order
|
||||
|
||||
`app/_layout.tsx` wraps the app in: `ErrorBoundary` → `NotifierWrapper` → `ThemeProvider` → `QueryProvider` → `AuthProvider` → navigation stack. Redux `store` is provided inside `app/(application)/_layout.tsx`, not at the root.
|
||||
|
||||
## Error Boundary
|
||||
|
||||
`components/ErrorBoundary.tsx` is a class component (required by React) wrapping the entire app. It uses React Native's built-in `Text` — **do not replace it with the custom `components/Text.tsx`** as that pulls in `ThemeProvider` → `AsyncStorage`, which breaks Jest tests.
|
||||
|
||||
Tests for ErrorBoundary live in `__tests__/ErrorBoundary-test.tsx` and use `@testing-library/react-native`.
|
||||
13
docs/CONVENTIONS.md
Normal file
13
docs/CONVENTIONS.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# Key Conventions
|
||||
|
||||
**Imports:** Use `@/` alias (maps to project root, configured in `tsconfig.json`). Never use relative paths like `../../`.
|
||||
|
||||
**Utility functions:** Prefixed with `fun_` (e.g., `lib/fun_stringToDate.ts`, `lib/fun_validateName.ts`).
|
||||
|
||||
**Styling:** Use theme-aware colors from `useTheme()` hook. Global `StyleSheet` definitions live in `constants/Styles.ts`. Color tokens are in `constants/Colors.ts` with explicit `light`/`dark` variants.
|
||||
|
||||
**Component structure:** Feature-specific subdirectories under `components/` (e.g., `components/announcement/`) typically contain a header component alongside list/card components for that feature.
|
||||
|
||||
**Environment config:** All env vars are declared in `.env`, exposed through `app.config.js` `extra` field, and accessed via `Constants.expoConfig.extra.*` or the `constants/ConstEnv.ts` wrapper.
|
||||
|
||||
**EAS builds:** Profiles are `development`, `preview`, and `production` in `eas.json`. Production builds auto-increment the app version via the `bump` script.
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user