@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.
- package/App.tsx +69 -0
- package/README.md +97 -0
- package/app.json +4 -0
- package/babel.config.js +18 -0
- package/global.css +143 -0
- package/index.js +9 -0
- package/metro.config.js +209 -0
- package/nativewind-env.d.ts +1 -0
- package/package.json +106 -0
- package/patches/@react-navigation+stack+7.6.16.patch +11 -0
- package/patches/@suflon+native-ui+0.0.18.patch +26020 -0
- package/patches/react-native+0.83.1.patch +52 -0
- package/react-native.config.js +27 -0
- package/scripts/fix-suflon-native-ui.js +25 -0
- package/scripts/link-react-native-pnpm.js +42 -0
- package/src/config/index.ts +10 -0
- package/src/context/ConnectionI18nContext.tsx +61 -0
- package/src/modules/Reporting/component/README.md +3 -0
- package/src/modules/Reporting/component/ReportChart.tsx +882 -0
- package/src/modules/Reporting/component/ReportFilterModal.tsx +403 -0
- package/src/modules/Reporting/component/ReportingDetail.tsx +481 -0
- package/src/modules/Reporting/index.tsx +239 -0
- package/src/modules/Reporting/utils.tsx +14 -0
- package/src/navigation/index.tsx +31 -0
- package/src/screens/ConnectionListScreen.tsx +471 -0
- package/src/screens/DevToolsCorner.tsx +810 -0
- package/src/screens/NewConnectionModal.tsx +282 -0
- package/src/services/ApiService.ts +22 -0
- package/src/services/ConnectionService.ts +81 -0
- package/src/services/api.ts +83 -0
- package/src/stores/connection.store.ts +3 -0
- package/src/stores/language.store.ts +54 -0
- package/src/theme/colors.ts +56 -0
- package/src/types/connection.ts +69 -0
- package/src/utils/AsyncStorageUtils.ts +56 -0
- package/src/utils/connectionStrings.ts +158 -0
- package/src/utils/errorMessage.ts +11 -0
- package/tailwind.config.js +196 -0
- package/tsconfig.json +25 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
diff --git a/node_modules/react-native/Libraries/NativeComponent/ViewConfigIgnore.js b/node_modules/react-native/Libraries/NativeComponent/ViewConfigIgnore.js
|
|
2
|
+
index 155b1bf..471b52d 100644
|
|
3
|
+
--- a/node_modules/react-native/Libraries/NativeComponent/ViewConfigIgnore.js
|
|
4
|
+
+++ b/node_modules/react-native/Libraries/NativeComponent/ViewConfigIgnore.js
|
|
5
|
+
@@ -10,13 +10,13 @@
|
|
6
|
+
|
|
7
|
+
import Platform from '../Utilities/Platform';
|
|
8
|
+
|
|
9
|
+
-const ignoredViewConfigProps = new WeakSet<{...}>();
|
|
10
|
+
+const ignoredViewConfigProps = new WeakSet();
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Decorates ViewConfig values that are dynamically injected by the library,
|
|
14
|
+
* react-native-gesture-handler. (T45765076)
|
|
15
|
+
*/
|
|
16
|
+
-export function DynamicallyInjectedByGestureHandler<T: {...}>(object: T): T {
|
|
17
|
+
+export function DynamicallyInjectedByGestureHandler(object) {
|
|
18
|
+
ignoredViewConfigProps.add(object);
|
|
19
|
+
return object;
|
|
20
|
+
}
|
|
21
|
+
@@ -34,16 +34,14 @@ export function DynamicallyInjectedByGestureHandler<T: {...}>(object: T): T {
|
|
22
|
+
*
|
|
23
|
+
* TODO(T110872225): Remove this logic, after achieving platform-consistency
|
|
24
|
+
*/
|
|
25
|
+
-export function ConditionallyIgnoredEventHandlers<
|
|
26
|
+
- const T: {+[name: string]: true},
|
|
27
|
+
->(value: T): T | void {
|
|
28
|
+
+export function ConditionallyIgnoredEventHandlers(value) {
|
|
29
|
+
if (Platform.OS === 'ios') {
|
|
30
|
+
return value;
|
|
31
|
+
}
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
-export function isIgnored(value: mixed): boolean {
|
|
36
|
+
+export function isIgnored(value) {
|
|
37
|
+
if (typeof value === 'object' && value != null) {
|
|
38
|
+
return ignoredViewConfigProps.has(value);
|
|
39
|
+
}
|
|
40
|
+
diff --git a/node_modules/react-native/ReactCommon/react/renderer/core/graphicsConversions.h b/node_modules/react-native/ReactCommon/react/renderer/core/graphicsConversions.h
|
|
41
|
+
index ccc6510..8650fcf 100644
|
|
42
|
+
--- a/node_modules/react-native/ReactCommon/react/renderer/core/graphicsConversions.h
|
|
43
|
+
+++ b/node_modules/react-native/ReactCommon/react/renderer/core/graphicsConversions.h
|
|
44
|
+
@@ -68,7 +68,7 @@ inline folly::dynamic toDynamic(const YGValue &dimension)
|
|
45
|
+
case YGUnitPoint:
|
|
46
|
+
return dimension.value;
|
|
47
|
+
case YGUnitPercent:
|
|
48
|
+
- return std::format("{}%", dimension.value);
|
|
49
|
+
+ return std::to_string(dimension.value) + "%";
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return nullptr;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @suflon/native-ui is a JS-only component library (no native Android/iOS code).
|
|
3
|
+
* Exclude it from autolinking so React Native config doesn't try to parse its
|
|
4
|
+
* android/ folder (which is an app template, not a native module).
|
|
5
|
+
*
|
|
6
|
+
* react-native-vector-icons: fonts are linked so icons (back, search, filter, chevron) render.
|
|
7
|
+
*/
|
|
8
|
+
const path = require('path');
|
|
9
|
+
|
|
10
|
+
module.exports = {
|
|
11
|
+
dependency: {
|
|
12
|
+
platforms: {
|
|
13
|
+
android: null,
|
|
14
|
+
ios: null,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
project: {
|
|
18
|
+
ios: {},
|
|
19
|
+
android: {},
|
|
20
|
+
},
|
|
21
|
+
dependencies: {
|
|
22
|
+
'@suflon/native-ui': { platforms: { android: null, ios: null } },
|
|
23
|
+
},
|
|
24
|
+
assets: [
|
|
25
|
+
path.resolve(__dirname, 'node_modules/react-native-vector-icons/Fonts'),
|
|
26
|
+
],
|
|
27
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* When @suflon/native-ui is installed without a built lib/ folder,
|
|
3
|
+
* point package.json main/module/types to src/ so Metro and TypeScript can resolve.
|
|
4
|
+
*/
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const fs = require('fs');
|
|
7
|
+
|
|
8
|
+
const pkgDir = path.join(__dirname, '..', 'node_modules', '@suflon', 'native-ui');
|
|
9
|
+
const pkgPath = path.join(pkgDir, 'package.json');
|
|
10
|
+
const libEntry = path.join(pkgDir, 'lib', 'index.js');
|
|
11
|
+
const srcEntry = path.join(pkgDir, 'src', 'index.ts');
|
|
12
|
+
|
|
13
|
+
if (!fs.existsSync(pkgPath)) return;
|
|
14
|
+
|
|
15
|
+
if (fs.existsSync(libEntry)) return; // lib exists, nothing to do
|
|
16
|
+
if (!fs.existsSync(srcEntry)) return; // no src either, leave as-is
|
|
17
|
+
|
|
18
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
19
|
+
if (pkg.main === 'src/index.ts') return; // already fixed
|
|
20
|
+
|
|
21
|
+
pkg.main = 'src/index.ts';
|
|
22
|
+
pkg.module = 'src/index.ts';
|
|
23
|
+
pkg.types = 'src/index.ts';
|
|
24
|
+
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
|
|
25
|
+
console.log('fix-suflon-native-ui: pointed main/module/types to src/ (lib/ missing)');
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* pnpm stores packages in .pnpm; React Native Android build expects
|
|
4
|
+
* node_modules/@react-native/codegen and node_modules/@react-native/gradle-plugin.
|
|
5
|
+
* This script creates symlinks so the build finds them.
|
|
6
|
+
*/
|
|
7
|
+
const fs = require('fs');
|
|
8
|
+
const path = require('path');
|
|
9
|
+
|
|
10
|
+
const nodeModules = path.join(__dirname, '..', 'node_modules');
|
|
11
|
+
const pnpmStore = path.join(nodeModules, '.pnpm');
|
|
12
|
+
const reactNativeScope = path.join(nodeModules, '@react-native');
|
|
13
|
+
|
|
14
|
+
if (!fs.existsSync(pnpmStore)) {
|
|
15
|
+
process.exit(0); // not pnpm, nothing to do
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (!fs.existsSync(reactNativeScope)) {
|
|
19
|
+
fs.mkdirSync(reactNativeScope, { recursive: true });
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const dirs = fs.readdirSync(pnpmStore);
|
|
23
|
+
const codegenDir = dirs.find((d) => d.startsWith('@react-native+codegen@'));
|
|
24
|
+
const gradlePluginDir = dirs.find((d) => d.startsWith('@react-native+gradle-plugin@'));
|
|
25
|
+
|
|
26
|
+
if (codegenDir) {
|
|
27
|
+
const target = path.join(pnpmStore, codegenDir, 'node_modules', '@react-native', 'codegen');
|
|
28
|
+
const link = path.join(reactNativeScope, 'codegen');
|
|
29
|
+
if (fs.existsSync(target) && !fs.existsSync(link)) {
|
|
30
|
+
fs.symlinkSync(path.relative(reactNativeScope, target), link, 'dir');
|
|
31
|
+
console.log('Linked @react-native/codegen for pnpm');
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (gradlePluginDir) {
|
|
36
|
+
const target = path.join(pnpmStore, gradlePluginDir, 'node_modules', '@react-native', 'gradle-plugin');
|
|
37
|
+
const link = path.join(reactNativeScope, 'gradle-plugin');
|
|
38
|
+
if (fs.existsSync(target) && !fs.existsSync(link)) {
|
|
39
|
+
fs.symlinkSync(path.relative(reactNativeScope, target), link, 'dir');
|
|
40
|
+
console.log('Linked @react-native/gradle-plugin for pnpm');
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const BASE_URL = 'http://192.168.1.240/platform/api/online';
|
|
2
|
+
|
|
3
|
+
export const API_ENDPOINTS = {
|
|
4
|
+
getConnections: '/platform/company/connection/',
|
|
5
|
+
createConnectionRequest: '/platform/company/connection/request',
|
|
6
|
+
searchCompany: '/platform/company/by_num/',
|
|
7
|
+
/** Base path for connection actions: append /{id}/accept | reject | cancel | disconnect */
|
|
8
|
+
connectionAction: (id: number, action: 'accept' | 'reject' | 'cancel' | 'disconnect') =>
|
|
9
|
+
`/platform/company/connection/${id}/${action}`,
|
|
10
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React, { createContext, useContext, useMemo, ReactNode } from 'react';
|
|
2
|
+
import type { LanguageCode } from '@/stores/language.store';
|
|
3
|
+
import { useLanguageStore } from '@/stores/language.store';
|
|
4
|
+
import { getConnectionT } from '@/utils/connectionStrings';
|
|
5
|
+
|
|
6
|
+
export type ConnectionT = (key: string, params?: { count?: number }) => string;
|
|
7
|
+
|
|
8
|
+
type ConnectionI18nValue = {
|
|
9
|
+
language: LanguageCode;
|
|
10
|
+
t: ConnectionT;
|
|
11
|
+
/** True when host app provides language (e.g. mdplix_mobileapp); connection package does not change it. */
|
|
12
|
+
controlledByHost: boolean;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const ConnectionI18nContext = createContext<ConnectionI18nValue | null>(null);
|
|
16
|
+
|
|
17
|
+
export type ConnectionI18nProviderProps = {
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
/** When embedded in host app: current language from host (en | hi | ar). */
|
|
20
|
+
language?: LanguageCode;
|
|
21
|
+
/** When embedded: host's translation function for connection keys (e.g. i18n.t('connection.' + key)). */
|
|
22
|
+
getT?: ConnectionT;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Provides language and t() to connection screens.
|
|
27
|
+
* When language + getT are passed (host mode), uses them; otherwise uses internal store + getConnectionT.
|
|
28
|
+
*/
|
|
29
|
+
export function ConnectionI18nProvider({
|
|
30
|
+
children,
|
|
31
|
+
language: hostLanguage,
|
|
32
|
+
getT: hostGetT,
|
|
33
|
+
}: ConnectionI18nProviderProps) {
|
|
34
|
+
const storeLanguage = useLanguageStore((s) => s.language);
|
|
35
|
+
const controlledByHost = hostLanguage !== undefined;
|
|
36
|
+
|
|
37
|
+
const value = useMemo<ConnectionI18nValue>(() => {
|
|
38
|
+
const language = controlledByHost ? (hostLanguage as LanguageCode) : storeLanguage;
|
|
39
|
+
const t = hostGetT ?? getConnectionT(language);
|
|
40
|
+
return { language, t, controlledByHost };
|
|
41
|
+
}, [controlledByHost, hostLanguage, storeLanguage, hostGetT]);
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<ConnectionI18nContext.Provider value={value}>
|
|
45
|
+
{children}
|
|
46
|
+
</ConnectionI18nContext.Provider>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function useConnectionI18n(): ConnectionI18nValue {
|
|
51
|
+
const ctx = useContext(ConnectionI18nContext);
|
|
52
|
+
const storeLanguage = useLanguageStore((s) => s.language);
|
|
53
|
+
return useMemo(() => {
|
|
54
|
+
if (ctx) return ctx;
|
|
55
|
+
return {
|
|
56
|
+
language: storeLanguage,
|
|
57
|
+
t: getConnectionT(storeLanguage),
|
|
58
|
+
controlledByHost: false,
|
|
59
|
+
};
|
|
60
|
+
}, [ctx, storeLanguage]);
|
|
61
|
+
}
|