feeddo-react-native 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +401 -2
- package/android/build.gradle +39 -0
- package/android/src/main/AndroidManifest.xml +1 -0
- package/android/src/main/java/dev/feeddo/reactnative/FeeddoReactNativeModule.java +380 -0
- package/android/src/main/java/dev/feeddo/reactnative/FeeddoReactNativePackage.java +25 -0
- package/dist/Feeddo.d.ts +131 -0
- package/dist/Feeddo.d.ts.map +1 -0
- package/dist/Feeddo.js +176 -0
- package/dist/Feeddo.js.map +1 -0
- package/dist/FeeddoClient.d.ts +151 -0
- package/dist/FeeddoClient.d.ts.map +1 -0
- package/dist/FeeddoClient.js +690 -0
- package/dist/FeeddoClient.js.map +1 -0
- package/dist/FeeddoProvider.d.ts +23 -0
- package/dist/FeeddoProvider.d.ts.map +1 -0
- package/dist/FeeddoProvider.js +76 -0
- package/dist/FeeddoProvider.js.map +1 -0
- package/dist/config/FeeddoConfig.d.ts +10 -0
- package/dist/config/FeeddoConfig.d.ts.map +1 -0
- package/dist/config/FeeddoConfig.js +10 -0
- package/dist/config/FeeddoConfig.js.map +1 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -0
- package/dist/models/Conversation.d.ts +27 -0
- package/dist/models/Conversation.d.ts.map +1 -0
- package/dist/models/Conversation.js +24 -0
- package/dist/models/Conversation.js.map +1 -0
- package/dist/models/EndUser.d.ts +49 -0
- package/dist/models/EndUser.d.ts.map +1 -0
- package/dist/models/EndUser.js +2 -0
- package/dist/models/EndUser.js.map +1 -0
- package/dist/models/FeeddoNotification.d.ts +15 -0
- package/dist/models/FeeddoNotification.d.ts.map +1 -0
- package/dist/models/FeeddoNotification.js +15 -0
- package/dist/models/FeeddoNotification.js.map +1 -0
- package/dist/models/HomeData.d.ts +16 -0
- package/dist/models/HomeData.d.ts.map +1 -0
- package/dist/models/HomeData.js +19 -0
- package/dist/models/HomeData.js.map +1 -0
- package/dist/models/Message.d.ts +12 -0
- package/dist/models/Message.d.ts.map +1 -0
- package/dist/models/Message.js +25 -0
- package/dist/models/Message.js.map +1 -0
- package/dist/models/PushProvider.d.ts +14 -0
- package/dist/models/PushProvider.d.ts.map +1 -0
- package/dist/models/PushProvider.js +9 -0
- package/dist/models/PushProvider.js.map +1 -0
- package/dist/models/Task.d.ts +17 -0
- package/dist/models/Task.d.ts.map +1 -0
- package/dist/models/Task.js +22 -0
- package/dist/models/Task.js.map +1 -0
- package/dist/models/TaskComment.d.ts +11 -0
- package/dist/models/TaskComment.d.ts.map +1 -0
- package/dist/models/TaskComment.js +27 -0
- package/dist/models/TaskComment.js.map +1 -0
- package/dist/models/Ticket.d.ts +13 -0
- package/dist/models/Ticket.d.ts.map +1 -0
- package/dist/models/Ticket.js +14 -0
- package/dist/models/Ticket.js.map +1 -0
- package/dist/native/FeeddoNative.d.ts +58 -0
- package/dist/native/FeeddoNative.d.ts.map +1 -0
- package/dist/native/FeeddoNative.js +22 -0
- package/dist/native/FeeddoNative.js.map +1 -0
- package/dist/push/FeeddoPushNotificationApns.d.ts +73 -0
- package/dist/push/FeeddoPushNotificationApns.d.ts.map +1 -0
- package/dist/push/FeeddoPushNotificationApns.js +301 -0
- package/dist/push/FeeddoPushNotificationApns.js.map +1 -0
- package/dist/services/ApiService.d.ts +64 -0
- package/dist/services/ApiService.d.ts.map +1 -0
- package/dist/services/ApiService.js +406 -0
- package/dist/services/ApiService.js.map +1 -0
- package/dist/services/ConversationService.d.ts +45 -0
- package/dist/services/ConversationService.d.ts.map +1 -0
- package/dist/services/ConversationService.js +259 -0
- package/dist/services/ConversationService.js.map +1 -0
- package/dist/services/WebSocketService.d.ts +26 -0
- package/dist/services/WebSocketService.d.ts.map +1 -0
- package/dist/services/WebSocketService.js +157 -0
- package/dist/services/WebSocketService.js.map +1 -0
- package/dist/theme/FeeddoTheme.d.ts +31 -0
- package/dist/theme/FeeddoTheme.d.ts.map +1 -0
- package/dist/theme/FeeddoTheme.js +60 -0
- package/dist/theme/FeeddoTheme.js.map +1 -0
- package/dist/ui/FeeddoFeedbackCard.d.ts +15 -0
- package/dist/ui/FeeddoFeedbackCard.d.ts.map +1 -0
- package/dist/ui/FeeddoFeedbackCard.js +188 -0
- package/dist/ui/FeeddoFeedbackCard.js.map +1 -0
- package/dist/ui/FeeddoModal.d.ts +20 -0
- package/dist/ui/FeeddoModal.d.ts.map +1 -0
- package/dist/ui/FeeddoModal.js +174 -0
- package/dist/ui/FeeddoModal.js.map +1 -0
- package/dist/ui/components/AttachmentPreview.d.ts +10 -0
- package/dist/ui/components/AttachmentPreview.d.ts.map +1 -0
- package/dist/ui/components/AttachmentPreview.js +143 -0
- package/dist/ui/components/AttachmentPreview.js.map +1 -0
- package/dist/ui/components/ChatInputArea.d.ts +16 -0
- package/dist/ui/components/ChatInputArea.d.ts.map +1 -0
- package/dist/ui/components/ChatInputArea.js +85 -0
- package/dist/ui/components/ChatInputArea.js.map +1 -0
- package/dist/ui/components/FeeddoIcon.d.ts +10 -0
- package/dist/ui/components/FeeddoIcon.d.ts.map +1 -0
- package/dist/ui/components/FeeddoIcon.js +690 -0
- package/dist/ui/components/FeeddoIcon.js.map +1 -0
- package/dist/ui/components/FeeddoNotificationBadge.d.ts +14 -0
- package/dist/ui/components/FeeddoNotificationBadge.d.ts.map +1 -0
- package/dist/ui/components/FeeddoNotificationBadge.js +171 -0
- package/dist/ui/components/FeeddoNotificationBadge.js.map +1 -0
- package/dist/ui/components/MessageBubble.d.ts +13 -0
- package/dist/ui/components/MessageBubble.d.ts.map +1 -0
- package/dist/ui/components/MessageBubble.js +163 -0
- package/dist/ui/components/MessageBubble.js.map +1 -0
- package/dist/ui/components/NotificationsSheet.d.ts +10 -0
- package/dist/ui/components/NotificationsSheet.d.ts.map +1 -0
- package/dist/ui/components/NotificationsSheet.js +252 -0
- package/dist/ui/components/NotificationsSheet.js.map +1 -0
- package/dist/ui/components/RatingWidget.d.ts +11 -0
- package/dist/ui/components/RatingWidget.d.ts.map +1 -0
- package/dist/ui/components/RatingWidget.js +34 -0
- package/dist/ui/components/RatingWidget.js.map +1 -0
- package/dist/ui/components/TaskCard.d.ts +12 -0
- package/dist/ui/components/TaskCard.d.ts.map +1 -0
- package/dist/ui/components/TaskCard.js +210 -0
- package/dist/ui/components/TaskCard.js.map +1 -0
- package/dist/ui/components/TaskDetailsSheet.d.ts +15 -0
- package/dist/ui/components/TaskDetailsSheet.d.ts.map +1 -0
- package/dist/ui/components/TaskDetailsSheet.js +577 -0
- package/dist/ui/components/TaskDetailsSheet.js.map +1 -0
- package/dist/ui/components/TicketCard.d.ts +11 -0
- package/dist/ui/components/TicketCard.d.ts.map +1 -0
- package/dist/ui/components/TicketCard.js +100 -0
- package/dist/ui/components/TicketCard.js.map +1 -0
- package/dist/ui/components/TicketDetailsSheet.d.ts +14 -0
- package/dist/ui/components/TicketDetailsSheet.d.ts.map +1 -0
- package/dist/ui/components/TicketDetailsSheet.js +254 -0
- package/dist/ui/components/TicketDetailsSheet.js.map +1 -0
- package/dist/ui/components/TypingIndicator.d.ts +10 -0
- package/dist/ui/components/TypingIndicator.d.ts.map +1 -0
- package/dist/ui/components/TypingIndicator.js +77 -0
- package/dist/ui/components/TypingIndicator.js.map +1 -0
- package/dist/ui/screens/FeeddoChatScreen.d.ts +13 -0
- package/dist/ui/screens/FeeddoChatScreen.d.ts.map +1 -0
- package/dist/ui/screens/FeeddoChatScreen.js +681 -0
- package/dist/ui/screens/FeeddoChatScreen.js.map +1 -0
- package/dist/ui/screens/FeeddoHomeScreen.d.ts +15 -0
- package/dist/ui/screens/FeeddoHomeScreen.d.ts.map +1 -0
- package/dist/ui/screens/FeeddoHomeScreen.js +653 -0
- package/dist/ui/screens/FeeddoHomeScreen.js.map +1 -0
- package/dist/ui/screens/FeeddoMessagesScreen.d.ts +12 -0
- package/dist/ui/screens/FeeddoMessagesScreen.d.ts.map +1 -0
- package/dist/ui/screens/FeeddoMessagesScreen.js +326 -0
- package/dist/ui/screens/FeeddoMessagesScreen.js.map +1 -0
- package/dist/ui/screens/FeeddoTasksScreen.d.ts +13 -0
- package/dist/ui/screens/FeeddoTasksScreen.d.ts.map +1 -0
- package/dist/ui/screens/FeeddoTasksScreen.js +517 -0
- package/dist/ui/screens/FeeddoTasksScreen.js.map +1 -0
- package/dist/ui/screens/FeeddoTicketsScreen.d.ts +10 -0
- package/dist/ui/screens/FeeddoTicketsScreen.d.ts.map +1 -0
- package/dist/ui/screens/FeeddoTicketsScreen.js +112 -0
- package/dist/ui/screens/FeeddoTicketsScreen.js.map +1 -0
- package/dist/utils/DeviceInfoHelper.d.ts +29 -0
- package/dist/utils/DeviceInfoHelper.d.ts.map +1 -0
- package/dist/utils/DeviceInfoHelper.js +190 -0
- package/dist/utils/DeviceInfoHelper.js.map +1 -0
- package/dist/utils/MediaHelper.d.ts +20 -0
- package/dist/utils/MediaHelper.d.ts.map +1 -0
- package/dist/utils/MediaHelper.js +92 -0
- package/dist/utils/MediaHelper.js.map +1 -0
- package/dist/utils/NotificationSupport.d.ts +22 -0
- package/dist/utils/NotificationSupport.d.ts.map +1 -0
- package/dist/utils/NotificationSupport.js +211 -0
- package/dist/utils/NotificationSupport.js.map +1 -0
- package/dist/utils/StorageHelper.d.ts +65 -0
- package/dist/utils/StorageHelper.d.ts.map +1 -0
- package/dist/utils/StorageHelper.js +273 -0
- package/dist/utils/StorageHelper.js.map +1 -0
- package/feeddo-react-native.podspec +26 -0
- package/ios/FeeddoReactNativeModule.h +8 -0
- package/ios/FeeddoReactNativeModule.m +831 -0
- package/package.json +56 -4
- package/src/Feeddo.ts +247 -0
- package/src/FeeddoClient.ts +895 -0
- package/src/FeeddoProvider.tsx +139 -0
- package/src/config/FeeddoConfig.ts +9 -0
- package/src/index.ts +67 -0
- package/src/models/Conversation.ts +50 -0
- package/src/models/EndUser.ts +65 -0
- package/src/models/FeeddoNotification.ts +29 -0
- package/src/models/HomeData.ts +33 -0
- package/src/models/Message.ts +36 -0
- package/src/models/PushProvider.ts +15 -0
- package/src/models/Task.ts +40 -0
- package/src/models/TaskComment.ts +36 -0
- package/src/models/Ticket.ts +25 -0
- package/src/native/FeeddoNative.ts +80 -0
- package/src/push/FeeddoPushNotificationApns.ts +362 -0
- package/src/services/ApiService.ts +456 -0
- package/src/services/ConversationService.ts +305 -0
- package/src/services/WebSocketService.ts +185 -0
- package/src/theme/FeeddoTheme.ts +85 -0
- package/src/ui/FeeddoFeedbackCard.tsx +245 -0
- package/src/ui/FeeddoModal.tsx +303 -0
- package/src/ui/components/AttachmentPreview.tsx +192 -0
- package/src/ui/components/ChatInputArea.tsx +154 -0
- package/src/ui/components/FeeddoIcon.tsx +903 -0
- package/src/ui/components/FeeddoNotificationBadge.tsx +234 -0
- package/src/ui/components/MessageBubble.tsx +223 -0
- package/src/ui/components/NotificationsSheet.tsx +324 -0
- package/src/ui/components/RatingWidget.tsx +64 -0
- package/src/ui/components/TaskCard.tsx +259 -0
- package/src/ui/components/TaskDetailsSheet.tsx +747 -0
- package/src/ui/components/TicketCard.tsx +128 -0
- package/src/ui/components/TicketDetailsSheet.tsx +324 -0
- package/src/ui/components/TypingIndicator.tsx +104 -0
- package/src/ui/screens/FeeddoChatScreen.tsx +877 -0
- package/src/ui/screens/FeeddoHomeScreen.tsx +824 -0
- package/src/ui/screens/FeeddoMessagesScreen.tsx +414 -0
- package/src/ui/screens/FeeddoTasksScreen.tsx +671 -0
- package/src/ui/screens/FeeddoTicketsScreen.tsx +164 -0
- package/src/utils/DeviceInfoHelper.ts +209 -0
- package/src/utils/MediaHelper.ts +105 -0
- package/src/utils/NotificationSupport.ts +233 -0
- package/src/utils/StorageHelper.ts +305 -0
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
import React, { useState, useEffect, useRef } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
Text,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
TouchableOpacity,
|
|
7
|
+
FlatList,
|
|
8
|
+
ActivityIndicator,
|
|
9
|
+
SafeAreaView,
|
|
10
|
+
} from 'react-native';
|
|
11
|
+
import { Conversation } from '../../models/Conversation';
|
|
12
|
+
import { FeeddoTheme } from '../../theme/FeeddoTheme';
|
|
13
|
+
import { FeeddoIcon } from '../components/FeeddoIcon';
|
|
14
|
+
import { FeeddoInternal } from '../../FeeddoClient';
|
|
15
|
+
|
|
16
|
+
interface FeeddoMessagesScreenProps {
|
|
17
|
+
theme: FeeddoTheme;
|
|
18
|
+
isActive?: boolean;
|
|
19
|
+
onBack: () => void;
|
|
20
|
+
onOpenConversation: (conversation: Conversation | null) => void;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const FeeddoMessagesScreen: React.FC<FeeddoMessagesScreenProps> = ({
|
|
24
|
+
theme,
|
|
25
|
+
isActive = true,
|
|
26
|
+
onBack,
|
|
27
|
+
onOpenConversation,
|
|
28
|
+
}) => {
|
|
29
|
+
const [conversations, setConversations] = useState<Conversation[]>([]);
|
|
30
|
+
const [isLoading, setIsLoading] = useState<boolean>(true);
|
|
31
|
+
const [error, setError] = useState<string | null>(null);
|
|
32
|
+
const wasActive = useRef(isActive);
|
|
33
|
+
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
loadConversations();
|
|
36
|
+
|
|
37
|
+
const unsubscribe = FeeddoInternal.instance.conversationService.addListener(() => {
|
|
38
|
+
const svc = FeeddoInternal.instance.conversationService;
|
|
39
|
+
setConversations(svc.conversations);
|
|
40
|
+
setIsLoading(svc.isLoading);
|
|
41
|
+
setError(svc.error);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
FeeddoInternal.instance.connectWebSocket().catch(() => { });
|
|
45
|
+
|
|
46
|
+
return () => {
|
|
47
|
+
unsubscribe();
|
|
48
|
+
};
|
|
49
|
+
}, []);
|
|
50
|
+
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (isActive && !wasActive.current) {
|
|
53
|
+
FeeddoInternal.instance.connectWebSocket().catch(() => { });
|
|
54
|
+
loadConversations();
|
|
55
|
+
}
|
|
56
|
+
wasActive.current = isActive;
|
|
57
|
+
}, [isActive]);
|
|
58
|
+
|
|
59
|
+
const loadConversations = async () => {
|
|
60
|
+
setIsLoading(true);
|
|
61
|
+
setError(null);
|
|
62
|
+
try {
|
|
63
|
+
const list = await FeeddoInternal.getConversations();
|
|
64
|
+
const svcError = FeeddoInternal.instance.conversationService.error;
|
|
65
|
+
setConversations(list);
|
|
66
|
+
setError(svcError);
|
|
67
|
+
} catch (e: any) {
|
|
68
|
+
setError(e?.message || String(e));
|
|
69
|
+
} finally {
|
|
70
|
+
setIsLoading(false);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const formatDate = (timestamp: number): string => {
|
|
75
|
+
const d = new Date(timestamp);
|
|
76
|
+
const now = new Date();
|
|
77
|
+
const isToday =
|
|
78
|
+
d.getDate() === now.getDate() &&
|
|
79
|
+
d.getMonth() === now.getMonth() &&
|
|
80
|
+
d.getFullYear() === now.getFullYear();
|
|
81
|
+
|
|
82
|
+
if (isToday) {
|
|
83
|
+
const hours = d.getHours().toString().padStart(2, '0');
|
|
84
|
+
const mins = d.getMinutes().toString().padStart(2, '0');
|
|
85
|
+
return `${hours}:${mins}`;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const diffDays = Math.floor((now.getTime() - d.getTime()) / (1000 * 60 * 60 * 24));
|
|
89
|
+
if (diffDays < 7) {
|
|
90
|
+
const weekdays = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
|
91
|
+
return weekdays[d.getDay()];
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return `${d.getDate()}/${d.getMonth() + 1}/${d.getFullYear()}`;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const renderRichPreview = (text: string) => {
|
|
98
|
+
const parts = text.split('**');
|
|
99
|
+
return (
|
|
100
|
+
<Text
|
|
101
|
+
style={[styles.previewText, { color: theme.colors.textSecondary }]}
|
|
102
|
+
numberOfLines={1}
|
|
103
|
+
>
|
|
104
|
+
{parts.map((part, index) => (
|
|
105
|
+
<Text key={index} style={index % 2 === 1 ? styles.boldPreview : undefined}>
|
|
106
|
+
{part}
|
|
107
|
+
</Text>
|
|
108
|
+
))}
|
|
109
|
+
</Text>
|
|
110
|
+
);
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const handleTapConversation = (item: Conversation) => {
|
|
114
|
+
FeeddoInternal.instance.conversationService.markAsRead(item.id);
|
|
115
|
+
onOpenConversation(item);
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
const onPrimaryColor = theme.isDark ? '#000000' : '#FFFFFF';
|
|
119
|
+
|
|
120
|
+
return (
|
|
121
|
+
<SafeAreaView style={[styles.container, { backgroundColor: theme.colors.background }]}>
|
|
122
|
+
{/* AppBar */}
|
|
123
|
+
<View
|
|
124
|
+
style={[
|
|
125
|
+
styles.appBar,
|
|
126
|
+
{
|
|
127
|
+
backgroundColor: theme.colors.appBarBackground,
|
|
128
|
+
},
|
|
129
|
+
]}
|
|
130
|
+
>
|
|
131
|
+
<TouchableOpacity activeOpacity={0.8} onPress={onBack} style={styles.backButton}>
|
|
132
|
+
<FeeddoIcon name="arrow_back" size={20} color={theme.colors.iconColor} />
|
|
133
|
+
</TouchableOpacity>
|
|
134
|
+
<Text style={[styles.appBarTitle, { color: theme.colors.textPrimary }]}>
|
|
135
|
+
Messages
|
|
136
|
+
</Text>
|
|
137
|
+
</View>
|
|
138
|
+
|
|
139
|
+
{/* List */}
|
|
140
|
+
{isLoading && conversations.length === 0 ? (
|
|
141
|
+
<View style={styles.centerContainer}>
|
|
142
|
+
<ActivityIndicator size="large" color={theme.colors.primary} />
|
|
143
|
+
</View>
|
|
144
|
+
) : error && conversations.length === 0 ? (
|
|
145
|
+
<View style={styles.centerContainer}>
|
|
146
|
+
<Text style={[styles.errorText, { color: theme.colors.textPrimary }]}>
|
|
147
|
+
{`Error: ${error}`}
|
|
148
|
+
</Text>
|
|
149
|
+
<TouchableOpacity onPress={loadConversations} style={styles.retryButton}>
|
|
150
|
+
<Text style={[styles.retryText, { color: theme.colors.primary }]}>Retry</Text>
|
|
151
|
+
</TouchableOpacity>
|
|
152
|
+
</View>
|
|
153
|
+
) : conversations.length === 0 ? (
|
|
154
|
+
<View style={styles.centerContainer}>
|
|
155
|
+
<Text style={[styles.emptyText, { color: theme.colors.textPrimary }]}>
|
|
156
|
+
No messages yet
|
|
157
|
+
</Text>
|
|
158
|
+
</View>
|
|
159
|
+
) : (
|
|
160
|
+
<FlatList
|
|
161
|
+
data={conversations}
|
|
162
|
+
keyExtractor={(item) => item.id}
|
|
163
|
+
ItemSeparatorComponent={() => (
|
|
164
|
+
<View style={[styles.separator, { backgroundColor: theme.colors.divider }]} />
|
|
165
|
+
)}
|
|
166
|
+
renderItem={({ item }) => {
|
|
167
|
+
const firstLetter = (() => {
|
|
168
|
+
const name = item.displayName?.trim() || item.title?.trim();
|
|
169
|
+
return name && name.length > 0 ? name[0].toUpperCase() : '?';
|
|
170
|
+
})();
|
|
171
|
+
|
|
172
|
+
return (
|
|
173
|
+
<TouchableOpacity
|
|
174
|
+
activeOpacity={0.7}
|
|
175
|
+
onPress={() => handleTapConversation(item)}
|
|
176
|
+
style={styles.conversationItem}
|
|
177
|
+
>
|
|
178
|
+
{/* Avatar */}
|
|
179
|
+
<View
|
|
180
|
+
style={[
|
|
181
|
+
styles.avatar,
|
|
182
|
+
{ backgroundColor: `${theme.colors.primary}1A` },
|
|
183
|
+
]}
|
|
184
|
+
>
|
|
185
|
+
<Text style={[styles.avatarText, { color: theme.colors.primary }]}>
|
|
186
|
+
{firstLetter}
|
|
187
|
+
</Text>
|
|
188
|
+
</View>
|
|
189
|
+
|
|
190
|
+
{/* Content */}
|
|
191
|
+
<View style={styles.itemContent}>
|
|
192
|
+
<View style={styles.topRow}>
|
|
193
|
+
<Text
|
|
194
|
+
style={[styles.itemTitle, { color: theme.colors.textPrimary }]}
|
|
195
|
+
numberOfLines={1}
|
|
196
|
+
>
|
|
197
|
+
{item.displayName || item.title || 'Conversation'}
|
|
198
|
+
</Text>
|
|
199
|
+
<Text style={[styles.itemTime, { color: theme.colors.textSecondary }]}>
|
|
200
|
+
{formatDate(item.lastMessageAt)}
|
|
201
|
+
</Text>
|
|
202
|
+
</View>
|
|
203
|
+
|
|
204
|
+
<View style={styles.previewRow}>
|
|
205
|
+
{renderRichPreview(item.lastMessagePreview || 'No messages')}
|
|
206
|
+
|
|
207
|
+
{item.unreadMessages > 0 && (
|
|
208
|
+
<View style={styles.unreadBadge}>
|
|
209
|
+
<Text style={styles.unreadBadgeText}>
|
|
210
|
+
{item.unreadMessages}
|
|
211
|
+
</Text>
|
|
212
|
+
</View>
|
|
213
|
+
)}
|
|
214
|
+
</View>
|
|
215
|
+
|
|
216
|
+
{/* Status Chips */}
|
|
217
|
+
{(item.status === 'resolved' || item.hasTicket || item.hasTask) && (
|
|
218
|
+
<View style={styles.statusChipsRow}>
|
|
219
|
+
{item.status === 'resolved' && (
|
|
220
|
+
<View style={[styles.chip, { backgroundColor: 'rgba(34, 197, 94, 0.1)' }]}>
|
|
221
|
+
<FeeddoIcon name="check_circle" size={12} color={theme.colors.success} />
|
|
222
|
+
<Text style={[styles.chipText, { color: theme.colors.success }]}>
|
|
223
|
+
Resolved
|
|
224
|
+
</Text>
|
|
225
|
+
</View>
|
|
226
|
+
)}
|
|
227
|
+
|
|
228
|
+
{item.hasTicket && (
|
|
229
|
+
<View style={[styles.chip, { backgroundColor: 'rgba(59, 130, 246, 0.1)' }]}>
|
|
230
|
+
<FeeddoIcon name="ticket" size={12} color="#3B82F6" />
|
|
231
|
+
<Text style={[styles.chipText, { color: '#3B82F6' }]}>
|
|
232
|
+
{`Ticket: ${item.ticketStatus || 'Open'}`}
|
|
233
|
+
</Text>
|
|
234
|
+
</View>
|
|
235
|
+
)}
|
|
236
|
+
|
|
237
|
+
{item.hasTask && (
|
|
238
|
+
<View style={[styles.chip, { backgroundColor: 'rgba(245, 158, 11, 0.1)' }]}>
|
|
239
|
+
<FeeddoIcon name="lightbulb" size={12} color="#F59E0B" />
|
|
240
|
+
<Text style={[styles.chipText, { color: '#F59E0B' }]}>
|
|
241
|
+
Task
|
|
242
|
+
</Text>
|
|
243
|
+
</View>
|
|
244
|
+
)}
|
|
245
|
+
</View>
|
|
246
|
+
)}
|
|
247
|
+
</View>
|
|
248
|
+
</TouchableOpacity>
|
|
249
|
+
);
|
|
250
|
+
}}
|
|
251
|
+
/>
|
|
252
|
+
)}
|
|
253
|
+
|
|
254
|
+
{/* FAB to compose new message */}
|
|
255
|
+
<TouchableOpacity
|
|
256
|
+
activeOpacity={0.85}
|
|
257
|
+
onPress={() => onOpenConversation(null)}
|
|
258
|
+
style={[
|
|
259
|
+
styles.fab,
|
|
260
|
+
{
|
|
261
|
+
backgroundColor: theme.colors.primary,
|
|
262
|
+
shadowColor: theme.colors.primary,
|
|
263
|
+
},
|
|
264
|
+
]}
|
|
265
|
+
>
|
|
266
|
+
<FeeddoIcon name="edit" size={20} color={onPrimaryColor} />
|
|
267
|
+
</TouchableOpacity>
|
|
268
|
+
</SafeAreaView>
|
|
269
|
+
);
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
const styles = StyleSheet.create({
|
|
273
|
+
container: {
|
|
274
|
+
flex: 1,
|
|
275
|
+
},
|
|
276
|
+
appBar: {
|
|
277
|
+
flexDirection: 'row',
|
|
278
|
+
alignItems: 'center',
|
|
279
|
+
paddingHorizontal: 16,
|
|
280
|
+
paddingVertical: 14,
|
|
281
|
+
},
|
|
282
|
+
backButton: {
|
|
283
|
+
padding: 6,
|
|
284
|
+
marginRight: 10,
|
|
285
|
+
},
|
|
286
|
+
appBarTitle: {
|
|
287
|
+
fontSize: 20,
|
|
288
|
+
fontWeight: '700',
|
|
289
|
+
},
|
|
290
|
+
centerContainer: {
|
|
291
|
+
flex: 1,
|
|
292
|
+
alignItems: 'center',
|
|
293
|
+
justifyContent: 'center',
|
|
294
|
+
padding: 16,
|
|
295
|
+
},
|
|
296
|
+
errorText: {
|
|
297
|
+
fontSize: 14,
|
|
298
|
+
textAlign: 'center',
|
|
299
|
+
},
|
|
300
|
+
retryButton: {
|
|
301
|
+
marginTop: 12,
|
|
302
|
+
paddingHorizontal: 16,
|
|
303
|
+
paddingVertical: 8,
|
|
304
|
+
},
|
|
305
|
+
retryText: {
|
|
306
|
+
fontSize: 15,
|
|
307
|
+
fontWeight: '600',
|
|
308
|
+
},
|
|
309
|
+
emptyText: {
|
|
310
|
+
fontSize: 16,
|
|
311
|
+
fontWeight: '600',
|
|
312
|
+
},
|
|
313
|
+
conversationItem: {
|
|
314
|
+
flexDirection: 'row',
|
|
315
|
+
alignItems: 'center',
|
|
316
|
+
paddingHorizontal: 16,
|
|
317
|
+
paddingVertical: 12,
|
|
318
|
+
},
|
|
319
|
+
avatar: {
|
|
320
|
+
width: 40,
|
|
321
|
+
height: 40,
|
|
322
|
+
borderRadius: 20,
|
|
323
|
+
alignItems: 'center',
|
|
324
|
+
justifyContent: 'center',
|
|
325
|
+
},
|
|
326
|
+
avatarText: {
|
|
327
|
+
fontSize: 18,
|
|
328
|
+
fontWeight: '700',
|
|
329
|
+
},
|
|
330
|
+
itemContent: {
|
|
331
|
+
flex: 1,
|
|
332
|
+
marginLeft: 12,
|
|
333
|
+
},
|
|
334
|
+
topRow: {
|
|
335
|
+
flexDirection: 'row',
|
|
336
|
+
justifyContent: 'space-between',
|
|
337
|
+
alignItems: 'center',
|
|
338
|
+
},
|
|
339
|
+
itemTitle: {
|
|
340
|
+
fontSize: 16,
|
|
341
|
+
fontWeight: '600',
|
|
342
|
+
flex: 1,
|
|
343
|
+
},
|
|
344
|
+
itemTime: {
|
|
345
|
+
fontSize: 12,
|
|
346
|
+
marginLeft: 8,
|
|
347
|
+
},
|
|
348
|
+
previewRow: {
|
|
349
|
+
flexDirection: 'row',
|
|
350
|
+
alignItems: 'center',
|
|
351
|
+
justifyContent: 'space-between',
|
|
352
|
+
marginTop: 4,
|
|
353
|
+
},
|
|
354
|
+
previewText: {
|
|
355
|
+
fontSize: 14,
|
|
356
|
+
flex: 1,
|
|
357
|
+
},
|
|
358
|
+
boldPreview: {
|
|
359
|
+
fontWeight: '700',
|
|
360
|
+
},
|
|
361
|
+
unreadBadge: {
|
|
362
|
+
backgroundColor: '#EF4444',
|
|
363
|
+
borderRadius: 11,
|
|
364
|
+
minWidth: 22,
|
|
365
|
+
height: 22,
|
|
366
|
+
alignItems: 'center',
|
|
367
|
+
justifyContent: 'center',
|
|
368
|
+
paddingHorizontal: 6,
|
|
369
|
+
marginLeft: 8,
|
|
370
|
+
},
|
|
371
|
+
unreadBadgeText: {
|
|
372
|
+
color: '#FFFFFF',
|
|
373
|
+
fontSize: 10,
|
|
374
|
+
fontWeight: '700',
|
|
375
|
+
},
|
|
376
|
+
statusChipsRow: {
|
|
377
|
+
flexDirection: 'row',
|
|
378
|
+
alignItems: 'center',
|
|
379
|
+
marginTop: 6,
|
|
380
|
+
flexWrap: 'wrap',
|
|
381
|
+
},
|
|
382
|
+
chip: {
|
|
383
|
+
flexDirection: 'row',
|
|
384
|
+
alignItems: 'center',
|
|
385
|
+
paddingHorizontal: 8,
|
|
386
|
+
paddingVertical: 4,
|
|
387
|
+
borderRadius: 4,
|
|
388
|
+
marginRight: 8,
|
|
389
|
+
marginTop: 2,
|
|
390
|
+
},
|
|
391
|
+
chipText: {
|
|
392
|
+
fontSize: 10,
|
|
393
|
+
fontWeight: '500',
|
|
394
|
+
marginLeft: 5,
|
|
395
|
+
},
|
|
396
|
+
separator: {
|
|
397
|
+
height: 1,
|
|
398
|
+
marginLeft: 68,
|
|
399
|
+
},
|
|
400
|
+
fab: {
|
|
401
|
+
position: 'absolute',
|
|
402
|
+
right: 20,
|
|
403
|
+
bottom: 24,
|
|
404
|
+
width: 48,
|
|
405
|
+
height: 48,
|
|
406
|
+
borderRadius: 24,
|
|
407
|
+
alignItems: 'center',
|
|
408
|
+
justifyContent: 'center',
|
|
409
|
+
shadowOffset: { width: 0, height: 4 },
|
|
410
|
+
shadowOpacity: 0.3,
|
|
411
|
+
shadowRadius: 8,
|
|
412
|
+
elevation: 4,
|
|
413
|
+
},
|
|
414
|
+
});
|