@admin-layout/gluestack-ui-mobile 6.5.1-alpha.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 (199) hide show
  1. package/CHANGELOG.md +117 -0
  2. package/LICENSE +21 -0
  3. package/README.md +4 -0
  4. package/assets/logo.png +0 -0
  5. package/babel.config.js +26 -0
  6. package/jest-react-navigation-setup.js +14 -0
  7. package/jest.config.js +39 -0
  8. package/jest.env.js +2 -0
  9. package/lib/__tests__/prolayout-layout-feature.test.d.ts +1 -0
  10. package/lib/__tests__/prolayout-layout-feature.test.js +202 -0
  11. package/lib/__tests__/prolayout-layout-feature.test.js.map +1 -0
  12. package/lib/components/ApplicationErrorFillWrapper.d.ts +2 -0
  13. package/lib/components/ApplicationErrorFillWrapper.js +7 -0
  14. package/lib/components/ApplicationErrorFillWrapper.js.map +1 -0
  15. package/lib/components/ApplicationErrorHandler.d.ts +2 -0
  16. package/lib/components/ApplicationErrorHandler.js +24 -0
  17. package/lib/components/ApplicationErrorHandler.js.map +1 -0
  18. package/lib/components/ErrorBounday.d.ts +18 -0
  19. package/lib/components/ErrorBounday.js +22 -0
  20. package/lib/components/ErrorBounday.js.map +1 -0
  21. package/lib/components/Fallback.d.ts +6 -0
  22. package/lib/components/Fallback.js +53 -0
  23. package/lib/components/Fallback.js.map +1 -0
  24. package/lib/components/Layout/components/BasicLayout.d.ts +5 -0
  25. package/lib/components/Layout/components/BasicLayout.js +28 -0
  26. package/lib/components/Layout/components/BasicLayout.js.map +1 -0
  27. package/lib/components/Layout/components/BottomTabBar.d.ts +2 -0
  28. package/lib/components/Layout/components/BottomTabBar.js +90 -0
  29. package/lib/components/Layout/components/BottomTabBar.js.map +1 -0
  30. package/lib/components/Layout/components/Drawer.d.ts +2 -0
  31. package/lib/components/Layout/components/Drawer.js +253 -0
  32. package/lib/components/Layout/components/Drawer.js.map +1 -0
  33. package/lib/components/Layout/components/Header.d.ts +2 -0
  34. package/lib/components/Layout/components/Header.js +130 -0
  35. package/lib/components/Layout/components/Header.js.map +1 -0
  36. package/lib/components/Layout/components/Sample.d.ts +2 -0
  37. package/lib/components/Layout/components/Sample.js +7 -0
  38. package/lib/components/Layout/components/Sample.js.map +1 -0
  39. package/lib/components/Layout/components/SettingDrawer/LayoutButton.d.ts +3 -0
  40. package/lib/components/Layout/components/SettingDrawer/LayoutButton.js +66 -0
  41. package/lib/components/Layout/components/SettingDrawer/LayoutButton.js.map +1 -0
  42. package/lib/components/Layout/components/SettingDrawer/SettingDrawer.d.ts +2 -0
  43. package/lib/components/Layout/components/SettingDrawer/SettingDrawer.js +23 -0
  44. package/lib/components/Layout/components/SettingDrawer/SettingDrawer.js.map +1 -0
  45. package/lib/components/Layout/components/SettingDrawer/ThemeColorButton.d.ts +3 -0
  46. package/lib/components/Layout/components/SettingDrawer/ThemeColorButton.js +24 -0
  47. package/lib/components/Layout/components/SettingDrawer/ThemeColorButton.js.map +1 -0
  48. package/lib/components/Layout/components/SettingDrawer/index.d.ts +1 -0
  49. package/lib/components/Layout/components/SettingDrawer/index.js +2 -0
  50. package/lib/components/Layout/components/SettingDrawer/index.js.map +1 -0
  51. package/lib/components/Layout/components/SideBar.d.ts +10 -0
  52. package/lib/components/Layout/components/SideBar.js +59 -0
  53. package/lib/components/Layout/components/SideBar.js.map +1 -0
  54. package/lib/components/Layout/components/defaultSettings.d.ts +4 -0
  55. package/lib/components/Layout/components/defaultSettings.js +16 -0
  56. package/lib/components/Layout/components/defaultSettings.js.map +1 -0
  57. package/lib/components/Layout/components/index.d.ts +4 -0
  58. package/lib/components/Layout/components/index.js +5 -0
  59. package/lib/components/Layout/components/index.js.map +1 -0
  60. package/lib/components/Layout/components/util.d.ts +1 -0
  61. package/lib/components/Layout/components/util.js +15 -0
  62. package/lib/components/Layout/components/util.js.map +1 -0
  63. package/lib/components/Layout/compute.d.ts +6 -0
  64. package/lib/components/Layout/compute.js +316 -0
  65. package/lib/components/Layout/compute.js.map +1 -0
  66. package/lib/components/Layout/compute.test.d.ts +6 -0
  67. package/lib/components/Layout/compute.test.js +120 -0
  68. package/lib/components/Layout/compute.test.js.map +1 -0
  69. package/lib/components/Layout/index.d.ts +4 -0
  70. package/lib/components/Layout/index.js +4 -0
  71. package/lib/components/Layout/index.js.map +1 -0
  72. package/lib/components/Layout/typings.d.ts +1 -0
  73. package/lib/components/Layout/typings.js +2 -0
  74. package/lib/components/Layout/typings.js.map +1 -0
  75. package/lib/components/NavigationComponent.d.ts +15 -0
  76. package/lib/components/NavigationComponent.js +120 -0
  77. package/lib/components/NavigationComponent.js.map +1 -0
  78. package/lib/components/PluginArea.d.ts +2 -0
  79. package/lib/components/PluginArea.js +8 -0
  80. package/lib/components/PluginArea.js.map +1 -0
  81. package/lib/components/ToastAlert.d.ts +12 -0
  82. package/lib/components/ToastAlert.js +17 -0
  83. package/lib/components/ToastAlert.js.map +1 -0
  84. package/lib/components/index.d.ts +9 -0
  85. package/lib/components/index.js +10 -0
  86. package/lib/components/index.js.map +1 -0
  87. package/lib/components/with-interactions-managed.d.ts +2 -0
  88. package/lib/components/with-interactions-managed.js +18 -0
  89. package/lib/components/with-interactions-managed.js.map +1 -0
  90. package/lib/config/config.d.ts +17 -0
  91. package/lib/config/config.js +18 -0
  92. package/lib/config/config.js.map +1 -0
  93. package/lib/config/index.d.ts +1 -0
  94. package/lib/config/index.js +2 -0
  95. package/lib/config/index.js.map +1 -0
  96. package/lib/constants/routes.d.ts +3 -0
  97. package/lib/constants/routes.js +5 -0
  98. package/lib/constants/routes.js.map +1 -0
  99. package/lib/containers/layout/BasicLayout.d.ts +7 -0
  100. package/lib/containers/layout/BasicLayout.js +36 -0
  101. package/lib/containers/layout/BasicLayout.js.map +1 -0
  102. package/lib/containers/layout/DrawerBottomNavigationConfig.d.ts +128 -0
  103. package/lib/containers/layout/DrawerBottomNavigationConfig.js +72 -0
  104. package/lib/containers/layout/DrawerBottomNavigationConfig.js.map +1 -0
  105. package/lib/containers/layout/DrawerConfig.d.ts +85 -0
  106. package/lib/containers/layout/DrawerConfig.js +48 -0
  107. package/lib/containers/layout/DrawerConfig.js.map +1 -0
  108. package/lib/containers/layout/Lifecycle.d.ts +13 -0
  109. package/lib/containers/layout/Lifecycle.js +18 -0
  110. package/lib/containers/layout/Lifecycle.js.map +1 -0
  111. package/lib/containers/layout/ProLayout.d.ts +5 -0
  112. package/lib/containers/layout/ProLayout.js +35 -0
  113. package/lib/containers/layout/ProLayout.js.map +1 -0
  114. package/lib/containers/layout/module.d.ts +5 -0
  115. package/lib/containers/layout/module.js +22 -0
  116. package/lib/containers/layout/module.js.map +1 -0
  117. package/lib/hooks/use-after-interactions.d.ts +6 -0
  118. package/lib/hooks/use-after-interactions.js +29 -0
  119. package/lib/hooks/use-after-interactions.js.map +1 -0
  120. package/lib/hooks/useIsReady.d.ts +2 -0
  121. package/lib/hooks/useIsReady.js +24 -0
  122. package/lib/hooks/useIsReady.js.map +1 -0
  123. package/lib/hooks/useLayoutSetting/index.d.ts +11 -0
  124. package/lib/hooks/useLayoutSetting/index.js +68 -0
  125. package/lib/hooks/useLayoutSetting/index.js.map +1 -0
  126. package/lib/index.d.ts +14 -0
  127. package/lib/index.js +26 -0
  128. package/lib/index.js.map +1 -0
  129. package/lib/interfaces/index.d.ts +1 -0
  130. package/lib/interfaces/index.js +2 -0
  131. package/lib/interfaces/index.js.map +1 -0
  132. package/lib/interfaces/settings.d.ts +4 -0
  133. package/lib/interfaces/settings.js +2 -0
  134. package/lib/interfaces/settings.js.map +1 -0
  135. package/lib/redux/settings.d.ts +80 -0
  136. package/lib/redux/settings.js +16 -0
  137. package/lib/redux/settings.js.map +1 -0
  138. package/lib/utils/ThemeColor.d.ts +8 -0
  139. package/lib/utils/ThemeColor.js +9 -0
  140. package/lib/utils/ThemeColor.js.map +1 -0
  141. package/lib/utils/routeConfigKeyReplace.d.ts +7 -0
  142. package/lib/utils/routeConfigKeyReplace.js +77 -0
  143. package/lib/utils/routeConfigKeyReplace.js.map +1 -0
  144. package/lib/utils/routeConfigKeyReplace.test.d.ts +1 -0
  145. package/lib/utils/routeConfigKeyReplace.test.js +102 -0
  146. package/lib/utils/routeConfigKeyReplace.test.js.map +1 -0
  147. package/package.json +40 -0
  148. package/src/__tests__/prolayout-layout-feature.test.tsx +207 -0
  149. package/src/components/ApplicationErrorFillWrapper.tsx +7 -0
  150. package/src/components/ApplicationErrorHandler.tsx +30 -0
  151. package/src/components/ErrorBounday.tsx +31 -0
  152. package/src/components/Fallback.tsx +65 -0
  153. package/src/components/Layout/README.md +11 -0
  154. package/src/components/Layout/components/BasicLayout.tsx +70 -0
  155. package/src/components/Layout/components/BottomTabBar.tsx +135 -0
  156. package/src/components/Layout/components/Drawer.tsx +412 -0
  157. package/src/components/Layout/components/Header.tsx +195 -0
  158. package/src/components/Layout/components/Sample.tsx +10 -0
  159. package/src/components/Layout/components/SettingDrawer/LayoutButton.tsx +102 -0
  160. package/src/components/Layout/components/SettingDrawer/SettingDrawer.tsx +60 -0
  161. package/src/components/Layout/components/SettingDrawer/ThemeColorButton.tsx +26 -0
  162. package/src/components/Layout/components/SettingDrawer/index.ts +1 -0
  163. package/src/components/Layout/components/SideBar.tsx +109 -0
  164. package/src/components/Layout/components/defaultSettings.ts +19 -0
  165. package/src/components/Layout/components/index.ts +4 -0
  166. package/src/components/Layout/components/util.ts +14 -0
  167. package/src/components/Layout/compute.test.tsx +129 -0
  168. package/src/components/Layout/compute.tsx +384 -0
  169. package/src/components/Layout/eslint.json +1 -0
  170. package/src/components/Layout/index.ts +5 -0
  171. package/src/components/Layout/typings.ts +1 -0
  172. package/src/components/NavigationComponent.tsx +154 -0
  173. package/src/components/PluginArea.tsx +11 -0
  174. package/src/components/ToastAlert.tsx +44 -0
  175. package/src/components/index.ts +9 -0
  176. package/src/components/with-interactions-managed.tsx +33 -0
  177. package/src/config/config.ts +17 -0
  178. package/src/config/index.ts +1 -0
  179. package/src/constants/routes.ts +3 -0
  180. package/src/containers/layout/BasicLayout.tsx +61 -0
  181. package/src/containers/layout/DrawerBottomNavigationConfig.tsx +85 -0
  182. package/src/containers/layout/DrawerConfig.tsx +59 -0
  183. package/src/containers/layout/Lifecycle.tsx +23 -0
  184. package/src/containers/layout/ProLayout.tsx +42 -0
  185. package/src/containers/layout/module.ts +24 -0
  186. package/src/hooks/use-after-interactions.ts +35 -0
  187. package/src/hooks/useIsReady.ts +31 -0
  188. package/src/hooks/useLayoutSetting/index.ts +99 -0
  189. package/src/index.ts +41 -0
  190. package/src/interfaces/index.ts +1 -0
  191. package/src/interfaces/settings.ts +5 -0
  192. package/src/redux/settings.ts +28 -0
  193. package/src/utils/ThemeColor.ts +9 -0
  194. package/src/utils/__snapshots__/routeConfigKeyReplace.test.ts.snap +117 -0
  195. package/src/utils/routeConfigKeyReplace.test.ts +114 -0
  196. package/src/utils/routeConfigKeyReplace.ts +74 -0
  197. package/tsconfig.json +37 -0
  198. package/types.d.ts +11 -0
  199. package/webpack.config.js +104 -0
@@ -0,0 +1,384 @@
1
+ import React from 'react';
2
+ import { Feature } from '@common-stack/client-react';
3
+ import { createDrawerNavigator } from '@react-navigation/drawer';
4
+ import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
5
+ import { Drawer, BottomTabBar, Header } from './components';
6
+ import { AntDesign } from '@expo/vector-icons';
7
+ import { navigationRef } from '@common-stack/client-react';
8
+
9
+ const layoutSettingConfig =
10
+ process.APP_ENV && process.APP_ENV.LAYOUT_SETTINGS ? JSON.parse(process.APP_ENV.LAYOUT_SETTINGS) : null;
11
+
12
+ const headerSettings: any = layoutSettingConfig
13
+ ? {
14
+ showToggle: layoutSettingConfig.hasOwnProperty('topLeftToggle')
15
+ ? layoutSettingConfig.topLeftToggle
16
+ ? true
17
+ : false
18
+ : true,
19
+ rightSettingToggle: layoutSettingConfig.hasOwnProperty('topRightSettingToggle')
20
+ ? layoutSettingConfig.topRightSettingToggle
21
+ ? true
22
+ : false
23
+ : true,
24
+ }
25
+ : { showToggle: true, rightSettingToggle: true };
26
+
27
+ const drawerConfig = (props: any) => {
28
+ let drawerProps = props?.drawerConfig??null;
29
+ return {
30
+ ['//main_drawer']: {
31
+ exact: false,
32
+ container: createDrawerNavigator(),
33
+ name: 'Layout',
34
+ props: {
35
+ initialRouteName: 'MainStack.Layout.Home',
36
+ drawerContent: (props: any) => {
37
+ let currentRoute = navigationRef.isReady() ? navigationRef?.getCurrentRoute() : null;
38
+ let currentOptions = currentRoute?.params?.options
39
+ ? JSON.parse(currentRoute?.params?.options)
40
+ : null;
41
+ let drawerOptions = { ...currentOptions?.drawerOption, ...drawerProps?.drawerOption };
42
+ return React.createElement(
43
+ drawerProps?.drawerContent ?? Drawer,
44
+ Object.assign({}, props, {
45
+ title: 'ClockBook',
46
+ titleColor: 'black',
47
+ logout: true,
48
+ redirect: 'MainStack.Login',
49
+ ...drawerOptions,
50
+ }),
51
+ );
52
+ },
53
+ screenOptions: (options: any) => {
54
+ let currentRoute = navigationRef.isReady() ? navigationRef?.getCurrentRoute() : null;
55
+ let currentOptions = currentRoute?.params?.options
56
+ ? JSON.parse(currentRoute?.params?.options)
57
+ : null;
58
+ return {
59
+ headerShown: true,
60
+ header: (props: any) => (
61
+ <Header
62
+ showToggle={
63
+ headerSettings && headerSettings.showToggle ? headerSettings.showToggle : false
64
+ }
65
+ right={
66
+ headerSettings && headerSettings.rightSettingToggle
67
+ ? headerSettings.rightSettingToggle
68
+ : false
69
+ }
70
+ {...props}
71
+ />
72
+ ),
73
+ drawerIcon: 'grid',
74
+ drawerStyle: currentOptions?.drawerStyle ?? drawerProps?.drawerStyle ?? {},
75
+ gestureEnabled: currentOptions?.gestureEnabled ?? true,
76
+ swipeEnabled: currentOptions?.swipeEnabled ?? true,
77
+ };
78
+ },
79
+ },
80
+ },
81
+ };
82
+ };
83
+
84
+ const bottomTabConfig = (props: any) => {
85
+ let tabBarProps = props?.tabBarConfig??null;
86
+ return {
87
+ ['//bottom_tab']: {
88
+ exact: false,
89
+ container: createBottomTabNavigator(),
90
+ name: 'Layout',
91
+ props: {
92
+ initialRouteName: 'MainStack.Layout.Home',
93
+ //tabBar: (props: any) => <BottomTabBar {...props} />,
94
+ tabBar: (props: any) => {
95
+ return React.createElement(
96
+ tabBarProps?.bottomTabBar ?? BottomTabBar,
97
+ Object.assign({}, props),
98
+ );
99
+ },
100
+ screenOptions: ({ route }: any) => {
101
+ return {
102
+ headerShown: false,
103
+ title: 'Home',
104
+ headerTitle: 'Home',
105
+ tabBarActiveTintColor: '#4c87f9',
106
+ tabBarInactiveTintColor: 'black',
107
+ tabBarIcon: ({ color }: { color: any }) => <AntDesign name={'search1'} color={color} size={24} />,
108
+ };
109
+ },
110
+ },
111
+ },
112
+ }};
113
+
114
+ const hostBottomTabConfig = (props: any) => {
115
+ let tabBarProps = props?.tabBarConfig??null;
116
+ return {
117
+ ['//host_tab']: {
118
+ container: createBottomTabNavigator(),
119
+ exact: false,
120
+ name: 'Layout',
121
+ props: {
122
+ initialRouteName: 'MainStack.Layout.Home',
123
+ //tabBar: (props: any) => <BottomTabBar {...props} />,
124
+ tabBar: (props: any) => {
125
+ return React.createElement(
126
+ tabBarProps?.bottomTabBar ?? BottomTabBar,
127
+ Object.assign({}, props),
128
+ );
129
+ },
130
+ screenOptions: (props: any) => {
131
+ return {
132
+ headerShown: false,
133
+ title: 'Home',
134
+ headerTitle: 'Home',
135
+ tabBarActiveTintColor: '#4c87f9',
136
+ tabBarInactiveTintColor: 'black',
137
+ tabBarIcon: ({ color }: { color: any }) => <AntDesign name={'search1'} color={color} size={24} />,
138
+ };
139
+ },
140
+ },
141
+ },
142
+ }};
143
+
144
+ const drawerBottomTabConfig = (props: any) => {
145
+ let drawerProps = props?.drawerConfig??null;
146
+ let tabBarProps = props?.tabBarConfig??null;
147
+ return {
148
+ ['//main_drawer']: {
149
+ exact: false,
150
+ container: createDrawerNavigator(),
151
+ name: 'Layout',
152
+ props: {
153
+ initialRouteName: 'MainStack.Layout.MainBottomTab',
154
+ drawerContent: (props: any) => {
155
+ let currentRoute = navigationRef.isReady() ? navigationRef?.getCurrentRoute() : null;
156
+ let currentOptions = currentRoute?.params?.options
157
+ ? JSON.parse(currentRoute?.params?.options)
158
+ : null;
159
+ let drawerOptions = { ...currentOptions?.drawerOption, ...drawerProps?.drawerOption };
160
+ return React.createElement(
161
+ drawerProps?.drawerContent ?? Drawer,
162
+ Object.assign({}, props, {
163
+ title: 'ClockBook',
164
+ titleColor: 'black',
165
+ logout: true,
166
+ redirect: 'MainStack.Login',
167
+ ...drawerOptions,
168
+ }),
169
+ );
170
+ },
171
+ screenOptions: (options: any) => {
172
+ let currentRoute = navigationRef.isReady() ? navigationRef?.getCurrentRoute() : null;
173
+ let currentOptions = currentRoute?.params?.options
174
+ ? JSON.parse(currentRoute?.params?.options)
175
+ : null;
176
+ return {
177
+ headerShown: false,
178
+ drawerIcon: 'grid',
179
+ drawerStyle: currentOptions?.drawerStyle ?? drawerProps?.drawerStyle ?? {},
180
+ gestureEnabled: currentOptions?.gestureEnabled ?? true,
181
+ swipeEnabled: currentOptions?.swipeEnabled ?? true,
182
+ };
183
+ },
184
+ },
185
+ },
186
+ ['//main_drawer/bottom_tab']: {
187
+ container: createBottomTabNavigator(),
188
+ exact: false,
189
+ name: 'MainBottomTab',
190
+ props: {
191
+ initialRouteName: 'MainStack.MainDrawer.MainBottomTab.Home',
192
+ //tabBar: (props: any) => <BottomTabBar {...props} />,
193
+ tabBar: (props: any) => {
194
+ return React.createElement(
195
+ tabBarProps?.bottomTabBar ?? BottomTabBar,
196
+ Object.assign({}, props),
197
+ );
198
+ },
199
+ screenOptions: ({ route }: any) => {
200
+ return {
201
+ headerShown: true,
202
+ header: (props: any) => (
203
+ <Header
204
+ showToggle={
205
+ headerSettings && headerSettings.showToggle ? headerSettings.showToggle : false
206
+ }
207
+ right={
208
+ headerSettings && headerSettings.rightSettingToggle
209
+ ? headerSettings.rightSettingToggle
210
+ : false
211
+ }
212
+ {...props}
213
+ />
214
+ ),
215
+ title: 'Home',
216
+ headerTitle: 'Home',
217
+ tabBarActiveTintColor: '#ff5a60',
218
+ tabBarInactiveTintColor: 'black',
219
+ };
220
+ },
221
+ },
222
+ },
223
+ };
224
+ };
225
+
226
+ const bottomTabDrawerConfig = (props: any) => {
227
+ let drawerProps = props?.drawerConfig??null;
228
+ let tabBarProps = props?.tabBarConfig??null;
229
+
230
+ return {
231
+ ['//bottom_tab']: {
232
+ container: createBottomTabNavigator(),
233
+ exact: false,
234
+ name: 'Layout',
235
+ props: {
236
+ initialRouteName: 'MainStack.Layout.Home',
237
+ // tabBar: (props: any) => <BottomTabBar {...props} />,
238
+ tabBar: (props: any) => {
239
+ return React.createElement(
240
+ tabBarProps?.bottomTabBar ?? BottomTabBar,
241
+ Object.assign({}, props),
242
+ );
243
+ },
244
+ screenOptions: ({ route }: any) => {
245
+ return {
246
+ headerShown: true,
247
+ header: (props: any) => (
248
+ <Header
249
+ showToggle={
250
+ headerSettings && headerSettings.showToggle ? headerSettings.showToggle : false
251
+ }
252
+ right={
253
+ headerSettings && headerSettings.rightSettingToggle
254
+ ? headerSettings.rightSettingToggle
255
+ : false
256
+ }
257
+ {...props}
258
+ />
259
+ ),
260
+ title: 'Home',
261
+ headerTitle: 'Home',
262
+ tabBarActiveTintColor: '#ff5a60',
263
+ tabBarInactiveTintColor: 'black',
264
+ };
265
+ },
266
+ // screenOptions: ({ route }: any) => {
267
+ // return {
268
+ // headerShown: false,
269
+ // //header: (props: any) => <Header showToggle={true} right={true} {...props} />,
270
+ // title: 'Home',
271
+ // headerTitle: 'Home',
272
+ // tabBarActiveTintColor: '#ff5a60',
273
+ // tabBarInactiveTintColor: 'black',
274
+ // };
275
+ // },
276
+ },
277
+ },
278
+ // ['//bottom_tab/main_drawer']: {
279
+ // exact: false,
280
+ // container: createDrawerNavigator(),
281
+ // name: 'MainDrawer',
282
+ // props: {
283
+ // initialRouteName: 'MainStack.MainBottomTab.MainDrawer.Home',
284
+ // drawerContent: (props: any) => (
285
+ // <Drawer
286
+ // {...props}
287
+ // title={'ClockBook'}
288
+ // titleColor={'black'}
289
+ // logout={true}
290
+ // redirect={'MainStack.Login'}
291
+ // />
292
+ // ),
293
+ // screenOptions:(options:any) =>{
294
+
295
+ // return{
296
+ // headerShown: true,
297
+ // header: (props: any) => <Header showToggle={true} right={true} {...props} />,
298
+ // drawerIcon: 'grid',
299
+ // }
300
+ // }
301
+ // },
302
+ // },
303
+ };
304
+
305
+ }
306
+
307
+ // const bottomTabDrawerConfig = {
308
+ // ['//bottom_tab']: {
309
+ // container: createBottomTabNavigator(),
310
+ // exact: false,
311
+ // name: 'Layout',
312
+ // props: {
313
+ // initialRouteName: 'MainStack.Layout.Home',
314
+ // tabBar: (props: any) => <BottomTabBar {...props} />,
315
+ // screenOptions: ({ route }: any) => {
316
+ // return {
317
+ // headerShown: false,
318
+ // //header: (props: any) => <Header showToggle={true} right={true} {...props} />,
319
+ // title: 'Home',
320
+ // headerTitle: 'Home',
321
+ // tabBarActiveTintColor: '#ff5a60',
322
+ // tabBarInactiveTintColor: 'black',
323
+ // };
324
+ // },
325
+ // },
326
+ // },
327
+ // // ['//bottom_tab/main_drawer']: {
328
+ // // exact: false,
329
+ // // container: createDrawerNavigator(),
330
+ // // name: 'MainDrawer',
331
+ // // props: {
332
+ // // initialRouteName: 'MainStack.MainBottomTab.MainDrawer.Home',
333
+ // // drawerContent: (props: any) => (
334
+ // // <Drawer
335
+ // // {...props}
336
+ // // title={'ClockBook'}
337
+ // // titleColor={'black'}
338
+ // // logout={true}
339
+ // // redirect={'MainStack.Login'}
340
+ // // />
341
+ // // ),
342
+ // // screenOptions:(options:any) =>{
343
+
344
+ // // return{
345
+ // // headerShown: true,
346
+ // // header: (props: any) => <Header showToggle={true} right={true} {...props} />,
347
+ // // drawerIcon: 'grid',
348
+ // // }
349
+ // // }
350
+ // // },
351
+ // // },
352
+ // };
353
+
354
+ // export const appDrawerFeature = new Feature({
355
+ // routeConfig: drawerConfig as any,
356
+ // });
357
+
358
+ // export const appDrawerBottomTabFeature = new Feature({
359
+ // routeConfig: drawerBottomTabConfig as any,
360
+ // });
361
+
362
+ export const appDrawerFeature = (props: any) =>
363
+ new Feature({
364
+ routeConfig: drawerConfig(props) as any,
365
+ });
366
+
367
+ export const appDrawerBottomTabFeature = (props: any) =>
368
+ new Feature({
369
+ routeConfig: drawerBottomTabConfig(props) as any,
370
+ });
371
+
372
+ export const appBottomTabFeature = (props: any) =>
373
+ new Feature({
374
+ routeConfig: bottomTabConfig(props) as any,
375
+ });
376
+
377
+ export const appHostBottomTabFeature = (props: any) =>
378
+ new Feature({
379
+ routeConfig: hostBottomTabConfig(props) as any,
380
+ });
381
+
382
+ export const appBottomTabDrawerFeature = new Feature({
383
+ routeConfig: bottomTabDrawerConfig as any,
384
+ });
@@ -0,0 +1 @@
1
+ {}
@@ -0,0 +1,5 @@
1
+ import BasicLayout from './components/BasicLayout';
2
+
3
+ export * from './components';
4
+ export { BasicLayout };
5
+ export type { ProSettings as Settings } from './components/defaultSettings';
@@ -0,0 +1 @@
1
+ export * from '@admin-layout/client/lib/interfaces/typings';
@@ -0,0 +1,154 @@
1
+ import { LOCATION_CHANGE as LOCATION_CHANGE_SUCCESS } from '@common-stack/remix-router-redux';
2
+ import { NavigationContainer, LinkingOptions } from '@react-navigation/native';
3
+ import { cloneDeep, merge } from 'lodash-es';
4
+ import React, { MutableRefObject, ReactElement, useRef } from 'react';
5
+ import { useDispatch, useSelector } from 'react-redux';
6
+ import { navigationRef } from '@common-stack/client-react';
7
+
8
+ interface INavigationContainerComponentProps {
9
+ children: ReactElement[];
10
+ configurableRoutes: Record<string, any>[];
11
+ independent?: boolean;
12
+ linking?: LinkingOptions<any>;
13
+ }
14
+
15
+ interface INavigationContainerRef {
16
+ name: string;
17
+ key: string;
18
+ params?: Readonly<object | undefined>;
19
+ }
20
+
21
+ export const getPath = (routeName: string, configurableRoutes: Record<string, any>[]) => {
22
+ let resultantPath = '';
23
+ configurableRoutes.forEach((item) => {
24
+ if (item.children?.length) {
25
+ const value = getPath(routeName, item.children);
26
+ if (value) {
27
+ resultantPath = value;
28
+ }
29
+ }
30
+ if (item.navigationRouteName === routeName) {
31
+ resultantPath = item.path;
32
+ }
33
+ });
34
+ return resultantPath;
35
+ };
36
+
37
+ export const configurableRoutesWithNavigationRouteName = (
38
+ configurableRoutes: Record<string, any>[],
39
+ parentName: string = '',
40
+ ) => {
41
+ return configurableRoutes.map((item) => {
42
+ const resultantName = parentName;
43
+ const navigationRouteName = resultantName.length ? `${resultantName}.${item.name}` : item.name;
44
+ item.navigationRouteName = navigationRouteName;
45
+ if (item.children) {
46
+ item.children = configurableRoutesWithNavigationRouteName(item.children, navigationRouteName);
47
+ }
48
+ return item;
49
+ });
50
+ };
51
+
52
+ export const useLocationChange = () => {
53
+ const dispatch = useDispatch();
54
+ const [locationChange, setLocationChange] = React.useState<any>(null);
55
+ const platformState = useSelector((state) => (state as any).platform);
56
+
57
+ React.useEffect(() => {
58
+ if (locationChange) setLocation(locationChange);
59
+ }, [locationChange]);
60
+
61
+ const setLocation = ({ configurableRoutes, previousRoute = null, orgName = null }: any) => {
62
+ const currentRoute: any = navigationRef.isReady() ? navigationRef?.getCurrentRoute() : null;
63
+ const currentRouteName = currentRoute ? currentRoute!?.name : null;
64
+ const configuredRoutes = configurableRoutesWithNavigationRouteName(configurableRoutes);
65
+ const currentPath = currentRouteName ? getPath(currentRouteName as string, configuredRoutes) : null;
66
+ const previousPath = previousRoute ? getPath(previousRoute?.current!.name, configuredRoutes) : null;
67
+ const currParams = {
68
+ ...(currentRoute!.params || {}),
69
+ orgName: orgName ? orgName : currentRoute!.params?.orgName ?? platformState?.orgName,
70
+ };
71
+
72
+ navigationRef?.setParams(currParams);
73
+
74
+ dispatch({
75
+ type: LOCATION_CHANGE_SUCCESS,
76
+ payload: {
77
+ currentRoute: {
78
+ path: currentPath,
79
+ params: currParams,
80
+ },
81
+ previousRoute: {
82
+ path: previousPath,
83
+ params: previousRoute?.current?.params ?? { orgName: '' },
84
+ },
85
+ },
86
+ });
87
+ };
88
+
89
+ return { setLocationChange };
90
+ };
91
+
92
+ export const NavigationContainerComponent = ({
93
+ children,
94
+ configurableRoutes,
95
+ independent,
96
+ linking,
97
+ }: INavigationContainerComponentProps): ReactElement => {
98
+ const routeNameRef = useRef() as MutableRefObject<INavigationContainerRef | undefined>;
99
+ const dispatch = useDispatch();
100
+ const platformState = useSelector((state) => (state as any).platform);
101
+ const { setLocationChange } = useLocationChange();
102
+ //const user = useSelector((state: any) => state.user);
103
+ return (
104
+ <NavigationContainer
105
+ ref={navigationRef}
106
+ linking={linking}
107
+ independent={independent}
108
+ onReady={() => {
109
+ routeNameRef.current = navigationRef.isReady() ? navigationRef?.getCurrentRoute() : null;
110
+ const currentRoute: any = routeNameRef?.current;
111
+ setLocationChange({
112
+ configurableRoutes,
113
+ orgName: platformState?.orgName ?? currentRoute?.params?.orgName ?? '',
114
+ });
115
+ }}
116
+ onStateChange={async () => {
117
+ const previousRoute: any = routeNameRef?.current ? cloneDeep(routeNameRef) : null;
118
+ const currentRoute: any = navigationRef.isReady() ? navigationRef?.getCurrentRoute() : null;
119
+ const previousRouteName = previousRoute ? previousRoute?.current!.name : null;
120
+ const currentRouteName = currentRoute ? currentRoute!?.name : null;
121
+
122
+ const configuredRoutes = configurableRoutesWithNavigationRouteName(configurableRoutes);
123
+ const currentPath = currentRouteName ? getPath(currentRouteName as string, configuredRoutes) : null;
124
+ const previousPath = previousRoute ? getPath(previousRoute?.current!.name, configuredRoutes) : null;
125
+ const currParams = {
126
+ ...(currentRoute!.params || {}),
127
+ orgName: currentRoute!.params?.orgName || platformState?.orgName,
128
+ };
129
+ //if (previousRouteName && currentRouteName && previousRouteName !== currentRouteName) {
130
+ if (previousPath !== currentPath) {
131
+ routeNameRef.current = currentRoute;
132
+
133
+ setLocationChange({ configurableRoutes, previousRoute });
134
+
135
+ // dispatch({
136
+ // type: LOCATION_CHANGE_SUCCESS,
137
+ // payload: {
138
+ // currentRoute: {
139
+ // path: currentPath,
140
+ // params: currParams,
141
+ // },
142
+ // previousRoute: {
143
+ // path: previousPath,
144
+ // params: previousRoute?.current?.params ?? { orgName: '' },
145
+ // },
146
+ // },
147
+ // });
148
+ }
149
+ }}
150
+ >
151
+ {children}
152
+ </NavigationContainer>
153
+ );
154
+ };
@@ -0,0 +1,11 @@
1
+ import { PluginArea } from '@common-stack/client-react';
2
+ import { View } from 'react-native';
3
+ import * as React from 'react';
4
+
5
+ export const MobilePluginArea = () => {
6
+ return (
7
+ <View style={{ display: "none" }}>
8
+ <PluginArea />
9
+ </View>
10
+ )
11
+ }
@@ -0,0 +1,44 @@
1
+ import React from 'react';
2
+
3
+ import {
4
+ Toast,
5
+ VStack,
6
+ ToastTitle,
7
+ ToastDescription,
8
+ Pressable,
9
+ Icon,
10
+ CloseIcon,
11
+ } from '@gluestack-ui/themed';
12
+
13
+ interface IToast {
14
+ id: string;
15
+ title: string;
16
+ status?: any;
17
+ description?: string;
18
+ isClosable?: boolean;
19
+ toast?: any;
20
+ variant?:any
21
+ }
22
+
23
+ // variants:
24
+ // accent,
25
+ // solid,
26
+ // outline
27
+
28
+ export const ToastAlert = ({ id, status = 'info', title='', description = '',variant='solid', isClosable, toast=null }: IToast) => {
29
+ const toastId = 'toast-' + id;
30
+ const actionType = status || 'info';
31
+ return (
32
+ <Toast nativeID={toastId} variant={variant} action={actionType}>
33
+ <VStack space="xs">
34
+ <ToastTitle>{title}</ToastTitle>
35
+ {description && <ToastDescription>{description}</ToastDescription>}
36
+ </VStack>
37
+ {isClosable && toast ? (
38
+ <Pressable mt="$1" onPress={() => toast?.close(id)}>
39
+ <Icon as={CloseIcon} color="$coolGray50" />
40
+ </Pressable>
41
+ ) : null}
42
+ </Toast>
43
+ );
44
+ };
@@ -0,0 +1,9 @@
1
+ export * from './Layout';
2
+ export * from './PluginArea';
3
+ export * from './ApplicationErrorHandler';
4
+ export * from './ApplicationErrorFillWrapper';
5
+ export * from './Fallback';
6
+ export * from './ErrorBounday';
7
+ export * from './NavigationComponent';
8
+ export * from './ToastAlert';
9
+ export * from './with-interactions-managed';
@@ -0,0 +1,33 @@
1
+ import React, { ComponentType } from 'react';
2
+ import { Transition, Transitioning } from 'react-native-reanimated';
3
+ import { useAfterInteractions } from '../hooks/use-after-interactions';
4
+ import { Box, Spinner, Text } from '@gluestack-ui/themed';
5
+ import hoistNonReactStatics from 'hoist-non-react-statics';
6
+
7
+ export function withInteractionsManaged<Props>(
8
+ Component: ComponentType<Props>,
9
+ Placeholder: ComponentType | null = null,
10
+ ) {
11
+ const Wrapped = (props: Props) => {
12
+ const { transitionRef, interactionsComplete } = useAfterInteractions();
13
+ const LoadingComponent = () => <Box flex={1}>{<Spinner color={'blue.500'} />}</Box>;
14
+ console.log('interactionsComplete', interactionsComplete);
15
+ return (
16
+ <Transitioning.View
17
+ transition={
18
+ <Transition.Together>
19
+ <Transition.Change interpolation="easeInOut" />
20
+ <Transition.In type="fade" />
21
+ </Transition.Together>
22
+ }
23
+ style={{ flex: 1 }}
24
+ ref={transitionRef}
25
+ >
26
+ {interactionsComplete ? <Component {...props} /> : Placeholder ? <Placeholder /> : <LoadingComponent />}
27
+ </Transitioning.View>
28
+ );
29
+ };
30
+
31
+ hoistNonReactStatics(Wrapped, Component);
32
+ return Wrapped;
33
+ }
@@ -0,0 +1,17 @@
1
+ export const config = {
2
+ LAYOUT_SETTINGS: {
3
+ logo: 'https://cdmbase.s3.ca-central-1.amazonaws.com/favicon-new-128.svg',
4
+ navTheme: 'light', // 'dark'
5
+ primaryColor: '#3FA541C', // '#1890ff'
6
+ layout: 'side',
7
+ contentWidth: 'Fluid',
8
+ fixedHeader: false,
9
+ fixSiderbar: true,
10
+ colorWeak: false,
11
+ title: 'CDMBase LLC',
12
+ iconfontUrl: '',
13
+ language: 'en-US',
14
+ topLeftToggle: true,
15
+ topRightSettingToggle: true,
16
+ },
17
+ };
@@ -0,0 +1 @@
1
+ export * from './config';
@@ -0,0 +1,3 @@
1
+ export enum MobileRoutes {
2
+ Org = '/o/:orgName',
3
+ }