@suflon/rnmd-reporting 0.0.1

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 (39) hide show
  1. package/App.tsx +69 -0
  2. package/README.md +97 -0
  3. package/app.json +4 -0
  4. package/babel.config.js +18 -0
  5. package/global.css +143 -0
  6. package/index.js +9 -0
  7. package/metro.config.js +209 -0
  8. package/nativewind-env.d.ts +1 -0
  9. package/package.json +106 -0
  10. package/patches/@react-navigation+stack+7.6.16.patch +11 -0
  11. package/patches/@suflon+native-ui+0.0.18.patch +26020 -0
  12. package/patches/react-native+0.83.1.patch +52 -0
  13. package/react-native.config.js +27 -0
  14. package/scripts/fix-suflon-native-ui.js +25 -0
  15. package/scripts/link-react-native-pnpm.js +42 -0
  16. package/src/config/index.ts +10 -0
  17. package/src/context/ConnectionI18nContext.tsx +61 -0
  18. package/src/modules/Reporting/component/README.md +3 -0
  19. package/src/modules/Reporting/component/ReportChart.tsx +882 -0
  20. package/src/modules/Reporting/component/ReportFilterModal.tsx +403 -0
  21. package/src/modules/Reporting/component/ReportingDetail.tsx +481 -0
  22. package/src/modules/Reporting/index.tsx +239 -0
  23. package/src/modules/Reporting/utils.tsx +14 -0
  24. package/src/navigation/index.tsx +31 -0
  25. package/src/screens/ConnectionListScreen.tsx +471 -0
  26. package/src/screens/DevToolsCorner.tsx +810 -0
  27. package/src/screens/NewConnectionModal.tsx +282 -0
  28. package/src/services/ApiService.ts +22 -0
  29. package/src/services/ConnectionService.ts +81 -0
  30. package/src/services/api.ts +83 -0
  31. package/src/stores/connection.store.ts +3 -0
  32. package/src/stores/language.store.ts +54 -0
  33. package/src/theme/colors.ts +56 -0
  34. package/src/types/connection.ts +69 -0
  35. package/src/utils/AsyncStorageUtils.ts +56 -0
  36. package/src/utils/connectionStrings.ts +158 -0
  37. package/src/utils/errorMessage.ts +11 -0
  38. package/tailwind.config.js +196 -0
  39. package/tsconfig.json +25 -0
@@ -0,0 +1,56 @@
1
+ const memoryFallback = new Map<string, string>();
2
+
3
+ function getAsyncStorage(): typeof import('@react-native-async-storage/async-storage').default | null {
4
+ try {
5
+ return require('@react-native-async-storage/async-storage').default;
6
+ } catch {
7
+ return null;
8
+ }
9
+ }
10
+
11
+ export const saveData = async (key: string, value: unknown): Promise<void> => {
12
+ const str = JSON.stringify(value);
13
+ memoryFallback.set(key, str);
14
+ const AS = getAsyncStorage();
15
+ try {
16
+ if (AS) await AS.setItem(key, str);
17
+ } catch (error) {
18
+ console.warn('Error saving data:', error);
19
+ }
20
+ };
21
+
22
+ export const getData = async <T>(key: string): Promise<T | string | null> => {
23
+ const AS = getAsyncStorage();
24
+ try {
25
+ let value: string | null = null;
26
+ if (AS) value = await AS.getItem(key);
27
+ if (value === null) value = memoryFallback.get(key) ?? null;
28
+ if (value === null) return null;
29
+ try {
30
+ return JSON.parse(value) as T;
31
+ } catch {
32
+ return value;
33
+ }
34
+ } catch (error) {
35
+ console.warn('Error getting data:', error);
36
+ const fromMem = memoryFallback.get(key);
37
+ if (fromMem != null) {
38
+ try {
39
+ return JSON.parse(fromMem) as T;
40
+ } catch {
41
+ return fromMem;
42
+ }
43
+ }
44
+ return null;
45
+ }
46
+ };
47
+
48
+ export const removeData = async (key: string): Promise<void> => {
49
+ memoryFallback.delete(key);
50
+ const AS = getAsyncStorage();
51
+ try {
52
+ if (AS) await AS.removeItem(key);
53
+ } catch (error) {
54
+ console.warn('Error removing data:', error);
55
+ }
56
+ };
@@ -0,0 +1,158 @@
1
+ import type { LanguageCode } from '@/stores/language.store';
2
+
3
+ export const CONNECTION_STRINGS: Record<LanguageCode, Record<string, string>> = {
4
+ en: {
5
+ title: 'Company Connections',
6
+ searchPlaceholder: 'Search connections...',
7
+ create: 'Create',
8
+ loading: 'Loading connections...',
9
+ from: 'From:',
10
+ requestedAt: 'Requested At',
11
+ direction: 'Direction',
12
+ cancel: 'Cancel',
13
+ disconnect: 'Disconnect',
14
+ accept: 'Accept',
15
+ reject: 'Reject',
16
+ view: 'View',
17
+ filterConnections: 'Filter connections',
18
+ filter: 'Filter:',
19
+ status: 'Status',
20
+ allStatuses: 'All statuses',
21
+ allDirections: 'All directions',
22
+ clear: 'Clear',
23
+ apply: 'Apply',
24
+ showingCount: 'Showing {{count}} connections',
25
+ noConnections: 'No connections found',
26
+ incoming: 'INCOMING',
27
+ outgoing: 'OUTGOING',
28
+ // New Connection modal
29
+ newConnection: 'New Connection',
30
+ companyRegNumber: 'Company Registration Number',
31
+ searchCompanyPlaceholder: 'Search Company By ID',
32
+ search: 'Search',
33
+ resultsValidated: '*Results are validated against corporate registry.',
34
+ searching: 'Searching...',
35
+ profileFound: 'Profile Found',
36
+ verified: 'Verified',
37
+ regId: 'Reg ID',
38
+ email: 'Email',
39
+ phone: 'Phone',
40
+ location: 'Location',
41
+ clearSelection: 'Clear Selection',
42
+ professionalMessage: 'Professional Message (Optional)',
43
+ messagePlaceholder: 'Enter a brief message...',
44
+ sendRequest: 'Send Request',
45
+ sending: 'Sending...',
46
+ yes: 'Yes',
47
+ confirmTitle: 'Confirm Action',
48
+ disconnectConfirm: 'Do you really want to disconnect this connection?',
49
+ cancelConfirm: 'Do you really want to cancel this connection?',
50
+ rejectConfirm: 'Do you really want to reject this connection?',
51
+ acceptConfirm: 'Do you really want to accept this connection?',
52
+ },
53
+ hi: {
54
+ title: 'कंपनी कनेक्शन',
55
+ searchPlaceholder: 'कनेक्शन खोजें...',
56
+ create: 'बनाएं',
57
+ loading: 'कनेक्शन लोड हो रहे हैं...',
58
+ from: 'से:',
59
+ requestedAt: 'अनुरोध तिथि',
60
+ direction: 'दिशा',
61
+ cancel: 'रद्द करें',
62
+ disconnect: 'डिस्कनेक्ट',
63
+ accept: 'स्वीकार करें',
64
+ reject: 'अस्वीकार करें',
65
+ view: 'देखें',
66
+ filterConnections: 'कनेक्शन फ़िल्टर करें',
67
+ filter: 'फ़िल्टर:',
68
+ status: 'स्थिति',
69
+ allStatuses: 'सभी स्थितियां',
70
+ allDirections: 'सभी दिशाएं',
71
+ clear: 'साफ़ करें',
72
+ apply: 'लागू करें',
73
+ showingCount: '{{count}} कनेक्शन दिख रहे हैं',
74
+ noConnections: 'कोई कनेक्शन नहीं मिला',
75
+ incoming: 'आने वाला',
76
+ outgoing: 'जाने वाला',
77
+ newConnection: 'नया कनेक्शन',
78
+ companyRegNumber: 'कंपनी पंजीकरण संख्या',
79
+ searchCompanyPlaceholder: 'कंपनी आईडी द्वारा खोजें',
80
+ search: 'खोजें',
81
+ resultsValidated: '*परिणाम कॉर्पोरेट रजिस्ट्री के विरुद्ध सत्यापित हैं।',
82
+ searching: 'खोज रहे हैं...',
83
+ profileFound: 'प्रोफाइल मिली',
84
+ verified: 'सत्यापित',
85
+ regId: 'रजिस्ट्रेशन आईडी',
86
+ email: 'ईमेल',
87
+ phone: 'फ़ोन',
88
+ location: 'स्थान',
89
+ clearSelection: 'चयन साफ़ करें',
90
+ professionalMessage: 'पेशेवर संदेश (वैकल्पिक)',
91
+ messagePlaceholder: 'संक्षिप्त संदेश लिखें...',
92
+ sendRequest: 'अनुरोध भेजें',
93
+ sending: 'भेज रहे हैं...',
94
+ yes: 'हां',
95
+ confirmTitle: 'कार्रवाई की पुष्टि करें',
96
+ disconnectConfirm: 'क्या आप सचमुच इस कनेक्शन को डिस्कनेक्ट करना चाहते हैं?',
97
+ cancelConfirm: 'क्या आप सचमुच इस कनेक्शन को रद्द करना चाहते हैं?',
98
+ rejectConfirm: 'क्या आप सचमुच इस कनेक्शन को अस्वीकार करना चाहते हैं?',
99
+ acceptConfirm: 'क्या आप सचमुच इस कनेक्शन को स्वीकार करना चाहते हैं?',
100
+ },
101
+ ar: {
102
+ title: 'روابط الشركة',
103
+ searchPlaceholder: 'البحث عن الروابط...',
104
+ create: 'إنشاء',
105
+ loading: 'جاري تحميل الروابط...',
106
+ from: 'من:',
107
+ requestedAt: 'تاريخ الطلب',
108
+ direction: 'الاتجاه',
109
+ cancel: 'إلغاء',
110
+ disconnect: 'قطع الاتصال',
111
+ accept: 'قبول',
112
+ reject: 'رفض',
113
+ view: 'عرض',
114
+ filterConnections: 'تصفية الروابط',
115
+ filter: 'تصفية:',
116
+ status: 'الحالة',
117
+ allStatuses: 'جميع الحالات',
118
+ allDirections: 'جميع الاتجاهات',
119
+ clear: 'مسح',
120
+ apply: 'تطبيق',
121
+ showingCount: 'عرض {{count}} روابط',
122
+ noConnections: 'لم يتم العثور على روابط',
123
+ incoming: 'وارد',
124
+ outgoing: 'صادر',
125
+ newConnection: 'اتصال جديد',
126
+ companyRegNumber: 'رقم تسجيل الشركة',
127
+ searchCompanyPlaceholder: 'البحث عن الشركة حسب المعرف',
128
+ search: 'بحث',
129
+ resultsValidated: '*يتم التحقق من النتائج مقابل السجل التجاري.',
130
+ searching: 'جاري البحث...',
131
+ profileFound: 'تم العثور على الملف',
132
+ verified: 'موثق',
133
+ regId: 'رقم التسجيل',
134
+ email: 'البريد الإلكتروني',
135
+ phone: 'الهاتف',
136
+ location: 'الموقع',
137
+ clearSelection: 'مسح الاختيار',
138
+ professionalMessage: 'رسالة مهنية (اختياري)',
139
+ messagePlaceholder: 'أدخل رسالة موجزة...',
140
+ sendRequest: 'إرسال الطلب',
141
+ sending: 'جاري الإرسال...',
142
+ yes: 'نعم',
143
+ confirmTitle: 'تأكيد الإجراء',
144
+ disconnectConfirm: 'هل تريد حقًا قطع هذا الاتصال؟',
145
+ cancelConfirm: 'هل تريد حقًا إلغاء هذا الاتصال؟',
146
+ rejectConfirm: 'هل تريد حقًا رفض هذا الاتصال؟',
147
+ acceptConfirm: 'هل تريد حقًا قبول هذا الاتصال؟',
148
+ },
149
+ };
150
+
151
+ export function getConnectionT(lang: LanguageCode) {
152
+ const strings = CONNECTION_STRINGS[lang] ?? CONNECTION_STRINGS.en;
153
+ return (key: string, params?: { count?: number }) => {
154
+ let s = strings[key] ?? CONNECTION_STRINGS.en[key] ?? key;
155
+ if (params?.count != null) s = s.replace('{{count}}', String(params.count));
156
+ return s;
157
+ };
158
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Get user-facing message from API error (e.g. Axios).
3
+ * Prefers backend `detail` or `message`, falls back to err.message.
4
+ */
5
+ export function getBackendMessage(err: any): string {
6
+ const detail = err?.response?.data?.detail;
7
+ if (typeof detail === 'string') return detail;
8
+ const msg = err?.response?.data?.message;
9
+ if (typeof msg === 'string') return msg;
10
+ return err?.message || 'Something went wrong';
11
+ }
@@ -0,0 +1,196 @@
1
+ /** @type {import('tailwindcss').Config} */
2
+ module.exports = {
3
+ content: [
4
+ './src/**/*.{js,jsx,ts,tsx}',
5
+ './App.{js,jsx,ts,tsx}',
6
+ './node_modules/@suflon/native-ui/**/*.{js,jsx,ts,tsx}',
7
+ ],
8
+ presets: [require('nativewind/preset')],
9
+ theme: {
10
+ extend: {
11
+ colors: {
12
+ brand: {
13
+ 50: '#f5f3ff',
14
+ 100: '#ede9fe',
15
+ 200: '#ddd6fe',
16
+ 400: '#a78bfa',
17
+ 500: '#8b5cf6',
18
+ 600: '#7c3aed',
19
+ 700: '#6d28d9',
20
+ 900: '#4c1d95',
21
+ DEFAULT: '#7c3aed',
22
+ },
23
+ slate: {
24
+ 50: '#f8fafc',
25
+ 100: '#f1f5f9',
26
+ 200: '#e2e8f0',
27
+ 300: '#cbd5e1',
28
+ 400: '#94a3b8',
29
+ 500: '#64748b',
30
+ 600: '#475569',
31
+ 700: '#334155',
32
+ 800: '#1e293b',
33
+ 900: '#0f172a',
34
+ 950: '#020617',
35
+ },
36
+ emerald: {
37
+ 50: '#ecfdf5',
38
+ 100: '#d1fae5',
39
+ 500: '#10b981',
40
+ 600: '#059669',
41
+ 700: '#047857',
42
+ 800: '#065f46',
43
+ },
44
+ amber: {
45
+ 50: '#fffbeb',
46
+ 100: '#fef3c7',
47
+ 500: '#f59e0b',
48
+ 800: '#92400e',
49
+ },
50
+ rose: {
51
+ 100: '#ffe4e6',
52
+ 500: '#f43f5e',
53
+ 800: '#9f1239',
54
+ },
55
+ },
56
+ },
57
+ colors: {
58
+ orange: '#FFA851',
59
+ primary: '#7E43FF',
60
+ secondary: '#999999',
61
+ brand: {
62
+ 50: '#f5f3ff',
63
+ 100: '#ede9fe',
64
+ 200: '#ddd6fe',
65
+ 400: '#a78bfa',
66
+ 500: '#8b5cf6',
67
+ 600: '#7c3aed',
68
+ 700: '#6d28d9',
69
+ 900: '#4c1d95',
70
+ DEFAULT: '#7c3aed',
71
+ },
72
+ slate: {
73
+ 50: '#f8fafc',
74
+ 100: '#f1f5f9',
75
+ 200: '#e2e8f0',
76
+ 300: '#cbd5e1',
77
+ 400: '#94a3b8',
78
+ 500: '#64748b',
79
+ 600: '#475569',
80
+ 700: '#334155',
81
+ 800: '#1e293b',
82
+ 900: '#0f172a',
83
+ 950: '#020617',
84
+ },
85
+ emerald: {
86
+ 50: '#ecfdf5',
87
+ 100: '#d1fae5',
88
+ 500: '#10b981',
89
+ 600: '#059669',
90
+ 700: '#047857',
91
+ 800: '#065f46',
92
+ },
93
+ amber: {
94
+ 50: '#fffbeb',
95
+ 100: '#fef3c7',
96
+ 500: '#f59e0b',
97
+ 800: '#92400e',
98
+ },
99
+ rose: {
100
+ 100: '#ffe4e6',
101
+ 500: '#f43f5e',
102
+ 800: '#9f1239',
103
+ },
104
+ green: {
105
+ DEFAULT: '#008E59',
106
+ 100: '#dcfce7',
107
+ 400: '#4ade80',
108
+ 700: '#15803d',
109
+ 900: '#14532d',
110
+ },
111
+ yellow: {
112
+ 100: '#fef9c3',
113
+ 400: '#facc15',
114
+ 800: '#854d0e',
115
+ 900: '#713f12',
116
+ },
117
+ blue: {
118
+ 100: '#dbeafe',
119
+ 400: '#60a5fa',
120
+ 700: '#1d4ed8',
121
+ 900: '#1e3a8a',
122
+ },
123
+ red: {
124
+ 100: '#fee2e2',
125
+ 400: '#f87171',
126
+ 700: '#b91c1c',
127
+ 900: '#7f1d1d',
128
+ },
129
+ violet: {
130
+ 50: '#f5f3ff',
131
+ 100: '#ede9fe',
132
+ 200: '#ddd6fe',
133
+ 600: '#7c3aed',
134
+ 700: '#6d28d9',
135
+ DEFAULT: '#7E43FF',
136
+ },
137
+ pink: {
138
+ 50: '#fdf2f8',
139
+ 600: '#db2777',
140
+ },
141
+ gray: {
142
+ 50: '#f9fafb',
143
+ 100: '#f3f4f6',
144
+ 200: '#e5e7eb',
145
+ 300: '#d1d5db',
146
+ 500: '#6b7280',
147
+ 700: '#374151',
148
+ 800: '#1f2937',
149
+ 900: '#111827',
150
+ },
151
+ background: {
152
+ red: '#E53935',
153
+ blue: '#1A7EE6',
154
+ indigo: '#263446',
155
+ violet: '#7E43FF',
156
+ light: '#FFFFFF',
157
+ darkBg: '#000000',
158
+ secondaryBg: '#F2F2F7',
159
+ darkSecondaryBg: '#1C1C1E',
160
+ darkGray: '#424242',
161
+ lightGray: '#EBEBEB',
162
+ lightBlack: '#141518',
163
+ lightBlue: '#f6f8ff',
164
+ lightPink: '#FFEDF8',
165
+ lightGreen: '#90EE90',
166
+ lightYellow: '#FFFDA5',
167
+ lightOrange: '#FFD3BB',
168
+ darkBlue: '#EBF5FF',
169
+ darkGreen: '#008E59',
170
+ },
171
+ text: {
172
+ light: {
173
+ green: '#90EE90',
174
+ primary: '#000000',
175
+ secondary: '#999999',
176
+ gray: '#424242',
177
+ white: '#ffffff',
178
+ secondaryText: '#007AFF',
179
+ link: '#007bff',
180
+ subHeading: '#817F85',
181
+ red: '#CA0B00',
182
+ violet: '#7E43FF',
183
+ blue: '#007AFF',
184
+ },
185
+ dark: {
186
+ primary: '#FFFFFF',
187
+ secondary: '#C7C7CC',
188
+ link: '#EEEEEE',
189
+ subHeading: '#888888',
190
+ red: '#CA0B00',
191
+ },
192
+ },
193
+ },
194
+ },
195
+ plugins: [],
196
+ };
package/tsconfig.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "extends": "./node_modules/@react-native/typescript-config/tsconfig.json",
3
+ "compilerOptions": {
4
+ "baseUrl": ".",
5
+ "jsx": "react",
6
+ "esModuleInterop": true,
7
+ "skipLibCheck": true,
8
+ "paths": {
9
+ "@/*": [
10
+ "src/*"
11
+ ],
12
+ "@suflon/native-ui": [
13
+ "node_modules/@suflon/native-ui/src/index.ts"
14
+ ],
15
+ "@suflon/native-ui/*": [
16
+ "node_modules/@suflon/native-ui/src/*"
17
+ ]
18
+ }
19
+ },
20
+ "include": [
21
+ "**/*.ts",
22
+ "**/*.tsx",
23
+ "nativewind-env.d.ts"
24
+ ]
25
+ }