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.
Files changed (225) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +401 -2
  3. package/android/build.gradle +39 -0
  4. package/android/src/main/AndroidManifest.xml +1 -0
  5. package/android/src/main/java/dev/feeddo/reactnative/FeeddoReactNativeModule.java +380 -0
  6. package/android/src/main/java/dev/feeddo/reactnative/FeeddoReactNativePackage.java +25 -0
  7. package/dist/Feeddo.d.ts +131 -0
  8. package/dist/Feeddo.d.ts.map +1 -0
  9. package/dist/Feeddo.js +176 -0
  10. package/dist/Feeddo.js.map +1 -0
  11. package/dist/FeeddoClient.d.ts +151 -0
  12. package/dist/FeeddoClient.d.ts.map +1 -0
  13. package/dist/FeeddoClient.js +690 -0
  14. package/dist/FeeddoClient.js.map +1 -0
  15. package/dist/FeeddoProvider.d.ts +23 -0
  16. package/dist/FeeddoProvider.d.ts.map +1 -0
  17. package/dist/FeeddoProvider.js +76 -0
  18. package/dist/FeeddoProvider.js.map +1 -0
  19. package/dist/config/FeeddoConfig.d.ts +10 -0
  20. package/dist/config/FeeddoConfig.d.ts.map +1 -0
  21. package/dist/config/FeeddoConfig.js +10 -0
  22. package/dist/config/FeeddoConfig.js.map +1 -0
  23. package/dist/index.d.ts +36 -0
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +38 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/models/Conversation.d.ts +27 -0
  28. package/dist/models/Conversation.d.ts.map +1 -0
  29. package/dist/models/Conversation.js +24 -0
  30. package/dist/models/Conversation.js.map +1 -0
  31. package/dist/models/EndUser.d.ts +49 -0
  32. package/dist/models/EndUser.d.ts.map +1 -0
  33. package/dist/models/EndUser.js +2 -0
  34. package/dist/models/EndUser.js.map +1 -0
  35. package/dist/models/FeeddoNotification.d.ts +15 -0
  36. package/dist/models/FeeddoNotification.d.ts.map +1 -0
  37. package/dist/models/FeeddoNotification.js +15 -0
  38. package/dist/models/FeeddoNotification.js.map +1 -0
  39. package/dist/models/HomeData.d.ts +16 -0
  40. package/dist/models/HomeData.d.ts.map +1 -0
  41. package/dist/models/HomeData.js +19 -0
  42. package/dist/models/HomeData.js.map +1 -0
  43. package/dist/models/Message.d.ts +12 -0
  44. package/dist/models/Message.d.ts.map +1 -0
  45. package/dist/models/Message.js +25 -0
  46. package/dist/models/Message.js.map +1 -0
  47. package/dist/models/PushProvider.d.ts +14 -0
  48. package/dist/models/PushProvider.d.ts.map +1 -0
  49. package/dist/models/PushProvider.js +9 -0
  50. package/dist/models/PushProvider.js.map +1 -0
  51. package/dist/models/Task.d.ts +17 -0
  52. package/dist/models/Task.d.ts.map +1 -0
  53. package/dist/models/Task.js +22 -0
  54. package/dist/models/Task.js.map +1 -0
  55. package/dist/models/TaskComment.d.ts +11 -0
  56. package/dist/models/TaskComment.d.ts.map +1 -0
  57. package/dist/models/TaskComment.js +27 -0
  58. package/dist/models/TaskComment.js.map +1 -0
  59. package/dist/models/Ticket.d.ts +13 -0
  60. package/dist/models/Ticket.d.ts.map +1 -0
  61. package/dist/models/Ticket.js +14 -0
  62. package/dist/models/Ticket.js.map +1 -0
  63. package/dist/native/FeeddoNative.d.ts +58 -0
  64. package/dist/native/FeeddoNative.d.ts.map +1 -0
  65. package/dist/native/FeeddoNative.js +22 -0
  66. package/dist/native/FeeddoNative.js.map +1 -0
  67. package/dist/push/FeeddoPushNotificationApns.d.ts +73 -0
  68. package/dist/push/FeeddoPushNotificationApns.d.ts.map +1 -0
  69. package/dist/push/FeeddoPushNotificationApns.js +301 -0
  70. package/dist/push/FeeddoPushNotificationApns.js.map +1 -0
  71. package/dist/services/ApiService.d.ts +64 -0
  72. package/dist/services/ApiService.d.ts.map +1 -0
  73. package/dist/services/ApiService.js +406 -0
  74. package/dist/services/ApiService.js.map +1 -0
  75. package/dist/services/ConversationService.d.ts +45 -0
  76. package/dist/services/ConversationService.d.ts.map +1 -0
  77. package/dist/services/ConversationService.js +259 -0
  78. package/dist/services/ConversationService.js.map +1 -0
  79. package/dist/services/WebSocketService.d.ts +26 -0
  80. package/dist/services/WebSocketService.d.ts.map +1 -0
  81. package/dist/services/WebSocketService.js +157 -0
  82. package/dist/services/WebSocketService.js.map +1 -0
  83. package/dist/theme/FeeddoTheme.d.ts +31 -0
  84. package/dist/theme/FeeddoTheme.d.ts.map +1 -0
  85. package/dist/theme/FeeddoTheme.js +60 -0
  86. package/dist/theme/FeeddoTheme.js.map +1 -0
  87. package/dist/ui/FeeddoFeedbackCard.d.ts +15 -0
  88. package/dist/ui/FeeddoFeedbackCard.d.ts.map +1 -0
  89. package/dist/ui/FeeddoFeedbackCard.js +188 -0
  90. package/dist/ui/FeeddoFeedbackCard.js.map +1 -0
  91. package/dist/ui/FeeddoModal.d.ts +20 -0
  92. package/dist/ui/FeeddoModal.d.ts.map +1 -0
  93. package/dist/ui/FeeddoModal.js +174 -0
  94. package/dist/ui/FeeddoModal.js.map +1 -0
  95. package/dist/ui/components/AttachmentPreview.d.ts +10 -0
  96. package/dist/ui/components/AttachmentPreview.d.ts.map +1 -0
  97. package/dist/ui/components/AttachmentPreview.js +143 -0
  98. package/dist/ui/components/AttachmentPreview.js.map +1 -0
  99. package/dist/ui/components/ChatInputArea.d.ts +16 -0
  100. package/dist/ui/components/ChatInputArea.d.ts.map +1 -0
  101. package/dist/ui/components/ChatInputArea.js +85 -0
  102. package/dist/ui/components/ChatInputArea.js.map +1 -0
  103. package/dist/ui/components/FeeddoIcon.d.ts +10 -0
  104. package/dist/ui/components/FeeddoIcon.d.ts.map +1 -0
  105. package/dist/ui/components/FeeddoIcon.js +690 -0
  106. package/dist/ui/components/FeeddoIcon.js.map +1 -0
  107. package/dist/ui/components/FeeddoNotificationBadge.d.ts +14 -0
  108. package/dist/ui/components/FeeddoNotificationBadge.d.ts.map +1 -0
  109. package/dist/ui/components/FeeddoNotificationBadge.js +171 -0
  110. package/dist/ui/components/FeeddoNotificationBadge.js.map +1 -0
  111. package/dist/ui/components/MessageBubble.d.ts +13 -0
  112. package/dist/ui/components/MessageBubble.d.ts.map +1 -0
  113. package/dist/ui/components/MessageBubble.js +163 -0
  114. package/dist/ui/components/MessageBubble.js.map +1 -0
  115. package/dist/ui/components/NotificationsSheet.d.ts +10 -0
  116. package/dist/ui/components/NotificationsSheet.d.ts.map +1 -0
  117. package/dist/ui/components/NotificationsSheet.js +252 -0
  118. package/dist/ui/components/NotificationsSheet.js.map +1 -0
  119. package/dist/ui/components/RatingWidget.d.ts +11 -0
  120. package/dist/ui/components/RatingWidget.d.ts.map +1 -0
  121. package/dist/ui/components/RatingWidget.js +34 -0
  122. package/dist/ui/components/RatingWidget.js.map +1 -0
  123. package/dist/ui/components/TaskCard.d.ts +12 -0
  124. package/dist/ui/components/TaskCard.d.ts.map +1 -0
  125. package/dist/ui/components/TaskCard.js +210 -0
  126. package/dist/ui/components/TaskCard.js.map +1 -0
  127. package/dist/ui/components/TaskDetailsSheet.d.ts +15 -0
  128. package/dist/ui/components/TaskDetailsSheet.d.ts.map +1 -0
  129. package/dist/ui/components/TaskDetailsSheet.js +577 -0
  130. package/dist/ui/components/TaskDetailsSheet.js.map +1 -0
  131. package/dist/ui/components/TicketCard.d.ts +11 -0
  132. package/dist/ui/components/TicketCard.d.ts.map +1 -0
  133. package/dist/ui/components/TicketCard.js +100 -0
  134. package/dist/ui/components/TicketCard.js.map +1 -0
  135. package/dist/ui/components/TicketDetailsSheet.d.ts +14 -0
  136. package/dist/ui/components/TicketDetailsSheet.d.ts.map +1 -0
  137. package/dist/ui/components/TicketDetailsSheet.js +254 -0
  138. package/dist/ui/components/TicketDetailsSheet.js.map +1 -0
  139. package/dist/ui/components/TypingIndicator.d.ts +10 -0
  140. package/dist/ui/components/TypingIndicator.d.ts.map +1 -0
  141. package/dist/ui/components/TypingIndicator.js +77 -0
  142. package/dist/ui/components/TypingIndicator.js.map +1 -0
  143. package/dist/ui/screens/FeeddoChatScreen.d.ts +13 -0
  144. package/dist/ui/screens/FeeddoChatScreen.d.ts.map +1 -0
  145. package/dist/ui/screens/FeeddoChatScreen.js +681 -0
  146. package/dist/ui/screens/FeeddoChatScreen.js.map +1 -0
  147. package/dist/ui/screens/FeeddoHomeScreen.d.ts +15 -0
  148. package/dist/ui/screens/FeeddoHomeScreen.d.ts.map +1 -0
  149. package/dist/ui/screens/FeeddoHomeScreen.js +653 -0
  150. package/dist/ui/screens/FeeddoHomeScreen.js.map +1 -0
  151. package/dist/ui/screens/FeeddoMessagesScreen.d.ts +12 -0
  152. package/dist/ui/screens/FeeddoMessagesScreen.d.ts.map +1 -0
  153. package/dist/ui/screens/FeeddoMessagesScreen.js +326 -0
  154. package/dist/ui/screens/FeeddoMessagesScreen.js.map +1 -0
  155. package/dist/ui/screens/FeeddoTasksScreen.d.ts +13 -0
  156. package/dist/ui/screens/FeeddoTasksScreen.d.ts.map +1 -0
  157. package/dist/ui/screens/FeeddoTasksScreen.js +517 -0
  158. package/dist/ui/screens/FeeddoTasksScreen.js.map +1 -0
  159. package/dist/ui/screens/FeeddoTicketsScreen.d.ts +10 -0
  160. package/dist/ui/screens/FeeddoTicketsScreen.d.ts.map +1 -0
  161. package/dist/ui/screens/FeeddoTicketsScreen.js +112 -0
  162. package/dist/ui/screens/FeeddoTicketsScreen.js.map +1 -0
  163. package/dist/utils/DeviceInfoHelper.d.ts +29 -0
  164. package/dist/utils/DeviceInfoHelper.d.ts.map +1 -0
  165. package/dist/utils/DeviceInfoHelper.js +190 -0
  166. package/dist/utils/DeviceInfoHelper.js.map +1 -0
  167. package/dist/utils/MediaHelper.d.ts +20 -0
  168. package/dist/utils/MediaHelper.d.ts.map +1 -0
  169. package/dist/utils/MediaHelper.js +92 -0
  170. package/dist/utils/MediaHelper.js.map +1 -0
  171. package/dist/utils/NotificationSupport.d.ts +22 -0
  172. package/dist/utils/NotificationSupport.d.ts.map +1 -0
  173. package/dist/utils/NotificationSupport.js +211 -0
  174. package/dist/utils/NotificationSupport.js.map +1 -0
  175. package/dist/utils/StorageHelper.d.ts +65 -0
  176. package/dist/utils/StorageHelper.d.ts.map +1 -0
  177. package/dist/utils/StorageHelper.js +273 -0
  178. package/dist/utils/StorageHelper.js.map +1 -0
  179. package/feeddo-react-native.podspec +26 -0
  180. package/ios/FeeddoReactNativeModule.h +8 -0
  181. package/ios/FeeddoReactNativeModule.m +831 -0
  182. package/package.json +56 -4
  183. package/src/Feeddo.ts +247 -0
  184. package/src/FeeddoClient.ts +895 -0
  185. package/src/FeeddoProvider.tsx +139 -0
  186. package/src/config/FeeddoConfig.ts +9 -0
  187. package/src/index.ts +67 -0
  188. package/src/models/Conversation.ts +50 -0
  189. package/src/models/EndUser.ts +65 -0
  190. package/src/models/FeeddoNotification.ts +29 -0
  191. package/src/models/HomeData.ts +33 -0
  192. package/src/models/Message.ts +36 -0
  193. package/src/models/PushProvider.ts +15 -0
  194. package/src/models/Task.ts +40 -0
  195. package/src/models/TaskComment.ts +36 -0
  196. package/src/models/Ticket.ts +25 -0
  197. package/src/native/FeeddoNative.ts +80 -0
  198. package/src/push/FeeddoPushNotificationApns.ts +362 -0
  199. package/src/services/ApiService.ts +456 -0
  200. package/src/services/ConversationService.ts +305 -0
  201. package/src/services/WebSocketService.ts +185 -0
  202. package/src/theme/FeeddoTheme.ts +85 -0
  203. package/src/ui/FeeddoFeedbackCard.tsx +245 -0
  204. package/src/ui/FeeddoModal.tsx +303 -0
  205. package/src/ui/components/AttachmentPreview.tsx +192 -0
  206. package/src/ui/components/ChatInputArea.tsx +154 -0
  207. package/src/ui/components/FeeddoIcon.tsx +903 -0
  208. package/src/ui/components/FeeddoNotificationBadge.tsx +234 -0
  209. package/src/ui/components/MessageBubble.tsx +223 -0
  210. package/src/ui/components/NotificationsSheet.tsx +324 -0
  211. package/src/ui/components/RatingWidget.tsx +64 -0
  212. package/src/ui/components/TaskCard.tsx +259 -0
  213. package/src/ui/components/TaskDetailsSheet.tsx +747 -0
  214. package/src/ui/components/TicketCard.tsx +128 -0
  215. package/src/ui/components/TicketDetailsSheet.tsx +324 -0
  216. package/src/ui/components/TypingIndicator.tsx +104 -0
  217. package/src/ui/screens/FeeddoChatScreen.tsx +877 -0
  218. package/src/ui/screens/FeeddoHomeScreen.tsx +824 -0
  219. package/src/ui/screens/FeeddoMessagesScreen.tsx +414 -0
  220. package/src/ui/screens/FeeddoTasksScreen.tsx +671 -0
  221. package/src/ui/screens/FeeddoTicketsScreen.tsx +164 -0
  222. package/src/utils/DeviceInfoHelper.ts +209 -0
  223. package/src/utils/MediaHelper.ts +105 -0
  224. package/src/utils/NotificationSupport.ts +233 -0
  225. package/src/utils/StorageHelper.ts +305 -0
@@ -0,0 +1,324 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import {
3
+ View,
4
+ Text,
5
+ StyleSheet,
6
+ TouchableOpacity,
7
+ ScrollView,
8
+ ActivityIndicator,
9
+ Modal,
10
+ SafeAreaView,
11
+ } from 'react-native';
12
+ import { FeeddoNotification } from '../../models/FeeddoNotification';
13
+ import { FeeddoTheme } from '../../theme/FeeddoTheme';
14
+ import { FeeddoIcon } from './FeeddoIcon';
15
+ import { FeeddoInternal } from '../../FeeddoClient';
16
+ import { Feeddo } from '../../Feeddo';
17
+
18
+ interface NotificationsSheetProps {
19
+ visible: boolean;
20
+ onClose: () => void;
21
+ theme: FeeddoTheme;
22
+ }
23
+
24
+ export const NotificationsSheet: React.FC<NotificationsSheetProps> = ({
25
+ visible,
26
+ onClose,
27
+ theme,
28
+ }) => {
29
+ const [notifications, setNotifications] = useState<FeeddoNotification[]>([]);
30
+ const [isLoading, setIsLoading] = useState<boolean>(true);
31
+ const [error, setError] = useState<string | null>(null);
32
+
33
+ useEffect(() => {
34
+ if (visible) {
35
+ loadNotifications();
36
+ }
37
+ }, [visible]);
38
+
39
+ const loadNotifications = async () => {
40
+ setIsLoading(true);
41
+ setError(null);
42
+ try {
43
+ const userId = await FeeddoInternal.instance.ensureUserInitialized();
44
+ if (!userId) {
45
+ throw new Error('User not initialized');
46
+ }
47
+ const list = await FeeddoInternal.instance.apiService.getNotifications(userId);
48
+ setNotifications(list);
49
+ } catch (e: any) {
50
+ setError(e?.message || 'Failed to load notifications');
51
+ } finally {
52
+ setIsLoading(false);
53
+ }
54
+ };
55
+
56
+ const formatDate = (timestamp: number): string => {
57
+ const d = new Date(timestamp);
58
+ const now = new Date();
59
+ const diff = Math.floor((now.getTime() - d.getTime()) / 1000);
60
+
61
+ if (diff < 86400 && d.getDate() === now.getDate()) {
62
+ const hours = d.getHours();
63
+ const mins = d.getMinutes().toString().padStart(2, '0');
64
+ const ampm = hours >= 12 ? 'PM' : 'AM';
65
+ const h12 = hours % 12 === 0 ? 12 : hours % 12;
66
+ return `${h12}:${mins} ${ampm}`;
67
+ }
68
+
69
+ const weekdays = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
70
+ if (diff < 7 * 86400) {
71
+ return weekdays[d.getDay()];
72
+ }
73
+
74
+ const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
75
+ return `${months[d.getMonth()]} ${d.getDate()}`;
76
+ };
77
+
78
+ const handleNotificationPress = (notif: FeeddoNotification) => {
79
+ onClose();
80
+ if (notif.data) {
81
+ Feeddo.handleNotificationTap(notif.data, { theme });
82
+ }
83
+ };
84
+
85
+ return (
86
+ <Modal
87
+ visible={visible}
88
+ transparent
89
+ animationType="slide"
90
+ onRequestClose={onClose}
91
+ >
92
+ <View style={styles.backdrop}>
93
+ <TouchableOpacity activeOpacity={1} onPress={onClose} style={styles.backdropTouch} />
94
+
95
+ <SafeAreaView
96
+ style={[
97
+ styles.sheetContainer,
98
+ { backgroundColor: theme.colors.background },
99
+ ]}
100
+ >
101
+ {/* Drag Handle */}
102
+ <View style={styles.handleContainer}>
103
+ <View
104
+ style={[
105
+ styles.handleBar,
106
+ { backgroundColor: `${theme.colors.textSecondary}33` },
107
+ ]}
108
+ />
109
+ </View>
110
+
111
+ {/* Header */}
112
+ <View style={styles.header}>
113
+ <Text style={[styles.title, { color: theme.colors.textPrimary }]}>
114
+ Notifications
115
+ </Text>
116
+ <TouchableOpacity onPress={onClose} hitSlop={{ top: 10, bottom: 10, left: 10, right: 10 }}>
117
+ <FeeddoIcon name="close" size={20} color={theme.colors.textSecondary} />
118
+ </TouchableOpacity>
119
+ </View>
120
+
121
+ {/* Content */}
122
+ {isLoading ? (
123
+ <View style={styles.centerContainer}>
124
+ <ActivityIndicator size="large" color={theme.colors.primary} />
125
+ </View>
126
+ ) : error ? (
127
+ <View style={styles.emptyContainer}>
128
+ <FeeddoIcon name="error" size={48} color={theme.colors.error} />
129
+ <Text style={[styles.errorText, { color: theme.colors.textPrimary }]}>
130
+ {error}
131
+ </Text>
132
+ <TouchableOpacity onPress={loadNotifications} style={styles.retryButton}>
133
+ <Text style={[styles.retryText, { color: theme.colors.primary }]}>Retry</Text>
134
+ </TouchableOpacity>
135
+ </View>
136
+ ) : notifications.length === 0 ? (
137
+ <View style={styles.emptyContainer}>
138
+ <FeeddoIcon
139
+ name="notifications"
140
+ size={64}
141
+ color={`${theme.colors.textSecondary}80`}
142
+ />
143
+ <Text style={[styles.emptyText, { color: theme.colors.textSecondary }]}>
144
+ No notifications yet
145
+ </Text>
146
+ </View>
147
+ ) : (
148
+ <ScrollView style={styles.listContent}>
149
+ {notifications.map((item) => (
150
+ <TouchableOpacity
151
+ key={item.id}
152
+ activeOpacity={0.8}
153
+ onPress={() => handleNotificationPress(item)}
154
+ style={[
155
+ styles.notificationItem,
156
+ {
157
+ backgroundColor: theme.colors.cardBackground,
158
+ borderColor: `${theme.colors.border}80`,
159
+ },
160
+ ]}
161
+ >
162
+ <View
163
+ style={[
164
+ styles.iconCircle,
165
+ { backgroundColor: `${theme.colors.primary}1A` },
166
+ ]}
167
+ >
168
+ <FeeddoIcon
169
+ name="notifications"
170
+ size={20}
171
+ color={theme.colors.primary}
172
+ />
173
+ </View>
174
+
175
+ <View style={styles.itemTextContainer}>
176
+ <View style={styles.itemTitleRow}>
177
+ <Text
178
+ style={[
179
+ styles.itemTitle,
180
+ { color: theme.colors.textPrimary },
181
+ ]}
182
+ >
183
+ {item.title || 'Notification'}
184
+ </Text>
185
+ <Text
186
+ style={[
187
+ styles.itemDate,
188
+ { color: theme.colors.textSecondary },
189
+ ]}
190
+ >
191
+ {formatDate(item.createdAt)}
192
+ </Text>
193
+ </View>
194
+
195
+ {Boolean(item.body) && (
196
+ <Text
197
+ style={[
198
+ styles.itemBody,
199
+ { color: theme.colors.textSecondary },
200
+ ]}
201
+ >
202
+ {item.body}
203
+ </Text>
204
+ )}
205
+ </View>
206
+ </TouchableOpacity>
207
+ ))}
208
+ </ScrollView>
209
+ )}
210
+ </SafeAreaView>
211
+ </View>
212
+ </Modal>
213
+ );
214
+ };
215
+
216
+ const styles = StyleSheet.create({
217
+ backdrop: {
218
+ flex: 1,
219
+ backgroundColor: 'rgba(0,0,0,0.5)',
220
+ justifyContent: 'flex-end',
221
+ },
222
+ backdropTouch: {
223
+ flex: 1,
224
+ },
225
+ sheetContainer: {
226
+ height: '80%',
227
+ borderTopLeftRadius: 20,
228
+ borderTopRightRadius: 20,
229
+ overflow: 'hidden',
230
+ },
231
+ handleContainer: {
232
+ alignItems: 'center',
233
+ paddingTop: 12,
234
+ paddingBottom: 8,
235
+ },
236
+ handleBar: {
237
+ width: 40,
238
+ height: 4,
239
+ borderRadius: 2,
240
+ },
241
+ header: {
242
+ flexDirection: 'row',
243
+ alignItems: 'center',
244
+ justifyContent: 'space-between',
245
+ paddingHorizontal: 20,
246
+ paddingVertical: 12,
247
+ },
248
+ title: {
249
+ fontSize: 20,
250
+ fontWeight: '700',
251
+ },
252
+ centerContainer: {
253
+ flex: 1,
254
+ alignItems: 'center',
255
+ justifyContent: 'center',
256
+ },
257
+ emptyContainer: {
258
+ flex: 1,
259
+ alignItems: 'center',
260
+ justifyContent: 'center',
261
+ padding: 24,
262
+ paddingBottom: 40,
263
+ },
264
+ emptyText: {
265
+ fontSize: 16,
266
+ marginTop: 16,
267
+ },
268
+ errorText: {
269
+ fontSize: 16,
270
+ marginTop: 16,
271
+ textAlign: 'center',
272
+ },
273
+ retryButton: {
274
+ marginTop: 12,
275
+ paddingHorizontal: 16,
276
+ paddingVertical: 8,
277
+ },
278
+ retryText: {
279
+ fontSize: 15,
280
+ fontWeight: '600',
281
+ },
282
+ listContent: {
283
+ flex: 1,
284
+ padding: 16,
285
+ },
286
+ notificationItem: {
287
+ flexDirection: 'row',
288
+ alignItems: 'flex-start',
289
+ padding: 12,
290
+ borderRadius: 12,
291
+ borderWidth: 1,
292
+ marginBottom: 12,
293
+ },
294
+ iconCircle: {
295
+ width: 40,
296
+ height: 40,
297
+ borderRadius: 20,
298
+ alignItems: 'center',
299
+ justifyContent: 'center',
300
+ },
301
+ itemTextContainer: {
302
+ flex: 1,
303
+ marginLeft: 12,
304
+ },
305
+ itemTitleRow: {
306
+ flexDirection: 'row',
307
+ justifyContent: 'space-between',
308
+ alignItems: 'center',
309
+ },
310
+ itemTitle: {
311
+ fontSize: 14,
312
+ fontWeight: '600',
313
+ flex: 1,
314
+ },
315
+ itemDate: {
316
+ fontSize: 12,
317
+ marginLeft: 8,
318
+ },
319
+ itemBody: {
320
+ fontSize: 13,
321
+ marginTop: 4,
322
+ lineHeight: 18,
323
+ },
324
+ });
@@ -0,0 +1,64 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import { View, TouchableOpacity, StyleSheet } from 'react-native';
3
+ import { FeeddoIcon } from './FeeddoIcon';
4
+ import { FeeddoTheme } from '../../theme/FeeddoTheme';
5
+
6
+ interface RatingWidgetProps {
7
+ initialRating?: number;
8
+ onRatingChanged: (rating: number) => void;
9
+ readOnly?: boolean;
10
+ theme?: FeeddoTheme;
11
+ }
12
+
13
+ export const RatingWidget: React.FC<RatingWidgetProps> = ({
14
+ initialRating = 0,
15
+ onRatingChanged,
16
+ readOnly = false,
17
+ theme,
18
+ }) => {
19
+ const [currentRating, setCurrentRating] = useState(initialRating);
20
+
21
+ useEffect(() => {
22
+ setCurrentRating(initialRating);
23
+ }, [initialRating]);
24
+
25
+ const handlePress = (rating: number) => {
26
+ if (readOnly) return;
27
+ setCurrentRating(rating);
28
+ onRatingChanged(rating);
29
+ };
30
+
31
+ return (
32
+ <View style={styles.container}>
33
+ {[1, 2, 3, 4, 5].map((starIndex) => {
34
+ const isFilled = starIndex <= currentRating;
35
+ return (
36
+ <TouchableOpacity
37
+ key={starIndex}
38
+ disabled={readOnly}
39
+ onPress={() => handlePress(starIndex)}
40
+ style={styles.starButton}
41
+ activeOpacity={0.7}
42
+ >
43
+ <FeeddoIcon
44
+ name={isFilled ? 'star' : 'star_border'}
45
+ size={26}
46
+ color="#F59E0B"
47
+ />
48
+ </TouchableOpacity>
49
+ );
50
+ })}
51
+ </View>
52
+ );
53
+ };
54
+
55
+ const styles = StyleSheet.create({
56
+ container: {
57
+ flexDirection: 'row',
58
+ alignItems: 'center',
59
+ justifyContent: 'center',
60
+ },
61
+ starButton: {
62
+ padding: 4,
63
+ },
64
+ });
@@ -0,0 +1,259 @@
1
+ import React from 'react';
2
+ import { View, Text, StyleSheet, TouchableOpacity } from 'react-native';
3
+ import { Task } from '../../models/Task';
4
+ import { FeeddoTheme } from '../../theme/FeeddoTheme';
5
+ import { FeeddoIcon } from './FeeddoIcon';
6
+
7
+ interface TaskCardProps {
8
+ task: Task;
9
+ onTap: () => void;
10
+ onVote?: (voteType: 'up' | 'remove') => void;
11
+ theme: FeeddoTheme;
12
+ }
13
+
14
+ export const TaskCard: React.FC<TaskCardProps> = ({
15
+ task,
16
+ onTap,
17
+ onVote,
18
+ theme,
19
+ }) => {
20
+ const isUpvoted = task.myVote === 'up';
21
+
22
+ const formatCount = (count: number): string => {
23
+ if (Math.abs(count) >= 1000) {
24
+ return `${(count / 1000).toFixed(1)}k`;
25
+ }
26
+ return count.toString();
27
+ };
28
+
29
+ const getStatusColor = (status: string): string => {
30
+ switch (status.toLowerCase()) {
31
+ case 'completed':
32
+ case 'done':
33
+ return theme.colors.success;
34
+ case 'in_progress':
35
+ case 'progress':
36
+ return theme.colors.primary;
37
+ case 'closed':
38
+ return theme.colors.textSecondary;
39
+ default:
40
+ return '#F59E0B'; // Open/Todo/Pending
41
+ }
42
+ };
43
+
44
+ const formatStatus = (status: string): string => {
45
+ return status
46
+ .split('_')
47
+ .map((w) => (w.length > 0 ? w[0].toUpperCase() + w.substring(1) : ''))
48
+ .join(' ');
49
+ };
50
+
51
+ const isBug = task.type === 'bug';
52
+ const statusColor = getStatusColor(task.status);
53
+
54
+ return (
55
+ <TouchableOpacity
56
+ activeOpacity={0.8}
57
+ onPress={onTap}
58
+ style={[
59
+ styles.cardContainer,
60
+ {
61
+ backgroundColor: theme.colors.cardBackground,
62
+ borderColor: theme.colors.border,
63
+ },
64
+ ]}
65
+ >
66
+ <View style={styles.cardContent}>
67
+ {/* Voting column */}
68
+ <TouchableOpacity
69
+ activeOpacity={0.7}
70
+ disabled={!onVote}
71
+ onPress={() => onVote?.(isUpvoted ? 'remove' : 'up')}
72
+ style={[
73
+ styles.voteColumn,
74
+ {
75
+ backgroundColor: theme.colors.background,
76
+ borderColor: isUpvoted ? theme.colors.primary : theme.colors.border,
77
+ },
78
+ ]}
79
+ >
80
+ <FeeddoIcon
81
+ name="arrow_up"
82
+ size={18}
83
+ color={isUpvoted ? theme.colors.primary : theme.colors.textSecondary}
84
+ />
85
+ <Text
86
+ style={[
87
+ styles.voteCount,
88
+ {
89
+ color: isUpvoted ? theme.colors.primary : theme.colors.cardText,
90
+ },
91
+ ]}
92
+ >
93
+ {formatCount(task.upvoteCount)}
94
+ </Text>
95
+ </TouchableOpacity>
96
+
97
+ {/* Content column */}
98
+ <View style={styles.detailsColumn}>
99
+ {/* Header: Type + Status */}
100
+ <View style={styles.headerRow}>
101
+ {/* Type badge */}
102
+ <View
103
+ style={[
104
+ styles.typeBadge,
105
+ {
106
+ backgroundColor: isBug
107
+ ? 'rgba(239, 68, 68, 0.12)'
108
+ : 'rgba(245, 158, 11, 0.12)',
109
+ },
110
+ ]}
111
+ >
112
+ <FeeddoIcon
113
+ name={isBug ? 'bug' : 'lightbulb'}
114
+ size={12}
115
+ color={isBug ? theme.colors.error : '#F59E0B'}
116
+ />
117
+ <Text
118
+ style={[
119
+ styles.typeBadgeText,
120
+ { color: isBug ? theme.colors.error : '#D97706' },
121
+ ]}
122
+ >
123
+ {isBug ? 'Bug Report' : 'Feature'}
124
+ </Text>
125
+ </View>
126
+
127
+ {/* Status badge */}
128
+ <View
129
+ style={[
130
+ styles.statusBadge,
131
+ {
132
+ backgroundColor: theme.colors.surface,
133
+ borderColor: `${statusColor}40`,
134
+ },
135
+ ]}
136
+ >
137
+ <View style={[styles.statusDot, { backgroundColor: statusColor }]} />
138
+ <Text style={[styles.statusText, { color: theme.colors.textSecondary }]}>
139
+ {formatStatus(task.status)}
140
+ </Text>
141
+ </View>
142
+ </View>
143
+
144
+ {/* Title */}
145
+ <Text style={[styles.title, { color: theme.colors.cardText }]}>
146
+ {task.title}
147
+ </Text>
148
+
149
+ {/* Description */}
150
+ {Boolean(task.description) && (
151
+ <Text style={[styles.description, { color: theme.colors.textSecondary }]}>
152
+ {task.description}
153
+ </Text>
154
+ )}
155
+
156
+ {/* Footer: Comments */}
157
+ <View style={styles.footerRow}>
158
+ <FeeddoIcon name="chat" size={13} color={theme.colors.textSecondary} />
159
+ <Text style={[styles.commentCountText, { color: theme.colors.textSecondary }]}>
160
+ {`${task.commentCount} comments`}
161
+ </Text>
162
+ </View>
163
+ </View>
164
+ </View>
165
+ </TouchableOpacity>
166
+ );
167
+ };
168
+
169
+ const styles = StyleSheet.create({
170
+ cardContainer: {
171
+ borderRadius: 16,
172
+ borderWidth: 1,
173
+ marginVertical: 6,
174
+ shadowColor: '#000',
175
+ shadowOffset: { width: 0, height: 2 },
176
+ shadowOpacity: 0.04,
177
+ shadowRadius: 8,
178
+ elevation: 2,
179
+ },
180
+ cardContent: {
181
+ flexDirection: 'row',
182
+ padding: 16,
183
+ },
184
+ voteColumn: {
185
+ alignItems: 'center',
186
+ justifyContent: 'center',
187
+ paddingVertical: 8,
188
+ paddingHorizontal: 10,
189
+ borderRadius: 12,
190
+ borderWidth: 1,
191
+ alignSelf: 'flex-start',
192
+ minWidth: 44,
193
+ },
194
+ voteCount: {
195
+ fontSize: 13,
196
+ fontWeight: '700',
197
+ marginTop: 2,
198
+ },
199
+ detailsColumn: {
200
+ flex: 1,
201
+ marginLeft: 14,
202
+ },
203
+ headerRow: {
204
+ flexDirection: 'row',
205
+ justifyContent: 'space-between',
206
+ alignItems: 'center',
207
+ },
208
+ typeBadge: {
209
+ flexDirection: 'row',
210
+ alignItems: 'center',
211
+ paddingHorizontal: 8,
212
+ paddingVertical: 3,
213
+ borderRadius: 6,
214
+ },
215
+ typeBadgeText: {
216
+ fontSize: 11,
217
+ fontWeight: '600',
218
+ marginLeft: 4,
219
+ },
220
+ statusBadge: {
221
+ flexDirection: 'row',
222
+ alignItems: 'center',
223
+ paddingHorizontal: 8,
224
+ paddingVertical: 3,
225
+ borderRadius: 20,
226
+ borderWidth: 1,
227
+ },
228
+ statusDot: {
229
+ width: 6,
230
+ height: 6,
231
+ borderRadius: 3,
232
+ },
233
+ statusText: {
234
+ fontSize: 11,
235
+ fontWeight: '600',
236
+ marginLeft: 6,
237
+ },
238
+ title: {
239
+ fontSize: 15,
240
+ fontWeight: '700',
241
+ marginTop: 8,
242
+ lineHeight: 20,
243
+ },
244
+ description: {
245
+ fontSize: 13,
246
+ marginTop: 4,
247
+ lineHeight: 18,
248
+ },
249
+ footerRow: {
250
+ flexDirection: 'row',
251
+ alignItems: 'center',
252
+ marginTop: 10,
253
+ },
254
+ commentCountText: {
255
+ fontSize: 12,
256
+ fontWeight: '500',
257
+ marginLeft: 6,
258
+ },
259
+ });