@admin-layout/gluestack-ui-mobile 9.0.4-alpha.0 → 9.0.4-alpha.102
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/CHANGELOG.md +96 -0
- package/lib/components/AuthWrapper.d.ts +4 -2
- package/lib/components/AuthWrapper.js +5 -5
- package/lib/components/AuthWrapper.js.map +1 -1
- package/lib/components/Layout/components/Drawer.js +9 -9
- package/lib/components/Layout/components/Drawer.js.map +1 -1
- package/lib/components/Layout/components/Header.js +28 -15
- package/lib/components/Layout/components/Header.js.map +1 -1
- package/lib/components/Layout/components/SettingDrawer/LayoutButton.js +14 -6
- package/lib/components/Layout/components/SettingDrawer/LayoutButton.js.map +1 -1
- package/lib/components/Layout/components/SettingDrawer/SettingDrawer.d.ts +1 -1
- package/lib/components/Layout/components/SettingDrawer/SettingDrawer.js +55 -15
- package/lib/components/Layout/components/SettingDrawer/SettingDrawer.js.map +1 -1
- package/lib/components/Layout/components/SettingDrawer/ThemeColorButton.js +1 -1
- package/lib/components/NavigationComponent.js +11 -2
- package/lib/components/NavigationComponent.js.map +1 -1
- package/lib/components/WithConfiguration.d.ts +18 -0
- package/lib/components/WithConfiguration.js +42 -0
- package/lib/components/WithConfiguration.js.map +1 -0
- package/lib/components/WithPermission.d.ts +31 -0
- package/lib/components/WithPermission.js +53 -0
- package/lib/components/WithPermission.js.map +1 -0
- package/lib/components/WithPolicy.d.ts +13 -0
- package/lib/components/WithPolicy.js +18 -0
- package/lib/components/WithPolicy.js.map +1 -0
- package/lib/components/index.d.ts +5 -0
- package/lib/components/index.js +5 -0
- package/lib/components/index.js.map +1 -1
- package/lib/components/usePermissionAutoFetch.d.ts +75 -0
- package/lib/components/usePermissionAutoFetch.js +63 -0
- package/lib/components/usePermissionAutoFetch.js.map +1 -0
- package/lib/components/useSetting.d.ts +25 -0
- package/lib/components/useSetting.js +87 -0
- package/lib/components/useSetting.js.map +1 -0
- package/lib/components/with-interactions-lifecycle-managed.d.ts +3 -3
- package/lib/components/with-interactions-lifecycle-managed.js +23 -15
- package/lib/components/with-interactions-lifecycle-managed.js.map +1 -1
- package/lib/containers/layout/BasicLayout.d.ts +2 -2
- package/lib/containers/layout/DrawerBottomNavigationConfig.d.ts +393 -88
- package/lib/containers/layout/DrawerConfig.d.ts +266 -60
- package/lib/containers/layout/module.js +2 -2
- package/lib/containers/layout/module.js.map +1 -1
- package/lib/redux/settings.d.ts +8 -8
- package/lib/utils/ThemeColor.js +11 -1
- package/lib/utils/ThemeColor.js.map +1 -1
- package/lib/utils/generateMobileNavigations.d.ts +4 -11
- package/lib/utils/generateMobileNavigations.js +498 -298
- package/lib/utils/generateMobileNavigations.js.map +1 -1
- package/package.json +7 -7
- package/src/components/AuthWrapper.tsx +6 -4
- package/src/components/Layout/components/Drawer.tsx +19 -20
- package/src/components/Layout/components/Header.tsx +154 -93
- package/src/components/Layout/components/SettingDrawer/LayoutButton.tsx +27 -13
- package/src/components/Layout/components/SettingDrawer/SettingDrawer.tsx +151 -48
- package/src/components/Layout/components/SettingDrawer/ThemeColorButton.tsx +2 -2
- package/src/components/NavigationComponent.tsx +9 -2
- package/src/components/WithConfiguration.tsx +74 -0
- package/src/components/WithPermission.tsx +81 -0
- package/src/components/WithPolicy.tsx +32 -0
- package/src/components/index.ts +6 -1
- package/src/components/usePermissionAutoFetch.tsx +78 -0
- package/src/components/useSetting.tsx +137 -0
- package/src/components/with-interactions-lifecycle-managed.tsx +62 -26
- package/src/containers/layout/module.ts +2 -2
- package/src/utils/ThemeColor.ts +11 -1
- package/src/utils/generateMobileNavigations.ts +543 -276
- package/lib/components/Layout/components/util.d.ts +0 -1
- package/lib/components/Layout/components/util.js +0 -15
- package/lib/components/Layout/components/util.js.map +0 -1
- package/src/components/Layout/components/util.ts +0 -14
|
@@ -7,101 +7,162 @@ import { useDispatch } from 'react-redux';
|
|
|
7
7
|
import { CHANGE_SETTINGS_ACTION } from '@admin-layout/client';
|
|
8
8
|
import { useSelector } from 'react-redux';
|
|
9
9
|
|
|
10
|
+
export const Header = React.memo(
|
|
11
|
+
({
|
|
12
|
+
navigation,
|
|
13
|
+
route,
|
|
14
|
+
options,
|
|
15
|
+
back,
|
|
16
|
+
showToggle = null,
|
|
17
|
+
theme = 'light',
|
|
18
|
+
right = null,
|
|
19
|
+
rightComponent,
|
|
20
|
+
isMixedLayout = null,
|
|
21
|
+
...rest
|
|
22
|
+
}: any) => {
|
|
23
|
+
const title = rest?.title || getHeaderTitle(options, route.name);
|
|
10
24
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
showToggle = null,
|
|
17
|
-
theme = 'light',
|
|
18
|
-
right = null,
|
|
19
|
-
rightComponent,
|
|
20
|
-
isMixedLayout=null,
|
|
21
|
-
...rest
|
|
22
|
-
}: any)=>{
|
|
23
|
-
const title = rest?.title || getHeaderTitle(options, route.name);
|
|
25
|
+
const matches: any = title.match(/\b(\w)/g);
|
|
26
|
+
const acronym: any = matches.join('').substring(0, 2); // JSON
|
|
27
|
+
const [settingToggle, setSettingToggle] = useState(false);
|
|
28
|
+
const settings = useSelector<any>((state) => state.settings) as any;
|
|
29
|
+
const dispatch = useDispatch();
|
|
24
30
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
31
|
+
const onSettingChange = useCallback(
|
|
32
|
+
(config: any) =>
|
|
33
|
+
dispatch({
|
|
34
|
+
type: CHANGE_SETTINGS_ACTION,
|
|
35
|
+
payload: config,
|
|
36
|
+
}),
|
|
37
|
+
[dispatch],
|
|
38
|
+
);
|
|
30
39
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
40
|
+
return (
|
|
41
|
+
<SafeAreaView bg={settings?.navTheme === 'light' || settings?.navTheme === 'dark' ? '$white' : '$black'}>
|
|
42
|
+
<StatusBar
|
|
43
|
+
barStyle={
|
|
44
|
+
settings?.navTheme === 'light' || settings?.navTheme === 'dark'
|
|
45
|
+
? 'dark-content'
|
|
46
|
+
: 'light-content'
|
|
47
|
+
}
|
|
48
|
+
/>
|
|
49
|
+
<Box bg={settings?.navTheme === 'light' || settings?.navTheme === 'dark' ? '$white' : '$black'}>
|
|
50
|
+
<HStack
|
|
51
|
+
bg={settings?.navTheme === 'light' || settings?.navTheme === 'dark' ? '$white' : '$black'}
|
|
52
|
+
px="$1"
|
|
53
|
+
py="$3"
|
|
54
|
+
// justifyContent={
|
|
55
|
+
// settings?.layout === 'bottom' || settings?.layout === 'host-bottom' ? 'center' : 'space-between'
|
|
56
|
+
// }
|
|
57
|
+
justifyContent={
|
|
58
|
+
(settings?.layout === 'bottom' || settings?.layout === 'host-bottom') &&
|
|
59
|
+
!isMixedLayout &&
|
|
60
|
+
!right
|
|
61
|
+
? 'center'
|
|
62
|
+
: 'space-between'
|
|
63
|
+
}
|
|
64
|
+
alignItems="center"
|
|
65
|
+
borderBottomWidth={'$1'}
|
|
66
|
+
borderBottomColor={'#d3d3d3'}
|
|
67
|
+
w="100%"
|
|
68
|
+
>
|
|
69
|
+
{back ? (
|
|
70
|
+
<Button size="xs" bg={'transparent'} onPress={() => navigation.goBack()}>
|
|
71
|
+
<Ionicons
|
|
72
|
+
name={'arrow-back'}
|
|
73
|
+
color={
|
|
74
|
+
settings?.navTheme === 'light' || settings?.navTheme === 'dark'
|
|
75
|
+
? 'black'
|
|
76
|
+
: 'white'
|
|
77
|
+
}
|
|
78
|
+
size={20}
|
|
79
|
+
/>
|
|
80
|
+
</Button>
|
|
81
|
+
) : (showToggle && settings?.layout !== 'bottom') ||
|
|
82
|
+
(showToggle && settings?.layout !== 'host-bottom') ? (
|
|
83
|
+
<Button size="xs" bg={'transparent'} onPress={() => navigation.toggleDrawer()}>
|
|
84
|
+
<Ionicons
|
|
85
|
+
name={'menu'}
|
|
86
|
+
color={
|
|
87
|
+
settings?.navTheme === 'light' || settings?.navTheme === 'dark'
|
|
88
|
+
? 'black'
|
|
89
|
+
: 'white'
|
|
90
|
+
}
|
|
91
|
+
size={20}
|
|
92
|
+
/>
|
|
93
|
+
</Button>
|
|
94
|
+
) : (
|
|
95
|
+
<></>
|
|
96
|
+
)}
|
|
97
|
+
<Text
|
|
98
|
+
px={'$2'}
|
|
99
|
+
color={
|
|
100
|
+
settings?.navTheme === 'light' || settings?.navTheme === 'dark' ? '$black' : '$white'
|
|
101
|
+
}
|
|
102
|
+
style={{ fontSize: 20 }}
|
|
103
|
+
fontWeight="$bold"
|
|
104
|
+
textAlign="center"
|
|
105
|
+
>
|
|
106
|
+
{title}
|
|
107
|
+
</Text>
|
|
108
|
+
{!!settingToggle ? (
|
|
109
|
+
<SettingDrawer
|
|
110
|
+
isOpen={settingToggle}
|
|
111
|
+
onSettingChange={(settings: any) => {
|
|
112
|
+
onSettingChange(settings);
|
|
113
|
+
setSettingToggle(false);
|
|
114
|
+
}}
|
|
115
|
+
handleClose={() => setSettingToggle(false)}
|
|
116
|
+
/>
|
|
117
|
+
) : null}
|
|
118
|
+
{right && (
|
|
119
|
+
<>
|
|
120
|
+
<HStack alignItems={'center'}>
|
|
121
|
+
<Button
|
|
122
|
+
size="xs"
|
|
123
|
+
bg={'transparent'}
|
|
124
|
+
onPress={() => setSettingToggle(!settingToggle)}
|
|
125
|
+
>
|
|
126
|
+
<Ionicons
|
|
127
|
+
name={'cog'}
|
|
128
|
+
color={theme === 'light' ? 'black' : 'white'}
|
|
129
|
+
size={20}
|
|
130
|
+
/>
|
|
131
|
+
</Button>
|
|
132
|
+
{rightComponent ? <Box>{rightComponent}</Box> : null}
|
|
133
|
+
</HStack>
|
|
134
|
+
</>
|
|
135
|
+
)}
|
|
39
136
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
<Button size="xs" bg={'transparent'} onPress={() => navigation.goBack()}>
|
|
64
|
-
<Ionicons name={'arrow-back'} color={theme === 'light' ? 'black' : 'white'} size={20} />
|
|
65
|
-
</Button>
|
|
66
|
-
) : (showToggle && settings?.layout !== 'bottom') || (showToggle && settings?.layout !== 'host-bottom') ? (
|
|
67
|
-
<Button size="xs" bg={'transparent'} onPress={() => navigation.toggleDrawer()}>
|
|
68
|
-
<Ionicons name={'menu'} color={theme === 'light' ? 'black' : 'white'} size={20} />
|
|
69
|
-
</Button>
|
|
70
|
-
) : (
|
|
71
|
-
<></>
|
|
72
|
-
)}
|
|
73
|
-
<Text
|
|
74
|
-
px={'$2'}
|
|
75
|
-
color={theme === 'light' ? '$black' : '$white'}
|
|
76
|
-
style={{ fontSize: 20 }}
|
|
77
|
-
fontWeight="$bold"
|
|
78
|
-
>
|
|
79
|
-
{title}
|
|
80
|
-
</Text>
|
|
81
|
-
{!!settingToggle ? (
|
|
82
|
-
<SettingDrawer
|
|
83
|
-
onSettingChange={(settings: any) => {
|
|
84
|
-
onSettingChange(settings);
|
|
85
|
-
setSettingToggle(false);
|
|
86
|
-
}}
|
|
87
|
-
/>
|
|
88
|
-
) : null}
|
|
89
|
-
{right ? (
|
|
90
|
-
<HStack alignItems={'center'}>
|
|
91
|
-
<Button size="xs" bg={'transparent'} onPress={() => setSettingToggle(!settingToggle)}>
|
|
92
|
-
<Ionicons name={'cog'} color={theme === 'light' ? 'black' : 'white'} size={20} />
|
|
93
|
-
</Button>
|
|
94
|
-
{rightComponent ? <Box>{rightComponent}</Box> : null}
|
|
137
|
+
{(back ||
|
|
138
|
+
(showToggle && settings?.layout !== 'bottom') ||
|
|
139
|
+
(showToggle && settings?.layout !== 'host-bottom')) && (
|
|
140
|
+
<Button bg={'transparent'} mr={'$2'}></Button>
|
|
141
|
+
)}
|
|
142
|
+
{/* {right ? (
|
|
143
|
+
<HStack alignItems={'center'}>
|
|
144
|
+
<Button size="xs" bg={'transparent'} onPress={() => setSettingToggle(!settingToggle)}>
|
|
145
|
+
<Ionicons
|
|
146
|
+
name={'cog'}
|
|
147
|
+
color={
|
|
148
|
+
settings?.navTheme === 'light' || settings?.navTheme === 'dark'
|
|
149
|
+
? 'black'
|
|
150
|
+
: 'white'
|
|
151
|
+
}
|
|
152
|
+
size={20}
|
|
153
|
+
/>
|
|
154
|
+
</Button>
|
|
155
|
+
{rightComponent ? <Box>{rightComponent}</Box> : null}
|
|
156
|
+
</HStack>
|
|
157
|
+
) : (
|
|
158
|
+
<Button bg={'transparent'} mr={'$2'}></Button>
|
|
159
|
+
)} */}
|
|
95
160
|
</HStack>
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
</Box>
|
|
102
|
-
</SafeAreaView>
|
|
103
|
-
);
|
|
104
|
-
});
|
|
161
|
+
</Box>
|
|
162
|
+
</SafeAreaView>
|
|
163
|
+
);
|
|
164
|
+
},
|
|
165
|
+
);
|
|
105
166
|
|
|
106
167
|
export default Header;
|
|
107
168
|
|
|
@@ -134,7 +195,7 @@ export default Header;
|
|
|
134
195
|
|
|
135
196
|
// return (
|
|
136
197
|
// <SafeAreaView>
|
|
137
|
-
// <StatusBar barStyle={theme === 'light' ? 'dark-content':'light-content'} />
|
|
198
|
+
// <StatusBar barStyle={theme === 'light' ? 'dark-content':'light-content'} />
|
|
138
199
|
// <Box bg={theme === 'light' ? '$white' : '$black'}>
|
|
139
200
|
// <HStack
|
|
140
201
|
// bg={theme === 'light' ? '$white' : '$black'}
|
|
@@ -152,7 +213,7 @@ export default Header;
|
|
|
152
213
|
// borderBottomWidth={'$1'}
|
|
153
214
|
// borderBottomColor={'#d3d3d3'}
|
|
154
215
|
// w="100%"
|
|
155
|
-
|
|
216
|
+
|
|
156
217
|
// >
|
|
157
218
|
// {back ? (
|
|
158
219
|
// <Button size="xs" bg={'transparent'} onPress={() => navigation.goBack()}>
|
|
@@ -192,7 +253,7 @@ export default Header;
|
|
|
192
253
|
// <Button bg={'transparent'} mr={'$2'}></Button>
|
|
193
254
|
// )}
|
|
194
255
|
// </HStack>
|
|
195
|
-
|
|
256
|
+
|
|
196
257
|
// </Box>
|
|
197
258
|
// </SafeAreaView>
|
|
198
259
|
// );
|
|
@@ -4,21 +4,29 @@ import { Box, Pressable, HStack, VStack, Text } from '@gluestack-ui/themed';
|
|
|
4
4
|
const LayoutButton = ({ color, onSettingChange, settings, bottom, mode, bottomOnly, bottomDrawer }: any) => {
|
|
5
5
|
return (
|
|
6
6
|
<Pressable
|
|
7
|
-
backgroundColor={'#f0f2f5'}
|
|
7
|
+
backgroundColor={color === 'light' || color === 'dark' ? '#f0f2f5' : '#263749'}
|
|
8
8
|
width={50}
|
|
9
9
|
height={50}
|
|
10
10
|
borderRadius={'$sm'}
|
|
11
|
+
softShadow={'4'}
|
|
11
12
|
mr={'$4'}
|
|
12
13
|
onPress={() => {
|
|
13
14
|
if (mode === 'style') {
|
|
14
15
|
let { navTheme, ...rest } = settings;
|
|
15
|
-
if (color === '
|
|
16
|
+
if (color === 'light') {
|
|
16
17
|
navTheme = 'light';
|
|
17
18
|
const newSettings = {
|
|
18
19
|
...rest,
|
|
19
20
|
navTheme,
|
|
20
21
|
};
|
|
21
22
|
onSettingChange(newSettings);
|
|
23
|
+
} else if (color === 'realDark') {
|
|
24
|
+
navTheme = 'realDark';
|
|
25
|
+
const newSettings = {
|
|
26
|
+
...rest,
|
|
27
|
+
navTheme,
|
|
28
|
+
};
|
|
29
|
+
onSettingChange(newSettings);
|
|
22
30
|
} else {
|
|
23
31
|
navTheme = 'dark';
|
|
24
32
|
const newSettings = {
|
|
@@ -63,33 +71,39 @@ const LayoutButton = ({ color, onSettingChange, settings, bottom, mode, bottomOn
|
|
|
63
71
|
>
|
|
64
72
|
<HStack>
|
|
65
73
|
<Box
|
|
66
|
-
backgroundColor={color}
|
|
74
|
+
backgroundColor={color === 'light' ? '$white' : '$black'}
|
|
67
75
|
height={bottomOnly ? '$0' : 50}
|
|
68
|
-
width={'28%'}
|
|
76
|
+
width={bottomOnly ? '$0' : '28%'}
|
|
69
77
|
borderTopLeftRadius={'$sm'}
|
|
70
78
|
borderBottomLeftRadius={'$sm'}
|
|
71
79
|
/>
|
|
72
80
|
<VStack justifyContent={'space-between'}>
|
|
73
|
-
<Box
|
|
81
|
+
<Box
|
|
82
|
+
height={15}
|
|
83
|
+
width={bottomOnly ? 49 : 36}
|
|
84
|
+
backgroundColor={color === 'light' || color === 'dark' ? '$white' : '$black'}
|
|
85
|
+
borderTopRightRadius={'$sm'}
|
|
86
|
+
/>
|
|
74
87
|
{bottom ? (
|
|
75
88
|
<Box height={15} width={36} backgroundColor={'$black'} borderBottomRightRadius={'$sm'} />
|
|
76
89
|
) : null}
|
|
77
90
|
|
|
78
91
|
{bottomOnly ? (
|
|
79
92
|
<>
|
|
80
|
-
<Box height={
|
|
81
|
-
<Box height={15} width={49} backgroundColor={'$black'} />
|
|
82
|
-
</>
|
|
83
|
-
) : null}
|
|
84
|
-
|
|
85
|
-
{bottomDrawer ? (
|
|
86
|
-
<>
|
|
93
|
+
<Box height={18} width={'$0'} backgroundColor={'$white'} borderTopRightRadius={'$sm'} />
|
|
87
94
|
<Box
|
|
88
95
|
height={15}
|
|
89
|
-
width={
|
|
96
|
+
width={49}
|
|
90
97
|
backgroundColor={'$black'}
|
|
98
|
+
borderBottomLeftRadius={'$sm'}
|
|
91
99
|
borderBottomRightRadius={'$sm'}
|
|
92
100
|
/>
|
|
101
|
+
</>
|
|
102
|
+
) : null}
|
|
103
|
+
|
|
104
|
+
{bottomDrawer ? (
|
|
105
|
+
<>
|
|
106
|
+
<Box height={15} width={36} backgroundColor={'$black'} borderBottomRightRadius={'$sm'} />
|
|
93
107
|
<Text></Text>
|
|
94
108
|
</>
|
|
95
109
|
) : null}
|
|
@@ -1,60 +1,163 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Box,
|
|
4
|
+
Text,
|
|
5
|
+
HStack,
|
|
6
|
+
Actionsheet,
|
|
7
|
+
ActionsheetBackdrop,
|
|
8
|
+
ActionsheetContent,
|
|
9
|
+
ActionsheetDragIndicatorWrapper,
|
|
10
|
+
ActionsheetDragIndicator,
|
|
11
|
+
Select,
|
|
12
|
+
SelectTrigger,
|
|
13
|
+
SelectInput,
|
|
14
|
+
Icon,
|
|
15
|
+
ChevronDownIcon,
|
|
16
|
+
SelectPortal,
|
|
17
|
+
SelectBackdrop,
|
|
18
|
+
SelectContent,
|
|
19
|
+
SelectDragIndicatorWrapper,
|
|
20
|
+
SelectDragIndicator,
|
|
21
|
+
SelectItem,
|
|
22
|
+
Divider,
|
|
23
|
+
Switch,
|
|
24
|
+
ScrollView,
|
|
25
|
+
} from '@gluestack-ui/themed';
|
|
3
26
|
import { useSelector } from 'react-redux';
|
|
4
27
|
|
|
5
28
|
import LayoutButton from './LayoutButton';
|
|
6
29
|
import ThemeColorButton from './ThemeColorButton';
|
|
7
30
|
import { THEMECOLOR } from '../../../../utils/ThemeColor';
|
|
8
31
|
|
|
9
|
-
export const SettingDrawer = ({ onSettingChange }: any) => {
|
|
32
|
+
export const SettingDrawer = ({ isOpen, onSettingChange, handleClose }: any) => {
|
|
10
33
|
const settings = useSelector<any>((state) => state.settings) as any;
|
|
11
34
|
return (
|
|
12
|
-
<
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
<Actionsheet isOpen={isOpen} onClose={handleClose} zIndex={999}>
|
|
36
|
+
<ActionsheetBackdrop />
|
|
37
|
+
<ActionsheetContent zIndex={999} w={'100%'}>
|
|
38
|
+
<ActionsheetDragIndicatorWrapper>
|
|
39
|
+
<ActionsheetDragIndicator />
|
|
40
|
+
</ActionsheetDragIndicatorWrapper>
|
|
41
|
+
<ScrollView>
|
|
42
|
+
<Box alignItems="flex-start" bg={'$white'} w={'100%'} p={'$3'}>
|
|
43
|
+
<Text color={'#00000'} fontWeight={'$semibold'}>
|
|
44
|
+
Page style setting
|
|
45
|
+
</Text>
|
|
46
|
+
<HStack space={'md'} mt={'$3'}>
|
|
47
|
+
<LayoutButton
|
|
48
|
+
mode="style"
|
|
49
|
+
settings={settings}
|
|
50
|
+
onSettingChange={onSettingChange}
|
|
51
|
+
color={'light'}
|
|
52
|
+
/>
|
|
53
|
+
<LayoutButton
|
|
54
|
+
mode="style"
|
|
55
|
+
settings={settings}
|
|
56
|
+
onSettingChange={onSettingChange}
|
|
57
|
+
color={'dark'}
|
|
58
|
+
/>
|
|
59
|
+
<LayoutButton
|
|
60
|
+
mode="style"
|
|
61
|
+
settings={settings}
|
|
62
|
+
onSettingChange={onSettingChange}
|
|
63
|
+
color={'realDark'}
|
|
64
|
+
/>
|
|
65
|
+
</HStack>
|
|
66
|
+
<Text color={'#000000'} fontWeight={'$semibold'} mt={'$2'}>
|
|
67
|
+
Select Theme
|
|
68
|
+
</Text>
|
|
69
|
+
<Select
|
|
70
|
+
mt={'$2'}
|
|
71
|
+
w={'100%'}
|
|
72
|
+
selectedValue={settings?.themeName}
|
|
73
|
+
onValueChange={(value) => {
|
|
74
|
+
const newSettings = {
|
|
75
|
+
...settings,
|
|
76
|
+
themeName: value,
|
|
77
|
+
};
|
|
78
|
+
onSettingChange(newSettings);
|
|
79
|
+
}}
|
|
80
|
+
>
|
|
81
|
+
<SelectTrigger variant="outline" size="md">
|
|
82
|
+
<SelectInput placeholder="Select option" />
|
|
83
|
+
<Icon as={ChevronDownIcon} mr={'$3'} />
|
|
84
|
+
</SelectTrigger>
|
|
85
|
+
<SelectPortal>
|
|
86
|
+
<SelectBackdrop />
|
|
87
|
+
<SelectContent>
|
|
88
|
+
<SelectDragIndicatorWrapper>
|
|
89
|
+
<SelectDragIndicator />
|
|
90
|
+
</SelectDragIndicatorWrapper>
|
|
91
|
+
<SelectItem label="Default" value="default" />
|
|
92
|
+
<SelectItem label="Github Theme" value="github" />
|
|
93
|
+
<SelectItem label="Slack Theme" value="slack" />
|
|
94
|
+
<SelectItem label="Airbnb Theme" value="airbnb" />
|
|
95
|
+
<SelectItem label="Spotify Theme" value="spotify" />
|
|
96
|
+
</SelectContent>
|
|
97
|
+
</SelectPortal>
|
|
98
|
+
</Select>
|
|
99
|
+
<Text color={'#000000'} fontWeight={'$semibold'} mt={'$2'}>
|
|
100
|
+
Theme Color
|
|
101
|
+
</Text>
|
|
102
|
+
<HStack space={'md'} mt={'$3'} flexWrap={'wrap'}>
|
|
103
|
+
{THEMECOLOR.map((color, index) => (
|
|
104
|
+
<ThemeColorButton
|
|
105
|
+
key={index}
|
|
106
|
+
color={color}
|
|
107
|
+
settings={settings}
|
|
108
|
+
onSettingChange={onSettingChange}
|
|
109
|
+
/>
|
|
110
|
+
))}
|
|
111
|
+
</HStack>
|
|
112
|
+
<Divider my={'$4'} />
|
|
113
|
+
<Text color={'#000000'} fontWeight={'$semibold'} mt={'$2'}>
|
|
114
|
+
Navigation Mode
|
|
115
|
+
</Text>
|
|
116
|
+
<HStack space={'md'} mt={'$3'}>
|
|
117
|
+
<LayoutButton
|
|
118
|
+
mode="layout"
|
|
119
|
+
settings={settings}
|
|
120
|
+
onSettingChange={onSettingChange}
|
|
121
|
+
color={'light'}
|
|
122
|
+
/>
|
|
123
|
+
<LayoutButton
|
|
124
|
+
mode="layout"
|
|
125
|
+
bottom={true}
|
|
126
|
+
settings={settings}
|
|
127
|
+
onSettingChange={onSettingChange}
|
|
128
|
+
color={'light'}
|
|
129
|
+
/>
|
|
40
130
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
131
|
+
<LayoutButton
|
|
132
|
+
mode="light"
|
|
133
|
+
bottomOnly={true}
|
|
134
|
+
settings={settings}
|
|
135
|
+
onSettingChange={onSettingChange}
|
|
136
|
+
color={'light'}
|
|
137
|
+
/>
|
|
138
|
+
</HStack>
|
|
139
|
+
<Divider my={'$4'} />
|
|
140
|
+
<Text color={'#000000'} fontWeight={'$semibold'} mt={'$2'}>
|
|
141
|
+
Regional Settings
|
|
142
|
+
</Text>
|
|
143
|
+
<HStack w={'100%'} mt={'$3'} justifyContent={'space-between'} alignItems="center">
|
|
144
|
+
<Text>Menu Header</Text>
|
|
145
|
+
<Switch
|
|
146
|
+
onValueChange={(value) => {
|
|
147
|
+
console.log(value);
|
|
148
|
+
const newSettings = {
|
|
149
|
+
...settings,
|
|
150
|
+
menuHeader: value,
|
|
151
|
+
};
|
|
152
|
+
onSettingChange(newSettings);
|
|
153
|
+
}}
|
|
154
|
+
isChecked={settings?.menuHeader}
|
|
155
|
+
value={settings?.menuHeader}
|
|
156
|
+
/>
|
|
157
|
+
</HStack>
|
|
158
|
+
</Box>
|
|
159
|
+
</ScrollView>
|
|
160
|
+
</ActionsheetContent>
|
|
161
|
+
</Actionsheet>
|
|
59
162
|
);
|
|
60
163
|
};
|
|
@@ -5,8 +5,8 @@ const ThemeColorButton = ({ color, onSettingChange, settings }: any) => {
|
|
|
5
5
|
return (
|
|
6
6
|
<Pressable
|
|
7
7
|
backgroundColor={color}
|
|
8
|
-
height={'$
|
|
9
|
-
width={'$
|
|
8
|
+
height={'$6'}
|
|
9
|
+
width={'$6'}
|
|
10
10
|
borderRadius={'$sm'}
|
|
11
11
|
onPress={() => {
|
|
12
12
|
let { primaryColor, ...rest } = settings;
|
|
@@ -4,6 +4,7 @@ import { cloneDeep, merge } from 'lodash-es';
|
|
|
4
4
|
import React, { MutableRefObject, ReactElement, useRef } from 'react';
|
|
5
5
|
import { useDispatch, useSelector } from 'react-redux';
|
|
6
6
|
import { navigationRef } from '@common-stack/client-react';
|
|
7
|
+
import { isUserAuthenticated } from '@adminide-stack/user-auth0-client';
|
|
7
8
|
|
|
8
9
|
interface INavigationContainerComponentProps {
|
|
9
10
|
children: ReactElement[];
|
|
@@ -51,6 +52,7 @@ export const configurableRoutesWithNavigationRouteName = (
|
|
|
51
52
|
|
|
52
53
|
export const useLocationChange = () => {
|
|
53
54
|
const dispatch = useDispatch();
|
|
55
|
+
const { authenticated } = isUserAuthenticated();
|
|
54
56
|
const [locationChange, setLocationChange] = React.useState<any>(null);
|
|
55
57
|
const platformState = useSelector((state) => (state as any).platform);
|
|
56
58
|
|
|
@@ -64,9 +66,14 @@ export const useLocationChange = () => {
|
|
|
64
66
|
const configuredRoutes = configurableRoutesWithNavigationRouteName(configurableRoutes);
|
|
65
67
|
const currentPath = currentRouteName ? getPath(currentRouteName as string, configuredRoutes) : null;
|
|
66
68
|
const previousPath = previousRoute ? getPath(previousRoute?.current!.name, configuredRoutes) : null;
|
|
69
|
+
const currentOrgName = authenticated
|
|
70
|
+
? orgName
|
|
71
|
+
? orgName
|
|
72
|
+
: currentRoute!.params?.orgName || platformState?.orgName || previousRoute?.current?.params?.orgName
|
|
73
|
+
: null;
|
|
67
74
|
const currParams = {
|
|
68
75
|
...(currentRoute!.params || {}),
|
|
69
|
-
orgName:
|
|
76
|
+
orgName: currentOrgName,
|
|
70
77
|
};
|
|
71
78
|
|
|
72
79
|
navigationRef?.setParams(currParams);
|
|
@@ -104,7 +111,7 @@ export const NavigationContainerComponent = ({
|
|
|
104
111
|
<NavigationContainer
|
|
105
112
|
ref={navigationRef}
|
|
106
113
|
linking={linking}
|
|
107
|
-
independent={independent}
|
|
114
|
+
// independent={independent}
|
|
108
115
|
onReady={() => {
|
|
109
116
|
routeNameRef.current = navigationRef.isReady() ? navigationRef?.getCurrentRoute() : null;
|
|
110
117
|
const currentRoute: any = routeNameRef?.current;
|