diff --git a/components/discussion_general/discussionCommentInput.tsx b/components/discussion_general/discussionCommentInput.tsx index 020177f..9827047 100644 --- a/components/discussion_general/discussionCommentInput.tsx +++ b/components/discussion_general/discussionCommentInput.tsx @@ -4,7 +4,7 @@ import Styles from "@/constants/Styles"; import { useTheme } from "@/providers/ThemeProvider"; import { Feather, Ionicons, MaterialCommunityIcons, MaterialIcons } from "@expo/vector-icons"; import * as DocumentPicker from "expo-document-picker"; -import { Platform, Pressable, ScrollView, TextInput, View } from "react-native"; +import { ActivityIndicator, Platform, Pressable, ScrollView, TextInput, View } from "react-native"; import Toast from "react-native-toast-message"; type Props = { @@ -58,29 +58,39 @@ export default function DiscussionCommentInput({ return ( {mode === 'edit' && ( - + Edit Komentar + {loading && ( + Mengirim... + )} - - + + )} + {loading && mode === 'new' && (files.length > 0 || existingFiles.length > 0) && ( + + Mengirim... + + )} + {(existingFiles.length > 0 || files.length > 0) && ( {existingFiles.map((f) => ( onRemoveExistingFile?.(f.id)} + onPress={() => !loading && onRemoveExistingFile?.(f.id)} style={{ flexDirection: 'row', alignItems: 'center', gap: 6, paddingHorizontal: 10, paddingVertical: 6, borderRadius: 20, borderWidth: 1, backgroundColor: colors.card, borderColor: colors.icon + '18', - marginRight: 8 + marginRight: 8, + opacity: loading ? 0.5 : 1 }} > @@ -93,13 +103,14 @@ export default function DiscussionCommentInput({ {files.map((f, idx) => ( onRemoveFile?.(idx)} + onPress={() => !loading && onRemoveFile?.(idx)} style={{ flexDirection: 'row', alignItems: 'center', gap: 6, paddingHorizontal: 10, paddingVertical: 6, borderRadius: 20, borderWidth: 1, backgroundColor: colors.card, borderColor: colors.icon + '18', - marginRight: 8 + marginRight: 8, + opacity: loading ? 0.5 : 1 }} > @@ -122,12 +133,13 @@ export default function DiscussionCommentInput({ {mode === 'new' && ( 0 ? colors.tabActive : colors.dimmed} + color={loading ? colors.dimmed + '60' : files.length > 0 ? colors.tabActive : colors.dimmed} /> )} @@ -138,6 +150,7 @@ export default function DiscussionCommentInput({ borderRadius: 30, borderWidth: 1, borderColor: colors.icon + '20', paddingHorizontal: 14, paddingVertical: 10, + opacity: loading ? 0.6 : 1 }}> @@ -160,10 +174,12 @@ export default function DiscussionCommentInput({ width: 40, height: 40, borderRadius: 20, backgroundColor: sendDisabled ? colors.dimmed + '40' : colors.tint, justifyContent: 'center', alignItems: 'center', - marginBottom: 0 }} > - + {loading + ? + : + }