Merge pull request 'fix : tampilan' (#2) from amalia/22-jul-25 into join
Reviewed-on: bip/mobile-darmasaba#2
This commit is contained in:
@@ -104,7 +104,7 @@ export default function AddMemberTask() {
|
||||
)
|
||||
}}
|
||||
/>
|
||||
<View style={[Styles.p15]}>
|
||||
<View style={[Styles.p15, Styles.mb100]}>
|
||||
<InputSearch onChange={(val) => setSearch(val)} value={search} />
|
||||
|
||||
{
|
||||
@@ -142,10 +142,10 @@ export default function AddMemberTask() {
|
||||
!found && onChoose(item.idUser, item.name, item.img)
|
||||
}}
|
||||
>
|
||||
<View style={[Styles.rowItemsCenter]}>
|
||||
<View style={[Styles.rowItemsCenter, Styles.w80]}>
|
||||
<ImageUser src={`https://wibu-storage.wibudev.com/api/files/${item.img}`} border />
|
||||
<View style={[Styles.ml10]}>
|
||||
<Text style={[Styles.textDefault]}>{item.name}</Text>
|
||||
<Text style={[Styles.textDefault]} numberOfLines={1}>{item.name}</Text>
|
||||
{
|
||||
found && <Text style={[Styles.textInformation, Styles.cGray]}>sudah menjadi anggota</Text>
|
||||
}
|
||||
|
||||
@@ -31,14 +31,16 @@ export default function DetailTaskDivision() {
|
||||
const update = useSelector((state: any) => state.taskUpdate)
|
||||
|
||||
|
||||
async function handleLoad() {
|
||||
async function handleLoad(cat: 'data' | 'progress') {
|
||||
try {
|
||||
setLoading(true)
|
||||
if (cat == 'data') setLoading(true)
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiGetTaskOne({ id: detail, user: hasil, cat: 'data' })
|
||||
setData(response.data)
|
||||
const responseProgress = await apiGetTaskOne({ id: detail, user: hasil, cat: 'progress' })
|
||||
setProgress(responseProgress.data.progress)
|
||||
const response = await apiGetTaskOne({ id: detail, user: hasil, cat: cat })
|
||||
if (cat == 'data') {
|
||||
setData(response.data)
|
||||
} else {
|
||||
setProgress(response.data.progress)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
@@ -47,8 +49,12 @@ export default function DetailTaskDivision() {
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
handleLoad()
|
||||
}, [update.progress, update.data])
|
||||
handleLoad('data')
|
||||
}, [update.data])
|
||||
|
||||
useEffect(() => {
|
||||
handleLoad('progress')
|
||||
}, [update.progress])
|
||||
|
||||
return (
|
||||
<SafeAreaView>
|
||||
@@ -57,7 +63,7 @@ export default function DetailTaskDivision() {
|
||||
headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
||||
headerTitle: loading ? 'Loading... ' : data?.title,
|
||||
headerTitleAlign: 'center',
|
||||
headerRight: () => <HeaderRightTaskDetail id={detail} division={id} status={data?.status}/>,
|
||||
headerRight: () => <HeaderRightTaskDetail id={detail} division={id} status={data?.status} />,
|
||||
}}
|
||||
/>
|
||||
<ScrollView>
|
||||
|
||||
@@ -135,6 +135,7 @@ export default function Notification() {
|
||||
return (
|
||||
<BorderBottomItem
|
||||
borderType="bottom"
|
||||
width={55}
|
||||
icon={
|
||||
<View style={[Styles.iconContent, item.isRead ? ColorsStatus.secondary : ColorsStatus.primary]}>
|
||||
<Feather name="bell" size={25} color="white" />
|
||||
|
||||
@@ -102,9 +102,8 @@ export default function AddMemberProject() {
|
||||
)
|
||||
}}
|
||||
/>
|
||||
<View style={[Styles.p15]}>
|
||||
<View style={[Styles.p15, Styles.mb100]}>
|
||||
<InputSearch onChange={(val) => handleSearch(val)} value={search} />
|
||||
|
||||
{
|
||||
selectMember.length > 0
|
||||
?
|
||||
@@ -115,7 +114,7 @@ export default function AddMemberProject() {
|
||||
<ImageWithLabel
|
||||
key={index}
|
||||
label={item.name}
|
||||
src={item.img}
|
||||
src={`https://wibu-storage.wibudev.com/api/files/${item.img}`}
|
||||
onClick={() => onChoose(item.idUser, item.name, item.img)}
|
||||
/>
|
||||
))
|
||||
@@ -127,7 +126,6 @@ export default function AddMemberProject() {
|
||||
<Text style={[Styles.textDefault, Styles.cGray, Styles.pv05, { textAlign: 'center' }]}>Tidak ada member yang dipilih</Text>
|
||||
}
|
||||
<ScrollView>
|
||||
|
||||
{
|
||||
data.length > 0 ?
|
||||
data.map((item: any, index: any) => {
|
||||
@@ -140,10 +138,10 @@ export default function AddMemberProject() {
|
||||
!found && onChoose(item.id, item.name, item.img)
|
||||
}}
|
||||
>
|
||||
<View style={[Styles.rowItemsCenter]}>
|
||||
<View style={[Styles.rowItemsCenter, Styles.w80]}>
|
||||
<ImageUser src={`https://wibu-storage.wibudev.com/api/files/${item.img}`} border />
|
||||
<View style={[Styles.ml10]}>
|
||||
<Text style={[Styles.textDefault]}>{item.name}</Text>
|
||||
<Text style={[Styles.textDefault]} numberOfLines={1}>{item.name}</Text>
|
||||
{
|
||||
found && <Text style={[Styles.textInformation, Styles.cGray]}>sudah menjadi anggota</Text>
|
||||
}
|
||||
|
||||
@@ -38,14 +38,16 @@ export default function DetailProject() {
|
||||
const [isMember, setIsMember] = useState(false)
|
||||
const entityUser = useSelector((state: any) => state.user)
|
||||
|
||||
async function handleLoad() {
|
||||
async function handleLoad(cat: 'data' | 'progress') {
|
||||
try {
|
||||
setLoading(true)
|
||||
if (cat == 'data') setLoading(true)
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiGetProjectOne({ user: hasil, cat: 'data', id: id })
|
||||
setData(response.data)
|
||||
const responseProgress = await apiGetProjectOne({ user: hasil, cat: 'progress', id: id })
|
||||
setProgress(responseProgress.data.progress)
|
||||
const response = await apiGetProjectOne({ user: hasil, cat: cat, id: id })
|
||||
if (cat == 'data') {
|
||||
setData(response.data)
|
||||
} else {
|
||||
setProgress(response.data.progress)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
@@ -65,8 +67,12 @@ export default function DetailProject() {
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
handleLoad()
|
||||
}, [update.data, update.progress])
|
||||
handleLoad('data')
|
||||
}, [update.data])
|
||||
|
||||
useEffect(() => {
|
||||
handleLoad('progress')
|
||||
}, [update.progress])
|
||||
|
||||
useEffect(() => {
|
||||
checkMember()
|
||||
|
||||
@@ -2,11 +2,16 @@ import Styles from "@/constants/Styles";
|
||||
import { apiGetDivisionOneFeature } from "@/lib/api";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { Feather } from "@expo/vector-icons";
|
||||
import * as FileSystem from 'expo-file-system';
|
||||
import { startActivityAsync } from 'expo-intent-launcher';
|
||||
import { useLocalSearchParams } from "expo-router";
|
||||
import * as Sharing from 'expo-sharing';
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { Dimensions, Text, View } from "react-native";
|
||||
import { Alert, Dimensions, Platform, Pressable, Text, View } from "react-native";
|
||||
import * as mime from 'react-native-mime-types';
|
||||
import { ICarouselInstance } from "react-native-reanimated-carousel";
|
||||
import Skeleton from "../skeleton";
|
||||
import ModalLoading from "../modalLoading";
|
||||
|
||||
type Props = {
|
||||
id: string
|
||||
@@ -14,6 +19,7 @@ type Props = {
|
||||
extension: string
|
||||
path: string
|
||||
share: boolean
|
||||
idStorage: string
|
||||
}
|
||||
|
||||
export default function FileDivisionDetail() {
|
||||
@@ -23,6 +29,7 @@ export default function FileDivisionDetail() {
|
||||
const { token, decryptToken } = useAuthSession()
|
||||
const { id } = useLocalSearchParams<{ id: string }>()
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [loadingOpen, setLoadingOpen] = useState(false)
|
||||
|
||||
async function handleLoad() {
|
||||
try {
|
||||
@@ -41,8 +48,45 @@ export default function FileDivisionDetail() {
|
||||
handleLoad()
|
||||
}, [])
|
||||
|
||||
|
||||
const openFile = (item: Props) => {
|
||||
setLoadingOpen(true)
|
||||
let remoteUrl = 'https://wibu-storage.wibudev.com/api/files/' + item.idStorage;
|
||||
const fileName = item.name + '.' + item.extension;
|
||||
let 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') {
|
||||
// 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);
|
||||
}
|
||||
} catch (error) {
|
||||
Alert.alert('INFO', 'Gagal membuka file, tidak ada aplikasi yang dapat membuka file ini');
|
||||
} finally {
|
||||
setLoadingOpen(false)
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
return (
|
||||
<View style={[Styles.mb15]}>
|
||||
<ModalLoading isVisible={loadingOpen} setVisible={setLoadingOpen} />
|
||||
<Text style={[Styles.textDefaultSemiBold, Styles.mv10]}>Dokumen Terkini</Text>
|
||||
{
|
||||
loading ?
|
||||
@@ -56,7 +100,7 @@ export default function FileDivisionDetail() {
|
||||
<View style={[Styles.rowItemsCenter]}>
|
||||
{
|
||||
data.map((item, index) => (
|
||||
<View style={[Styles.mr05, { width: '24%' }]} key={index}>
|
||||
<Pressable style={[Styles.mr05, { width: '24%' }]} key={index} onPress={() => openFile(item)}>
|
||||
<View style={{ alignItems: 'center' }}>
|
||||
<View style={[Styles.wrapPaper, { alignItems: 'center' }]}>
|
||||
<Feather name="file-text" size={50} color="black" style={Styles.mr05} />
|
||||
@@ -65,7 +109,7 @@ export default function FileDivisionDetail() {
|
||||
<View style={[Styles.contentItemCenter]}>
|
||||
<Text style={[Styles.textMediumNormal, Styles.w90, { textAlign: 'center' }]} numberOfLines={1}>{item.name}.{item.extension}</Text>
|
||||
</View>
|
||||
</View>
|
||||
</Pressable>
|
||||
))
|
||||
}
|
||||
</View>
|
||||
|
||||
Reference in New Issue
Block a user