@brightlayer-ui/react-native-template-authentication-typescript 2.1.0 → 3.0.0-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.
- package/README.md +22 -17
- package/package.json +3 -3
- package/template/.bundle/config +2 -0
- package/template/.eslintrc.js +57 -0
- package/template/.prettierrc.js +7 -0
- package/template/.watchmanconfig +1 -0
- package/template/App.tsx +85 -47
- package/template/Gemfile +9 -0
- package/template/Gemfile.lock +105 -0
- package/template/README.md +79 -0
- package/template/__tests__/App.test.tsx +17 -0
- package/template/android/app/build.gradle +120 -0
- package/template/android/app/debug.keystore +0 -0
- package/template/android/app/proguard-rules.pro +10 -0
- package/template/android/app/src/debug/AndroidManifest.xml +9 -0
- package/template/android/app/src/main/AndroidManifest.xml +25 -0
- package/template/android/app/src/main/java/com/workflow/MainActivity.kt +28 -0
- package/template/android/app/src/main/java/com/workflow/MainApplication.kt +43 -0
- package/template/android/app/src/main/res/drawable/rn_edit_text_material.xml +37 -0
- package/template/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/template/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/template/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/template/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/template/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/template/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/template/android/app/src/main/res/values/strings.xml +3 -0
- package/template/android/app/src/main/res/values/styles.xml +9 -0
- package/template/android/build.gradle +21 -0
- package/template/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/template/android/gradle/wrapper/gradle-wrapper.properties +7 -0
- package/template/android/gradle.properties +41 -0
- package/template/android/gradlew +249 -0
- package/template/android/gradlew.bat +92 -0
- package/template/android/link-assets-manifest.json +25 -0
- package/template/android/settings.gradle +4 -0
- package/template/app.json +4 -0
- package/template/assets/fonts/OpenSans-Bold.ttf +0 -0
- package/template/assets/fonts/OpenSans-ExtraBold.ttf +0 -0
- package/template/assets/fonts/OpenSans-Light.ttf +0 -0
- package/template/assets/fonts/OpenSans-Regular.ttf +0 -0
- package/template/assets/fonts/OpenSans-SemiBold.ttf +0 -0
- package/template/assets/images/Logo.png +0 -0
- package/template/babel.config.js +1 -2
- package/template/eslint.config.mjs +10 -0
- package/template/index.js +11 -0
- package/template/ios/.xcode.env +11 -0
- package/template/ios/Podfile +40 -0
- package/template/ios/Podfile.lock +1496 -0
- package/template/ios/blankTemplate/AppDelegate.h +6 -0
- package/template/ios/blankTemplate/AppDelegate.mm +31 -0
- package/template/ios/blankTemplate/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
- package/template/ios/blankTemplate/Images.xcassets/Contents.json +6 -0
- package/template/ios/blankTemplate/Info.plist +75 -0
- package/template/ios/blankTemplate/LaunchScreen.storyboard +47 -0
- package/template/ios/blankTemplate/PrivacyInfo.xcprivacy +37 -0
- package/template/ios/blankTemplate/main.m +10 -0
- package/template/ios/blankTemplate.xcodeproj/project.pbxproj +741 -0
- package/template/ios/blankTemplate.xcodeproj/xcshareddata/xcschemes/blankTemplate.xcscheme +88 -0
- package/template/ios/blankTemplate.xcworkspace/contents.xcworkspacedata +10 -0
- package/template/ios/blankTemplate.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/template/ios/blankTemplateTests/Info.plist +24 -0
- package/template/ios/blankTemplateTests/blankTemplateTests.m +66 -0
- package/template/ios/link-assets-manifest.json +25 -0
- package/template/jest.config.js +3 -0
- package/template/metro.config.js +7 -25
- package/template/package.json +70 -0
- package/template/src/actions/AuthUIActions.tsx +10 -11
- package/template/src/actions/RegistrationUIActions.tsx +37 -30
- package/template/src/assets/images/eaton_stacked_logo.png +0 -0
- package/template/src/components/AuthCustomScreen.tsx +50 -0
- package/template/src/components/CustomScreen.tsx +77 -0
- package/template/src/components/DebugComponent.tsx +49 -0
- package/template/src/components/ForgotPasswordScreenBaseExample.tsx +42 -0
- package/template/src/components/ResetPasswordScreenBaseExample.tsx +41 -0
- package/template/src/components/UserMenuExample.tsx +117 -0
- package/template/src/contexts/AppContextProvider.tsx +28 -0
- package/template/src/contexts/ThemeContext.ts +15 -0
- package/template/src/navigation/index.tsx +205 -22
- package/template/src/navigation/navigation-drawer.tsx +38 -25
- package/template/src/screens/ChangePassword.tsx +15 -0
- package/template/src/screens/Dashboard.tsx +137 -0
- package/template/src/screens/Homepage.tsx +135 -0
- package/template/src/screens/Locations.tsx +137 -0
- package/template/src/screens/Login.tsx +17 -0
- package/template/src/screens/Registration.tsx +4 -0
- package/template/src/screens/RegistrationInvite.tsx +5 -0
- package/template/src/screens/index.ts +12 -0
- package/template/src/store/local-storage.ts +4 -4
- package/template/translations/dictionary/chinese.ts +29 -0
- package/template/translations/dictionary/english.ts +29 -0
- package/template/translations/dictionary/french.ts +29 -0
- package/template/translations/dictionary/index.ts +19 -0
- package/template/translations/dictionary/portuguese.ts +29 -0
- package/template/translations/dictionary/spanish.ts +29 -0
- package/template/translations/dictionary/types.ts +27 -0
- package/template/translations/i18n.ts +58 -0
- package/template/tsconfig.json +60 -0
- package/template/yarn.lock +7341 -0
- package/template.config.js +4 -0
- package/CHANGELOG.md +0 -69
- package/dependencies.json +0 -31
- package/images/Logo.svg +0 -11
- package/template/__mocks__/svgMock.js +0 -8
- package/template/jestSetupFile.js +0 -17
- package/template/react-native.config.js +0 -3
- package/template/src/navigation/DeepLinking.ts +0 -62
- package/template/src/screens/home.tsx +0 -198
- package/template/src/screens/index.tsx +0 -3
- package/template/src/screens/pageOne.tsx +0 -91
- package/template/src/screens/pageTwo.tsx +0 -92
- /package/{fonts → template/android/app/src/main/assets/fonts}/OpenSans-Bold.ttf +0 -0
- /package/{fonts → template/android/app/src/main/assets/fonts}/OpenSans-ExtraBold.ttf +0 -0
- /package/{fonts → template/android/app/src/main/assets/fonts}/OpenSans-Light.ttf +0 -0
- /package/{fonts → template/android/app/src/main/assets/fonts}/OpenSans-Regular.ttf +0 -0
- /package/{fonts → template/android/app/src/main/assets/fonts}/OpenSans-SemiBold.ttf +0 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
SafeAreaView,
|
|
4
|
+
ScrollView,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
TextStyle,
|
|
7
|
+
ViewStyle,
|
|
8
|
+
Animated,
|
|
9
|
+
Easing,
|
|
10
|
+
I18nManager,
|
|
11
|
+
} from 'react-native';
|
|
12
|
+
import { EmptyState, Header } from '@brightlayer-ui/react-native-components';
|
|
13
|
+
import RNRestart from 'react-native-restart';
|
|
14
|
+
import { StackNavigationProp } from '@react-navigation/stack';
|
|
15
|
+
import { RootStackParamList } from '../navigation';
|
|
16
|
+
import { ExtendedTheme, useExtendedTheme } from '@brightlayer-ui/react-native-themes';
|
|
17
|
+
import { UserMenuExample } from '../components/UserMenuExample';
|
|
18
|
+
import { useThemeContext } from '../contexts/ThemeContext';
|
|
19
|
+
import { useTranslation } from 'react-i18next';
|
|
20
|
+
import { IconFamily } from '@brightlayer-ui/react-native-components/core/__types__';
|
|
21
|
+
import { DrawerActions } from '@react-navigation/native';
|
|
22
|
+
|
|
23
|
+
const styles = (
|
|
24
|
+
theme: ExtendedTheme
|
|
25
|
+
): StyleSheet.NamedStyles<{
|
|
26
|
+
content: ViewStyle;
|
|
27
|
+
pxbLogoWrapper: ViewStyle;
|
|
28
|
+
pxbLogo: ViewStyle;
|
|
29
|
+
title: TextStyle;
|
|
30
|
+
subtitle: TextStyle;
|
|
31
|
+
bold: TextStyle;
|
|
32
|
+
divider: ViewStyle;
|
|
33
|
+
openURLButtonText: TextStyle;
|
|
34
|
+
}> =>
|
|
35
|
+
StyleSheet.create({
|
|
36
|
+
content: {
|
|
37
|
+
flex: 1,
|
|
38
|
+
backgroundColor: theme.colors.background,
|
|
39
|
+
},
|
|
40
|
+
pxbLogoWrapper: {
|
|
41
|
+
justifyContent: 'center',
|
|
42
|
+
marginTop: 16,
|
|
43
|
+
},
|
|
44
|
+
pxbLogo: {
|
|
45
|
+
alignSelf: 'center',
|
|
46
|
+
height: 100,
|
|
47
|
+
width: 100,
|
|
48
|
+
},
|
|
49
|
+
title: {
|
|
50
|
+
textAlign: 'center',
|
|
51
|
+
marginBottom: 16,
|
|
52
|
+
},
|
|
53
|
+
subtitle: {
|
|
54
|
+
textAlign: 'center',
|
|
55
|
+
},
|
|
56
|
+
bold: {
|
|
57
|
+
fontWeight: 'bold',
|
|
58
|
+
},
|
|
59
|
+
divider: {
|
|
60
|
+
marginVertical: 24,
|
|
61
|
+
},
|
|
62
|
+
openURLButtonText: {
|
|
63
|
+
color: theme.colors.primary,
|
|
64
|
+
padding: 8,
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
type AppProps = {
|
|
69
|
+
navigation: StackNavigationProp<RootStackParamList, 'Dashboard'>;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const toggleRTL = (): void => {
|
|
73
|
+
if (I18nManager.isRTL) {
|
|
74
|
+
I18nManager.forceRTL(false);
|
|
75
|
+
} else {
|
|
76
|
+
I18nManager.forceRTL(true);
|
|
77
|
+
}
|
|
78
|
+
RNRestart.Restart();
|
|
79
|
+
};
|
|
80
|
+
const Dashboard: React.FC<AppProps> = ({ navigation }): JSX.Element => {
|
|
81
|
+
const theme = useExtendedTheme();
|
|
82
|
+
const { t } = useTranslation();
|
|
83
|
+
const { theme: themeType, setTheme } = useThemeContext();
|
|
84
|
+
|
|
85
|
+
const defaultStyles = styles(theme);
|
|
86
|
+
const spinValue = new Animated.Value(0);
|
|
87
|
+
const Event: IconFamily = { family: 'material', name: 'event', direction: 'ltr' };
|
|
88
|
+
Animated.loop(
|
|
89
|
+
Animated.timing(spinValue, {
|
|
90
|
+
toValue: 1,
|
|
91
|
+
duration: 2500,
|
|
92
|
+
easing: Easing.linear,
|
|
93
|
+
useNativeDriver: true,
|
|
94
|
+
})
|
|
95
|
+
).start();
|
|
96
|
+
|
|
97
|
+
return (
|
|
98
|
+
<>
|
|
99
|
+
<Header
|
|
100
|
+
title={`${t('DRAWER_MENU.DASHBOARD')}`}
|
|
101
|
+
icon={{ name: 'menu' }}
|
|
102
|
+
onIconPress={(): void => {
|
|
103
|
+
navigation.dispatch(DrawerActions.openDrawer());
|
|
104
|
+
}}
|
|
105
|
+
actionItems={[
|
|
106
|
+
{
|
|
107
|
+
icon: { name: 'more' },
|
|
108
|
+
onPress: (): void => {},
|
|
109
|
+
component: (
|
|
110
|
+
<UserMenuExample
|
|
111
|
+
onToggleRTL={toggleRTL}
|
|
112
|
+
onToggleTheme={(): void => setTheme(themeType === 'light' ? 'dark' : 'light')}
|
|
113
|
+
/>
|
|
114
|
+
),
|
|
115
|
+
},
|
|
116
|
+
]}
|
|
117
|
+
/>
|
|
118
|
+
<SafeAreaView style={defaultStyles.content}>
|
|
119
|
+
<ScrollView
|
|
120
|
+
contentContainerStyle={{
|
|
121
|
+
flex: 1,
|
|
122
|
+
justifyContent: 'center',
|
|
123
|
+
alignItems: 'center',
|
|
124
|
+
}}
|
|
125
|
+
>
|
|
126
|
+
<EmptyState
|
|
127
|
+
icon={Event}
|
|
128
|
+
title={`${t('DRAWER_MENU.DASHBOARD')}`}
|
|
129
|
+
description={`${t('PAGE_DETAILS.AUTHORISED_MESSAGE')}`}
|
|
130
|
+
/>
|
|
131
|
+
</ScrollView>
|
|
132
|
+
</SafeAreaView>
|
|
133
|
+
</>
|
|
134
|
+
);
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
export default Dashboard;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
SafeAreaView,
|
|
4
|
+
ScrollView,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
TextStyle,
|
|
7
|
+
ViewStyle,
|
|
8
|
+
Animated,
|
|
9
|
+
Easing,
|
|
10
|
+
I18nManager,
|
|
11
|
+
} from 'react-native';
|
|
12
|
+
import { EmptyState, Header } from '@brightlayer-ui/react-native-components';
|
|
13
|
+
import RNRestart from 'react-native-restart';
|
|
14
|
+
import { StackNavigationProp } from '@react-navigation/stack';
|
|
15
|
+
import { RootStackParamList } from '../navigation';
|
|
16
|
+
import { ExtendedTheme, useExtendedTheme } from '@brightlayer-ui/react-native-themes';
|
|
17
|
+
import { UserMenuExample } from '../components/UserMenuExample';
|
|
18
|
+
import { useThemeContext } from '../contexts/ThemeContext';
|
|
19
|
+
import { useTranslation } from 'react-i18next';
|
|
20
|
+
import { IconFamily } from '@brightlayer-ui/react-native-components/core/__types__';
|
|
21
|
+
import { DrawerActions } from '@react-navigation/native';
|
|
22
|
+
|
|
23
|
+
const styles = (
|
|
24
|
+
theme: ExtendedTheme
|
|
25
|
+
): StyleSheet.NamedStyles<{
|
|
26
|
+
content: ViewStyle;
|
|
27
|
+
pxbLogoWrapper: ViewStyle;
|
|
28
|
+
pxbLogo: ViewStyle;
|
|
29
|
+
title: TextStyle;
|
|
30
|
+
subtitle: TextStyle;
|
|
31
|
+
bold: TextStyle;
|
|
32
|
+
divider: ViewStyle;
|
|
33
|
+
openURLButtonText: TextStyle;
|
|
34
|
+
}> =>
|
|
35
|
+
StyleSheet.create({
|
|
36
|
+
content: {
|
|
37
|
+
flex: 1,
|
|
38
|
+
backgroundColor: theme.colors.background,
|
|
39
|
+
},
|
|
40
|
+
pxbLogoWrapper: {
|
|
41
|
+
justifyContent: 'center',
|
|
42
|
+
marginTop: 16,
|
|
43
|
+
},
|
|
44
|
+
pxbLogo: {
|
|
45
|
+
alignSelf: 'center',
|
|
46
|
+
height: 100,
|
|
47
|
+
width: 100,
|
|
48
|
+
},
|
|
49
|
+
title: {
|
|
50
|
+
textAlign: 'center',
|
|
51
|
+
marginBottom: 16,
|
|
52
|
+
},
|
|
53
|
+
subtitle: {
|
|
54
|
+
textAlign: 'center',
|
|
55
|
+
},
|
|
56
|
+
bold: {
|
|
57
|
+
fontWeight: 'bold',
|
|
58
|
+
},
|
|
59
|
+
divider: {
|
|
60
|
+
marginVertical: 24,
|
|
61
|
+
},
|
|
62
|
+
openURLButtonText: {
|
|
63
|
+
color: theme.colors.primary,
|
|
64
|
+
padding: 8,
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
type AppProps = {
|
|
69
|
+
navigation: StackNavigationProp<RootStackParamList, 'Homepage'>;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const toggleRTL = (): void => {
|
|
73
|
+
if (I18nManager.isRTL) {
|
|
74
|
+
I18nManager.forceRTL(false);
|
|
75
|
+
} else {
|
|
76
|
+
I18nManager.forceRTL(true);
|
|
77
|
+
}
|
|
78
|
+
RNRestart.Restart();
|
|
79
|
+
};
|
|
80
|
+
export const Homepage: React.FC<AppProps> = ({ navigation }): JSX.Element => {
|
|
81
|
+
const theme = useExtendedTheme();
|
|
82
|
+
const { t } = useTranslation();
|
|
83
|
+
const { theme: themeType, setTheme } = useThemeContext();
|
|
84
|
+
|
|
85
|
+
const defaultStyles = styles(theme);
|
|
86
|
+
const spinValue = new Animated.Value(0);
|
|
87
|
+
const Event: IconFamily = { family: 'material', name: 'event', direction: 'ltr' };
|
|
88
|
+
Animated.loop(
|
|
89
|
+
Animated.timing(spinValue, {
|
|
90
|
+
toValue: 1,
|
|
91
|
+
duration: 2500,
|
|
92
|
+
easing: Easing.linear,
|
|
93
|
+
useNativeDriver: true,
|
|
94
|
+
})
|
|
95
|
+
).start();
|
|
96
|
+
|
|
97
|
+
return (
|
|
98
|
+
<>
|
|
99
|
+
<Header
|
|
100
|
+
title={`${t('TOOLBAR_MENU.HOME_PAGE')}`}
|
|
101
|
+
icon={{ name: 'menu' }}
|
|
102
|
+
onIconPress={(): void => {
|
|
103
|
+
navigation.dispatch(DrawerActions.openDrawer());
|
|
104
|
+
}}
|
|
105
|
+
actionItems={[
|
|
106
|
+
{
|
|
107
|
+
icon: { name: 'more' },
|
|
108
|
+
onPress: (): void => {},
|
|
109
|
+
component: (
|
|
110
|
+
<UserMenuExample
|
|
111
|
+
onToggleRTL={toggleRTL}
|
|
112
|
+
onToggleTheme={(): void => setTheme(themeType === 'light' ? 'dark' : 'light')}
|
|
113
|
+
/>
|
|
114
|
+
),
|
|
115
|
+
},
|
|
116
|
+
]}
|
|
117
|
+
/>
|
|
118
|
+
<SafeAreaView style={defaultStyles.content}>
|
|
119
|
+
<ScrollView
|
|
120
|
+
contentContainerStyle={{
|
|
121
|
+
flex: 1,
|
|
122
|
+
justifyContent: 'center',
|
|
123
|
+
alignItems: 'center',
|
|
124
|
+
}}
|
|
125
|
+
>
|
|
126
|
+
<EmptyState
|
|
127
|
+
icon={Event}
|
|
128
|
+
title={`${t('TOOLBAR_MENU.HOME_PAGE')}`}
|
|
129
|
+
description={`${t('PAGE_DETAILS.AUTHORISED_MESSAGE')}`}
|
|
130
|
+
/>
|
|
131
|
+
</ScrollView>
|
|
132
|
+
</SafeAreaView>
|
|
133
|
+
</>
|
|
134
|
+
);
|
|
135
|
+
};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
SafeAreaView,
|
|
4
|
+
ScrollView,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
TextStyle,
|
|
7
|
+
ViewStyle,
|
|
8
|
+
Animated,
|
|
9
|
+
Easing,
|
|
10
|
+
I18nManager,
|
|
11
|
+
} from 'react-native';
|
|
12
|
+
import { EmptyState, Header } from '@brightlayer-ui/react-native-components';
|
|
13
|
+
import RNRestart from 'react-native-restart';
|
|
14
|
+
import { StackNavigationProp } from '@react-navigation/stack';
|
|
15
|
+
import { RootStackParamList } from '../navigation';
|
|
16
|
+
import { ExtendedTheme, useExtendedTheme } from '@brightlayer-ui/react-native-themes';
|
|
17
|
+
import { UserMenuExample } from '../components/UserMenuExample';
|
|
18
|
+
import { useThemeContext } from '../contexts/ThemeContext';
|
|
19
|
+
import { useTranslation } from 'react-i18next';
|
|
20
|
+
import { IconFamily } from '@brightlayer-ui/react-native-components/core/__types__';
|
|
21
|
+
import { DrawerActions } from '@react-navigation/native';
|
|
22
|
+
|
|
23
|
+
const styles = (
|
|
24
|
+
theme: ExtendedTheme
|
|
25
|
+
): StyleSheet.NamedStyles<{
|
|
26
|
+
content: ViewStyle;
|
|
27
|
+
pxbLogoWrapper: ViewStyle;
|
|
28
|
+
pxbLogo: ViewStyle;
|
|
29
|
+
title: TextStyle;
|
|
30
|
+
subtitle: TextStyle;
|
|
31
|
+
bold: TextStyle;
|
|
32
|
+
divider: ViewStyle;
|
|
33
|
+
openURLButtonText: TextStyle;
|
|
34
|
+
}> =>
|
|
35
|
+
StyleSheet.create({
|
|
36
|
+
content: {
|
|
37
|
+
flex: 1,
|
|
38
|
+
backgroundColor: theme.colors.background,
|
|
39
|
+
},
|
|
40
|
+
pxbLogoWrapper: {
|
|
41
|
+
justifyContent: 'center',
|
|
42
|
+
marginTop: 16,
|
|
43
|
+
},
|
|
44
|
+
pxbLogo: {
|
|
45
|
+
alignSelf: 'center',
|
|
46
|
+
height: 100,
|
|
47
|
+
width: 100,
|
|
48
|
+
},
|
|
49
|
+
title: {
|
|
50
|
+
textAlign: 'center',
|
|
51
|
+
marginBottom: 16,
|
|
52
|
+
},
|
|
53
|
+
subtitle: {
|
|
54
|
+
textAlign: 'center',
|
|
55
|
+
},
|
|
56
|
+
bold: {
|
|
57
|
+
fontWeight: 'bold',
|
|
58
|
+
},
|
|
59
|
+
divider: {
|
|
60
|
+
marginVertical: 24,
|
|
61
|
+
},
|
|
62
|
+
openURLButtonText: {
|
|
63
|
+
color: theme.colors.primary,
|
|
64
|
+
padding: 8,
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
type AppProps = {
|
|
69
|
+
navigation: StackNavigationProp<RootStackParamList, 'Locations'>;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const toggleRTL = (): void => {
|
|
73
|
+
if (I18nManager.isRTL) {
|
|
74
|
+
I18nManager.forceRTL(false);
|
|
75
|
+
} else {
|
|
76
|
+
I18nManager.forceRTL(true);
|
|
77
|
+
}
|
|
78
|
+
RNRestart.Restart();
|
|
79
|
+
};
|
|
80
|
+
const Locations: React.FC<AppProps> = ({ navigation }): JSX.Element => {
|
|
81
|
+
const theme = useExtendedTheme();
|
|
82
|
+
const { t } = useTranslation();
|
|
83
|
+
const { theme: themeType, setTheme } = useThemeContext();
|
|
84
|
+
|
|
85
|
+
const defaultStyles = styles(theme);
|
|
86
|
+
const spinValue = new Animated.Value(0);
|
|
87
|
+
const Event: IconFamily = { family: 'material', name: 'event', direction: 'ltr' };
|
|
88
|
+
Animated.loop(
|
|
89
|
+
Animated.timing(spinValue, {
|
|
90
|
+
toValue: 1,
|
|
91
|
+
duration: 2500,
|
|
92
|
+
easing: Easing.linear,
|
|
93
|
+
useNativeDriver: true,
|
|
94
|
+
})
|
|
95
|
+
).start();
|
|
96
|
+
|
|
97
|
+
return (
|
|
98
|
+
<>
|
|
99
|
+
<Header
|
|
100
|
+
title={`${t('DRAWER_MENU.LOCATIONS')}`}
|
|
101
|
+
icon={{ name: 'menu' }}
|
|
102
|
+
onIconPress={(): void => {
|
|
103
|
+
navigation.dispatch(DrawerActions.openDrawer());
|
|
104
|
+
}}
|
|
105
|
+
actionItems={[
|
|
106
|
+
{
|
|
107
|
+
icon: { name: 'more' },
|
|
108
|
+
onPress: (): void => {},
|
|
109
|
+
component: (
|
|
110
|
+
<UserMenuExample
|
|
111
|
+
onToggleRTL={toggleRTL}
|
|
112
|
+
onToggleTheme={(): void => setTheme(themeType === 'light' ? 'dark' : 'light')}
|
|
113
|
+
/>
|
|
114
|
+
),
|
|
115
|
+
},
|
|
116
|
+
]}
|
|
117
|
+
/>
|
|
118
|
+
<SafeAreaView style={defaultStyles.content}>
|
|
119
|
+
<ScrollView
|
|
120
|
+
contentContainerStyle={{
|
|
121
|
+
flex: 1,
|
|
122
|
+
justifyContent: 'center',
|
|
123
|
+
alignItems: 'center',
|
|
124
|
+
}}
|
|
125
|
+
>
|
|
126
|
+
<EmptyState
|
|
127
|
+
icon={Event}
|
|
128
|
+
title={`${t('DRAWER_MENU.LOCATIONS')}`}
|
|
129
|
+
description={`${t('PAGE_DETAILS.AUTHORISED_MESSAGE')}`}
|
|
130
|
+
/>
|
|
131
|
+
</ScrollView>
|
|
132
|
+
</SafeAreaView>
|
|
133
|
+
</>
|
|
134
|
+
);
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
export default Locations;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Image } from 'react-native';
|
|
3
|
+
import { DebugComponent } from '../components/DebugComponent';
|
|
4
|
+
import { LoginScreenProps, LoginScreen } from '@brightlayer-ui/react-native-auth-workflow';
|
|
5
|
+
|
|
6
|
+
export const Login: React.FC<React.PropsWithChildren<LoginScreenProps>> = () => (
|
|
7
|
+
<LoginScreen
|
|
8
|
+
projectImage={
|
|
9
|
+
<Image
|
|
10
|
+
style={{ width: '100%' }}
|
|
11
|
+
resizeMode="contain"
|
|
12
|
+
source={require('../assets/images/eaton_stacked_logo.png')}
|
|
13
|
+
/>
|
|
14
|
+
}
|
|
15
|
+
header={<DebugComponent />}
|
|
16
|
+
/>
|
|
17
|
+
);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RegistrationWorkflow } from '@brightlayer-ui/react-native-auth-workflow';
|
|
3
|
+
export const RegistrationInvite: React.FC = () => (
|
|
4
|
+
<RegistrationWorkflow isInviteRegistration initialRegistrationParams={{ code: '123', email: 'aa@aa.aa' }} />
|
|
5
|
+
);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// App Screens
|
|
2
|
+
export * from './Homepage';
|
|
3
|
+
export * from './Dashboard';
|
|
4
|
+
export * from './Locations';
|
|
5
|
+
|
|
6
|
+
// Auth Screens
|
|
7
|
+
export * from './Login';
|
|
8
|
+
export * from './ChangePassword';
|
|
9
|
+
|
|
10
|
+
// Registration Screens
|
|
11
|
+
export * from './Registration';
|
|
12
|
+
export * from './RegistrationInvite';
|
|
@@ -30,21 +30,21 @@ async function readAuthData(): Promise<AuthData> {
|
|
|
30
30
|
return {
|
|
31
31
|
userId: userData.userId,
|
|
32
32
|
email: userData.user,
|
|
33
|
-
rememberMeData
|
|
33
|
+
rememberMeData,
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
function saveAuthCredentials(user: string, userId: string): void {
|
|
38
38
|
const userData = {
|
|
39
|
-
user
|
|
40
|
-
userId
|
|
39
|
+
user,
|
|
40
|
+
userId,
|
|
41
41
|
};
|
|
42
42
|
void window.localStorage.setItem(LOCAL_USER_DATA, JSON.stringify(userData));
|
|
43
43
|
}
|
|
44
44
|
function saveRememberMeData(user: string, rememberMe: boolean): void {
|
|
45
45
|
const RememberMeData = {
|
|
46
46
|
user: rememberMe ? user : '',
|
|
47
|
-
rememberMe
|
|
47
|
+
rememberMe,
|
|
48
48
|
};
|
|
49
49
|
void window.localStorage.setItem(REMEMBER_ME_DATA, JSON.stringify(RememberMeData));
|
|
50
50
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AppTranslationsFile } from './types';
|
|
2
|
+
|
|
3
|
+
const resources: AppTranslationsFile = {
|
|
4
|
+
translation: {
|
|
5
|
+
DRAWER_MENU: {
|
|
6
|
+
TITLE: '標題',
|
|
7
|
+
DASHBOARD: '儀表板',
|
|
8
|
+
LOCATIONS: '地點',
|
|
9
|
+
},
|
|
10
|
+
TOOLBAR_MENU: {
|
|
11
|
+
HOME_PAGE: '主頁',
|
|
12
|
+
},
|
|
13
|
+
PAGE_DETAILS: {
|
|
14
|
+
AUTHORISED_MESSAGE: '授權留言',
|
|
15
|
+
},
|
|
16
|
+
USER_MENU: {
|
|
17
|
+
LOG_OUT: '登出',
|
|
18
|
+
CHANGE_PASSWORD: '更改密碼',
|
|
19
|
+
MY_ACCOUNT: '我的賬戶',
|
|
20
|
+
TOGGLE_RTL: '切换 RTL',
|
|
21
|
+
TOGGLE_THEME: '切换主题',
|
|
22
|
+
LANGUAGE: '语言',
|
|
23
|
+
},
|
|
24
|
+
ORGANAIZATION_DETAILS: {
|
|
25
|
+
NAME: '机构名称',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
export default resources;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AppTranslationsFile } from './types';
|
|
2
|
+
|
|
3
|
+
const resources: AppTranslationsFile = {
|
|
4
|
+
translation: {
|
|
5
|
+
DRAWER_MENU: {
|
|
6
|
+
TITLE: 'Title',
|
|
7
|
+
DASHBOARD: 'Dashboard',
|
|
8
|
+
LOCATIONS: 'Locations',
|
|
9
|
+
},
|
|
10
|
+
TOOLBAR_MENU: {
|
|
11
|
+
HOME_PAGE: 'Home Page',
|
|
12
|
+
},
|
|
13
|
+
PAGE_DETAILS: {
|
|
14
|
+
AUTHORISED_MESSAGE: 'Authorised Message',
|
|
15
|
+
},
|
|
16
|
+
USER_MENU: {
|
|
17
|
+
LOG_OUT: 'Log out',
|
|
18
|
+
CHANGE_PASSWORD: 'Change Password',
|
|
19
|
+
MY_ACCOUNT: 'My Account',
|
|
20
|
+
TOGGLE_RTL: 'Toggle RTL',
|
|
21
|
+
TOGGLE_THEME: 'Toggle Theme',
|
|
22
|
+
LANGUAGE: 'Language',
|
|
23
|
+
},
|
|
24
|
+
ORGANAIZATION_DETAILS: {
|
|
25
|
+
NAME: 'Organisation Name',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
export default resources;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AppTranslationsFile } from './types';
|
|
2
|
+
|
|
3
|
+
const resources: AppTranslationsFile = {
|
|
4
|
+
translation: {
|
|
5
|
+
DRAWER_MENU: {
|
|
6
|
+
TITLE: 'Titre',
|
|
7
|
+
DASHBOARD: 'Tableau de bord',
|
|
8
|
+
LOCATIONS: 'Emplacements',
|
|
9
|
+
},
|
|
10
|
+
TOOLBAR_MENU: {
|
|
11
|
+
HOME_PAGE: "Page d'accueil",
|
|
12
|
+
},
|
|
13
|
+
PAGE_DETAILS: {
|
|
14
|
+
AUTHORISED_MESSAGE: 'Authorised Message',
|
|
15
|
+
},
|
|
16
|
+
USER_MENU: {
|
|
17
|
+
LOG_OUT: 'Se déconnecter',
|
|
18
|
+
CHANGE_PASSWORD: 'changer le mot de passe',
|
|
19
|
+
MY_ACCOUNT: 'Mon compte',
|
|
20
|
+
TOGGLE_RTL: 'basculer RTL',
|
|
21
|
+
TOGGLE_THEME: 'basculer le thème',
|
|
22
|
+
LANGUAGE: 'Langue',
|
|
23
|
+
},
|
|
24
|
+
ORGANAIZATION_DETAILS: {
|
|
25
|
+
NAME: 'Nom de lorganisme',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
export default resources;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import english from './english';
|
|
2
|
+
import french from './french';
|
|
3
|
+
import spanish from './spanish';
|
|
4
|
+
import chinese from './chinese';
|
|
5
|
+
import portuguese from './portuguese';
|
|
6
|
+
|
|
7
|
+
export { default as english } from './english';
|
|
8
|
+
export { default as french } from './french';
|
|
9
|
+
export { default as spanish } from './spanish';
|
|
10
|
+
export { default as chinese } from './chinese';
|
|
11
|
+
export { default as portuguese } from './portuguese';
|
|
12
|
+
|
|
13
|
+
export const AppDictionaries = {
|
|
14
|
+
english: english,
|
|
15
|
+
french: french,
|
|
16
|
+
spanish: spanish,
|
|
17
|
+
chinese: chinese,
|
|
18
|
+
portuguese: portuguese,
|
|
19
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AppTranslationsFile } from './types';
|
|
2
|
+
|
|
3
|
+
const resources: AppTranslationsFile = {
|
|
4
|
+
translation: {
|
|
5
|
+
DRAWER_MENU: {
|
|
6
|
+
TITLE: 'Título',
|
|
7
|
+
DASHBOARD: 'Painel',
|
|
8
|
+
LOCATIONS: 'Localizações',
|
|
9
|
+
},
|
|
10
|
+
TOOLBAR_MENU: {
|
|
11
|
+
HOME_PAGE: 'Pagina inicial',
|
|
12
|
+
},
|
|
13
|
+
PAGE_DETAILS: {
|
|
14
|
+
AUTHORISED_MESSAGE: 'Mensagem Autorizada',
|
|
15
|
+
},
|
|
16
|
+
USER_MENU: {
|
|
17
|
+
LOG_OUT: 'Sair',
|
|
18
|
+
CHANGE_PASSWORD: 'alterar a senha',
|
|
19
|
+
MY_ACCOUNT: 'Minha conta',
|
|
20
|
+
TOGGLE_RTL: 'Alternar RTL',
|
|
21
|
+
TOGGLE_THEME: 'Alternar tema',
|
|
22
|
+
LANGUAGE: 'Linguagem ',
|
|
23
|
+
},
|
|
24
|
+
ORGANAIZATION_DETAILS: {
|
|
25
|
+
NAME: 'Nome da organização',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
export default resources;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AppTranslationsFile } from './types';
|
|
2
|
+
|
|
3
|
+
const resources: AppTranslationsFile = {
|
|
4
|
+
translation: {
|
|
5
|
+
DRAWER_MENU: {
|
|
6
|
+
TITLE: 'Título',
|
|
7
|
+
DASHBOARD: 'Panel',
|
|
8
|
+
LOCATIONS: 'Ubicaciones',
|
|
9
|
+
},
|
|
10
|
+
TOOLBAR_MENU: {
|
|
11
|
+
HOME_PAGE: 'Página de inicio',
|
|
12
|
+
},
|
|
13
|
+
PAGE_DETAILS: {
|
|
14
|
+
AUTHORISED_MESSAGE: 'Mensaje autorizado',
|
|
15
|
+
},
|
|
16
|
+
USER_MENU: {
|
|
17
|
+
LOG_OUT: 'Cerrar sesión',
|
|
18
|
+
CHANGE_PASSWORD: 'cambiar la contraseña',
|
|
19
|
+
MY_ACCOUNT: 'Mi cuenta',
|
|
20
|
+
TOGGLE_RTL: 'Alternar RTL',
|
|
21
|
+
TOGGLE_THEME: 'Alternar tema',
|
|
22
|
+
LANGUAGE: 'Idioma',
|
|
23
|
+
},
|
|
24
|
+
ORGANAIZATION_DETAILS: {
|
|
25
|
+
NAME: 'nombre de la organización',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
export default resources;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type AppTranslations = {
|
|
2
|
+
DRAWER_MENU: {
|
|
3
|
+
TITLE: string;
|
|
4
|
+
DASHBOARD: string;
|
|
5
|
+
LOCATIONS: string;
|
|
6
|
+
};
|
|
7
|
+
TOOLBAR_MENU: {
|
|
8
|
+
HOME_PAGE: string;
|
|
9
|
+
};
|
|
10
|
+
PAGE_DETAILS: {
|
|
11
|
+
AUTHORISED_MESSAGE: string;
|
|
12
|
+
};
|
|
13
|
+
USER_MENU: {
|
|
14
|
+
LOG_OUT: string;
|
|
15
|
+
CHANGE_PASSWORD: string;
|
|
16
|
+
MY_ACCOUNT: string;
|
|
17
|
+
TOGGLE_RTL: string;
|
|
18
|
+
TOGGLE_THEME: string;
|
|
19
|
+
LANGUAGE: string;
|
|
20
|
+
};
|
|
21
|
+
ORGANAIZATION_DETAILS: {
|
|
22
|
+
NAME: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export type AppTranslationsFile = {
|
|
26
|
+
translation: AppTranslations;
|
|
27
|
+
};
|