forked from vergnet/application-amicale
Update prettier and eslint config
This commit is contained in:
parent
18f7a6abbd
commit
02f9241d28
151 changed files with 5434 additions and 5013 deletions
|
@ -1,6 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
root: true,
|
|
||||||
extends: '@react-native-community',
|
|
||||||
parser: '@typescript-eslint/parser',
|
|
||||||
plugins: ['@typescript-eslint'],
|
|
||||||
};
|
|
|
@ -1,6 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
bracketSpacing: false,
|
|
||||||
jsxBracketSameLine: true,
|
|
||||||
singleQuote: true,
|
|
||||||
trailingComma: 'all',
|
|
||||||
};
|
|
4
.vscode/settings.json
vendored
Normal file
4
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"i18n-ally.localesPaths": "locales",
|
||||||
|
"i18n-ally.keystyle": "nested"
|
||||||
|
}
|
25
App.tsx
25
App.tsx
|
@ -17,7 +17,7 @@
|
||||||
* along with Campus INSAT. If not, see <https://www.gnu.org/licenses/>.
|
* along with Campus INSAT. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as React from 'react';
|
import React from 'react';
|
||||||
import { LogBox, Platform, SafeAreaView, View } from 'react-native';
|
import { LogBox, Platform, SafeAreaView, View } from 'react-native';
|
||||||
import { NavigationContainer } from '@react-navigation/native';
|
import { NavigationContainer } from '@react-navigation/native';
|
||||||
import { Provider as PaperProvider } from 'react-native-paper';
|
import { Provider as PaperProvider } from 'react-native-paper';
|
||||||
|
@ -36,6 +36,7 @@ import URLHandler from './src/utils/URLHandler';
|
||||||
import { setupStatusBar } from './src/utils/Utils';
|
import { setupStatusBar } from './src/utils/Utils';
|
||||||
import initLocales from './src/utils/Locales';
|
import initLocales from './src/utils/Locales';
|
||||||
import { NavigationContainerRef } from '@react-navigation/core';
|
import { NavigationContainerRef } from '@react-navigation/core';
|
||||||
|
import GENERAL_STYLES from './src/constants/Styles';
|
||||||
|
|
||||||
// Native optimizations https://reactnavigation.org/docs/react-native-screens
|
// Native optimizations https://reactnavigation.org/docs/react-native-screens
|
||||||
// Crashes app when navigating away from webview on android 9+
|
// Crashes app when navigating away from webview on android 9+
|
||||||
|
@ -132,15 +133,15 @@ export default class App extends React.Component<{}, StateType> {
|
||||||
});
|
});
|
||||||
AsyncStorageManager.set(
|
AsyncStorageManager.set(
|
||||||
AsyncStorageManager.PREFERENCES.showIntro.key,
|
AsyncStorageManager.PREFERENCES.showIntro.key,
|
||||||
false,
|
false
|
||||||
);
|
);
|
||||||
AsyncStorageManager.set(
|
AsyncStorageManager.set(
|
||||||
AsyncStorageManager.PREFERENCES.updateNumber.key,
|
AsyncStorageManager.PREFERENCES.updateNumber.key,
|
||||||
Update.number,
|
Update.number
|
||||||
);
|
);
|
||||||
AsyncStorageManager.set(
|
AsyncStorageManager.set(
|
||||||
AsyncStorageManager.PREFERENCES.showAprilFoolsStart.key,
|
AsyncStorageManager.PREFERENCES.showAprilFoolsStart.key,
|
||||||
false,
|
false
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -161,16 +162,16 @@ export default class App extends React.Component<{}, StateType> {
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
currentTheme: ThemeManager.getCurrentTheme(),
|
currentTheme: ThemeManager.getCurrentTheme(),
|
||||||
showIntro: AsyncStorageManager.getBool(
|
showIntro: AsyncStorageManager.getBool(
|
||||||
AsyncStorageManager.PREFERENCES.showIntro.key,
|
AsyncStorageManager.PREFERENCES.showIntro.key
|
||||||
),
|
),
|
||||||
showUpdate:
|
showUpdate:
|
||||||
AsyncStorageManager.getNumber(
|
AsyncStorageManager.getNumber(
|
||||||
AsyncStorageManager.PREFERENCES.updateNumber.key,
|
AsyncStorageManager.PREFERENCES.updateNumber.key
|
||||||
) !== Update.number,
|
) !== Update.number,
|
||||||
showAprilFools:
|
showAprilFools:
|
||||||
AprilFoolsManager.getInstance().isAprilFoolsEnabled() &&
|
AprilFoolsManager.getInstance().isAprilFoolsEnabled() &&
|
||||||
AsyncStorageManager.getBool(
|
AsyncStorageManager.getBool(
|
||||||
AsyncStorageManager.PREFERENCES.showAprilFoolsStart.key,
|
AsyncStorageManager.PREFERENCES.showAprilFoolsStart.key
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
SplashScreen.hide();
|
SplashScreen.hide();
|
||||||
|
@ -213,12 +214,14 @@ export default class App extends React.Component<{}, StateType> {
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
backgroundColor: ThemeManager.getCurrentTheme().colors.background,
|
backgroundColor: ThemeManager.getCurrentTheme().colors.background,
|
||||||
flex: 1,
|
...GENERAL_STYLES.flex,
|
||||||
}}>
|
}}
|
||||||
<SafeAreaView style={{flex: 1}}>
|
>
|
||||||
|
<SafeAreaView style={GENERAL_STYLES.flex}>
|
||||||
<NavigationContainer
|
<NavigationContainer
|
||||||
theme={state.currentTheme}
|
theme={state.currentTheme}
|
||||||
ref={this.navigatorRef}>
|
ref={this.navigatorRef}
|
||||||
|
>
|
||||||
<MainNavigator
|
<MainNavigator
|
||||||
defaultHomeRoute={this.defaultHomeRoute}
|
defaultHomeRoute={this.defaultHomeRoute}
|
||||||
defaultHomeData={this.defaultHomeData}
|
defaultHomeData={this.defaultHomeData}
|
||||||
|
|
8
__mocks__/react-native-keychain/index.js
vendored
8
__mocks__/react-native-keychain/index.js
vendored
|
@ -1,7 +1,7 @@
|
||||||
const keychainMock = {
|
const keychainMock = {
|
||||||
SECURITY_LEVEL_ANY: "MOCK_SECURITY_LEVEL_ANY",
|
SECURITY_LEVEL_ANY: 'MOCK_SECURITY_LEVEL_ANY',
|
||||||
SECURITY_LEVEL_SECURE_SOFTWARE: "MOCK_SECURITY_LEVEL_SECURE_SOFTWARE",
|
SECURITY_LEVEL_SECURE_SOFTWARE: 'MOCK_SECURITY_LEVEL_SECURE_SOFTWARE',
|
||||||
SECURITY_LEVEL_SECURE_HARDWARE: "MOCK_SECURITY_LEVEL_SECURE_HARDWARE",
|
SECURITY_LEVEL_SECURE_HARDWARE: 'MOCK_SECURITY_LEVEL_SECURE_HARDWARE',
|
||||||
}
|
};
|
||||||
|
|
||||||
export default keychainMock;
|
export default keychainMock;
|
|
@ -1,11 +1,9 @@
|
||||||
/* eslint-disable */
|
|
||||||
|
|
||||||
import React from 'react';
|
|
||||||
import ConnectionManager from '../../src/managers/ConnectionManager';
|
import ConnectionManager from '../../src/managers/ConnectionManager';
|
||||||
import { ERROR_TYPE } from '../../src/utils/WebData';
|
import { ERROR_TYPE } from '../../src/utils/WebData';
|
||||||
|
|
||||||
jest.mock('react-native-keychain');
|
jest.mock('react-native-keychain');
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
const fetch = require('isomorphic-fetch'); // fetch is not implemented in nodeJS but in react-native
|
const fetch = require('isomorphic-fetch'); // fetch is not implemented in nodeJS but in react-native
|
||||||
|
|
||||||
const c = ConnectionManager.getInstance();
|
const c = ConnectionManager.getInstance();
|
||||||
|
@ -44,7 +42,7 @@ test('connect bad credentials', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return expect(c.connect('email', 'password')).rejects.toBe(
|
return expect(c.connect('email', 'password')).rejects.toBe(
|
||||||
ERROR_TYPE.BAD_CREDENTIALS,
|
ERROR_TYPE.BAD_CREDENTIALS
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -79,7 +77,7 @@ test('connect good credentials no consent', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return expect(c.connect('email', 'password')).rejects.toBe(
|
return expect(c.connect('email', 'password')).rejects.toBe(
|
||||||
ERROR_TYPE.NO_CONSENT,
|
ERROR_TYPE.NO_CONSENT
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -100,7 +98,7 @@ test('connect good credentials, fail save token', () => {
|
||||||
return Promise.reject(false);
|
return Promise.reject(false);
|
||||||
});
|
});
|
||||||
return expect(c.connect('email', 'password')).rejects.toBe(
|
return expect(c.connect('email', 'password')).rejects.toBe(
|
||||||
ERROR_TYPE.TOKEN_SAVE,
|
ERROR_TYPE.TOKEN_SAVE
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -109,7 +107,7 @@ test('connect connection error', () => {
|
||||||
return Promise.reject();
|
return Promise.reject();
|
||||||
});
|
});
|
||||||
return expect(c.connect('email', 'password')).rejects.toBe(
|
return expect(c.connect('email', 'password')).rejects.toBe(
|
||||||
ERROR_TYPE.CONNECTION_ERROR,
|
ERROR_TYPE.CONNECTION_ERROR
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -125,7 +123,7 @@ test('connect bogus response 1', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return expect(c.connect('email', 'password')).rejects.toBe(
|
return expect(c.connect('email', 'password')).rejects.toBe(
|
||||||
ERROR_TYPE.SERVER_ERROR,
|
ERROR_TYPE.SERVER_ERROR
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -146,7 +144,7 @@ test('authenticatedRequest success', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return expect(
|
return expect(
|
||||||
c.authenticatedRequest('https://www.amicale-insat.fr/api/token/check'),
|
c.authenticatedRequest('https://www.amicale-insat.fr/api/token/check')
|
||||||
).resolves.toStrictEqual({ coucou: 'toi' });
|
).resolves.toStrictEqual({ coucou: 'toi' });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -167,7 +165,7 @@ test('authenticatedRequest error wrong token', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return expect(
|
return expect(
|
||||||
c.authenticatedRequest('https://www.amicale-insat.fr/api/token/check'),
|
c.authenticatedRequest('https://www.amicale-insat.fr/api/token/check')
|
||||||
).rejects.toBe(ERROR_TYPE.BAD_TOKEN);
|
).rejects.toBe(ERROR_TYPE.BAD_TOKEN);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -187,7 +185,7 @@ test('authenticatedRequest error bogus response', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return expect(
|
return expect(
|
||||||
c.authenticatedRequest('https://www.amicale-insat.fr/api/token/check'),
|
c.authenticatedRequest('https://www.amicale-insat.fr/api/token/check')
|
||||||
).rejects.toBe(ERROR_TYPE.SERVER_ERROR);
|
).rejects.toBe(ERROR_TYPE.SERVER_ERROR);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -201,7 +199,7 @@ test('authenticatedRequest connection error', () => {
|
||||||
return Promise.reject();
|
return Promise.reject();
|
||||||
});
|
});
|
||||||
return expect(
|
return expect(
|
||||||
c.authenticatedRequest('https://www.amicale-insat.fr/api/token/check'),
|
c.authenticatedRequest('https://www.amicale-insat.fr/api/token/check')
|
||||||
).rejects.toBe(ERROR_TYPE.CONNECTION_ERROR);
|
).rejects.toBe(ERROR_TYPE.CONNECTION_ERROR);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -212,6 +210,6 @@ test('authenticatedRequest error no token', () => {
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
return expect(
|
return expect(
|
||||||
c.authenticatedRequest('https://www.amicale-insat.fr/api/token/check'),
|
c.authenticatedRequest('https://www.amicale-insat.fr/api/token/check')
|
||||||
).rejects.toBe(ERROR_TYPE.TOKEN_RETRIEVE);
|
).rejects.toBe(ERROR_TYPE.TOKEN_RETRIEVE);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
/* eslint-disable */
|
|
||||||
|
|
||||||
import React from 'react';
|
|
||||||
import * as EquipmentBooking from '../../src/utils/EquipmentBooking';
|
import * as EquipmentBooking from '../../src/utils/EquipmentBooking';
|
||||||
import i18n from 'i18n-js';
|
import i18n from 'i18n-js';
|
||||||
|
|
||||||
|
@ -18,7 +15,7 @@ test('getCurrentDay', () => {
|
||||||
.spyOn(Date, 'now')
|
.spyOn(Date, 'now')
|
||||||
.mockImplementation(() => new Date('2020-01-14 14:50:35').getTime());
|
.mockImplementation(() => new Date('2020-01-14 14:50:35').getTime());
|
||||||
expect(EquipmentBooking.getCurrentDay().getTime()).toBe(
|
expect(EquipmentBooking.getCurrentDay().getTime()).toBe(
|
||||||
new Date('2020-01-14').getTime(),
|
new Date('2020-01-14').getTime()
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -58,18 +55,18 @@ test('getFirstEquipmentAvailability', () => {
|
||||||
booked_at: [{ begin: '2020-07-07', end: '2020-07-10' }],
|
booked_at: [{ begin: '2020-07-07', end: '2020-07-10' }],
|
||||||
};
|
};
|
||||||
expect(
|
expect(
|
||||||
EquipmentBooking.getFirstEquipmentAvailability(testDevice).getTime(),
|
EquipmentBooking.getFirstEquipmentAvailability(testDevice).getTime()
|
||||||
).toBe(new Date('2020-07-11').getTime());
|
).toBe(new Date('2020-07-11').getTime());
|
||||||
testDevice.booked_at = [{ begin: '2020-07-07', end: '2020-07-09' }];
|
testDevice.booked_at = [{ begin: '2020-07-07', end: '2020-07-09' }];
|
||||||
expect(
|
expect(
|
||||||
EquipmentBooking.getFirstEquipmentAvailability(testDevice).getTime(),
|
EquipmentBooking.getFirstEquipmentAvailability(testDevice).getTime()
|
||||||
).toBe(new Date('2020-07-10').getTime());
|
).toBe(new Date('2020-07-10').getTime());
|
||||||
testDevice.booked_at = [
|
testDevice.booked_at = [
|
||||||
{ begin: '2020-07-07', end: '2020-07-09' },
|
{ begin: '2020-07-07', end: '2020-07-09' },
|
||||||
{ begin: '2020-07-10', end: '2020-07-16' },
|
{ begin: '2020-07-10', end: '2020-07-16' },
|
||||||
];
|
];
|
||||||
expect(
|
expect(
|
||||||
EquipmentBooking.getFirstEquipmentAvailability(testDevice).getTime(),
|
EquipmentBooking.getFirstEquipmentAvailability(testDevice).getTime()
|
||||||
).toBe(new Date('2020-07-17').getTime());
|
).toBe(new Date('2020-07-17').getTime());
|
||||||
testDevice.booked_at = [
|
testDevice.booked_at = [
|
||||||
{ begin: '2020-07-07', end: '2020-07-09' },
|
{ begin: '2020-07-07', end: '2020-07-09' },
|
||||||
|
@ -77,7 +74,7 @@ test('getFirstEquipmentAvailability', () => {
|
||||||
{ begin: '2020-07-14', end: '2020-07-16' },
|
{ begin: '2020-07-14', end: '2020-07-16' },
|
||||||
];
|
];
|
||||||
expect(
|
expect(
|
||||||
EquipmentBooking.getFirstEquipmentAvailability(testDevice).getTime(),
|
EquipmentBooking.getFirstEquipmentAvailability(testDevice).getTime()
|
||||||
).toBe(new Date('2020-07-13').getTime());
|
).toBe(new Date('2020-07-13').getTime());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -85,7 +82,7 @@ test('getRelativeDateString', () => {
|
||||||
jest
|
jest
|
||||||
.spyOn(Date, 'now')
|
.spyOn(Date, 'now')
|
||||||
.mockImplementation(() => new Date('2020-07-09').getTime());
|
.mockImplementation(() => new Date('2020-07-09').getTime());
|
||||||
jest.spyOn(i18n, 't').mockImplementation((translationString: string) => {
|
jest.spyOn(i18n, 't').mockImplementation((translationString) => {
|
||||||
const prefix = 'screens.equipment.';
|
const prefix = 'screens.equipment.';
|
||||||
if (translationString === prefix + 'otherYear') return '0';
|
if (translationString === prefix + 'otherYear') return '0';
|
||||||
else if (translationString === prefix + 'otherMonth') return '1';
|
else if (translationString === prefix + 'otherMonth') return '1';
|
||||||
|
@ -95,25 +92,25 @@ test('getRelativeDateString', () => {
|
||||||
else return null;
|
else return null;
|
||||||
});
|
});
|
||||||
expect(EquipmentBooking.getRelativeDateString(new Date('2020-07-09'))).toBe(
|
expect(EquipmentBooking.getRelativeDateString(new Date('2020-07-09'))).toBe(
|
||||||
'4',
|
'4'
|
||||||
);
|
);
|
||||||
expect(EquipmentBooking.getRelativeDateString(new Date('2020-07-10'))).toBe(
|
expect(EquipmentBooking.getRelativeDateString(new Date('2020-07-10'))).toBe(
|
||||||
'3',
|
'3'
|
||||||
);
|
);
|
||||||
expect(EquipmentBooking.getRelativeDateString(new Date('2020-07-11'))).toBe(
|
expect(EquipmentBooking.getRelativeDateString(new Date('2020-07-11'))).toBe(
|
||||||
'2',
|
'2'
|
||||||
);
|
);
|
||||||
expect(EquipmentBooking.getRelativeDateString(new Date('2020-07-30'))).toBe(
|
expect(EquipmentBooking.getRelativeDateString(new Date('2020-07-30'))).toBe(
|
||||||
'2',
|
'2'
|
||||||
);
|
);
|
||||||
expect(EquipmentBooking.getRelativeDateString(new Date('2020-08-30'))).toBe(
|
expect(EquipmentBooking.getRelativeDateString(new Date('2020-08-30'))).toBe(
|
||||||
'1',
|
'1'
|
||||||
);
|
);
|
||||||
expect(EquipmentBooking.getRelativeDateString(new Date('2020-11-10'))).toBe(
|
expect(EquipmentBooking.getRelativeDateString(new Date('2020-11-10'))).toBe(
|
||||||
'1',
|
'1'
|
||||||
);
|
);
|
||||||
expect(EquipmentBooking.getRelativeDateString(new Date('2021-11-10'))).toBe(
|
expect(EquipmentBooking.getRelativeDateString(new Date('2021-11-10'))).toBe(
|
||||||
'0',
|
'0'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -134,7 +131,7 @@ test('getValidRange', () => {
|
||||||
'2020-07-15',
|
'2020-07-15',
|
||||||
];
|
];
|
||||||
expect(EquipmentBooking.getValidRange(start, end, testDevice)).toStrictEqual(
|
expect(EquipmentBooking.getValidRange(start, end, testDevice)).toStrictEqual(
|
||||||
result,
|
result
|
||||||
);
|
);
|
||||||
testDevice.booked_at = [
|
testDevice.booked_at = [
|
||||||
{ begin: '2020-07-07', end: '2020-07-10' },
|
{ begin: '2020-07-07', end: '2020-07-10' },
|
||||||
|
@ -142,43 +139,43 @@ test('getValidRange', () => {
|
||||||
];
|
];
|
||||||
result = ['2020-07-11', '2020-07-12'];
|
result = ['2020-07-11', '2020-07-12'];
|
||||||
expect(EquipmentBooking.getValidRange(start, end, testDevice)).toStrictEqual(
|
expect(EquipmentBooking.getValidRange(start, end, testDevice)).toStrictEqual(
|
||||||
result,
|
result
|
||||||
);
|
);
|
||||||
|
|
||||||
testDevice.booked_at = [{ begin: '2020-07-12', end: '2020-07-13' }];
|
testDevice.booked_at = [{ begin: '2020-07-12', end: '2020-07-13' }];
|
||||||
result = ['2020-07-11'];
|
result = ['2020-07-11'];
|
||||||
expect(EquipmentBooking.getValidRange(start, end, testDevice)).toStrictEqual(
|
expect(EquipmentBooking.getValidRange(start, end, testDevice)).toStrictEqual(
|
||||||
result,
|
result
|
||||||
);
|
);
|
||||||
testDevice.booked_at = [{ begin: '2020-07-07', end: '2020-07-12' }];
|
testDevice.booked_at = [{ begin: '2020-07-07', end: '2020-07-12' }];
|
||||||
result = ['2020-07-13', '2020-07-14', '2020-07-15'];
|
result = ['2020-07-13', '2020-07-14', '2020-07-15'];
|
||||||
expect(EquipmentBooking.getValidRange(end, start, testDevice)).toStrictEqual(
|
expect(EquipmentBooking.getValidRange(end, start, testDevice)).toStrictEqual(
|
||||||
result,
|
result
|
||||||
);
|
);
|
||||||
start = new Date('2020-07-14');
|
start = new Date('2020-07-14');
|
||||||
end = new Date('2020-07-14');
|
end = new Date('2020-07-14');
|
||||||
result = ['2020-07-14'];
|
result = ['2020-07-14'];
|
||||||
expect(
|
expect(
|
||||||
EquipmentBooking.getValidRange(start, start, testDevice),
|
EquipmentBooking.getValidRange(start, start, testDevice)
|
||||||
).toStrictEqual(result);
|
).toStrictEqual(result);
|
||||||
expect(EquipmentBooking.getValidRange(end, start, testDevice)).toStrictEqual(
|
expect(EquipmentBooking.getValidRange(end, start, testDevice)).toStrictEqual(
|
||||||
result,
|
result
|
||||||
);
|
);
|
||||||
expect(EquipmentBooking.getValidRange(start, end, null)).toStrictEqual(
|
expect(EquipmentBooking.getValidRange(start, end, null)).toStrictEqual(
|
||||||
result,
|
result
|
||||||
);
|
);
|
||||||
|
|
||||||
start = new Date('2020-07-14');
|
start = new Date('2020-07-14');
|
||||||
end = new Date('2020-07-17');
|
end = new Date('2020-07-17');
|
||||||
result = ['2020-07-14', '2020-07-15', '2020-07-16', '2020-07-17'];
|
result = ['2020-07-14', '2020-07-15', '2020-07-16', '2020-07-17'];
|
||||||
expect(EquipmentBooking.getValidRange(start, end, null)).toStrictEqual(
|
expect(EquipmentBooking.getValidRange(start, end, null)).toStrictEqual(
|
||||||
result,
|
result
|
||||||
);
|
);
|
||||||
|
|
||||||
testDevice.booked_at = [{ begin: '2020-07-17', end: '2020-07-17' }];
|
testDevice.booked_at = [{ begin: '2020-07-17', end: '2020-07-17' }];
|
||||||
result = ['2020-07-14', '2020-07-15', '2020-07-16'];
|
result = ['2020-07-14', '2020-07-15', '2020-07-16'];
|
||||||
expect(EquipmentBooking.getValidRange(start, end, testDevice)).toStrictEqual(
|
expect(EquipmentBooking.getValidRange(start, end, testDevice)).toStrictEqual(
|
||||||
result,
|
result
|
||||||
);
|
);
|
||||||
|
|
||||||
testDevice.booked_at = [
|
testDevice.booked_at = [
|
||||||
|
@ -189,7 +186,7 @@ test('getValidRange', () => {
|
||||||
end = new Date('2020-07-23');
|
end = new Date('2020-07-23');
|
||||||
result = ['2020-07-21', '2020-07-22', '2020-07-23'];
|
result = ['2020-07-21', '2020-07-22', '2020-07-23'];
|
||||||
expect(EquipmentBooking.getValidRange(end, start, testDevice)).toStrictEqual(
|
expect(EquipmentBooking.getValidRange(end, start, testDevice)).toStrictEqual(
|
||||||
result,
|
result
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -228,7 +225,7 @@ test('generateMarkedDates', () => {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
expect(
|
expect(
|
||||||
EquipmentBooking.generateMarkedDates(true, theme, range),
|
EquipmentBooking.generateMarkedDates(true, theme, range)
|
||||||
).toStrictEqual(result);
|
).toStrictEqual(result);
|
||||||
result = {
|
result = {
|
||||||
'2020-07-11': {
|
'2020-07-11': {
|
||||||
|
@ -248,7 +245,7 @@ test('generateMarkedDates', () => {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
expect(
|
expect(
|
||||||
EquipmentBooking.generateMarkedDates(false, theme, range),
|
EquipmentBooking.generateMarkedDates(false, theme, range)
|
||||||
).toStrictEqual(result);
|
).toStrictEqual(result);
|
||||||
result = {
|
result = {
|
||||||
'2020-07-11': {
|
'2020-07-11': {
|
||||||
|
@ -269,7 +266,7 @@ test('generateMarkedDates', () => {
|
||||||
};
|
};
|
||||||
range = EquipmentBooking.getValidRange(end, start, testDevice);
|
range = EquipmentBooking.getValidRange(end, start, testDevice);
|
||||||
expect(
|
expect(
|
||||||
EquipmentBooking.generateMarkedDates(false, theme, range),
|
EquipmentBooking.generateMarkedDates(false, theme, range)
|
||||||
).toStrictEqual(result);
|
).toStrictEqual(result);
|
||||||
|
|
||||||
testDevice.booked_at = [{ begin: '2020-07-13', end: '2020-07-15' }];
|
testDevice.booked_at = [{ begin: '2020-07-13', end: '2020-07-15' }];
|
||||||
|
@ -287,7 +284,7 @@ test('generateMarkedDates', () => {
|
||||||
};
|
};
|
||||||
range = EquipmentBooking.getValidRange(start, end, testDevice);
|
range = EquipmentBooking.getValidRange(start, end, testDevice);
|
||||||
expect(
|
expect(
|
||||||
EquipmentBooking.generateMarkedDates(true, theme, range),
|
EquipmentBooking.generateMarkedDates(true, theme, range)
|
||||||
).toStrictEqual(result);
|
).toStrictEqual(result);
|
||||||
|
|
||||||
testDevice.booked_at = [{ begin: '2020-07-12', end: '2020-07-13' }];
|
testDevice.booked_at = [{ begin: '2020-07-12', end: '2020-07-13' }];
|
||||||
|
@ -300,7 +297,7 @@ test('generateMarkedDates', () => {
|
||||||
};
|
};
|
||||||
range = EquipmentBooking.getValidRange(start, end, testDevice);
|
range = EquipmentBooking.getValidRange(start, end, testDevice);
|
||||||
expect(
|
expect(
|
||||||
EquipmentBooking.generateMarkedDates(true, theme, range),
|
EquipmentBooking.generateMarkedDates(true, theme, range)
|
||||||
).toStrictEqual(result);
|
).toStrictEqual(result);
|
||||||
|
|
||||||
testDevice.booked_at = [
|
testDevice.booked_at = [
|
||||||
|
@ -318,7 +315,7 @@ test('generateMarkedDates', () => {
|
||||||
};
|
};
|
||||||
range = EquipmentBooking.getValidRange(start, end, testDevice);
|
range = EquipmentBooking.getValidRange(start, end, testDevice);
|
||||||
expect(
|
expect(
|
||||||
EquipmentBooking.generateMarkedDates(true, theme, range),
|
EquipmentBooking.generateMarkedDates(true, theme, range)
|
||||||
).toStrictEqual(result);
|
).toStrictEqual(result);
|
||||||
|
|
||||||
result = {
|
result = {
|
||||||
|
@ -340,6 +337,6 @@ test('generateMarkedDates', () => {
|
||||||
};
|
};
|
||||||
range = EquipmentBooking.getValidRange(end, start, testDevice);
|
range = EquipmentBooking.getValidRange(end, start, testDevice);
|
||||||
expect(
|
expect(
|
||||||
EquipmentBooking.generateMarkedDates(true, theme, range),
|
EquipmentBooking.generateMarkedDates(true, theme, range)
|
||||||
).toStrictEqual(result);
|
).toStrictEqual(result);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
/* eslint-disable */
|
|
||||||
|
|
||||||
import React from 'react';
|
|
||||||
import * as Planning from '../../src/utils/Planning';
|
import * as Planning from '../../src/utils/Planning';
|
||||||
|
|
||||||
test('isDescriptionEmpty', () => {
|
test('isDescriptionEmpty', () => {
|
||||||
|
@ -24,7 +21,7 @@ test('isEventDateStringFormatValid', () => {
|
||||||
expect(Planning.isEventDateStringFormatValid('3214-64-12 01:16')).toBeTrue();
|
expect(Planning.isEventDateStringFormatValid('3214-64-12 01:16')).toBeTrue();
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
Planning.isEventDateStringFormatValid('3214-64-12 01:16:00'),
|
Planning.isEventDateStringFormatValid('3214-64-12 01:16:00')
|
||||||
).toBeFalse();
|
).toBeFalse();
|
||||||
expect(Planning.isEventDateStringFormatValid('3214-64-12 1:16')).toBeFalse();
|
expect(Planning.isEventDateStringFormatValid('3214-64-12 1:16')).toBeFalse();
|
||||||
expect(Planning.isEventDateStringFormatValid('3214-f4-12 01:16')).toBeFalse();
|
expect(Planning.isEventDateStringFormatValid('3214-f4-12 01:16')).toBeFalse();
|
||||||
|
@ -32,7 +29,7 @@ test('isEventDateStringFormatValid', () => {
|
||||||
expect(Planning.isEventDateStringFormatValid('2020-03-21')).toBeFalse();
|
expect(Planning.isEventDateStringFormatValid('2020-03-21')).toBeFalse();
|
||||||
expect(Planning.isEventDateStringFormatValid('2020-03-21 truc')).toBeFalse();
|
expect(Planning.isEventDateStringFormatValid('2020-03-21 truc')).toBeFalse();
|
||||||
expect(
|
expect(
|
||||||
Planning.isEventDateStringFormatValid('3214-64-12 1:16:65'),
|
Planning.isEventDateStringFormatValid('3214-64-12 1:16:65')
|
||||||
).toBeFalse();
|
).toBeFalse();
|
||||||
expect(Planning.isEventDateStringFormatValid('garbage')).toBeFalse();
|
expect(Planning.isEventDateStringFormatValid('garbage')).toBeFalse();
|
||||||
expect(Planning.isEventDateStringFormatValid('')).toBeFalse();
|
expect(Planning.isEventDateStringFormatValid('')).toBeFalse();
|
||||||
|
@ -65,17 +62,17 @@ test('getFormattedEventTime', () => {
|
||||||
expect(Planning.getFormattedEventTime(undefined, undefined)).toBe('/ - /');
|
expect(Planning.getFormattedEventTime(undefined, undefined)).toBe('/ - /');
|
||||||
expect(Planning.getFormattedEventTime('20:30', '23:00')).toBe('/ - /');
|
expect(Planning.getFormattedEventTime('20:30', '23:00')).toBe('/ - /');
|
||||||
expect(Planning.getFormattedEventTime('2020-03-30', '2020-03-31')).toBe(
|
expect(Planning.getFormattedEventTime('2020-03-30', '2020-03-31')).toBe(
|
||||||
'/ - /',
|
'/ - /'
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
Planning.getFormattedEventTime('2020-03-21 09:00', '2020-03-21 09:00'),
|
Planning.getFormattedEventTime('2020-03-21 09:00', '2020-03-21 09:00')
|
||||||
).toBe('09:00');
|
).toBe('09:00');
|
||||||
expect(
|
expect(
|
||||||
Planning.getFormattedEventTime('2020-03-21 09:00', '2020-03-22 17:00'),
|
Planning.getFormattedEventTime('2020-03-21 09:00', '2020-03-22 17:00')
|
||||||
).toBe('09:00 - 23:59');
|
).toBe('09:00 - 23:59');
|
||||||
expect(
|
expect(
|
||||||
Planning.getFormattedEventTime('2020-03-30 20:30', '2020-03-30 23:00'),
|
Planning.getFormattedEventTime('2020-03-30 20:30', '2020-03-30 23:00')
|
||||||
).toBe('20:30 - 23:00');
|
).toBe('20:30 - 23:00');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -90,38 +87,38 @@ test('getDateOnlyString', () => {
|
||||||
|
|
||||||
test('isEventBefore', () => {
|
test('isEventBefore', () => {
|
||||||
expect(
|
expect(
|
||||||
Planning.isEventBefore('2020-03-21 09:00', '2020-03-21 10:00'),
|
Planning.isEventBefore('2020-03-21 09:00', '2020-03-21 10:00')
|
||||||
).toBeTrue();
|
).toBeTrue();
|
||||||
expect(
|
expect(
|
||||||
Planning.isEventBefore('2020-03-21 10:00', '2020-03-21 10:15'),
|
Planning.isEventBefore('2020-03-21 10:00', '2020-03-21 10:15')
|
||||||
).toBeTrue();
|
).toBeTrue();
|
||||||
expect(
|
expect(
|
||||||
Planning.isEventBefore('2020-03-21 10:15', '2021-03-21 10:15'),
|
Planning.isEventBefore('2020-03-21 10:15', '2021-03-21 10:15')
|
||||||
).toBeTrue();
|
).toBeTrue();
|
||||||
expect(
|
expect(
|
||||||
Planning.isEventBefore('2020-03-21 10:15', '2020-05-21 10:15'),
|
Planning.isEventBefore('2020-03-21 10:15', '2020-05-21 10:15')
|
||||||
).toBeTrue();
|
).toBeTrue();
|
||||||
expect(
|
expect(
|
||||||
Planning.isEventBefore('2020-03-21 10:15', '2020-03-30 10:15'),
|
Planning.isEventBefore('2020-03-21 10:15', '2020-03-30 10:15')
|
||||||
).toBeTrue();
|
).toBeTrue();
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
Planning.isEventBefore('2020-03-21 10:00', '2020-03-21 10:00'),
|
Planning.isEventBefore('2020-03-21 10:00', '2020-03-21 10:00')
|
||||||
).toBeFalse();
|
).toBeFalse();
|
||||||
expect(
|
expect(
|
||||||
Planning.isEventBefore('2020-03-21 10:00', '2020-03-21 09:00'),
|
Planning.isEventBefore('2020-03-21 10:00', '2020-03-21 09:00')
|
||||||
).toBeFalse();
|
).toBeFalse();
|
||||||
expect(
|
expect(
|
||||||
Planning.isEventBefore('2020-03-21 10:15', '2020-03-21 10:00'),
|
Planning.isEventBefore('2020-03-21 10:15', '2020-03-21 10:00')
|
||||||
).toBeFalse();
|
).toBeFalse();
|
||||||
expect(
|
expect(
|
||||||
Planning.isEventBefore('2021-03-21 10:15', '2020-03-21 10:15'),
|
Planning.isEventBefore('2021-03-21 10:15', '2020-03-21 10:15')
|
||||||
).toBeFalse();
|
).toBeFalse();
|
||||||
expect(
|
expect(
|
||||||
Planning.isEventBefore('2020-05-21 10:15', '2020-03-21 10:15'),
|
Planning.isEventBefore('2020-05-21 10:15', '2020-03-21 10:15')
|
||||||
).toBeFalse();
|
).toBeFalse();
|
||||||
expect(
|
expect(
|
||||||
Planning.isEventBefore('2020-03-30 10:15', '2020-03-21 10:15'),
|
Planning.isEventBefore('2020-03-30 10:15', '2020-03-21 10:15')
|
||||||
).toBeFalse();
|
).toBeFalse();
|
||||||
|
|
||||||
expect(Planning.isEventBefore('garbage', '2020-03-21 10:15')).toBeFalse();
|
expect(Planning.isEventBefore('garbage', '2020-03-21 10:15')).toBeFalse();
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
/* eslint-disable */
|
|
||||||
|
|
||||||
import React from 'react';
|
|
||||||
import {
|
import {
|
||||||
getCleanedMachineWatched,
|
getCleanedMachineWatched,
|
||||||
getMachineEndDate,
|
getMachineEndDate,
|
||||||
|
@ -16,13 +13,13 @@ test('getMachineEndDate', () => {
|
||||||
expectDate.setHours(23);
|
expectDate.setHours(23);
|
||||||
expectDate.setMinutes(10);
|
expectDate.setMinutes(10);
|
||||||
expect(getMachineEndDate({ endTime: '23:10' }).getTime()).toBe(
|
expect(getMachineEndDate({ endTime: '23:10' }).getTime()).toBe(
|
||||||
expectDate.getTime(),
|
expectDate.getTime()
|
||||||
);
|
);
|
||||||
|
|
||||||
expectDate.setHours(16);
|
expectDate.setHours(16);
|
||||||
expectDate.setMinutes(30);
|
expectDate.setMinutes(30);
|
||||||
expect(getMachineEndDate({ endTime: '16:30' }).getTime()).toBe(
|
expect(getMachineEndDate({ endTime: '16:30' }).getTime()).toBe(
|
||||||
expectDate.getTime(),
|
expectDate.getTime()
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(getMachineEndDate({ endTime: '15:30' })).toBeNull();
|
expect(getMachineEndDate({ endTime: '15:30' })).toBeNull();
|
||||||
|
@ -36,7 +33,7 @@ test('getMachineEndDate', () => {
|
||||||
expectDate.setHours(0);
|
expectDate.setHours(0);
|
||||||
expectDate.setMinutes(30);
|
expectDate.setMinutes(30);
|
||||||
expect(getMachineEndDate({ endTime: '00:30' }).getTime()).toBe(
|
expect(getMachineEndDate({ endTime: '00:30' }).getTime()).toBe(
|
||||||
expectDate.getTime(),
|
expectDate.getTime()
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -52,16 +49,16 @@ test('isMachineWatched', () => {
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
expect(
|
expect(
|
||||||
isMachineWatched({number: '0', endTime: '23:30'}, machineList),
|
isMachineWatched({ number: '0', endTime: '23:30' }, machineList)
|
||||||
).toBeTrue();
|
).toBeTrue();
|
||||||
expect(
|
expect(
|
||||||
isMachineWatched({number: '1', endTime: '20:30'}, machineList),
|
isMachineWatched({ number: '1', endTime: '20:30' }, machineList)
|
||||||
).toBeTrue();
|
).toBeTrue();
|
||||||
expect(
|
expect(
|
||||||
isMachineWatched({number: '3', endTime: '20:30'}, machineList),
|
isMachineWatched({ number: '3', endTime: '20:30' }, machineList)
|
||||||
).toBeFalse();
|
).toBeFalse();
|
||||||
expect(
|
expect(
|
||||||
isMachineWatched({number: '1', endTime: '23:30'}, machineList),
|
isMachineWatched({ number: '1', endTime: '23:30' }, machineList)
|
||||||
).toBeFalse();
|
).toBeFalse();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -110,7 +107,7 @@ test('getCleanedMachineWatched', () => {
|
||||||
];
|
];
|
||||||
let cleanedList = watchList;
|
let cleanedList = watchList;
|
||||||
expect(getCleanedMachineWatched(watchList, machineList)).toStrictEqual(
|
expect(getCleanedMachineWatched(watchList, machineList)).toStrictEqual(
|
||||||
cleanedList,
|
cleanedList
|
||||||
);
|
);
|
||||||
|
|
||||||
watchList = [
|
watchList = [
|
||||||
|
@ -138,7 +135,7 @@ test('getCleanedMachineWatched', () => {
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
expect(getCleanedMachineWatched(watchList, machineList)).toStrictEqual(
|
expect(getCleanedMachineWatched(watchList, machineList)).toStrictEqual(
|
||||||
cleanedList,
|
cleanedList
|
||||||
);
|
);
|
||||||
|
|
||||||
watchList = [
|
watchList = [
|
||||||
|
@ -162,6 +159,6 @@ test('getCleanedMachineWatched', () => {
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
expect(getCleanedMachineWatched(watchList, machineList)).toStrictEqual(
|
expect(getCleanedMachineWatched(watchList, machineList)).toStrictEqual(
|
||||||
cleanedList,
|
cleanedList
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
/* eslint-disable */
|
|
||||||
|
|
||||||
import React from 'react';
|
|
||||||
import { isApiResponseValid } from '../../src/utils/WebData';
|
import { isApiResponseValid } from '../../src/utils/WebData';
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
const fetch = require('isomorphic-fetch'); // fetch is not implemented in nodeJS but in react-native
|
const fetch = require('isomorphic-fetch'); // fetch is not implemented in nodeJS but in react-native
|
||||||
|
|
||||||
test('isRequestResponseValid', () => {
|
test('isRequestResponseValid', () => {
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
echo "Removing node_modules..."
|
|
||||||
rm -rf node_modules/
|
|
||||||
echo -e "Done\n"
|
|
||||||
|
|
||||||
echo "Removing locks..."
|
|
||||||
rm -f package-lock.json && rm -f yarn.lock
|
|
||||||
echo -e "Done\n"
|
|
||||||
|
|
||||||
#echo "Verifying npm cache..."
|
|
||||||
#npm cache verify
|
|
||||||
#echo -e "Done\n"
|
|
||||||
|
|
||||||
echo "Installing dependencies..."
|
|
||||||
npm install
|
|
||||||
echo -e "Done\n"
|
|
||||||
|
|
1
index.js
1
index.js
|
@ -25,5 +25,4 @@ import {AppRegistry} from 'react-native';
|
||||||
import App from './App';
|
import App from './App';
|
||||||
import { name as appName } from './app.json';
|
import { name as appName } from './app.json';
|
||||||
|
|
||||||
// eslint-disable-next-line flowtype/require-return-type
|
|
||||||
AppRegistry.registerComponent(appName, () => App);
|
AppRegistry.registerComponent(appName, () => App);
|
||||||
|
|
|
@ -7,11 +7,10 @@
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
transformer: {
|
transformer: {
|
||||||
// eslint-disable-next-line flowtype/require-return-type
|
|
||||||
getTransformOptions: async () => ({
|
getTransformOptions: async () => ({
|
||||||
transform: {
|
transform: {
|
||||||
experimentalImportSupport: false,
|
experimentalImportSupport: false,
|
||||||
inlineRequires: false,
|
inlineRequires: true,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
|
4670
package-lock.json
generated
4670
package-lock.json
generated
File diff suppressed because it is too large
Load diff
171
package.json
171
package.json
|
@ -3,12 +3,113 @@
|
||||||
"version": "4.1.0",
|
"version": "4.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "react-native start",
|
|
||||||
"android": "react-native run-android",
|
"android": "react-native run-android",
|
||||||
"android-release": "react-native run-android --variant=release",
|
"android-release": "react-native run-android --variant=release",
|
||||||
"ios": "react-native run-ios",
|
"ios": "react-native run-ios",
|
||||||
|
"start": "react-native start",
|
||||||
|
"start-no-cache": "react-native start --reset-cache",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"lint": "eslint . --ext .js,.jsx,.ts,.tsx"
|
"typescript": "tsc --noEmit",
|
||||||
|
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
|
||||||
|
"lint-fix": "eslint . --ext .js,.jsx,.ts,.tsx --fix",
|
||||||
|
"full-check": "npm run typescript && npm run lint && npm run test",
|
||||||
|
"pod": "cd ios && pod install && cd ..",
|
||||||
|
"bundle": "npm run full-check && cd android && ./gradlew bundleRelease",
|
||||||
|
"postversion": "react-native-version"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@nartc/react-native-barcode-mask": "1.2.0",
|
||||||
|
"@react-native-community/async-storage": "1.12.0",
|
||||||
|
"@react-native-community/masked-view": "0.1.10",
|
||||||
|
"@react-native-community/push-notification-ios": "1.5.0",
|
||||||
|
"@react-native-community/slider": "3.0.3",
|
||||||
|
"@react-navigation/bottom-tabs": "5.8.0",
|
||||||
|
"@react-navigation/native": "5.7.3",
|
||||||
|
"@react-navigation/stack": "5.9.0",
|
||||||
|
"i18n-js": "3.7.1",
|
||||||
|
"react": "16.13.1",
|
||||||
|
"react-native": "0.63.2",
|
||||||
|
"react-native-animatable": "1.3.3",
|
||||||
|
"react-native-app-intro-slider": "4.0.4",
|
||||||
|
"react-native-appearance": "0.3.4",
|
||||||
|
"react-native-autolink": "3.0.0",
|
||||||
|
"react-native-calendars": "1.403.0",
|
||||||
|
"react-native-camera": "3.40.0",
|
||||||
|
"react-native-collapsible": "1.5.3",
|
||||||
|
"react-native-gesture-handler": "1.8.0",
|
||||||
|
"react-native-image-zoom-viewer": "3.0.1",
|
||||||
|
"react-native-keychain": "4.0.5",
|
||||||
|
"react-native-linear-gradient": "2.5.6",
|
||||||
|
"react-native-localize": "1.4.1",
|
||||||
|
"react-native-modalize": "2.0.6",
|
||||||
|
"react-native-paper": "4.2.0",
|
||||||
|
"react-native-permissions": "2.2.1",
|
||||||
|
"react-native-push-notification": "5.1.1",
|
||||||
|
"react-native-reanimated": "1.13.0",
|
||||||
|
"react-native-render-html": "4.2.3",
|
||||||
|
"react-native-safe-area-context": "3.1.8",
|
||||||
|
"react-native-screens": "2.11.0",
|
||||||
|
"react-native-splash-screen": "3.2.0",
|
||||||
|
"react-native-vector-icons": "7.1.0",
|
||||||
|
"react-native-webview": "10.9.0",
|
||||||
|
"react-navigation-collapsible": "5.6.4",
|
||||||
|
"react-navigation-header-buttons": "5.0.2"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@babel/core": "7.11.0",
|
||||||
|
"@babel/runtime": "7.11.0",
|
||||||
|
"@react-native-community/eslint-config": "1.1.0",
|
||||||
|
"@types/i18n-js": "3.0.3",
|
||||||
|
"@types/jest": "25.2.3",
|
||||||
|
"@types/react-native": "0.63.2",
|
||||||
|
"@types/react-native-calendars": "1.20.10",
|
||||||
|
"@types/react-native-vector-icons": "6.4.6",
|
||||||
|
"@types/react-test-renderer": "16.9.2",
|
||||||
|
"@typescript-eslint/eslint-plugin": "2.27.0",
|
||||||
|
"@typescript-eslint/parser": "2.27.0",
|
||||||
|
"babel-jest": "25.1.0",
|
||||||
|
"eslint": "7.2.0",
|
||||||
|
"jest": "25.1.0",
|
||||||
|
"jest-extended": "0.11.5",
|
||||||
|
"jest-fetch-mock": "3.0.3",
|
||||||
|
"metro-react-native-babel-preset": "0.59.0",
|
||||||
|
"prettier": "2.0.5",
|
||||||
|
"react-native-version": "4.0.0",
|
||||||
|
"react-test-renderer": "16.13.1",
|
||||||
|
"typescript": "3.8.3"
|
||||||
|
},
|
||||||
|
"eslintConfig": {
|
||||||
|
"root": true,
|
||||||
|
"parser": "@typescript-eslint/parser",
|
||||||
|
"plugins": [
|
||||||
|
"@typescript-eslint"
|
||||||
|
],
|
||||||
|
"extends": [
|
||||||
|
"@react-native-community",
|
||||||
|
"prettier"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"prettier/prettier": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"quoteProps": "consistent",
|
||||||
|
"singleQuote": true,
|
||||||
|
"tabWidth": 2,
|
||||||
|
"trailingComma": "es5",
|
||||||
|
"useTabs": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"eslintIgnore": [
|
||||||
|
"node_modules/"
|
||||||
|
],
|
||||||
|
"prettier": {
|
||||||
|
"quoteProps": "consistent",
|
||||||
|
"singleQuote": true,
|
||||||
|
"tabWidth": 2,
|
||||||
|
"trailingComma": "es5",
|
||||||
|
"useTabs": false
|
||||||
},
|
},
|
||||||
"jest": {
|
"jest": {
|
||||||
"preset": "react-native",
|
"preset": "react-native",
|
||||||
|
@ -23,71 +124,5 @@
|
||||||
"setupFilesAfterEnv": [
|
"setupFilesAfterEnv": [
|
||||||
"jest-extended"
|
"jest-extended"
|
||||||
]
|
]
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@nartc/react-native-barcode-mask": "^1.2.0",
|
|
||||||
"@react-native-community/async-storage": "^1.12.0",
|
|
||||||
"@react-native-community/masked-view": "^0.1.10",
|
|
||||||
"@react-native-community/push-notification-ios": "^1.5.0",
|
|
||||||
"@react-native-community/slider": "^3.0.3",
|
|
||||||
"@react-navigation/bottom-tabs": "^5.8.0",
|
|
||||||
"@react-navigation/native": "^5.7.3",
|
|
||||||
"@react-navigation/stack": "^5.9.0",
|
|
||||||
"i18n-js": "^3.7.1",
|
|
||||||
"react": "16.13.1",
|
|
||||||
"react-native": "0.63.2",
|
|
||||||
"react-native-animatable": "^1.3.3",
|
|
||||||
"react-native-app-intro-slider": "^4.0.4",
|
|
||||||
"react-native-appearance": "^0.3.4",
|
|
||||||
"react-native-autolink": "^3.0.0",
|
|
||||||
"react-native-calendars": "^1.403.0",
|
|
||||||
"react-native-camera": "^3.40.0",
|
|
||||||
"react-native-collapsible": "^1.5.3",
|
|
||||||
"react-native-gesture-handler": "^1.8.0",
|
|
||||||
"react-native-image-zoom-viewer": "^3.0.1",
|
|
||||||
"react-native-keychain": "4.0.5",
|
|
||||||
"react-native-linear-gradient": "^2.5.6",
|
|
||||||
"react-native-localize": "^1.4.1",
|
|
||||||
"react-native-modalize": "^2.0.6",
|
|
||||||
"react-native-paper": "^4.2.0",
|
|
||||||
"react-native-permissions": "^2.2.1",
|
|
||||||
"react-native-push-notification": "^5.1.1",
|
|
||||||
"react-native-reanimated": "^1.13.0",
|
|
||||||
"react-native-render-html": "^4.2.3",
|
|
||||||
"react-native-safe-area-context": "^3.1.8",
|
|
||||||
"react-native-screens": "^2.11.0",
|
|
||||||
"react-native-splash-screen": "^3.2.0",
|
|
||||||
"react-native-vector-icons": "^7.1.0",
|
|
||||||
"react-native-webview": "^10.9.0",
|
|
||||||
"react-navigation-collapsible": "^5.6.4",
|
|
||||||
"react-navigation-header-buttons": "^5.0.2"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@babel/core": "^7.11.0",
|
|
||||||
"@babel/runtime": "^7.11.0",
|
|
||||||
"@react-native-community/eslint-config": "^1.1.0",
|
|
||||||
"@types/i18n-js": "^3.0.3",
|
|
||||||
"@types/jest": "^25.2.3",
|
|
||||||
"@types/react-native": "^0.63.2",
|
|
||||||
"@types/react-native-calendars": "^1.20.10",
|
|
||||||
"@types/react-native-vector-icons": "^6.4.6",
|
|
||||||
"@types/react-test-renderer": "^16.9.2",
|
|
||||||
"@typescript-eslint/eslint-plugin": "^2.27.0",
|
|
||||||
"@typescript-eslint/parser": "^2.27.0",
|
|
||||||
"babel-jest": "^25.1.0",
|
|
||||||
"eslint": "^7.2.0",
|
|
||||||
"eslint-config-airbnb": "^18.2.0",
|
|
||||||
"eslint-config-prettier": "^6.11.0",
|
|
||||||
"eslint-plugin-flowtype": "^5.2.0",
|
|
||||||
"eslint-plugin-import": "^2.22.0",
|
|
||||||
"eslint-plugin-jsx-a11y": "^6.3.1",
|
|
||||||
"eslint-plugin-react": "^7.20.5",
|
|
||||||
"eslint-plugin-react-hooks": "^4.0.0",
|
|
||||||
"jest": "^25.1.0",
|
|
||||||
"jest-extended": "^0.11.5",
|
|
||||||
"metro-react-native-babel-preset": "^0.59.0",
|
|
||||||
"prettier": "2.0.5",
|
|
||||||
"react-test-renderer": "16.13.1",
|
|
||||||
"typescript": "^3.8.3"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,11 +176,11 @@ class AuthenticatedScreen<T> extends React.Component<PropsType<T>, StateType> {
|
||||||
this.connectionManager
|
this.connectionManager
|
||||||
.authenticatedRequest<T>(
|
.authenticatedRequest<T>(
|
||||||
props.requests[i].link,
|
props.requests[i].link,
|
||||||
props.requests[i].params,
|
props.requests[i].params
|
||||||
)
|
)
|
||||||
.then((response: T): void => this.onRequestFinished(response, i))
|
.then((response: T): void => this.onRequestFinished(response, i))
|
||||||
.catch((error: number): void =>
|
.catch((error: number): void =>
|
||||||
this.onRequestFinished(null, i, error),
|
this.onRequestFinished(null, i, error)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -18,24 +18,31 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {View} from 'react-native';
|
import { StyleSheet, View } from 'react-native';
|
||||||
import { Headline, useTheme } from 'react-native-paper';
|
import { Headline, useTheme } from 'react-native-paper';
|
||||||
import i18n from 'i18n-js';
|
import i18n from 'i18n-js';
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
container: {
|
||||||
|
width: '100%',
|
||||||
|
marginTop: 10,
|
||||||
|
marginBottom: 10,
|
||||||
|
},
|
||||||
|
headline: {
|
||||||
|
textAlign: 'center',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
function VoteNotAvailable() {
|
function VoteNotAvailable() {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
return (
|
return (
|
||||||
<View
|
<View style={styles.container}>
|
||||||
style={{
|
|
||||||
width: '100%',
|
|
||||||
marginTop: 10,
|
|
||||||
marginBottom: 10,
|
|
||||||
}}>
|
|
||||||
<Headline
|
<Headline
|
||||||
style={{
|
style={{
|
||||||
color: theme.colors.textDisabled,
|
color: theme.colors.textDisabled,
|
||||||
textAlign: 'center',
|
...styles.headline,
|
||||||
}}>
|
}}
|
||||||
|
>
|
||||||
{i18n.t('screens.vote.noVote')}
|
{i18n.t('screens.vote.noVote')}
|
||||||
</Headline>
|
</Headline>
|
||||||
</View>
|
</View>
|
||||||
|
|
|
@ -40,8 +40,11 @@ const styles = StyleSheet.create({
|
||||||
card: {
|
card: {
|
||||||
margin: 10,
|
margin: 10,
|
||||||
},
|
},
|
||||||
icon: {
|
itemCard: {
|
||||||
backgroundColor: 'transparent',
|
marginTop: 10,
|
||||||
|
},
|
||||||
|
item: {
|
||||||
|
padding: 0,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -90,12 +93,14 @@ class VoteResults extends React.Component<PropsType> {
|
||||||
const isWinner = this.winnerIds.indexOf(item.id) !== -1;
|
const isWinner = this.winnerIds.indexOf(item.id) !== -1;
|
||||||
const isDraw = this.winnerIds.length > 1;
|
const isDraw = this.winnerIds.length > 1;
|
||||||
const { props } = this;
|
const { props } = this;
|
||||||
|
const elevation = isWinner ? 5 : 3;
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
style={{
|
style={{
|
||||||
marginTop: 10,
|
...styles.itemCard,
|
||||||
elevation: isWinner ? 5 : 3,
|
elevation: elevation,
|
||||||
}}>
|
}}
|
||||||
|
>
|
||||||
<List.Item
|
<List.Item
|
||||||
title={item.name}
|
title={item.name}
|
||||||
description={`${item.votes} ${i18n.t('screens.vote.results.votes')}`}
|
description={`${item.votes} ${i18n.t('screens.vote.results.votes')}`}
|
||||||
|
@ -113,7 +118,7 @@ class VoteResults extends React.Component<PropsType> {
|
||||||
? props.theme.colors.primary
|
? props.theme.colors.primary
|
||||||
: props.theme.colors.text,
|
: props.theme.colors.text,
|
||||||
}}
|
}}
|
||||||
style={{padding: 0}}
|
style={styles.item}
|
||||||
/>
|
/>
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
progress={item.votes / this.totalVotes}
|
progress={item.votes / this.totalVotes}
|
||||||
|
|
|
@ -43,8 +43,8 @@ const styles = StyleSheet.create({
|
||||||
card: {
|
card: {
|
||||||
margin: 10,
|
margin: 10,
|
||||||
},
|
},
|
||||||
icon: {
|
button: {
|
||||||
backgroundColor: 'transparent',
|
marginLeft: 'auto',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -123,7 +123,8 @@ export default class VoteSelect extends React.PureComponent<
|
||||||
<Card.Content>
|
<Card.Content>
|
||||||
<RadioButton.Group
|
<RadioButton.Group
|
||||||
onValueChange={this.onVoteSelectionChange}
|
onValueChange={this.onVoteSelectionChange}
|
||||||
value={state.selectedTeam}>
|
value={state.selectedTeam}
|
||||||
|
>
|
||||||
<FlatList
|
<FlatList
|
||||||
data={props.teams}
|
data={props.teams}
|
||||||
keyExtractor={this.voteKeyExtractor}
|
keyExtractor={this.voteKeyExtractor}
|
||||||
|
@ -137,8 +138,9 @@ export default class VoteSelect extends React.PureComponent<
|
||||||
icon="send"
|
icon="send"
|
||||||
mode="contained"
|
mode="contained"
|
||||||
onPress={this.showVoteDialog}
|
onPress={this.showVoteDialog}
|
||||||
style={{marginLeft: 'auto'}}
|
style={styles.button}
|
||||||
disabled={state.selectedTeam === 'none'}>
|
disabled={state.selectedTeam === 'none'}
|
||||||
|
>
|
||||||
{i18n.t('screens.vote.select.sendButton')}
|
{i18n.t('screens.vote.select.sendButton')}
|
||||||
</Button>
|
</Button>
|
||||||
</Card.Actions>
|
</Card.Actions>
|
||||||
|
|
|
@ -30,9 +30,6 @@ const styles = StyleSheet.create({
|
||||||
card: {
|
card: {
|
||||||
margin: 10,
|
margin: 10,
|
||||||
},
|
},
|
||||||
icon: {
|
|
||||||
backgroundColor: 'transparent',
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default function VoteTease(props: PropsType) {
|
export default function VoteTease(props: PropsType) {
|
||||||
|
|
|
@ -33,9 +33,6 @@ const styles = StyleSheet.create({
|
||||||
card: {
|
card: {
|
||||||
margin: 10,
|
margin: 10,
|
||||||
},
|
},
|
||||||
icon: {
|
|
||||||
backgroundColor: 'transparent',
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default function VoteWait(props: PropsType) {
|
export default function VoteWait(props: PropsType) {
|
||||||
|
|
|
@ -76,6 +76,12 @@ const styles = StyleSheet.create({
|
||||||
alignSelf: 'center',
|
alignSelf: 'center',
|
||||||
top: '-25%',
|
top: '-25%',
|
||||||
},
|
},
|
||||||
|
side: {
|
||||||
|
flexDirection: 'row',
|
||||||
|
},
|
||||||
|
icon: {
|
||||||
|
marginLeft: 5,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
class AnimatedBottomBar extends React.Component<PropsType, StateType> {
|
class AnimatedBottomBar extends React.Component<PropsType, StateType> {
|
||||||
|
@ -154,7 +160,8 @@ class AnimatedBottomBar extends React.Component<PropsType, StateType> {
|
||||||
style={{
|
style={{
|
||||||
...styles.container,
|
...styles.container,
|
||||||
bottom: 10 + CustomTabBar.TAB_BAR_HEIGHT,
|
bottom: 10 + CustomTabBar.TAB_BAR_HEIGHT,
|
||||||
}}>
|
}}
|
||||||
|
>
|
||||||
<Surface style={styles.surface}>
|
<Surface style={styles.surface}>
|
||||||
<View style={styles.fabContainer}>
|
<View style={styles.fabContainer}>
|
||||||
<AnimatedFAB
|
<AnimatedFAB
|
||||||
|
@ -165,10 +172,10 @@ class AnimatedBottomBar extends React.Component<PropsType, StateType> {
|
||||||
useNativeDriver
|
useNativeDriver
|
||||||
style={styles.fab}
|
style={styles.fab}
|
||||||
icon="account-clock"
|
icon="account-clock"
|
||||||
onPress={(): void => props.navigation.navigate('group-select')}
|
onPress={() => props.navigation.navigate('group-select')}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
<View style={{flexDirection: 'row'}}>
|
<View style={styles.side}>
|
||||||
<IconButton
|
<IconButton
|
||||||
icon={this.displayModeIcons[state.currentMode]}
|
icon={this.displayModeIcons[state.currentMode]}
|
||||||
color={buttonColor}
|
color={buttonColor}
|
||||||
|
@ -177,21 +184,21 @@ class AnimatedBottomBar extends React.Component<PropsType, StateType> {
|
||||||
<IconButton
|
<IconButton
|
||||||
icon="clock-in"
|
icon="clock-in"
|
||||||
color={buttonColor}
|
color={buttonColor}
|
||||||
style={{marginLeft: 5}}
|
style={styles.icon}
|
||||||
onPress={(): void => props.onPress('today')}
|
onPress={() => props.onPress('today')}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
<View style={{flexDirection: 'row'}}>
|
<View style={styles.side}>
|
||||||
<IconButton
|
<IconButton
|
||||||
icon="chevron-left"
|
icon="chevron-left"
|
||||||
color={buttonColor}
|
color={buttonColor}
|
||||||
onPress={(): void => props.onPress('prev')}
|
onPress={() => props.onPress('prev')}
|
||||||
/>
|
/>
|
||||||
<IconButton
|
<IconButton
|
||||||
icon="chevron-right"
|
icon="chevron-right"
|
||||||
color={buttonColor}
|
color={buttonColor}
|
||||||
style={{marginLeft: 5}}
|
style={styles.icon}
|
||||||
onPress={(): void => props.onPress('next')}
|
onPress={() => props.onPress('next')}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
</Surface>
|
</Surface>
|
||||||
|
|
|
@ -83,7 +83,8 @@ export default class AnimatedFAB extends React.Component<PropsType> {
|
||||||
style={{
|
style={{
|
||||||
...styles.fab,
|
...styles.fab,
|
||||||
bottom: CustomTabBar.TAB_BAR_HEIGHT,
|
bottom: CustomTabBar.TAB_BAR_HEIGHT,
|
||||||
}}>
|
}}
|
||||||
|
>
|
||||||
<FAB icon={props.icon} onPress={props.onPress} />
|
<FAB icon={props.icon} onPress={props.onPress} />
|
||||||
</Animatable.View>
|
</Animatable.View>
|
||||||
);
|
);
|
||||||
|
|
|
@ -20,17 +20,27 @@
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { useCollapsibleStack } from 'react-navigation-collapsible';
|
import { useCollapsibleStack } from 'react-navigation-collapsible';
|
||||||
import CustomTabBar from '../Tabbar/CustomTabBar';
|
import CustomTabBar from '../Tabbar/CustomTabBar';
|
||||||
import {NativeScrollEvent, NativeSyntheticEvent} from 'react-native';
|
import {
|
||||||
|
NativeScrollEvent,
|
||||||
|
NativeSyntheticEvent,
|
||||||
|
StyleSheet,
|
||||||
|
} from 'react-native';
|
||||||
|
|
||||||
export interface CollapsibleComponentPropsType {
|
export type CollapsibleComponentPropsType = {
|
||||||
children?: React.ReactNode;
|
children?: React.ReactNode;
|
||||||
hasTab?: boolean;
|
hasTab?: boolean;
|
||||||
onScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
onScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
||||||
}
|
};
|
||||||
|
|
||||||
interface PropsType extends CollapsibleComponentPropsType {
|
type PropsType = CollapsibleComponentPropsType & {
|
||||||
component: React.ComponentType<any>;
|
component: React.ComponentType<any>;
|
||||||
}
|
};
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
main: {
|
||||||
|
minHeight: '100%',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
function CollapsibleComponent(props: PropsType) {
|
function CollapsibleComponent(props: PropsType) {
|
||||||
const onScroll = (event: NativeSyntheticEvent<NativeScrollEvent>) => {
|
const onScroll = (event: NativeSyntheticEvent<NativeScrollEvent>) => {
|
||||||
|
@ -44,17 +54,18 @@ function CollapsibleComponent(props: PropsType) {
|
||||||
scrollIndicatorInsetTop,
|
scrollIndicatorInsetTop,
|
||||||
onScrollWithListener,
|
onScrollWithListener,
|
||||||
} = useCollapsibleStack();
|
} = useCollapsibleStack();
|
||||||
|
const paddingBottom = props.hasTab ? CustomTabBar.TAB_BAR_HEIGHT : 0;
|
||||||
return (
|
return (
|
||||||
<Comp
|
<Comp
|
||||||
{...props}
|
{...props}
|
||||||
onScroll={onScrollWithListener(onScroll)}
|
onScroll={onScrollWithListener(onScroll)}
|
||||||
contentContainerStyle={{
|
contentContainerStyle={{
|
||||||
paddingTop: containerPaddingTop,
|
paddingTop: containerPaddingTop,
|
||||||
paddingBottom: props.hasTab ? CustomTabBar.TAB_BAR_HEIGHT : 0,
|
paddingBottom: paddingBottom,
|
||||||
minHeight: '100%',
|
...styles.main,
|
||||||
}}
|
}}
|
||||||
scrollIndicatorInsets={{top: scrollIndicatorInsetTop}}>
|
scrollIndicatorInsets={{ top: scrollIndicatorInsetTop }}
|
||||||
|
>
|
||||||
{props.children}
|
{props.children}
|
||||||
</Comp>
|
</Comp>
|
||||||
);
|
);
|
||||||
|
|
|
@ -26,6 +26,7 @@ import {
|
||||||
Portal,
|
Portal,
|
||||||
} from 'react-native-paper';
|
} from 'react-native-paper';
|
||||||
import i18n from 'i18n-js';
|
import i18n from 'i18n-js';
|
||||||
|
import { StyleSheet } from 'react-native';
|
||||||
|
|
||||||
type PropsType = {
|
type PropsType = {
|
||||||
visible: boolean;
|
visible: boolean;
|
||||||
|
@ -41,6 +42,12 @@ type StateType = {
|
||||||
loading: boolean;
|
loading: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
button: {
|
||||||
|
marginRight: 10,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
export default class LoadingConfirmDialog extends React.PureComponent<
|
export default class LoadingConfirmDialog extends React.PureComponent<
|
||||||
PropsType,
|
PropsType,
|
||||||
StateType
|
StateType
|
||||||
|
@ -113,7 +120,7 @@ export default class LoadingConfirmDialog extends React.PureComponent<
|
||||||
</Dialog.Content>
|
</Dialog.Content>
|
||||||
{state.loading ? null : (
|
{state.loading ? null : (
|
||||||
<Dialog.Actions>
|
<Dialog.Actions>
|
||||||
<Button onPress={this.onDismiss} style={{marginRight: 10}}>
|
<Button onPress={this.onDismiss} style={styles.button}>
|
||||||
{i18n.t('dialog.cancel')}
|
{i18n.t('dialog.cancel')}
|
||||||
</Button>
|
</Button>
|
||||||
<Button onPress={this.onClickAccept}>
|
<Button onPress={this.onClickAccept}>
|
||||||
|
|
|
@ -19,10 +19,19 @@
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { List } from 'react-native-paper';
|
import { List } from 'react-native-paper';
|
||||||
import {View} from 'react-native';
|
import { StyleSheet, View } from 'react-native';
|
||||||
import i18n from 'i18n-js';
|
import i18n from 'i18n-js';
|
||||||
import { useNavigation } from '@react-navigation/native';
|
import { useNavigation } from '@react-navigation/native';
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
item: {
|
||||||
|
paddingTop: 0,
|
||||||
|
paddingBottom: 0,
|
||||||
|
marginLeft: 10,
|
||||||
|
marginRight: 10,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
function ActionsDashBoardItem() {
|
function ActionsDashBoardItem() {
|
||||||
const navigation = useNavigation();
|
const navigation = useNavigation();
|
||||||
return (
|
return (
|
||||||
|
@ -45,12 +54,7 @@ function ActionsDashBoardItem() {
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
onPress={(): void => navigation.navigate('feedback')}
|
onPress={(): void => navigation.navigate('feedback')}
|
||||||
style={{
|
style={styles.item}
|
||||||
paddingTop: 0,
|
|
||||||
paddingBottom: 0,
|
|
||||||
marginLeft: 10,
|
|
||||||
marginRight: 10,
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
|
|
@ -27,6 +27,7 @@ import {
|
||||||
} from 'react-native-paper';
|
} from 'react-native-paper';
|
||||||
import { StyleSheet, View } from 'react-native';
|
import { StyleSheet, View } from 'react-native';
|
||||||
import i18n from 'i18n-js';
|
import i18n from 'i18n-js';
|
||||||
|
import GENERAL_STYLES from '../../constants/Styles';
|
||||||
|
|
||||||
type PropsType = {
|
type PropsType = {
|
||||||
eventNumber: number;
|
eventNumber: number;
|
||||||
|
@ -45,6 +46,9 @@ const styles = StyleSheet.create({
|
||||||
avatar: {
|
avatar: {
|
||||||
backgroundColor: 'transparent',
|
backgroundColor: 'transparent',
|
||||||
},
|
},
|
||||||
|
text: {
|
||||||
|
fontWeight: 'bold',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -61,7 +65,7 @@ function EventDashBoardItem(props: PropsType) {
|
||||||
if (isAvailable) {
|
if (isAvailable) {
|
||||||
subtitle = (
|
subtitle = (
|
||||||
<Text>
|
<Text>
|
||||||
<Text style={{fontWeight: 'bold'}}>{props.eventNumber}</Text>
|
<Text style={styles.text}>{props.eventNumber}</Text>
|
||||||
<Text>
|
<Text>
|
||||||
{props.eventNumber > 1
|
{props.eventNumber > 1
|
||||||
? i18n.t('screens.home.dashboard.todayEventsSubtitlePlural')
|
? i18n.t('screens.home.dashboard.todayEventsSubtitlePlural')
|
||||||
|
@ -74,7 +78,7 @@ function EventDashBoardItem(props: PropsType) {
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<Card style={styles.card}>
|
<Card style={styles.card}>
|
||||||
<TouchableRipple style={{flex: 1}} onPress={props.clickAction}>
|
<TouchableRipple style={GENERAL_STYLES.flex} onPress={props.clickAction}>
|
||||||
<View>
|
<View>
|
||||||
<Card.Title
|
<Card.Title
|
||||||
title={i18n.t('screens.home.dashboard.todayEventsTitle')}
|
title={i18n.t('screens.home.dashboard.todayEventsTitle')}
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { Button, Card, Text, TouchableRipple } from 'react-native-paper';
|
import { Button, Card, Text, TouchableRipple } from 'react-native-paper';
|
||||||
import {Image, View} from 'react-native';
|
import { Image, StyleSheet, View } from 'react-native';
|
||||||
import Autolink from 'react-native-autolink';
|
import Autolink from 'react-native-autolink';
|
||||||
import i18n from 'i18n-js';
|
import i18n from 'i18n-js';
|
||||||
import type { FeedItemType } from '../../screens/Home/HomeScreen';
|
import type { FeedItemType } from '../../screens/Home/HomeScreen';
|
||||||
|
@ -29,6 +29,7 @@ import NewsSourcesConstants, {
|
||||||
import type { NewsSourceType } from '../../constants/NewsSourcesConstants';
|
import type { NewsSourceType } from '../../constants/NewsSourcesConstants';
|
||||||
import ImageGalleryButton from '../Media/ImageGalleryButton';
|
import ImageGalleryButton from '../Media/ImageGalleryButton';
|
||||||
import { useNavigation } from '@react-navigation/native';
|
import { useNavigation } from '@react-navigation/native';
|
||||||
|
import GENERAL_STYLES from '../../constants/Styles';
|
||||||
|
|
||||||
type PropsType = {
|
type PropsType = {
|
||||||
item: FeedItemType;
|
item: FeedItemType;
|
||||||
|
@ -46,6 +47,20 @@ function getFormattedDate(dateString: number): string {
|
||||||
return date.toLocaleString();
|
return date.toLocaleString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
image: {
|
||||||
|
width: 48,
|
||||||
|
height: 48,
|
||||||
|
},
|
||||||
|
button: {
|
||||||
|
marginLeft: 'auto',
|
||||||
|
marginRight: 'auto',
|
||||||
|
},
|
||||||
|
action: {
|
||||||
|
marginLeft: 'auto',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component used to display a feed item
|
* Component used to display a feed item
|
||||||
*/
|
*/
|
||||||
|
@ -76,31 +91,23 @@ function FeedItem(props: PropsType) {
|
||||||
style={{
|
style={{
|
||||||
margin: cardMargin,
|
margin: cardMargin,
|
||||||
height: cardHeight,
|
height: cardHeight,
|
||||||
}}>
|
}}
|
||||||
<TouchableRipple style={{flex: 1}} onPress={onPress}>
|
>
|
||||||
|
<TouchableRipple style={GENERAL_STYLES.flex} onPress={onPress}>
|
||||||
<View>
|
<View>
|
||||||
<Card.Title
|
<Card.Title
|
||||||
title={pageSource.name}
|
title={pageSource.name}
|
||||||
subtitle={getFormattedDate(item.time)}
|
subtitle={getFormattedDate(item.time)}
|
||||||
left={() => (
|
left={() => <Image source={pageSource.icon} style={styles.image} />}
|
||||||
<Image
|
|
||||||
source={pageSource.icon}
|
|
||||||
style={{
|
|
||||||
width: 48,
|
|
||||||
height: 48,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
style={{ height: titleHeight }}
|
style={{ height: titleHeight }}
|
||||||
/>
|
/>
|
||||||
{image != null ? (
|
{image != null ? (
|
||||||
<ImageGalleryButton
|
<ImageGalleryButton
|
||||||
images={[{ url: image }]}
|
images={[{ url: image }]}
|
||||||
style={{
|
style={{
|
||||||
|
...styles.button,
|
||||||
width: imageSize,
|
width: imageSize,
|
||||||
height: imageSize,
|
height: imageSize,
|
||||||
marginLeft: 'auto',
|
|
||||||
marginRight: 'auto',
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
|
@ -115,7 +122,7 @@ function FeedItem(props: PropsType) {
|
||||||
) : null}
|
) : null}
|
||||||
</Card.Content>
|
</Card.Content>
|
||||||
<Card.Actions style={{ height: actionsHeight }}>
|
<Card.Actions style={{ height: actionsHeight }}>
|
||||||
<Button onPress={onPress} icon="plus" style={{marginLeft: 'auto'}}>
|
<Button onPress={onPress} icon="plus" style={styles.action}>
|
||||||
{i18n.t('screens.home.dashboard.seeMore')}
|
{i18n.t('screens.home.dashboard.seeMore')}
|
||||||
</Button>
|
</Button>
|
||||||
</Card.Actions>
|
</Card.Actions>
|
||||||
|
|
|
@ -24,6 +24,7 @@ import {Avatar, Button, Card, TouchableRipple} from 'react-native-paper';
|
||||||
import { getTimeOnlyString, isDescriptionEmpty } from '../../utils/Planning';
|
import { getTimeOnlyString, isDescriptionEmpty } from '../../utils/Planning';
|
||||||
import CustomHTML from '../Overrides/CustomHTML';
|
import CustomHTML from '../Overrides/CustomHTML';
|
||||||
import type { PlanningEventType } from '../../utils/Planning';
|
import type { PlanningEventType } from '../../utils/Planning';
|
||||||
|
import GENERAL_STYLES from '../../constants/Styles';
|
||||||
|
|
||||||
type PropsType = {
|
type PropsType = {
|
||||||
event?: PlanningEventType | null;
|
event?: PlanningEventType | null;
|
||||||
|
@ -59,12 +60,19 @@ function PreviewEventDashboardItem(props: PropsType) {
|
||||||
const logo = event.logo;
|
const logo = event.logo;
|
||||||
const getImage = logo
|
const getImage = logo
|
||||||
? () => (
|
? () => (
|
||||||
<Avatar.Image source={{uri: logo}} size={50} style={styles.avatar} />
|
<Avatar.Image
|
||||||
|
source={{ uri: logo }}
|
||||||
|
size={50}
|
||||||
|
style={styles.avatar}
|
||||||
|
/>
|
||||||
)
|
)
|
||||||
: () => null;
|
: () => null;
|
||||||
return (
|
return (
|
||||||
<Card style={styles.card} elevation={3}>
|
<Card style={styles.card} elevation={3}>
|
||||||
<TouchableRipple style={{flex: 1}} onPress={props.clickAction}>
|
<TouchableRipple
|
||||||
|
style={GENERAL_STYLES.flex}
|
||||||
|
onPress={props.clickAction}
|
||||||
|
>
|
||||||
<View>
|
<View>
|
||||||
<Card.Title
|
<Card.Title
|
||||||
title={event.title}
|
title={event.title}
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { Badge, TouchableRipple, useTheme } from 'react-native-paper';
|
import { Badge, TouchableRipple, useTheme } from 'react-native-paper';
|
||||||
import {Dimensions, Image, View} from 'react-native';
|
import { Dimensions, Image, StyleSheet, View } from 'react-native';
|
||||||
import * as Animatable from 'react-native-animatable';
|
import * as Animatable from 'react-native-animatable';
|
||||||
|
|
||||||
type PropsType = {
|
type PropsType = {
|
||||||
|
@ -28,6 +28,25 @@ type PropsType = {
|
||||||
badgeCount?: number;
|
badgeCount?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
image: {
|
||||||
|
width: '80%',
|
||||||
|
height: '80%',
|
||||||
|
marginLeft: 'auto',
|
||||||
|
marginRight: 'auto',
|
||||||
|
marginTop: 'auto',
|
||||||
|
marginBottom: 'auto',
|
||||||
|
},
|
||||||
|
badgeContainer: {
|
||||||
|
position: 'absolute',
|
||||||
|
top: 0,
|
||||||
|
right: 0,
|
||||||
|
},
|
||||||
|
badge: {
|
||||||
|
borderWidth: 2,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component used to render a small dashboard item
|
* Component used to render a small dashboard item
|
||||||
*/
|
*/
|
||||||
|
@ -42,23 +61,18 @@ function SmallDashboardItem(props: PropsType) {
|
||||||
style={{
|
style={{
|
||||||
marginLeft: itemSize / 6,
|
marginLeft: itemSize / 6,
|
||||||
marginRight: itemSize / 6,
|
marginRight: itemSize / 6,
|
||||||
}}>
|
}}
|
||||||
|
>
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
width: itemSize,
|
width: itemSize,
|
||||||
height: itemSize,
|
height: itemSize,
|
||||||
}}>
|
}}
|
||||||
|
>
|
||||||
{image ? (
|
{image ? (
|
||||||
<Image
|
<Image
|
||||||
source={typeof image === 'string' ? { uri: image } : image}
|
source={typeof image === 'string' ? { uri: image } : image}
|
||||||
style={{
|
style={styles.image}
|
||||||
width: '80%',
|
|
||||||
height: '80%',
|
|
||||||
marginLeft: 'auto',
|
|
||||||
marginRight: 'auto',
|
|
||||||
marginTop: 'auto',
|
|
||||||
marginBottom: 'auto',
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
{props.badgeCount != null && props.badgeCount > 0 ? (
|
{props.badgeCount != null && props.badgeCount > 0 ? (
|
||||||
|
@ -66,18 +80,16 @@ function SmallDashboardItem(props: PropsType) {
|
||||||
animation="zoomIn"
|
animation="zoomIn"
|
||||||
duration={300}
|
duration={300}
|
||||||
useNativeDriver
|
useNativeDriver
|
||||||
style={{
|
style={styles.badgeContainer}
|
||||||
position: 'absolute',
|
>
|
||||||
top: 0,
|
|
||||||
right: 0,
|
|
||||||
}}>
|
|
||||||
<Badge
|
<Badge
|
||||||
visible={true}
|
visible={true}
|
||||||
style={{
|
style={{
|
||||||
backgroundColor: theme.colors.primary,
|
backgroundColor: theme.colors.primary,
|
||||||
borderColor: theme.colors.background,
|
borderColor: theme.colors.background,
|
||||||
borderWidth: 2,
|
...styles.badge,
|
||||||
}}>
|
}}
|
||||||
|
>
|
||||||
{props.badgeCount}
|
{props.badgeCount}
|
||||||
</Badge>
|
</Badge>
|
||||||
</Animatable.View>
|
</Animatable.View>
|
||||||
|
|
|
@ -21,6 +21,7 @@ import * as React from 'react';
|
||||||
import { StyleSheet, View } from 'react-native';
|
import { StyleSheet, View } from 'react-native';
|
||||||
import * as Animatable from 'react-native-animatable';
|
import * as Animatable from 'react-native-animatable';
|
||||||
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||||
|
import GENERAL_STYLES from '../../constants/Styles';
|
||||||
|
|
||||||
type PropsType = {
|
type PropsType = {
|
||||||
icon: string;
|
icon: string;
|
||||||
|
@ -37,7 +38,7 @@ const styles = StyleSheet.create({
|
||||||
|
|
||||||
function IntroIcon(props: PropsType) {
|
function IntroIcon(props: PropsType) {
|
||||||
return (
|
return (
|
||||||
<View style={{flex: 1}}>
|
<View style={GENERAL_STYLES.flex}>
|
||||||
<Animatable.View useNativeDriver style={styles.center} animation="fadeIn">
|
<Animatable.View useNativeDriver style={styles.center} animation="fadeIn">
|
||||||
<MaterialCommunityIcons name={props.icon} color="#fff" size={200} />
|
<MaterialCommunityIcons name={props.icon} color="#fff" size={200} />
|
||||||
</Animatable.View>
|
</Animatable.View>
|
||||||
|
|
|
@ -19,24 +19,22 @@
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { StyleSheet, View } from 'react-native';
|
import { StyleSheet, View } from 'react-native';
|
||||||
|
import GENERAL_STYLES from '../../constants/Styles';
|
||||||
import Mascot, { MASCOT_STYLE } from '../Mascot/Mascot';
|
import Mascot, { MASCOT_STYLE } from '../Mascot/Mascot';
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
center: {
|
center: {
|
||||||
marginTop: 'auto',
|
...GENERAL_STYLES.center,
|
||||||
marginBottom: 'auto',
|
width: '80%',
|
||||||
marginRight: 'auto',
|
|
||||||
marginLeft: 'auto',
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
function MascotIntroEnd() {
|
function MascotIntroEnd() {
|
||||||
return (
|
return (
|
||||||
<View style={{flex: 1}}>
|
<View style={GENERAL_STYLES.flex}>
|
||||||
<Mascot
|
<Mascot
|
||||||
style={{
|
style={{
|
||||||
...styles.center,
|
...styles.center,
|
||||||
width: '80%',
|
|
||||||
}}
|
}}
|
||||||
emotion={MASCOT_STYLE.COOL}
|
emotion={MASCOT_STYLE.COOL}
|
||||||
animated
|
animated
|
||||||
|
|
|
@ -21,25 +21,37 @@ import * as React from 'react';
|
||||||
import { StyleSheet, View } from 'react-native';
|
import { StyleSheet, View } from 'react-native';
|
||||||
import * as Animatable from 'react-native-animatable';
|
import * as Animatable from 'react-native-animatable';
|
||||||
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||||
|
import GENERAL_STYLES from '../../constants/Styles';
|
||||||
import Mascot, { MASCOT_STYLE } from '../Mascot/Mascot';
|
import Mascot, { MASCOT_STYLE } from '../Mascot/Mascot';
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
center: {
|
mascot: {
|
||||||
marginTop: 'auto',
|
...GENERAL_STYLES.center,
|
||||||
marginBottom: 'auto',
|
width: '80%',
|
||||||
marginRight: 'auto',
|
},
|
||||||
marginLeft: 'auto',
|
text: {
|
||||||
|
color: '#fff',
|
||||||
|
textAlign: 'center',
|
||||||
|
fontSize: 25,
|
||||||
|
},
|
||||||
|
container: {
|
||||||
|
position: 'absolute',
|
||||||
|
bottom: 30,
|
||||||
|
right: '20%',
|
||||||
|
width: 50,
|
||||||
|
height: 50,
|
||||||
|
},
|
||||||
|
icon: {
|
||||||
|
...GENERAL_STYLES.center,
|
||||||
|
transform: [{ rotateZ: '70deg' }],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
function MascotIntroWelcome() {
|
function MascotIntroWelcome() {
|
||||||
return (
|
return (
|
||||||
<View style={{flex: 1}}>
|
<View style={GENERAL_STYLES.flex}>
|
||||||
<Mascot
|
<Mascot
|
||||||
style={{
|
style={styles.mascot}
|
||||||
...styles.center,
|
|
||||||
width: '80%',
|
|
||||||
}}
|
|
||||||
emotion={MASCOT_STYLE.NORMAL}
|
emotion={MASCOT_STYLE.NORMAL}
|
||||||
animated
|
animated
|
||||||
entryAnimation={{
|
entryAnimation={{
|
||||||
|
@ -51,11 +63,8 @@ function MascotIntroWelcome() {
|
||||||
useNativeDriver
|
useNativeDriver
|
||||||
animation="fadeInUp"
|
animation="fadeInUp"
|
||||||
duration={500}
|
duration={500}
|
||||||
style={{
|
style={styles.text}
|
||||||
color: '#fff',
|
>
|
||||||
textAlign: 'center',
|
|
||||||
fontSize: 25,
|
|
||||||
}}>
|
|
||||||
PABLO
|
PABLO
|
||||||
</Animatable.Text>
|
</Animatable.Text>
|
||||||
<Animatable.View
|
<Animatable.View
|
||||||
|
@ -63,18 +72,10 @@ function MascotIntroWelcome() {
|
||||||
animation="fadeInUp"
|
animation="fadeInUp"
|
||||||
duration={500}
|
duration={500}
|
||||||
delay={200}
|
delay={200}
|
||||||
style={{
|
style={styles.container}
|
||||||
position: 'absolute',
|
>
|
||||||
bottom: 30,
|
|
||||||
right: '20%',
|
|
||||||
width: 50,
|
|
||||||
height: 50,
|
|
||||||
}}>
|
|
||||||
<MaterialCommunityIcons
|
<MaterialCommunityIcons
|
||||||
style={{
|
style={styles.icon}
|
||||||
...styles.center,
|
|
||||||
transform: [{rotateZ: '70deg'}],
|
|
||||||
}}
|
|
||||||
name="undo"
|
name="undo"
|
||||||
color="#fff"
|
color="#fff"
|
||||||
size={40}
|
size={40}
|
||||||
|
|
|
@ -19,28 +19,35 @@
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { Caption, Card, Paragraph, TouchableRipple } from 'react-native-paper';
|
import { Caption, Card, Paragraph, TouchableRipple } from 'react-native-paper';
|
||||||
import {View} from 'react-native';
|
import { StyleSheet, View } from 'react-native';
|
||||||
import type { ServiceItemType } from '../../../managers/ServicesManager';
|
import type { ServiceItemType } from '../../../managers/ServicesManager';
|
||||||
|
import GENERAL_STYLES from '../../../constants/Styles';
|
||||||
|
|
||||||
type PropsType = {
|
type PropsType = {
|
||||||
item: ServiceItemType;
|
item: ServiceItemType;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
card: {
|
||||||
|
width: '40%',
|
||||||
|
margin: 5,
|
||||||
|
marginLeft: 'auto',
|
||||||
|
marginRight: 'auto',
|
||||||
|
},
|
||||||
|
cover: {
|
||||||
|
height: 80,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
function CardListItem(props: PropsType) {
|
function CardListItem(props: PropsType) {
|
||||||
const { item } = props;
|
const { item } = props;
|
||||||
const source =
|
const source =
|
||||||
typeof item.image === 'number' ? item.image : { uri: item.image };
|
typeof item.image === 'number' ? item.image : { uri: item.image };
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card style={styles.card}>
|
||||||
style={{
|
<TouchableRipple style={GENERAL_STYLES.flex} onPress={item.onPress}>
|
||||||
width: '40%',
|
|
||||||
margin: 5,
|
|
||||||
marginLeft: 'auto',
|
|
||||||
marginRight: 'auto',
|
|
||||||
}}>
|
|
||||||
<TouchableRipple style={{flex: 1}} onPress={item.onPress}>
|
|
||||||
<View>
|
<View>
|
||||||
<Card.Cover style={{height: 80}} source={source} />
|
<Card.Cover style={styles.cover} source={source} />
|
||||||
<Card.Content>
|
<Card.Content>
|
||||||
<Paragraph>{item.title}</Paragraph>
|
<Paragraph>{item.title}</Paragraph>
|
||||||
<Caption>{item.subtitle}</Caption>
|
<Caption>{item.subtitle}</Caption>
|
||||||
|
|
|
@ -19,14 +19,26 @@
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { Text, TouchableRipple } from 'react-native-paper';
|
import { Text, TouchableRipple } from 'react-native-paper';
|
||||||
import {Image, View} from 'react-native';
|
import { Image, StyleSheet, View } from 'react-native';
|
||||||
import type { ServiceItemType } from '../../../managers/ServicesManager';
|
import type { ServiceItemType } from '../../../managers/ServicesManager';
|
||||||
|
import GENERAL_STYLES from '../../../constants/Styles';
|
||||||
|
|
||||||
type PropsType = {
|
type PropsType = {
|
||||||
item: ServiceItemType;
|
item: ServiceItemType;
|
||||||
width: number;
|
width: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
ripple: {
|
||||||
|
margin: 5,
|
||||||
|
},
|
||||||
|
text: {
|
||||||
|
...GENERAL_STYLES.centerHorizontal,
|
||||||
|
marginTop: 5,
|
||||||
|
textAlign: 'center',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
function ImageListItem(props: PropsType) {
|
function ImageListItem(props: PropsType) {
|
||||||
const { item } = props;
|
const { item } = props;
|
||||||
const source =
|
const source =
|
||||||
|
@ -36,28 +48,20 @@ function ImageListItem(props: PropsType) {
|
||||||
style={{
|
style={{
|
||||||
width: props.width,
|
width: props.width,
|
||||||
height: props.width + 40,
|
height: props.width + 40,
|
||||||
margin: 5,
|
...styles.ripple,
|
||||||
}}
|
}}
|
||||||
onPress={item.onPress}>
|
onPress={item.onPress}
|
||||||
|
>
|
||||||
<View>
|
<View>
|
||||||
<Image
|
<Image
|
||||||
style={{
|
style={{
|
||||||
width: props.width - 20,
|
width: props.width - 20,
|
||||||
height: props.width - 20,
|
height: props.width - 20,
|
||||||
marginLeft: 'auto',
|
...GENERAL_STYLES.centerHorizontal,
|
||||||
marginRight: 'auto',
|
|
||||||
}}
|
}}
|
||||||
source={source}
|
source={source}
|
||||||
/>
|
/>
|
||||||
<Text
|
<Text style={styles.text}>{item.title}</Text>
|
||||||
style={{
|
|
||||||
marginTop: 5,
|
|
||||||
marginLeft: 'auto',
|
|
||||||
marginRight: 'auto',
|
|
||||||
textAlign: 'center',
|
|
||||||
}}>
|
|
||||||
{item.title}
|
|
||||||
</Text>
|
|
||||||
</View>
|
</View>
|
||||||
</TouchableRipple>
|
</TouchableRipple>
|
||||||
);
|
);
|
||||||
|
|
|
@ -24,6 +24,7 @@ import i18n from 'i18n-js';
|
||||||
import AnimatedAccordion from '../../Animations/AnimatedAccordion';
|
import AnimatedAccordion from '../../Animations/AnimatedAccordion';
|
||||||
import { isItemInCategoryFilter } from '../../../utils/Search';
|
import { isItemInCategoryFilter } from '../../../utils/Search';
|
||||||
import type { ClubCategoryType } from '../../../screens/Amicale/Clubs/ClubListScreen';
|
import type { ClubCategoryType } from '../../../screens/Amicale/Clubs/ClubListScreen';
|
||||||
|
import GENERAL_STYLES from '../../../constants/Styles';
|
||||||
|
|
||||||
type PropsType = {
|
type PropsType = {
|
||||||
categories: Array<ClubCategoryType>;
|
categories: Array<ClubCategoryType>;
|
||||||
|
@ -39,8 +40,7 @@ const styles = StyleSheet.create({
|
||||||
paddingLeft: 0,
|
paddingLeft: 0,
|
||||||
marginTop: 5,
|
marginTop: 5,
|
||||||
marginBottom: 10,
|
marginBottom: 10,
|
||||||
marginLeft: 'auto',
|
...GENERAL_STYLES.centerHorizontal,
|
||||||
marginRight: 'auto',
|
|
||||||
},
|
},
|
||||||
chipContainer: {
|
chipContainer: {
|
||||||
justifyContent: 'space-around',
|
justifyContent: 'space-around',
|
||||||
|
@ -49,6 +49,11 @@ const styles = StyleSheet.create({
|
||||||
paddingLeft: 0,
|
paddingLeft: 0,
|
||||||
marginBottom: 5,
|
marginBottom: 5,
|
||||||
},
|
},
|
||||||
|
chip: {
|
||||||
|
marginRight: 5,
|
||||||
|
marginLeft: 5,
|
||||||
|
marginBottom: 5,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
function ClubListHeader(props: PropsType) {
|
function ClubListHeader(props: PropsType) {
|
||||||
|
@ -62,8 +67,9 @@ function ClubListHeader(props: PropsType) {
|
||||||
])}
|
])}
|
||||||
mode="outlined"
|
mode="outlined"
|
||||||
onPress={onPress}
|
onPress={onPress}
|
||||||
style={{marginRight: 5, marginLeft: 5, marginBottom: 5}}
|
style={styles.chip}
|
||||||
key={key}>
|
key={key}
|
||||||
|
>
|
||||||
{category.name}
|
{category.name}
|
||||||
</Chip>
|
</Chip>
|
||||||
);
|
);
|
||||||
|
@ -88,7 +94,8 @@ function ClubListHeader(props: PropsType) {
|
||||||
icon="star"
|
icon="star"
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
opened>
|
opened
|
||||||
|
>
|
||||||
<Text style={styles.text}>
|
<Text style={styles.text}>
|
||||||
{i18n.t('screens.clubs.categoriesFilterMessage')}
|
{i18n.t('screens.clubs.categoriesFilterMessage')}
|
||||||
</Text>
|
</Text>
|
||||||
|
|
|
@ -19,11 +19,12 @@
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { Avatar, Chip, List, withTheme } from 'react-native-paper';
|
import { Avatar, Chip, List, withTheme } from 'react-native-paper';
|
||||||
import {View} from 'react-native';
|
import { StyleSheet, View } from 'react-native';
|
||||||
import type {
|
import type {
|
||||||
ClubCategoryType,
|
ClubCategoryType,
|
||||||
ClubType,
|
ClubType,
|
||||||
} from '../../../screens/Amicale/Clubs/ClubListScreen';
|
} from '../../../screens/Amicale/Clubs/ClubListScreen';
|
||||||
|
import GENERAL_STYLES from '../../../constants/Styles';
|
||||||
|
|
||||||
type PropsType = {
|
type PropsType = {
|
||||||
onPress: () => void;
|
onPress: () => void;
|
||||||
|
@ -33,6 +34,28 @@ type PropsType = {
|
||||||
theme: ReactNativePaper.Theme;
|
theme: ReactNativePaper.Theme;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
chip: {
|
||||||
|
marginRight: 5,
|
||||||
|
marginBottom: 5,
|
||||||
|
},
|
||||||
|
chipContainer: {
|
||||||
|
flexDirection: 'row',
|
||||||
|
},
|
||||||
|
avatar: {
|
||||||
|
backgroundColor: 'transparent',
|
||||||
|
marginLeft: 10,
|
||||||
|
marginRight: 10,
|
||||||
|
},
|
||||||
|
icon: {
|
||||||
|
...GENERAL_STYLES.centerVertical,
|
||||||
|
backgroundColor: 'transparent',
|
||||||
|
},
|
||||||
|
item: {
|
||||||
|
justifyContent: 'center',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
class ClubListItem extends React.Component<PropsType> {
|
class ClubListItem extends React.Component<PropsType> {
|
||||||
hasManagers: boolean;
|
hasManagers: boolean;
|
||||||
|
|
||||||
|
@ -53,16 +76,14 @@ class ClubListItem extends React.Component<PropsType> {
|
||||||
const category = props.categoryTranslator(cat);
|
const category = props.categoryTranslator(cat);
|
||||||
if (category) {
|
if (category) {
|
||||||
final.push(
|
final.push(
|
||||||
<Chip
|
<Chip style={styles.chip} key={`${props.item.id}:${category.id}`}>
|
||||||
style={{marginRight: 5, marginBottom: 5}}
|
|
||||||
key={`${props.item.id}:${category.id}`}>
|
|
||||||
{category.name}
|
{category.name}
|
||||||
</Chip>,
|
</Chip>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return <View style={{flexDirection: 'row'}}>{final}</View>;
|
return <View style={styles.chipContainer}>{final}</View>;
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -77,22 +98,14 @@ class ClubListItem extends React.Component<PropsType> {
|
||||||
onPress={props.onPress}
|
onPress={props.onPress}
|
||||||
left={() => (
|
left={() => (
|
||||||
<Avatar.Image
|
<Avatar.Image
|
||||||
style={{
|
style={styles.avatar}
|
||||||
backgroundColor: 'transparent',
|
|
||||||
marginLeft: 10,
|
|
||||||
marginRight: 10,
|
|
||||||
}}
|
|
||||||
size={64}
|
size={64}
|
||||||
source={{ uri: props.item.logo }}
|
source={{ uri: props.item.logo }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
right={() => (
|
right={() => (
|
||||||
<Avatar.Icon
|
<Avatar.Icon
|
||||||
style={{
|
style={styles.icon}
|
||||||
marginTop: 'auto',
|
|
||||||
marginBottom: 'auto',
|
|
||||||
backgroundColor: 'transparent',
|
|
||||||
}}
|
|
||||||
size={48}
|
size={48}
|
||||||
icon={
|
icon={
|
||||||
this.hasManagers ? 'check-circle-outline' : 'alert-circle-outline'
|
this.hasManagers ? 'check-circle-outline' : 'alert-circle-outline'
|
||||||
|
@ -102,7 +115,7 @@ class ClubListItem extends React.Component<PropsType> {
|
||||||
)}
|
)}
|
||||||
style={{
|
style={{
|
||||||
height: props.height,
|
height: props.height,
|
||||||
justifyContent: 'center',
|
...styles.item,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { useTheme } from 'react-native-paper';
|
import { useTheme } from 'react-native-paper';
|
||||||
import {FlatList, Image, View} from 'react-native';
|
import { FlatList, Image, StyleSheet, View } from 'react-native';
|
||||||
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||||
import DashboardEditItem from './DashboardEditItem';
|
import DashboardEditItem from './DashboardEditItem';
|
||||||
import AnimatedAccordion from '../../Animations/AnimatedAccordion';
|
import AnimatedAccordion from '../../Animations/AnimatedAccordion';
|
||||||
|
@ -34,6 +34,13 @@ type PropsType = {
|
||||||
onPress: (service: ServiceItemType) => void;
|
onPress: (service: ServiceItemType) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
image: {
|
||||||
|
width: 40,
|
||||||
|
height: 40,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
const LIST_ITEM_HEIGHT = 64;
|
const LIST_ITEM_HEIGHT = 64;
|
||||||
|
|
||||||
function DashboardEditAccordion(props: PropsType) {
|
function DashboardEditAccordion(props: PropsType) {
|
||||||
|
@ -54,7 +61,7 @@ function DashboardEditAccordion(props: PropsType) {
|
||||||
|
|
||||||
const getItemLayout = (
|
const getItemLayout = (
|
||||||
data: Array<ServiceItemType> | null | undefined,
|
data: Array<ServiceItemType> | null | undefined,
|
||||||
index: number,
|
index: number
|
||||||
): { length: number; offset: number; index: number } => ({
|
): { length: number; offset: number; index: number } => ({
|
||||||
length: LIST_ITEM_HEIGHT,
|
length: LIST_ITEM_HEIGHT,
|
||||||
offset: LIST_ITEM_HEIGHT * index,
|
offset: LIST_ITEM_HEIGHT * index,
|
||||||
|
@ -68,13 +75,7 @@ function DashboardEditAccordion(props: PropsType) {
|
||||||
title={item.title}
|
title={item.title}
|
||||||
left={() =>
|
left={() =>
|
||||||
typeof item.image === 'number' ? (
|
typeof item.image === 'number' ? (
|
||||||
<Image
|
<Image source={item.image} style={styles.image} />
|
||||||
source={item.image}
|
|
||||||
style={{
|
|
||||||
width: 40,
|
|
||||||
height: 40,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
) : (
|
) : (
|
||||||
<MaterialCommunityIcons
|
<MaterialCommunityIcons
|
||||||
name={item.image}
|
name={item.image}
|
||||||
|
@ -82,7 +83,8 @@ function DashboardEditAccordion(props: PropsType) {
|
||||||
size={40}
|
size={40}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}>
|
}
|
||||||
|
>
|
||||||
<FlatList
|
<FlatList
|
||||||
data={item.content}
|
data={item.content}
|
||||||
extraData={props.activeDashboard.toString()}
|
extraData={props.activeDashboard.toString()}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import {Image} from 'react-native';
|
import { Image, StyleSheet } from 'react-native';
|
||||||
import { List, useTheme } from 'react-native-paper';
|
import { List, useTheme } from 'react-native-paper';
|
||||||
import type { ServiceItemType } from '../../../managers/ServicesManager';
|
import type { ServiceItemType } from '../../../managers/ServicesManager';
|
||||||
|
|
||||||
|
@ -29,9 +29,23 @@ type PropsType = {
|
||||||
onPress: () => void;
|
onPress: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
image: {
|
||||||
|
width: 40,
|
||||||
|
height: 40,
|
||||||
|
},
|
||||||
|
item: {
|
||||||
|
justifyContent: 'center',
|
||||||
|
paddingLeft: 30,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
function DashboardEditItem(props: PropsType) {
|
function DashboardEditItem(props: PropsType) {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const { item, onPress, height, isActive } = props;
|
const { item, onPress, height, isActive } = props;
|
||||||
|
const backgroundColor = isActive
|
||||||
|
? theme.colors.proxiwashFinishedColor
|
||||||
|
: 'transparent';
|
||||||
return (
|
return (
|
||||||
<List.Item
|
<List.Item
|
||||||
title={item.title}
|
title={item.title}
|
||||||
|
@ -42,10 +56,7 @@ function DashboardEditItem(props: PropsType) {
|
||||||
source={
|
source={
|
||||||
typeof item.image === 'string' ? { uri: item.image } : item.image
|
typeof item.image === 'string' ? { uri: item.image } : item.image
|
||||||
}
|
}
|
||||||
style={{
|
style={styles.image}
|
||||||
width: 40,
|
|
||||||
height: 40,
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
right={(iconProps) =>
|
right={(iconProps) =>
|
||||||
|
@ -58,12 +69,9 @@ function DashboardEditItem(props: PropsType) {
|
||||||
) : null
|
) : null
|
||||||
}
|
}
|
||||||
style={{
|
style={{
|
||||||
height,
|
...styles.image,
|
||||||
justifyContent: 'center',
|
height: height,
|
||||||
paddingLeft: 30,
|
backgroundColor: backgroundColor,
|
||||||
backgroundColor: isActive
|
|
||||||
? theme.colors.proxiwashFinishedColor
|
|
||||||
: 'transparent',
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { TouchableRipple, useTheme } from 'react-native-paper';
|
import { TouchableRipple, useTheme } from 'react-native-paper';
|
||||||
import {Dimensions, Image, View} from 'react-native';
|
import { Dimensions, Image, StyleSheet, View } from 'react-native';
|
||||||
|
|
||||||
type PropsType = {
|
type PropsType = {
|
||||||
image?: string | number;
|
image?: string | number;
|
||||||
|
@ -27,39 +27,50 @@ type PropsType = {
|
||||||
onPress: () => void;
|
onPress: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
ripple: {
|
||||||
|
marginLeft: 5,
|
||||||
|
marginRight: 5,
|
||||||
|
borderRadius: 5,
|
||||||
|
},
|
||||||
|
image: {
|
||||||
|
width: '100%',
|
||||||
|
height: '100%',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component used to render a small dashboard item
|
* Component used to render a small dashboard item
|
||||||
*/
|
*/
|
||||||
function DashboardEditPreviewItem(props: PropsType) {
|
function DashboardEditPreviewItem(props: PropsType) {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const itemSize = Dimensions.get('window').width / 8;
|
const itemSize = Dimensions.get('window').width / 8;
|
||||||
|
const backgroundColor = props.isActive
|
||||||
|
? theme.colors.textDisabled
|
||||||
|
: 'transparent';
|
||||||
return (
|
return (
|
||||||
<TouchableRipple
|
<TouchableRipple
|
||||||
onPress={props.onPress}
|
onPress={props.onPress}
|
||||||
borderless
|
borderless
|
||||||
style={{
|
style={{
|
||||||
marginLeft: 5,
|
...styles.ripple,
|
||||||
marginRight: 5,
|
backgroundColor: backgroundColor,
|
||||||
backgroundColor: props.isActive
|
}}
|
||||||
? theme.colors.textDisabled
|
>
|
||||||
: 'transparent',
|
|
||||||
borderRadius: 5,
|
|
||||||
}}>
|
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
width: itemSize,
|
width: itemSize,
|
||||||
height: itemSize,
|
height: itemSize,
|
||||||
}}>
|
}}
|
||||||
|
>
|
||||||
{props.image ? (
|
{props.image ? (
|
||||||
<Image
|
<Image
|
||||||
source={
|
source={
|
||||||
typeof props.image === 'string' ? {uri: props.image} : props.image
|
typeof props.image === 'string'
|
||||||
|
? { uri: props.image }
|
||||||
|
: props.image
|
||||||
}
|
}
|
||||||
style={{
|
style={styles.image}
|
||||||
width: '100%',
|
|
||||||
height: '100%',
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
</View>
|
</View>
|
||||||
|
|
|
@ -27,6 +27,8 @@ import {
|
||||||
getRelativeDateString,
|
getRelativeDateString,
|
||||||
isEquipmentAvailable,
|
isEquipmentAvailable,
|
||||||
} from '../../../utils/EquipmentBooking';
|
} from '../../../utils/EquipmentBooking';
|
||||||
|
import { StyleSheet } from 'react-native';
|
||||||
|
import GENERAL_STYLES from '../../../constants/Styles';
|
||||||
|
|
||||||
type PropsType = {
|
type PropsType = {
|
||||||
navigation: StackNavigationProp<any>;
|
navigation: StackNavigationProp<any>;
|
||||||
|
@ -35,6 +37,15 @@ type PropsType = {
|
||||||
height: number;
|
height: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
icon: {
|
||||||
|
backgroundColor: 'transparent',
|
||||||
|
},
|
||||||
|
item: {
|
||||||
|
justifyContent: 'center',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
function EquipmentListItem(props: PropsType) {
|
function EquipmentListItem(props: PropsType) {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const { item, userDeviceRentDates, navigation, height } = props;
|
const { item, userDeviceRentDates, navigation, height } = props;
|
||||||
|
@ -101,21 +112,12 @@ function EquipmentListItem(props: PropsType) {
|
||||||
title={item.name}
|
title={item.name}
|
||||||
description={description}
|
description={description}
|
||||||
onPress={onPress}
|
onPress={onPress}
|
||||||
left={() => (
|
left={() => <Avatar.Icon style={styles.icon} icon={icon} color={color} />}
|
||||||
<Avatar.Icon
|
|
||||||
style={{
|
|
||||||
backgroundColor: 'transparent',
|
|
||||||
}}
|
|
||||||
icon={icon}
|
|
||||||
color={color}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
right={() => (
|
right={() => (
|
||||||
<Avatar.Icon
|
<Avatar.Icon
|
||||||
style={{
|
style={{
|
||||||
marginTop: 'auto',
|
...GENERAL_STYLES.centerVertical,
|
||||||
marginBottom: 'auto',
|
...styles.icon,
|
||||||
backgroundColor: 'transparent',
|
|
||||||
}}
|
}}
|
||||||
size={48}
|
size={48}
|
||||||
icon="chevron-right"
|
icon="chevron-right"
|
||||||
|
@ -123,7 +125,7 @@ function EquipmentListItem(props: PropsType) {
|
||||||
)}
|
)}
|
||||||
style={{
|
style={{
|
||||||
height,
|
height,
|
||||||
justifyContent: 'center',
|
...styles.item,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { List, withTheme } from 'react-native-paper';
|
import { List, withTheme } from 'react-native-paper';
|
||||||
import {FlatList, View} from 'react-native';
|
import { FlatList, StyleSheet, View } from 'react-native';
|
||||||
import { stringMatchQuery } from '../../../utils/Search';
|
import { stringMatchQuery } from '../../../utils/Search';
|
||||||
import GroupListItem from './GroupListItem';
|
import GroupListItem from './GroupListItem';
|
||||||
import AnimatedAccordion from '../../Animations/AnimatedAccordion';
|
import AnimatedAccordion from '../../Animations/AnimatedAccordion';
|
||||||
|
@ -40,6 +40,12 @@ type PropsType = {
|
||||||
const LIST_ITEM_HEIGHT = 64;
|
const LIST_ITEM_HEIGHT = 64;
|
||||||
const REPLACE_REGEX = /_/g;
|
const REPLACE_REGEX = /_/g;
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
container: {
|
||||||
|
justifyContent: 'center',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
class GroupListAccordion extends React.Component<PropsType> {
|
class GroupListAccordion extends React.Component<PropsType> {
|
||||||
shouldComponentUpdate(nextProps: PropsType): boolean {
|
shouldComponentUpdate(nextProps: PropsType): boolean {
|
||||||
const { props } = this;
|
const { props } = this;
|
||||||
|
@ -83,7 +89,7 @@ class GroupListAccordion extends React.Component<PropsType> {
|
||||||
|
|
||||||
itemLayout = (
|
itemLayout = (
|
||||||
data: Array<PlanexGroupType> | null | undefined,
|
data: Array<PlanexGroupType> | null | undefined,
|
||||||
index: number,
|
index: number
|
||||||
): { length: number; offset: number; index: number } => ({
|
): { length: number; offset: number; index: number } => ({
|
||||||
length: LIST_ITEM_HEIGHT,
|
length: LIST_ITEM_HEIGHT,
|
||||||
offset: LIST_ITEM_HEIGHT * index,
|
offset: LIST_ITEM_HEIGHT * index,
|
||||||
|
@ -99,9 +105,7 @@ class GroupListAccordion extends React.Component<PropsType> {
|
||||||
<View>
|
<View>
|
||||||
<AnimatedAccordion
|
<AnimatedAccordion
|
||||||
title={item.name.replace(REPLACE_REGEX, ' ')}
|
title={item.name.replace(REPLACE_REGEX, ' ')}
|
||||||
style={{
|
style={styles.container}
|
||||||
justifyContent: 'center',
|
|
||||||
}}
|
|
||||||
left={(iconProps) =>
|
left={(iconProps) =>
|
||||||
item.id === 0 ? (
|
item.id === 0 ? (
|
||||||
<List.Icon
|
<List.Icon
|
||||||
|
@ -112,7 +116,8 @@ class GroupListAccordion extends React.Component<PropsType> {
|
||||||
) : null
|
) : null
|
||||||
}
|
}
|
||||||
unmountWhenCollapsed={item.id !== 0} // Only render list if expanded for increased performance
|
unmountWhenCollapsed={item.id !== 0} // Only render list if expanded for increased performance
|
||||||
opened={props.currentSearchString.length > 0}>
|
opened={props.currentSearchString.length > 0}
|
||||||
|
>
|
||||||
<FlatList
|
<FlatList
|
||||||
data={this.getData()}
|
data={this.getData()}
|
||||||
extraData={props.currentSearchString + props.favorites.length}
|
extraData={props.currentSearchString + props.favorites.length}
|
||||||
|
|
|
@ -22,7 +22,7 @@ import {List, TouchableRipple, withTheme} from 'react-native-paper';
|
||||||
import * as Animatable from 'react-native-animatable';
|
import * as Animatable from 'react-native-animatable';
|
||||||
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||||
import type { PlanexGroupType } from '../../../screens/Planex/GroupSelectionScreen';
|
import type { PlanexGroupType } from '../../../screens/Planex/GroupSelectionScreen';
|
||||||
import {View} from 'react-native';
|
import { StyleSheet, View } from 'react-native';
|
||||||
import { getPrettierPlanexGroupName } from '../../../utils/Utils';
|
import { getPrettierPlanexGroupName } from '../../../utils/Utils';
|
||||||
|
|
||||||
type PropsType = {
|
type PropsType = {
|
||||||
|
@ -34,6 +34,21 @@ type PropsType = {
|
||||||
height: number;
|
height: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
item: {
|
||||||
|
justifyContent: 'center',
|
||||||
|
},
|
||||||
|
icon: {
|
||||||
|
padding: 10,
|
||||||
|
},
|
||||||
|
iconContainer: {
|
||||||
|
marginRight: 10,
|
||||||
|
marginLeft: 'auto',
|
||||||
|
marginTop: 'auto',
|
||||||
|
marginBottom: 'auto',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
class GroupListItem extends React.Component<PropsType> {
|
class GroupListItem extends React.Component<PropsType> {
|
||||||
isFav: boolean;
|
isFav: boolean;
|
||||||
|
|
||||||
|
@ -98,15 +113,11 @@ class GroupListItem extends React.Component<PropsType> {
|
||||||
<Animatable.View ref={this.starRef} useNativeDriver>
|
<Animatable.View ref={this.starRef} useNativeDriver>
|
||||||
<TouchableRipple
|
<TouchableRipple
|
||||||
onPress={this.onStarPress}
|
onPress={this.onStarPress}
|
||||||
style={{
|
style={styles.iconContainer}
|
||||||
marginRight: 10,
|
>
|
||||||
marginLeft: 'auto',
|
|
||||||
marginTop: 'auto',
|
|
||||||
marginBottom: 'auto',
|
|
||||||
}}>
|
|
||||||
<MaterialCommunityIcons
|
<MaterialCommunityIcons
|
||||||
size={30}
|
size={30}
|
||||||
style={{padding: 10}}
|
style={styles.icon}
|
||||||
name="star"
|
name="star"
|
||||||
color={this.isFav ? colors.tetrisScore : iconProps.color}
|
color={this.isFav ? colors.tetrisScore : iconProps.color}
|
||||||
/>
|
/>
|
||||||
|
@ -115,7 +126,7 @@ class GroupListItem extends React.Component<PropsType> {
|
||||||
)}
|
)}
|
||||||
style={{
|
style={{
|
||||||
height: props.height,
|
height: props.height,
|
||||||
justifyContent: 'center',
|
...styles.item,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
|
@ -21,6 +21,7 @@ import * as React from 'react';
|
||||||
import { Avatar, List, Text } from 'react-native-paper';
|
import { Avatar, List, Text } from 'react-native-paper';
|
||||||
import i18n from 'i18n-js';
|
import i18n from 'i18n-js';
|
||||||
import type { ProximoArticleType } from '../../../screens/Services/Proximo/ProximoMainScreen';
|
import type { ProximoArticleType } from '../../../screens/Services/Proximo/ProximoMainScreen';
|
||||||
|
import { StyleSheet } from 'react-native';
|
||||||
|
|
||||||
type PropsType = {
|
type PropsType = {
|
||||||
onPress: () => void;
|
onPress: () => void;
|
||||||
|
@ -29,28 +30,38 @@ type PropsType = {
|
||||||
height: number;
|
height: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
avatar: {
|
||||||
|
backgroundColor: 'transparent',
|
||||||
|
},
|
||||||
|
text: {
|
||||||
|
fontWeight: 'bold',
|
||||||
|
},
|
||||||
|
item: {
|
||||||
|
justifyContent: 'center',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
function ProximoListItem(props: PropsType) {
|
function ProximoListItem(props: PropsType) {
|
||||||
return (
|
return (
|
||||||
<List.Item
|
<List.Item
|
||||||
title={props.item.name}
|
title={props.item.name}
|
||||||
description={`${props.item.quantity} ${i18n.t(
|
description={`${props.item.quantity} ${i18n.t(
|
||||||
'screens.proximo.inStock',
|
'screens.proximo.inStock'
|
||||||
)}`}
|
)}`}
|
||||||
descriptionStyle={{ color: props.color }}
|
descriptionStyle={{ color: props.color }}
|
||||||
onPress={props.onPress}
|
onPress={props.onPress}
|
||||||
left={() => (
|
left={() => (
|
||||||
<Avatar.Image
|
<Avatar.Image
|
||||||
style={{backgroundColor: 'transparent'}}
|
style={styles.avatar}
|
||||||
size={64}
|
size={64}
|
||||||
source={{ uri: props.item.image }}
|
source={{ uri: props.item.image }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
right={() => (
|
right={() => <Text style={styles.text}>{props.item.price}€</Text>}
|
||||||
<Text style={{fontWeight: 'bold'}}>{props.item.price}€</Text>
|
|
||||||
)}
|
|
||||||
style={{
|
style={{
|
||||||
height: props.height,
|
height: props.height,
|
||||||
justifyContent: 'center',
|
...styles.item,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
|
@ -42,7 +42,7 @@ type PropsType = {
|
||||||
onPress: (
|
onPress: (
|
||||||
title: string,
|
title: string,
|
||||||
item: ProxiwashMachineType,
|
item: ProxiwashMachineType,
|
||||||
isDryer: boolean,
|
isDryer: boolean
|
||||||
) => void;
|
) => void;
|
||||||
isWatched: boolean;
|
isWatched: boolean;
|
||||||
isDryer: boolean;
|
isDryer: boolean;
|
||||||
|
@ -56,6 +56,7 @@ const styles = StyleSheet.create({
|
||||||
margin: 5,
|
margin: 5,
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
elevation: 1,
|
elevation: 1,
|
||||||
|
borderRadius: 4,
|
||||||
},
|
},
|
||||||
icon: {
|
icon: {
|
||||||
backgroundColor: 'transparent',
|
backgroundColor: 'transparent',
|
||||||
|
@ -65,6 +66,18 @@ const styles = StyleSheet.create({
|
||||||
left: 0,
|
left: 0,
|
||||||
borderRadius: 4,
|
borderRadius: 4,
|
||||||
},
|
},
|
||||||
|
item: {
|
||||||
|
justifyContent: 'center',
|
||||||
|
},
|
||||||
|
text: {
|
||||||
|
fontWeight: 'bold',
|
||||||
|
},
|
||||||
|
textRow: {
|
||||||
|
flexDirection: 'row',
|
||||||
|
},
|
||||||
|
textContainer: {
|
||||||
|
justifyContent: 'center',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -75,7 +88,7 @@ class ProxiwashListItem extends React.Component<PropsType> {
|
||||||
[MachineStates.AVAILABLE]: i18n.t('screens.proxiwash.states.ready'),
|
[MachineStates.AVAILABLE]: i18n.t('screens.proxiwash.states.ready'),
|
||||||
[MachineStates.RUNNING]: i18n.t('screens.proxiwash.states.running'),
|
[MachineStates.RUNNING]: i18n.t('screens.proxiwash.states.running'),
|
||||||
[MachineStates.RUNNING_NOT_STARTED]: i18n.t(
|
[MachineStates.RUNNING_NOT_STARTED]: i18n.t(
|
||||||
'screens.proxiwash.states.runningNotStarted',
|
'screens.proxiwash.states.runningNotStarted'
|
||||||
),
|
),
|
||||||
[MachineStates.FINISHED]: i18n.t('screens.proxiwash.states.finished'),
|
[MachineStates.FINISHED]: i18n.t('screens.proxiwash.states.finished'),
|
||||||
[MachineStates.UNAVAILABLE]: i18n.t('screens.proxiwash.states.broken'),
|
[MachineStates.UNAVAILABLE]: i18n.t('screens.proxiwash.states.broken'),
|
||||||
|
@ -97,7 +110,7 @@ class ProxiwashListItem extends React.Component<PropsType> {
|
||||||
const displayMaxWeight = props.item.maxWeight;
|
const displayMaxWeight = props.item.maxWeight;
|
||||||
if (AprilFoolsManager.getInstance().isAprilFoolsEnabled()) {
|
if (AprilFoolsManager.getInstance().isAprilFoolsEnabled()) {
|
||||||
displayNumber = AprilFoolsManager.getProxiwashMachineDisplayNumber(
|
displayNumber = AprilFoolsManager.getProxiwashMachineDisplayNumber(
|
||||||
parseInt(props.item.number, 10),
|
parseInt(props.item.number, 10)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,8 +197,8 @@ class ProxiwashListItem extends React.Component<PropsType> {
|
||||||
style={{
|
style={{
|
||||||
...styles.container,
|
...styles.container,
|
||||||
height: props.height,
|
height: props.height,
|
||||||
borderRadius: 4,
|
}}
|
||||||
}}>
|
>
|
||||||
{!isReady ? (
|
{!isReady ? (
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
style={{
|
style={{
|
||||||
|
@ -201,26 +214,27 @@ class ProxiwashListItem extends React.Component<PropsType> {
|
||||||
description={description}
|
description={description}
|
||||||
style={{
|
style={{
|
||||||
height: props.height,
|
height: props.height,
|
||||||
justifyContent: 'center',
|
...styles.item,
|
||||||
}}
|
}}
|
||||||
onPress={this.onListItemPress}
|
onPress={this.onListItemPress}
|
||||||
left={() => icon}
|
left={() => icon}
|
||||||
right={() => (
|
right={() => (
|
||||||
<View style={{flexDirection: 'row'}}>
|
<View style={styles.textRow}>
|
||||||
<View style={{justifyContent: 'center'}}>
|
<View style={styles.textContainer}>
|
||||||
<Text
|
<Text
|
||||||
style={
|
style={
|
||||||
machineState === MachineStates.FINISHED
|
machineState === MachineStates.FINISHED
|
||||||
? {fontWeight: 'bold'}
|
? styles.text
|
||||||
: {}
|
: undefined
|
||||||
}>
|
}
|
||||||
|
>
|
||||||
{stateString}
|
{stateString}
|
||||||
</Text>
|
</Text>
|
||||||
{machineState === MachineStates.RUNNING ? (
|
{machineState === MachineStates.RUNNING ? (
|
||||||
<Caption>{props.item.remainingTime} min</Caption>
|
<Caption>{props.item.remainingTime} min</Caption>
|
||||||
) : null}
|
) : null}
|
||||||
</View>
|
</View>
|
||||||
<View style={{justifyContent: 'center'}}>
|
<View style={styles.textContainer}>
|
||||||
<Avatar.Icon
|
<Avatar.Icon
|
||||||
icon={stateIcon}
|
icon={stateIcon}
|
||||||
color={colors.text}
|
color={colors.text}
|
||||||
|
|
|
@ -44,6 +44,9 @@ const styles = StyleSheet.create({
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
},
|
},
|
||||||
|
textContainer: {
|
||||||
|
justifyContent: 'center',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -76,7 +79,7 @@ class ProxiwashListItem extends React.Component<PropsType> {
|
||||||
color={iconColor}
|
color={iconColor}
|
||||||
style={styles.icon}
|
style={styles.icon}
|
||||||
/>
|
/>
|
||||||
<View style={{justifyContent: 'center'}}>
|
<View style={styles.textContainer}>
|
||||||
<Text style={styles.text}>{props.title}</Text>
|
<Text style={styles.text}>{props.title}</Text>
|
||||||
<Text style={{ color: props.theme.colors.subtitle }}>{subtitle}</Text>
|
<Text style={{ color: props.theme.colors.subtitle }}>{subtitle}</Text>
|
||||||
</View>
|
</View>
|
||||||
|
|
|
@ -19,7 +19,13 @@
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import * as Animatable from 'react-native-animatable';
|
import * as Animatable from 'react-native-animatable';
|
||||||
import {Image, TouchableWithoutFeedback, View, ViewStyle} from 'react-native';
|
import {
|
||||||
|
Image,
|
||||||
|
StyleSheet,
|
||||||
|
TouchableWithoutFeedback,
|
||||||
|
View,
|
||||||
|
ViewStyle,
|
||||||
|
} from 'react-native';
|
||||||
import { AnimatableProperties } from 'react-native-animatable';
|
import { AnimatableProperties } from 'react-native-animatable';
|
||||||
|
|
||||||
export type AnimatableViewRefType = {
|
export type AnimatableViewRefType = {
|
||||||
|
@ -77,6 +83,34 @@ export enum MASCOT_STYLE {
|
||||||
RANDOM = 999,
|
RANDOM = 999,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
container: {
|
||||||
|
aspectRatio: 1,
|
||||||
|
},
|
||||||
|
mascot: {
|
||||||
|
width: '100%',
|
||||||
|
height: '100%',
|
||||||
|
},
|
||||||
|
glassesImage: {
|
||||||
|
position: 'absolute',
|
||||||
|
top: '15%',
|
||||||
|
left: 0,
|
||||||
|
width: '100%',
|
||||||
|
height: '100%',
|
||||||
|
},
|
||||||
|
eyesImage: {
|
||||||
|
position: 'absolute',
|
||||||
|
top: '15%',
|
||||||
|
width: '100%',
|
||||||
|
height: '100%',
|
||||||
|
},
|
||||||
|
eyesContainer: {
|
||||||
|
position: 'absolute',
|
||||||
|
width: '100%',
|
||||||
|
height: '100%',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
class Mascot extends React.Component<PropsType, StateType> {
|
class Mascot extends React.Component<PropsType, StateType> {
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
emotion: MASCOT_STYLE.NORMAL,
|
emotion: MASCOT_STYLE.NORMAL,
|
||||||
|
@ -174,29 +208,21 @@ class Mascot extends React.Component<PropsType, StateType> {
|
||||||
source={
|
source={
|
||||||
glasses != null ? glasses : this.glassesList[GLASSES_STYLE.NORMAL]
|
glasses != null ? glasses : this.glassesList[GLASSES_STYLE.NORMAL]
|
||||||
}
|
}
|
||||||
style={{
|
style={styles.glassesImage}
|
||||||
position: 'absolute',
|
|
||||||
top: '15%',
|
|
||||||
left: 0,
|
|
||||||
width: '100%',
|
|
||||||
height: '100%',
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
getEye(style: EYE_STYLE, isRight: boolean, rotation: string = '0deg') {
|
getEye(style: EYE_STYLE, isRight: boolean, rotation: string = '0deg') {
|
||||||
const eye = this.eyeList[style];
|
const eye = this.eyeList[style];
|
||||||
|
const left = isRight ? '-11%' : '11%';
|
||||||
return (
|
return (
|
||||||
<Image
|
<Image
|
||||||
key={isRight ? 'right' : 'left'}
|
key={isRight ? 'right' : 'left'}
|
||||||
source={eye != null ? eye : this.eyeList[EYE_STYLE.NORMAL]}
|
source={eye != null ? eye : this.eyeList[EYE_STYLE.NORMAL]}
|
||||||
style={{
|
style={{
|
||||||
position: 'absolute',
|
...styles.eyesImage,
|
||||||
top: '15%',
|
left: left,
|
||||||
left: isRight ? '-11%' : '11%',
|
|
||||||
width: '100%',
|
|
||||||
height: '100%',
|
|
||||||
transform: [{ rotateY: rotation }],
|
transform: [{ rotateY: rotation }],
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
@ -205,16 +231,7 @@ class Mascot extends React.Component<PropsType, StateType> {
|
||||||
|
|
||||||
getEyes(emotion: MASCOT_STYLE) {
|
getEyes(emotion: MASCOT_STYLE) {
|
||||||
const final = [];
|
const final = [];
|
||||||
final.push(
|
final.push(<View key="container" style={styles.eyesContainer} />);
|
||||||
<View
|
|
||||||
key="container"
|
|
||||||
style={{
|
|
||||||
position: 'absolute',
|
|
||||||
width: '100%',
|
|
||||||
height: '100%',
|
|
||||||
}}
|
|
||||||
/>,
|
|
||||||
);
|
|
||||||
if (emotion === MASCOT_STYLE.CUTE) {
|
if (emotion === MASCOT_STYLE.CUTE) {
|
||||||
final.push(this.getEye(EYE_STYLE.CUTE, true));
|
final.push(this.getEye(EYE_STYLE.CUTE, true));
|
||||||
final.push(this.getEye(EYE_STYLE.CUTE, false));
|
final.push(this.getEye(EYE_STYLE.CUTE, false));
|
||||||
|
@ -255,26 +272,22 @@ class Mascot extends React.Component<PropsType, StateType> {
|
||||||
return (
|
return (
|
||||||
<Animatable.View
|
<Animatable.View
|
||||||
style={{
|
style={{
|
||||||
aspectRatio: 1,
|
...styles.container,
|
||||||
...props.style,
|
...props.style,
|
||||||
}}
|
}}
|
||||||
{...entryAnimation}>
|
{...entryAnimation}
|
||||||
|
>
|
||||||
<TouchableWithoutFeedback
|
<TouchableWithoutFeedback
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
this.onPress(this.viewRef);
|
this.onPress(this.viewRef);
|
||||||
}}
|
}}
|
||||||
onLongPress={() => {
|
onLongPress={() => {
|
||||||
this.onLongPress(this.viewRef);
|
this.onLongPress(this.viewRef);
|
||||||
}}>
|
}}
|
||||||
|
>
|
||||||
<Animatable.View ref={this.viewRef}>
|
<Animatable.View ref={this.viewRef}>
|
||||||
<Animatable.View {...loopAnimation}>
|
<Animatable.View {...loopAnimation}>
|
||||||
<Image
|
<Image source={MASCOT_IMAGE} style={styles.mascot} />
|
||||||
source={MASCOT_IMAGE}
|
|
||||||
style={{
|
|
||||||
width: '100%',
|
|
||||||
height: '100%',
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
{this.getEyes(state.currentEmotion)}
|
{this.getEyes(state.currentEmotion)}
|
||||||
</Animatable.View>
|
</Animatable.View>
|
||||||
</Animatable.View>
|
</Animatable.View>
|
||||||
|
|
|
@ -31,12 +31,14 @@ import {
|
||||||
BackHandler,
|
BackHandler,
|
||||||
Dimensions,
|
Dimensions,
|
||||||
ScrollView,
|
ScrollView,
|
||||||
|
StyleSheet,
|
||||||
TouchableWithoutFeedback,
|
TouchableWithoutFeedback,
|
||||||
View,
|
View,
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import Mascot from './Mascot';
|
import Mascot from './Mascot';
|
||||||
import SpeechArrow from './SpeechArrow';
|
import SpeechArrow from './SpeechArrow';
|
||||||
import AsyncStorageManager from '../../managers/AsyncStorageManager';
|
import AsyncStorageManager from '../../managers/AsyncStorageManager';
|
||||||
|
import GENERAL_STYLES from '../../constants/Styles';
|
||||||
|
|
||||||
type PropsType = {
|
type PropsType = {
|
||||||
theme: ReactNativePaper.Theme;
|
theme: ReactNativePaper.Theme;
|
||||||
|
@ -67,6 +69,41 @@ type StateType = {
|
||||||
dialogVisible: boolean;
|
dialogVisible: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
speechBubbleContainer: {
|
||||||
|
marginLeft: '10%',
|
||||||
|
marginRight: '10%',
|
||||||
|
},
|
||||||
|
speechBubbleCard: {
|
||||||
|
borderWidth: 4,
|
||||||
|
borderRadius: 10,
|
||||||
|
},
|
||||||
|
speechBubbleIcon: {
|
||||||
|
backgroundColor: 'transparent',
|
||||||
|
},
|
||||||
|
speechBubbleText: {
|
||||||
|
marginBottom: 10,
|
||||||
|
},
|
||||||
|
actionsContainer: {
|
||||||
|
marginTop: 10,
|
||||||
|
marginBottom: 10,
|
||||||
|
},
|
||||||
|
button: {
|
||||||
|
...GENERAL_STYLES.centerHorizontal,
|
||||||
|
marginBottom: 10,
|
||||||
|
},
|
||||||
|
background: {
|
||||||
|
position: 'absolute',
|
||||||
|
backgroundColor: 'rgba(0,0,0,0.7)',
|
||||||
|
width: '100%',
|
||||||
|
height: '100%',
|
||||||
|
},
|
||||||
|
container: {
|
||||||
|
marginTop: -80,
|
||||||
|
width: '100%',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component used to display a popup with the mascot.
|
* Component used to display a popup with the mascot.
|
||||||
*/
|
*/
|
||||||
|
@ -107,11 +144,12 @@ class MascotPopup extends React.Component<PropsType, StateType> {
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
BackHandler.addEventListener(
|
BackHandler.addEventListener(
|
||||||
'hardwareBackPress',
|
'hardwareBackPress',
|
||||||
this.onBackButtonPressAndroid,
|
this.onBackButtonPressAndroid
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
shouldComponentUpdate(nextProps: PropsType, nextState: StateType): boolean {
|
shouldComponentUpdate(nextProps: PropsType, nextState: StateType): boolean {
|
||||||
|
// TODO this is so dirty it shouldn't even work
|
||||||
const { props, state } = this;
|
const { props, state } = this;
|
||||||
if (nextProps.visible) {
|
if (nextProps.visible) {
|
||||||
this.state.shouldRenderDialog = true;
|
this.state.shouldRenderDialog = true;
|
||||||
|
@ -155,13 +193,11 @@ class MascotPopup extends React.Component<PropsType, StateType> {
|
||||||
const { state, props } = this;
|
const { state, props } = this;
|
||||||
return (
|
return (
|
||||||
<Animatable.View
|
<Animatable.View
|
||||||
style={{
|
style={styles.speechBubbleContainer}
|
||||||
marginLeft: '10%',
|
|
||||||
marginRight: '10%',
|
|
||||||
}}
|
|
||||||
useNativeDriver
|
useNativeDriver
|
||||||
animation={state.dialogVisible ? 'bounceInLeft' : 'bounceOutLeft'}
|
animation={state.dialogVisible ? 'bounceInLeft' : 'bounceOutLeft'}
|
||||||
duration={state.dialogVisible ? 1000 : 300}>
|
duration={state.dialogVisible ? 1000 : 300}
|
||||||
|
>
|
||||||
<SpeechArrow
|
<SpeechArrow
|
||||||
style={{ marginLeft: this.mascotSize / 3 }}
|
style={{ marginLeft: this.mascotSize / 3 }}
|
||||||
size={20}
|
size={20}
|
||||||
|
@ -170,9 +206,9 @@ class MascotPopup extends React.Component<PropsType, StateType> {
|
||||||
<Card
|
<Card
|
||||||
style={{
|
style={{
|
||||||
borderColor: props.theme.colors.mascotMessageArrow,
|
borderColor: props.theme.colors.mascotMessageArrow,
|
||||||
borderWidth: 4,
|
...styles.speechBubbleCard,
|
||||||
borderRadius: 10,
|
}}
|
||||||
}}>
|
>
|
||||||
<Card.Title
|
<Card.Title
|
||||||
title={props.title}
|
title={props.title}
|
||||||
left={
|
left={
|
||||||
|
@ -180,7 +216,7 @@ class MascotPopup extends React.Component<PropsType, StateType> {
|
||||||
? () => (
|
? () => (
|
||||||
<Avatar.Icon
|
<Avatar.Icon
|
||||||
size={48}
|
size={48}
|
||||||
style={{backgroundColor: 'transparent'}}
|
style={styles.speechBubbleIcon}
|
||||||
color={props.theme.colors.primary}
|
color={props.theme.colors.primary}
|
||||||
icon={props.icon}
|
icon={props.icon}
|
||||||
/>
|
/>
|
||||||
|
@ -191,13 +227,16 @@ class MascotPopup extends React.Component<PropsType, StateType> {
|
||||||
<Card.Content
|
<Card.Content
|
||||||
style={{
|
style={{
|
||||||
maxHeight: this.windowHeight / 3,
|
maxHeight: this.windowHeight / 3,
|
||||||
}}>
|
}}
|
||||||
|
>
|
||||||
<ScrollView>
|
<ScrollView>
|
||||||
<Paragraph style={{marginBottom: 10}}>{props.message}</Paragraph>
|
<Paragraph style={styles.speechBubbleText}>
|
||||||
|
{props.message}
|
||||||
|
</Paragraph>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</Card.Content>
|
</Card.Content>
|
||||||
|
|
||||||
<Card.Actions style={{marginTop: 10, marginBottom: 10}}>
|
<Card.Actions style={styles.actionsContainer}>
|
||||||
{this.getButtons()}
|
{this.getButtons()}
|
||||||
</Card.Actions>
|
</Card.Actions>
|
||||||
</Card>
|
</Card>
|
||||||
|
@ -211,7 +250,8 @@ class MascotPopup extends React.Component<PropsType, StateType> {
|
||||||
<Animatable.View
|
<Animatable.View
|
||||||
useNativeDriver
|
useNativeDriver
|
||||||
animation={state.dialogVisible ? 'bounceInLeft' : 'bounceOutLeft'}
|
animation={state.dialogVisible ? 'bounceInLeft' : 'bounceOutLeft'}
|
||||||
duration={state.dialogVisible ? 1500 : 200}>
|
duration={state.dialogVisible ? 1500 : 200}
|
||||||
|
>
|
||||||
<Mascot
|
<Mascot
|
||||||
style={{ width: this.mascotSize }}
|
style={{ width: this.mascotSize }}
|
||||||
animated
|
animated
|
||||||
|
@ -226,41 +266,30 @@ class MascotPopup extends React.Component<PropsType, StateType> {
|
||||||
const { action } = props.buttons;
|
const { action } = props.buttons;
|
||||||
const { cancel } = props.buttons;
|
const { cancel } = props.buttons;
|
||||||
return (
|
return (
|
||||||
<View
|
<View style={GENERAL_STYLES.center}>
|
||||||
style={{
|
|
||||||
marginLeft: 'auto',
|
|
||||||
marginRight: 'auto',
|
|
||||||
marginTop: 'auto',
|
|
||||||
marginBottom: 'auto',
|
|
||||||
}}>
|
|
||||||
{action != null ? (
|
{action != null ? (
|
||||||
<Button
|
<Button
|
||||||
style={{
|
style={styles.button}
|
||||||
marginLeft: 'auto',
|
|
||||||
marginRight: 'auto',
|
|
||||||
marginBottom: 10,
|
|
||||||
}}
|
|
||||||
mode="contained"
|
mode="contained"
|
||||||
icon={action.icon}
|
icon={action.icon}
|
||||||
color={action.color}
|
color={action.color}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
this.onDismiss(action.onPress);
|
this.onDismiss(action.onPress);
|
||||||
}}>
|
}}
|
||||||
|
>
|
||||||
{action.message}
|
{action.message}
|
||||||
</Button>
|
</Button>
|
||||||
) : null}
|
) : null}
|
||||||
{cancel != null ? (
|
{cancel != null ? (
|
||||||
<Button
|
<Button
|
||||||
style={{
|
style={styles.button}
|
||||||
marginLeft: 'auto',
|
|
||||||
marginRight: 'auto',
|
|
||||||
}}
|
|
||||||
mode="contained"
|
mode="contained"
|
||||||
icon={cancel.icon}
|
icon={cancel.icon}
|
||||||
color={cancel.color}
|
color={cancel.color}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
this.onDismiss(cancel.onPress);
|
this.onDismiss(cancel.onPress);
|
||||||
}}>
|
}}
|
||||||
|
>
|
||||||
{cancel.message}
|
{cancel.message}
|
||||||
</Button>
|
</Button>
|
||||||
) : null}
|
) : null}
|
||||||
|
@ -274,14 +303,10 @@ class MascotPopup extends React.Component<PropsType, StateType> {
|
||||||
<TouchableWithoutFeedback
|
<TouchableWithoutFeedback
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
this.onDismiss(props.buttons.cancel?.onPress);
|
this.onDismiss(props.buttons.cancel?.onPress);
|
||||||
}}>
|
|
||||||
<Animatable.View
|
|
||||||
style={{
|
|
||||||
position: 'absolute',
|
|
||||||
backgroundColor: 'rgba(0,0,0,0.7)',
|
|
||||||
width: '100%',
|
|
||||||
height: '100%',
|
|
||||||
}}
|
}}
|
||||||
|
>
|
||||||
|
<Animatable.View
|
||||||
|
style={styles.background}
|
||||||
useNativeDriver
|
useNativeDriver
|
||||||
animation={state.dialogVisible ? 'fadeIn' : 'fadeOut'}
|
animation={state.dialogVisible ? 'fadeIn' : 'fadeOut'}
|
||||||
duration={state.dialogVisible ? 300 : 300}
|
duration={state.dialogVisible ? 300 : 300}
|
||||||
|
@ -307,16 +332,8 @@ class MascotPopup extends React.Component<PropsType, StateType> {
|
||||||
return (
|
return (
|
||||||
<Portal>
|
<Portal>
|
||||||
{this.getBackground()}
|
{this.getBackground()}
|
||||||
<View
|
<View style={GENERAL_STYLES.centerVertical}>
|
||||||
style={{
|
<View style={styles.container}>
|
||||||
marginTop: 'auto',
|
|
||||||
marginBottom: 'auto',
|
|
||||||
}}>
|
|
||||||
<View
|
|
||||||
style={{
|
|
||||||
marginTop: -80,
|
|
||||||
width: '100%',
|
|
||||||
}}>
|
|
||||||
{this.getMascot()}
|
{this.getMascot()}
|
||||||
{this.getSpeechBubble()}
|
{this.getSpeechBubble()}
|
||||||
</View>
|
</View>
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import {View, ViewStyle} from 'react-native';
|
import { StyleSheet, View, ViewStyle } from 'react-native';
|
||||||
|
|
||||||
type PropsType = {
|
type PropsType = {
|
||||||
style?: ViewStyle;
|
style?: ViewStyle;
|
||||||
|
@ -26,20 +26,26 @@ type PropsType = {
|
||||||
color: string;
|
color: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
arrow: {
|
||||||
|
width: 0,
|
||||||
|
height: 0,
|
||||||
|
borderLeftWidth: 0,
|
||||||
|
borderStyle: 'solid',
|
||||||
|
backgroundColor: 'transparent',
|
||||||
|
borderLeftColor: 'transparent',
|
||||||
|
borderRightColor: 'transparent',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
export default function SpeechArrow(props: PropsType) {
|
export default function SpeechArrow(props: PropsType) {
|
||||||
return (
|
return (
|
||||||
<View style={props.style}>
|
<View style={props.style}>
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
width: 0,
|
...styles.arrow,
|
||||||
height: 0,
|
|
||||||
borderLeftWidth: 0,
|
|
||||||
borderRightWidth: props.size,
|
borderRightWidth: props.size,
|
||||||
borderBottomWidth: props.size,
|
borderBottomWidth: props.size,
|
||||||
borderStyle: 'solid',
|
|
||||||
backgroundColor: 'transparent',
|
|
||||||
borderLeftColor: 'transparent',
|
|
||||||
borderRightColor: 'transparent',
|
|
||||||
borderBottomColor: props.color,
|
borderBottomColor: props.color,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -21,13 +21,20 @@ import * as React from 'react';
|
||||||
import { TouchableRipple } from 'react-native-paper';
|
import { TouchableRipple } from 'react-native-paper';
|
||||||
import { Image } from 'react-native-animatable';
|
import { Image } from 'react-native-animatable';
|
||||||
import { useNavigation } from '@react-navigation/native';
|
import { useNavigation } from '@react-navigation/native';
|
||||||
import {ViewStyle} from 'react-native';
|
import { StyleSheet, ViewStyle } from 'react-native';
|
||||||
|
|
||||||
type PropsType = {
|
type PropsType = {
|
||||||
images: Array<{ url: string }>;
|
images: Array<{ url: string }>;
|
||||||
style: ViewStyle;
|
style: ViewStyle;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
image: {
|
||||||
|
width: '100%',
|
||||||
|
height: '100%',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
function ImageGalleryButton(props: PropsType) {
|
function ImageGalleryButton(props: PropsType) {
|
||||||
const navigation = useNavigation();
|
const navigation = useNavigation();
|
||||||
|
|
||||||
|
@ -40,10 +47,7 @@ function ImageGalleryButton(props: PropsType) {
|
||||||
<Image
|
<Image
|
||||||
resizeMode="contain"
|
resizeMode="contain"
|
||||||
source={{ uri: props.images[0].url }}
|
source={{ uri: props.images[0].url }}
|
||||||
style={{
|
style={styles.image}
|
||||||
width: '100%',
|
|
||||||
height: '100%',
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
</TouchableRipple>
|
</TouchableRipple>
|
||||||
);
|
);
|
||||||
|
|
|
@ -21,6 +21,7 @@ import * as React from 'react';
|
||||||
import { View } from 'react-native';
|
import { View } from 'react-native';
|
||||||
import { useTheme } from 'react-native-paper';
|
import { useTheme } from 'react-native-paper';
|
||||||
import { Agenda, AgendaProps } from 'react-native-calendars';
|
import { Agenda, AgendaProps } from 'react-native-calendars';
|
||||||
|
import GENERAL_STYLES from '../../constants/Styles';
|
||||||
|
|
||||||
type PropsType = {
|
type PropsType = {
|
||||||
onRef: (ref: Agenda<any>) => void;
|
onRef: (ref: Agenda<any>) => void;
|
||||||
|
@ -67,7 +68,7 @@ function CustomAgenda(props: PropsType) {
|
||||||
|
|
||||||
// Completely recreate the component on theme change to force theme reload
|
// Completely recreate the component on theme change to force theme reload
|
||||||
if (theme.dark) {
|
if (theme.dark) {
|
||||||
return <View style={{flex: 1}}>{getAgenda()}</View>;
|
return <View style={GENERAL_STYLES.flex}>{getAgenda()}</View>;
|
||||||
}
|
}
|
||||||
return getAgenda();
|
return getAgenda();
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ function CustomHTML(props: PropsType) {
|
||||||
htmlAttribs: any,
|
htmlAttribs: any,
|
||||||
children: any,
|
children: any,
|
||||||
convertedCSSStyles: any,
|
convertedCSSStyles: any,
|
||||||
passProps: any,
|
passProps: any
|
||||||
) => {
|
) => {
|
||||||
return <Text {...passProps}>{children}</Text>;
|
return <Text {...passProps}>{children}</Text>;
|
||||||
};
|
};
|
||||||
|
|
|
@ -40,7 +40,7 @@ const MaterialHeaderButton = (props: HeaderButtonProps) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const MaterialHeaderButtons = (
|
const MaterialHeaderButtons = (
|
||||||
props: HeaderButtonsProps & {children?: React.ReactNode},
|
props: HeaderButtonsProps & { children?: React.ReactNode }
|
||||||
) => {
|
) => {
|
||||||
return (
|
return (
|
||||||
<HeaderButtons {...props} HeaderButtonComponent={MaterialHeaderButton} />
|
<HeaderButtons {...props} HeaderButtonComponent={MaterialHeaderButton} />
|
||||||
|
|
|
@ -37,6 +37,7 @@ import Mascot, {MASCOT_STYLE} from '../Mascot/Mascot';
|
||||||
import MascotIntroWelcome from '../Intro/MascotIntroWelcome';
|
import MascotIntroWelcome from '../Intro/MascotIntroWelcome';
|
||||||
import IntroIcon from '../Intro/IconIntro';
|
import IntroIcon from '../Intro/IconIntro';
|
||||||
import MascotIntroEnd from '../Intro/MascotIntroEnd';
|
import MascotIntroEnd from '../Intro/MascotIntroEnd';
|
||||||
|
import GENERAL_STYLES from '../../constants/Styles';
|
||||||
|
|
||||||
type PropsType = {
|
type PropsType = {
|
||||||
onDone: () => void;
|
onDone: () => void;
|
||||||
|
@ -75,11 +76,42 @@ const styles = StyleSheet.create({
|
||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
marginBottom: 16,
|
marginBottom: 16,
|
||||||
},
|
},
|
||||||
center: {
|
mascot: {
|
||||||
marginTop: 'auto',
|
marginLeft: 30,
|
||||||
marginBottom: 'auto',
|
marginBottom: 0,
|
||||||
marginRight: 'auto',
|
width: 100,
|
||||||
marginLeft: 'auto',
|
marginTop: -30,
|
||||||
|
},
|
||||||
|
speechArrow: {
|
||||||
|
marginLeft: 50,
|
||||||
|
width: 0,
|
||||||
|
height: 0,
|
||||||
|
borderLeftWidth: 20,
|
||||||
|
borderRightWidth: 0,
|
||||||
|
borderBottomWidth: 20,
|
||||||
|
borderStyle: 'solid',
|
||||||
|
backgroundColor: 'transparent',
|
||||||
|
borderLeftColor: 'transparent',
|
||||||
|
borderRightColor: 'transparent',
|
||||||
|
borderBottomColor: 'rgba(0,0,0,0.60)',
|
||||||
|
},
|
||||||
|
card: {
|
||||||
|
backgroundColor: 'rgba(0,0,0,0.38)',
|
||||||
|
marginHorizontal: 20,
|
||||||
|
borderColor: 'rgba(0,0,0,0.60)',
|
||||||
|
borderWidth: 4,
|
||||||
|
borderRadius: 10,
|
||||||
|
elevation: 0,
|
||||||
|
},
|
||||||
|
nextButtonContainer: {
|
||||||
|
borderRadius: 25,
|
||||||
|
padding: 5,
|
||||||
|
backgroundColor: 'rgba(0,0,0,0.2)',
|
||||||
|
},
|
||||||
|
doneButtonContainer: {
|
||||||
|
borderRadius: 25,
|
||||||
|
padding: 5,
|
||||||
|
backgroundColor: 'rgb(190,21,34)',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -175,7 +207,7 @@ export default class CustomIntroSlider extends React.Component<
|
||||||
| (ListRenderItemInfo<IntroSlideType> & {
|
| (ListRenderItemInfo<IntroSlideType> & {
|
||||||
dimensions: { width: number; height: number };
|
dimensions: { width: number; height: number };
|
||||||
})
|
})
|
||||||
| ListRenderItemInfo<IntroSlideType>,
|
| ListRenderItemInfo<IntroSlideType>
|
||||||
) => {
|
) => {
|
||||||
const item = data.item;
|
const item = data.item;
|
||||||
const { state } = this;
|
const { state } = this;
|
||||||
|
@ -185,19 +217,15 @@ export default class CustomIntroSlider extends React.Component<
|
||||||
style={[styles.mainContent]}
|
style={[styles.mainContent]}
|
||||||
colors={item.colors}
|
colors={item.colors}
|
||||||
start={{ x: 0, y: 0.1 }}
|
start={{ x: 0, y: 0.1 }}
|
||||||
end={{x: 0.1, y: 1}}>
|
end={{ x: 0.1, y: 1 }}
|
||||||
|
>
|
||||||
{state.currentSlide === index ? (
|
{state.currentSlide === index ? (
|
||||||
<View style={{height: '100%', flex: 1}}>
|
<View style={GENERAL_STYLES.flex}>
|
||||||
<View style={{flex: 1}}>{item.view()}</View>
|
<View style={GENERAL_STYLES.flex}>{item.view()}</View>
|
||||||
<Animatable.View useNativeDriver animation="fadeIn">
|
<Animatable.View useNativeDriver animation="fadeIn">
|
||||||
{item.mascotStyle != null ? (
|
{item.mascotStyle != null ? (
|
||||||
<Mascot
|
<Mascot
|
||||||
style={{
|
style={styles.mascot}
|
||||||
marginLeft: 30,
|
|
||||||
marginBottom: 0,
|
|
||||||
width: 100,
|
|
||||||
marginTop: -30,
|
|
||||||
}}
|
|
||||||
emotion={item.mascotStyle}
|
emotion={item.mascotStyle}
|
||||||
animated
|
animated
|
||||||
entryAnimation={{
|
entryAnimation={{
|
||||||
|
@ -211,43 +239,23 @@ export default class CustomIntroSlider extends React.Component<
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
<View
|
<View style={styles.speechArrow} />
|
||||||
style={{
|
<Card style={styles.card}>
|
||||||
marginLeft: 50,
|
|
||||||
width: 0,
|
|
||||||
height: 0,
|
|
||||||
borderLeftWidth: 20,
|
|
||||||
borderRightWidth: 0,
|
|
||||||
borderBottomWidth: 20,
|
|
||||||
borderStyle: 'solid',
|
|
||||||
backgroundColor: 'transparent',
|
|
||||||
borderLeftColor: 'transparent',
|
|
||||||
borderRightColor: 'transparent',
|
|
||||||
borderBottomColor: 'rgba(0,0,0,0.60)',
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<Card
|
|
||||||
style={{
|
|
||||||
backgroundColor: 'rgba(0,0,0,0.38)',
|
|
||||||
marginHorizontal: 20,
|
|
||||||
borderColor: 'rgba(0,0,0,0.60)',
|
|
||||||
borderWidth: 4,
|
|
||||||
borderRadius: 10,
|
|
||||||
elevation: 0,
|
|
||||||
}}>
|
|
||||||
<Card.Content>
|
<Card.Content>
|
||||||
<Animatable.Text
|
<Animatable.Text
|
||||||
useNativeDriver
|
useNativeDriver
|
||||||
animation="fadeIn"
|
animation="fadeIn"
|
||||||
delay={100}
|
delay={100}
|
||||||
style={styles.title}>
|
style={styles.title}
|
||||||
|
>
|
||||||
{item.title}
|
{item.title}
|
||||||
</Animatable.Text>
|
</Animatable.Text>
|
||||||
<Animatable.Text
|
<Animatable.Text
|
||||||
useNativeDriver
|
useNativeDriver
|
||||||
animation="fadeIn"
|
animation="fadeIn"
|
||||||
delay={200}
|
delay={200}
|
||||||
style={styles.text}>
|
style={styles.text}
|
||||||
|
>
|
||||||
{item.text}
|
{item.text}
|
||||||
</Animatable.Text>
|
</Animatable.Text>
|
||||||
</Card.Content>
|
</Card.Content>
|
||||||
|
@ -272,7 +280,7 @@ export default class CustomIntroSlider extends React.Component<
|
||||||
|
|
||||||
onSkip = () => {
|
onSkip = () => {
|
||||||
CustomIntroSlider.setStatusBarColor(
|
CustomIntroSlider.setStatusBarColor(
|
||||||
this.currentSlides[this.currentSlides.length - 1].colors[0],
|
this.currentSlides[this.currentSlides.length - 1].colors[0]
|
||||||
);
|
);
|
||||||
if (this.sliderRef.current != null) {
|
if (this.sliderRef.current != null) {
|
||||||
this.sliderRef.current.goToSlide(this.currentSlides.length - 1);
|
this.sliderRef.current.goToSlide(this.currentSlides.length - 1);
|
||||||
|
@ -282,7 +290,7 @@ export default class CustomIntroSlider extends React.Component<
|
||||||
onDone = () => {
|
onDone = () => {
|
||||||
const { props } = this;
|
const { props } = this;
|
||||||
CustomIntroSlider.setStatusBarColor(
|
CustomIntroSlider.setStatusBarColor(
|
||||||
ThemeManager.getCurrentTheme().colors.surface,
|
ThemeManager.getCurrentTheme().colors.surface
|
||||||
);
|
);
|
||||||
props.onDone();
|
props.onDone();
|
||||||
};
|
};
|
||||||
|
@ -292,11 +300,8 @@ export default class CustomIntroSlider extends React.Component<
|
||||||
<Animatable.View
|
<Animatable.View
|
||||||
useNativeDriver
|
useNativeDriver
|
||||||
animation="fadeIn"
|
animation="fadeIn"
|
||||||
style={{
|
style={styles.nextButtonContainer}
|
||||||
borderRadius: 25,
|
>
|
||||||
padding: 5,
|
|
||||||
backgroundColor: 'rgba(0,0,0,0.2)',
|
|
||||||
}}>
|
|
||||||
<MaterialCommunityIcons name="arrow-right" color="#fff" size={40} />
|
<MaterialCommunityIcons name="arrow-right" color="#fff" size={40} />
|
||||||
</Animatable.View>
|
</Animatable.View>
|
||||||
);
|
);
|
||||||
|
@ -307,11 +312,8 @@ export default class CustomIntroSlider extends React.Component<
|
||||||
<Animatable.View
|
<Animatable.View
|
||||||
useNativeDriver
|
useNativeDriver
|
||||||
animation="bounceIn"
|
animation="bounceIn"
|
||||||
style={{
|
style={styles.doneButtonContainer}
|
||||||
borderRadius: 25,
|
>
|
||||||
padding: 5,
|
|
||||||
backgroundColor: 'rgb(190,21,34)',
|
|
||||||
}}>
|
|
||||||
<MaterialCommunityIcons name="check" color="#fff" size={40} />
|
<MaterialCommunityIcons name="check" color="#fff" size={40} />
|
||||||
</Animatable.View>
|
</Animatable.View>
|
||||||
);
|
);
|
||||||
|
|
|
@ -41,11 +41,13 @@ function CustomModal(props: {
|
||||||
adjustToContentHeight
|
adjustToContentHeight
|
||||||
handlePosition="inside"
|
handlePosition="inside"
|
||||||
modalStyle={{ backgroundColor: theme.colors.card }}
|
modalStyle={{ backgroundColor: theme.colors.card }}
|
||||||
handleStyle={{backgroundColor: theme.colors.primary}}>
|
handleStyle={{ backgroundColor: theme.colors.primary }}
|
||||||
|
>
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
paddingBottom: CustomTabBar.TAB_BAR_HEIGHT,
|
paddingBottom: CustomTabBar.TAB_BAR_HEIGHT,
|
||||||
}}>
|
}}
|
||||||
|
>
|
||||||
{children}
|
{children}
|
||||||
</View>
|
</View>
|
||||||
</Modalize>
|
</Modalize>
|
||||||
|
|
|
@ -22,11 +22,24 @@ import {Text} from 'react-native-paper';
|
||||||
import { View } from 'react-native-animatable';
|
import { View } from 'react-native-animatable';
|
||||||
import Slider, { SliderProps } from '@react-native-community/slider';
|
import Slider, { SliderProps } from '@react-native-community/slider';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
|
import { StyleSheet } from 'react-native';
|
||||||
|
|
||||||
type PropsType = {
|
type PropsType = {
|
||||||
valueSuffix?: string;
|
valueSuffix?: string;
|
||||||
} & SliderProps;
|
} & SliderProps;
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
container: {
|
||||||
|
flex: 1,
|
||||||
|
flexDirection: 'row',
|
||||||
|
},
|
||||||
|
text: {
|
||||||
|
marginHorizontal: 10,
|
||||||
|
marginTop: 'auto',
|
||||||
|
marginBottom: 'auto',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstraction layer for Modalize component, using custom configuration
|
* Abstraction layer for Modalize component, using custom configuration
|
||||||
*
|
*
|
||||||
|
@ -44,15 +57,8 @@ function CustomSlider(props: PropsType) {
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={{flex: 1, flexDirection: 'row'}}>
|
<View style={styles.container}>
|
||||||
<Text
|
<Text style={styles.text}>{currentValue}min</Text>
|
||||||
style={{
|
|
||||||
marginHorizontal: 10,
|
|
||||||
marginTop: 'auto',
|
|
||||||
marginBottom: 'auto',
|
|
||||||
}}>
|
|
||||||
{currentValue}min
|
|
||||||
</Text>
|
|
||||||
<Slider {...props} ref={undefined} onValueChange={onValueChange} />
|
<Slider {...props} ref={undefined} onValueChange={onValueChange} />
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
|
|
@ -17,16 +17,24 @@
|
||||||
* along with Campus INSAT. If not, see <https://www.gnu.org/licenses/>.
|
* along with Campus INSAT. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @flow
|
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import {View} from 'react-native';
|
import { StyleSheet, View } from 'react-native';
|
||||||
import { ActivityIndicator, useTheme } from 'react-native-paper';
|
import { ActivityIndicator, useTheme } from 'react-native-paper';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
isAbsolute?: boolean;
|
isAbsolute?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
container: {
|
||||||
|
top: 0,
|
||||||
|
right: 0,
|
||||||
|
width: '100%',
|
||||||
|
height: '100%',
|
||||||
|
justifyContent: 'center',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component used to display a header button
|
* Component used to display a header button
|
||||||
*
|
*
|
||||||
|
@ -36,17 +44,15 @@ type Props = {
|
||||||
export default function BasicLoadingScreen(props: Props) {
|
export default function BasicLoadingScreen(props: Props) {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const { isAbsolute } = props;
|
const { isAbsolute } = props;
|
||||||
|
const position = isAbsolute ? 'absolute' : 'relative';
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
backgroundColor: theme.colors.background,
|
backgroundColor: theme.colors.background,
|
||||||
position: isAbsolute ? 'absolute' : 'relative',
|
position: position,
|
||||||
top: 0,
|
...styles.container,
|
||||||
right: 0,
|
}}
|
||||||
width: '100%',
|
>
|
||||||
height: '100%',
|
|
||||||
justifyContent: 'center',
|
|
||||||
}}>
|
|
||||||
<ActivityIndicator animating size="large" color={theme.colors.primary} />
|
<ActivityIndicator animating size="large" color={theme.colors.primary} />
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
|
|
@ -90,7 +90,8 @@ class ErrorView extends React.PureComponent<PropsType> {
|
||||||
mode="contained"
|
mode="contained"
|
||||||
icon="refresh"
|
icon="refresh"
|
||||||
onPress={props.onRefresh}
|
onPress={props.onRefresh}
|
||||||
style={styles.button}>
|
style={styles.button}
|
||||||
|
>
|
||||||
{i18n.t('general.retry')}
|
{i18n.t('general.retry')}
|
||||||
</Button>
|
</Button>
|
||||||
);
|
);
|
||||||
|
@ -102,7 +103,8 @@ class ErrorView extends React.PureComponent<PropsType> {
|
||||||
mode="contained"
|
mode="contained"
|
||||||
icon="login"
|
icon="login"
|
||||||
onPress={this.goToLogin}
|
onPress={this.goToLogin}
|
||||||
style={styles.button}>
|
style={styles.button}
|
||||||
|
>
|
||||||
{i18n.t('screens.login.title')}
|
{i18n.t('screens.login.title')}
|
||||||
</Button>
|
</Button>
|
||||||
);
|
);
|
||||||
|
@ -190,7 +192,8 @@ class ErrorView extends React.PureComponent<PropsType> {
|
||||||
}}
|
}}
|
||||||
animation="zoomIn"
|
animation="zoomIn"
|
||||||
duration={200}
|
duration={200}
|
||||||
useNativeDriver>
|
useNativeDriver
|
||||||
|
>
|
||||||
<View style={styles.inner}>
|
<View style={styles.inner}>
|
||||||
<View style={styles.iconContainer}>
|
<View style={styles.iconContainer}>
|
||||||
<MaterialCommunityIcons
|
<MaterialCommunityIcons
|
||||||
|
@ -204,7 +207,8 @@ class ErrorView extends React.PureComponent<PropsType> {
|
||||||
style={{
|
style={{
|
||||||
...styles.subheading,
|
...styles.subheading,
|
||||||
color: props.theme.colors.textDisabled,
|
color: props.theme.colors.textDisabled,
|
||||||
}}>
|
}}
|
||||||
|
>
|
||||||
{this.message}
|
{this.message}
|
||||||
</Subheading>
|
</Subheading>
|
||||||
{button}
|
{button}
|
||||||
|
|
|
@ -24,6 +24,7 @@ import {
|
||||||
NativeSyntheticEvent,
|
NativeSyntheticEvent,
|
||||||
RefreshControl,
|
RefreshControl,
|
||||||
SectionListData,
|
SectionListData,
|
||||||
|
StyleSheet,
|
||||||
View,
|
View,
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import * as Animatable from 'react-native-animatable';
|
import * as Animatable from 'react-native-animatable';
|
||||||
|
@ -51,7 +52,7 @@ type PropsType<ItemT, RawData> = {
|
||||||
renderItem: (data: { item: ItemT }) => React.ReactNode;
|
renderItem: (data: { item: ItemT }) => React.ReactNode;
|
||||||
createDataset: (
|
createDataset: (
|
||||||
data: RawData | null,
|
data: RawData | null,
|
||||||
isLoading?: boolean,
|
isLoading?: boolean
|
||||||
) => SectionListDataType<ItemT>;
|
) => SectionListDataType<ItemT>;
|
||||||
onScroll: (event: NativeSyntheticEvent<EventTarget>) => void;
|
onScroll: (event: NativeSyntheticEvent<EventTarget>) => void;
|
||||||
collapsibleStack: Collapsible;
|
collapsibleStack: Collapsible;
|
||||||
|
@ -60,11 +61,11 @@ type PropsType<ItemT, RawData> = {
|
||||||
itemHeight?: number | null;
|
itemHeight?: number | null;
|
||||||
updateData?: number;
|
updateData?: number;
|
||||||
renderListHeaderComponent?: (
|
renderListHeaderComponent?: (
|
||||||
data: RawData | null,
|
data: RawData | null
|
||||||
) => React.ComponentType<any> | React.ReactElement | null;
|
) => React.ComponentType<any> | React.ReactElement | null;
|
||||||
renderSectionHeader?: (
|
renderSectionHeader?: (
|
||||||
data: { section: SectionListData<ItemT> },
|
data: { section: SectionListData<ItemT> },
|
||||||
isLoading?: boolean,
|
isLoading?: boolean
|
||||||
) => React.ReactElement | null;
|
) => React.ReactElement | null;
|
||||||
stickyHeader?: boolean;
|
stickyHeader?: boolean;
|
||||||
};
|
};
|
||||||
|
@ -77,6 +78,12 @@ type StateType<RawData> = {
|
||||||
|
|
||||||
const MIN_REFRESH_TIME = 5 * 1000;
|
const MIN_REFRESH_TIME = 5 * 1000;
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
container: {
|
||||||
|
minHeight: '100%',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component used to render a SectionList with data fetched from the web
|
* Component used to render a SectionList with data fetched from the web
|
||||||
*
|
*
|
||||||
|
@ -204,7 +211,7 @@ class WebSectionList<ItemT, RawData> extends React.PureComponent<
|
||||||
getItemLayout = (
|
getItemLayout = (
|
||||||
height: number,
|
height: number,
|
||||||
data: Array<SectionListData<ItemT>> | null,
|
data: Array<SectionListData<ItemT>> | null,
|
||||||
index: number,
|
index: number
|
||||||
): { length: number; offset: number; index: number } => {
|
): { length: number; offset: number; index: number } => {
|
||||||
return {
|
return {
|
||||||
length: height,
|
length: height,
|
||||||
|
@ -269,7 +276,7 @@ class WebSectionList<ItemT, RawData> extends React.PureComponent<
|
||||||
renderSectionHeader={this.getRenderSectionHeader}
|
renderSectionHeader={this.getRenderSectionHeader}
|
||||||
renderItem={this.getRenderItem}
|
renderItem={this.getRenderItem}
|
||||||
stickySectionHeadersEnabled={props.stickyHeader}
|
stickySectionHeadersEnabled={props.stickyHeader}
|
||||||
style={{minHeight: '100%'}}
|
style={styles.container}
|
||||||
ListHeaderComponent={
|
ListHeaderComponent={
|
||||||
props.renderListHeaderComponent != null
|
props.renderListHeaderComponent != null
|
||||||
? props.renderListHeaderComponent(state.fetchedData)
|
? props.renderListHeaderComponent(state.fetchedData)
|
||||||
|
@ -304,7 +311,8 @@ class WebSectionList<ItemT, RawData> extends React.PureComponent<
|
||||||
duration={4000}
|
duration={4000}
|
||||||
style={{
|
style={{
|
||||||
bottom: CustomTabBar.TAB_BAR_HEIGHT,
|
bottom: CustomTabBar.TAB_BAR_HEIGHT,
|
||||||
}}>
|
}}
|
||||||
|
>
|
||||||
{i18n.t('general.listUpdateFail')}
|
{i18n.t('general.listUpdateFail')}
|
||||||
</Snackbar>
|
</Snackbar>
|
||||||
</View>
|
</View>
|
||||||
|
|
|
@ -31,6 +31,7 @@ import {
|
||||||
Linking,
|
Linking,
|
||||||
NativeScrollEvent,
|
NativeScrollEvent,
|
||||||
NativeSyntheticEvent,
|
NativeSyntheticEvent,
|
||||||
|
StyleSheet,
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||||
import { withTheme } from 'react-native-paper';
|
import { withTheme } from 'react-native-paper';
|
||||||
|
@ -56,6 +57,12 @@ type PropsType = {
|
||||||
|
|
||||||
const AnimatedWebView = Animated.createAnimatedComponent(WebView);
|
const AnimatedWebView = Animated.createAnimatedComponent(WebView);
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
overflow: {
|
||||||
|
marginHorizontal: 10,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class defining a webview screen.
|
* Class defining a webview screen.
|
||||||
*/
|
*/
|
||||||
|
@ -92,13 +99,13 @@ class WebViewScreen extends React.PureComponent<PropsType> {
|
||||||
props.navigation.addListener('focus', () => {
|
props.navigation.addListener('focus', () => {
|
||||||
BackHandler.addEventListener(
|
BackHandler.addEventListener(
|
||||||
'hardwareBackPress',
|
'hardwareBackPress',
|
||||||
this.onBackButtonPressAndroid,
|
this.onBackButtonPressAndroid
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
props.navigation.addListener('blur', () => {
|
props.navigation.addListener('blur', () => {
|
||||||
BackHandler.removeEventListener(
|
BackHandler.removeEventListener(
|
||||||
'hardwareBackPress',
|
'hardwareBackPress',
|
||||||
this.onBackButtonPressAndroid,
|
this.onBackButtonPressAndroid
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -154,14 +161,15 @@ class WebViewScreen extends React.PureComponent<PropsType> {
|
||||||
onPress={this.onRefreshClicked}
|
onPress={this.onRefreshClicked}
|
||||||
/>
|
/>
|
||||||
<OverflowMenu
|
<OverflowMenu
|
||||||
style={{marginHorizontal: 10}}
|
style={styles.overflow}
|
||||||
OverflowIcon={
|
OverflowIcon={
|
||||||
<MaterialCommunityIcons
|
<MaterialCommunityIcons
|
||||||
name="dots-vertical"
|
name="dots-vertical"
|
||||||
size={26}
|
size={26}
|
||||||
color={props.theme.colors.text}
|
color={props.theme.colors.text}
|
||||||
/>
|
/>
|
||||||
}>
|
}
|
||||||
|
>
|
||||||
<HiddenItem
|
<HiddenItem
|
||||||
title={i18n.t('general.goBack')}
|
title={i18n.t('general.goBack')}
|
||||||
onPress={this.onGoBackClicked}
|
onPress={this.onGoBackClicked}
|
||||||
|
@ -248,7 +256,10 @@ class WebViewScreen extends React.PureComponent<PropsType> {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { props } = this;
|
const { props } = this;
|
||||||
const {containerPaddingTop, onScrollWithListener} = props.collapsibleStack;
|
const {
|
||||||
|
containerPaddingTop,
|
||||||
|
onScrollWithListener,
|
||||||
|
} = props.collapsibleStack;
|
||||||
return (
|
return (
|
||||||
<AnimatedWebView
|
<AnimatedWebView
|
||||||
ref={this.webviewRef}
|
ref={this.webviewRef}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import {Animated} from 'react-native';
|
import { Animated, StyleSheet } from 'react-native';
|
||||||
import { withTheme } from 'react-native-paper';
|
import { withTheme } from 'react-native-paper';
|
||||||
import { Collapsible } from 'react-navigation-collapsible';
|
import { Collapsible } from 'react-navigation-collapsible';
|
||||||
import TabIcon from './TabIcon';
|
import TabIcon from './TabIcon';
|
||||||
|
@ -51,6 +51,16 @@ const TAB_ICONS = {
|
||||||
planex: 'clock',
|
planex: 'clock',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
container: {
|
||||||
|
flexDirection: 'row',
|
||||||
|
width: '100%',
|
||||||
|
position: 'absolute',
|
||||||
|
bottom: 0,
|
||||||
|
left: 0,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
class CustomTabBar extends React.Component<PropsType, StateType> {
|
class CustomTabBar extends React.Component<PropsType, StateType> {
|
||||||
static TAB_BAR_HEIGHT = 48;
|
static TAB_BAR_HEIGHT = 48;
|
||||||
|
|
||||||
|
@ -202,15 +212,12 @@ class CustomTabBar extends React.Component<PropsType, StateType> {
|
||||||
return (
|
return (
|
||||||
<Animated.View
|
<Animated.View
|
||||||
style={{
|
style={{
|
||||||
flexDirection: 'row',
|
|
||||||
height: CustomTabBar.TAB_BAR_HEIGHT,
|
height: CustomTabBar.TAB_BAR_HEIGHT,
|
||||||
width: '100%',
|
|
||||||
position: 'absolute',
|
|
||||||
bottom: 0,
|
|
||||||
left: 0,
|
|
||||||
backgroundColor: props.theme.colors.surface,
|
backgroundColor: props.theme.colors.surface,
|
||||||
transform: [{ translateY: state.translateY }],
|
transform: [{ translateY: state.translateY }],
|
||||||
}}>
|
...styles.container,
|
||||||
|
}}
|
||||||
|
>
|
||||||
{icons}
|
{icons}
|
||||||
</Animated.View>
|
</Animated.View>
|
||||||
);
|
);
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import {Image, View} from 'react-native';
|
import { Image, StyleSheet, View } from 'react-native';
|
||||||
import { FAB } from 'react-native-paper';
|
import { FAB } from 'react-native-paper';
|
||||||
import * as Animatable from 'react-native-animatable';
|
import * as Animatable from 'react-native-animatable';
|
||||||
const FOCUSED_ICON = require('../../../assets/tab-icon.png');
|
const FOCUSED_ICON = require('../../../assets/tab-icon.png');
|
||||||
|
@ -33,6 +33,25 @@ type PropsType = {
|
||||||
|
|
||||||
const AnimatedFAB = Animatable.createAnimatableComponent(FAB);
|
const AnimatedFAB = Animatable.createAnimatableComponent(FAB);
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
container: {
|
||||||
|
flex: 1,
|
||||||
|
justifyContent: 'center',
|
||||||
|
},
|
||||||
|
subcontainer: {
|
||||||
|
position: 'absolute',
|
||||||
|
bottom: 0,
|
||||||
|
left: 0,
|
||||||
|
width: '100%',
|
||||||
|
marginBottom: -15,
|
||||||
|
},
|
||||||
|
fab: {
|
||||||
|
marginTop: 15,
|
||||||
|
marginLeft: 'auto',
|
||||||
|
marginRight: 'auto',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstraction layer for Agenda component, using custom configuration
|
* Abstraction layer for Agenda component, using custom configuration
|
||||||
*/
|
*/
|
||||||
|
@ -91,20 +110,13 @@ class TabHomeIcon extends React.Component<PropsType> {
|
||||||
render() {
|
render() {
|
||||||
const { props } = this;
|
const { props } = this;
|
||||||
return (
|
return (
|
||||||
|
<View style={styles.container}>
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
flex: 1,
|
|
||||||
justifyContent: 'center',
|
|
||||||
}}>
|
|
||||||
<View
|
|
||||||
style={{
|
|
||||||
position: 'absolute',
|
|
||||||
bottom: 0,
|
|
||||||
left: 0,
|
|
||||||
width: '100%',
|
|
||||||
height: props.tabBarHeight + 30,
|
height: props.tabBarHeight + 30,
|
||||||
marginBottom: -15,
|
...styles.subcontainer,
|
||||||
}}>
|
}}
|
||||||
|
>
|
||||||
<AnimatedFAB
|
<AnimatedFAB
|
||||||
duration={200}
|
duration={200}
|
||||||
easing="ease-out"
|
easing="ease-out"
|
||||||
|
@ -112,11 +124,7 @@ class TabHomeIcon extends React.Component<PropsType> {
|
||||||
icon={this.getIconRender}
|
icon={this.getIconRender}
|
||||||
onPress={props.onPress}
|
onPress={props.onPress}
|
||||||
onLongPress={props.onLongPress}
|
onLongPress={props.onLongPress}
|
||||||
style={{
|
style={styles.fab}
|
||||||
marginTop: 15,
|
|
||||||
marginLeft: 'auto',
|
|
||||||
marginRight: 'auto',
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
|
@ -18,10 +18,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import {View} from 'react-native';
|
import { StyleSheet, View } from 'react-native';
|
||||||
import { TouchableRipple, withTheme } from 'react-native-paper';
|
import { TouchableRipple, withTheme } from 'react-native-paper';
|
||||||
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||||
import * as Animatable from 'react-native-animatable';
|
import * as Animatable from 'react-native-animatable';
|
||||||
|
import GENERAL_STYLES from '../../constants/Styles';
|
||||||
|
|
||||||
type PropsType = {
|
type PropsType = {
|
||||||
focused: boolean;
|
focused: boolean;
|
||||||
|
@ -34,6 +35,19 @@ type PropsType = {
|
||||||
extraData: null | boolean | number | string;
|
extraData: null | boolean | number | string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
container: {
|
||||||
|
flex: 1,
|
||||||
|
justifyContent: 'center',
|
||||||
|
borderRadius: 10,
|
||||||
|
},
|
||||||
|
text: {
|
||||||
|
marginLeft: 'auto',
|
||||||
|
marginRight: 'auto',
|
||||||
|
fontSize: 10,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstraction layer for Agenda component, using custom configuration
|
* Abstraction layer for Agenda component, using custom configuration
|
||||||
*/
|
*/
|
||||||
|
@ -93,26 +107,21 @@ class TabIcon extends React.Component<PropsType> {
|
||||||
onPress={props.onPress}
|
onPress={props.onPress}
|
||||||
onLongPress={props.onLongPress}
|
onLongPress={props.onLongPress}
|
||||||
rippleColor={props.theme.colors.primary}
|
rippleColor={props.theme.colors.primary}
|
||||||
borderless
|
borderless={true}
|
||||||
style={{
|
style={styles.container}
|
||||||
flex: 1,
|
>
|
||||||
justifyContent: 'center',
|
|
||||||
borderRadius: 10,
|
|
||||||
}}>
|
|
||||||
<View>
|
<View>
|
||||||
<Animatable.View
|
<Animatable.View
|
||||||
duration={200}
|
duration={200}
|
||||||
easing="ease-out"
|
easing="ease-out"
|
||||||
animation={props.focused ? 'focusIn' : 'focusOut'}
|
animation={props.focused ? 'focusIn' : 'focusOut'}
|
||||||
useNativeDriver>
|
useNativeDriver
|
||||||
|
>
|
||||||
<MaterialCommunityIcons
|
<MaterialCommunityIcons
|
||||||
name={props.icon}
|
name={props.icon}
|
||||||
color={props.color}
|
color={props.color}
|
||||||
size={26}
|
size={26}
|
||||||
style={{
|
style={GENERAL_STYLES.centerHorizontal}
|
||||||
marginLeft: 'auto',
|
|
||||||
marginRight: 'auto',
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
</Animatable.View>
|
</Animatable.View>
|
||||||
<Animatable.Text
|
<Animatable.Text
|
||||||
|
@ -120,10 +129,9 @@ class TabIcon extends React.Component<PropsType> {
|
||||||
useNativeDriver
|
useNativeDriver
|
||||||
style={{
|
style={{
|
||||||
color: props.color,
|
color: props.color,
|
||||||
marginLeft: 'auto',
|
...styles.text,
|
||||||
marginRight: 'auto',
|
}}
|
||||||
fontSize: 10,
|
>
|
||||||
}}>
|
|
||||||
{props.label}
|
{props.label}
|
||||||
</Animatable.Text>
|
</Animatable.Text>
|
||||||
</View>
|
</View>
|
||||||
|
|
|
@ -17,8 +17,6 @@
|
||||||
* along with Campus INSAT. If not, see <https://www.gnu.org/licenses/>.
|
* along with Campus INSAT. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @flow
|
|
||||||
|
|
||||||
const ICON_AMICALE = require('../../assets/amicale.png');
|
const ICON_AMICALE = require('../../assets/amicale.png');
|
||||||
const ICON_CAMPUS = require('../../assets/android.icon.png');
|
const ICON_CAMPUS = require('../../assets/android.icon.png');
|
||||||
|
|
||||||
|
|
23
src/constants/Styles.tsx
Normal file
23
src/constants/Styles.tsx
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
import { StyleSheet } from 'react-native';
|
||||||
|
|
||||||
|
const GENERAL_STYLES = StyleSheet.create({
|
||||||
|
centerHorizontal: {
|
||||||
|
marginLeft: 'auto',
|
||||||
|
marginRight: 'auto',
|
||||||
|
},
|
||||||
|
centerVertical: {
|
||||||
|
marginTop: 'auto',
|
||||||
|
marginBottom: 'auto',
|
||||||
|
},
|
||||||
|
center: {
|
||||||
|
marginLeft: 'auto',
|
||||||
|
marginRight: 'auto',
|
||||||
|
marginTop: 'auto',
|
||||||
|
marginBottom: 'auto',
|
||||||
|
},
|
||||||
|
flex: {
|
||||||
|
flex: 1,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default GENERAL_STYLES;
|
|
@ -67,7 +67,7 @@ export default class AprilFoolsManager {
|
||||||
* @returns {Object}
|
* @returns {Object}
|
||||||
*/
|
*/
|
||||||
static getFakeMenuItem(
|
static getFakeMenuItem(
|
||||||
menu: Array<RuFoodCategoryType>,
|
menu: Array<RuFoodCategoryType>
|
||||||
): Array<RuFoodCategoryType> {
|
): Array<RuFoodCategoryType> {
|
||||||
menu[1].dishes.splice(4, 0, { name: 'Coq au vin' });
|
menu[1].dishes.splice(4, 0, { name: 'Coq au vin' });
|
||||||
menu[1].dishes.splice(2, 0, { name: "Bat'Soupe" });
|
menu[1].dishes.splice(2, 0, { name: "Bat'Soupe" });
|
||||||
|
@ -83,7 +83,7 @@ export default class AprilFoolsManager {
|
||||||
* @param dryers
|
* @param dryers
|
||||||
*/
|
*/
|
||||||
static getNewProxiwashDryerOrderedList(
|
static getNewProxiwashDryerOrderedList(
|
||||||
dryers: Array<ProxiwashMachineType> | null,
|
dryers: Array<ProxiwashMachineType> | null
|
||||||
) {
|
) {
|
||||||
if (dryers != null) {
|
if (dryers != null) {
|
||||||
const second = dryers[1];
|
const second = dryers[1];
|
||||||
|
@ -98,7 +98,7 @@ export default class AprilFoolsManager {
|
||||||
* @param washers
|
* @param washers
|
||||||
*/
|
*/
|
||||||
static getNewProxiwashWasherOrderedList(
|
static getNewProxiwashWasherOrderedList(
|
||||||
washers: Array<ProxiwashMachineType> | null,
|
washers: Array<ProxiwashMachineType> | null
|
||||||
) {
|
) {
|
||||||
if (washers != null) {
|
if (washers != null) {
|
||||||
const first = washers[0];
|
const first = washers[0];
|
||||||
|
@ -129,7 +129,7 @@ export default class AprilFoolsManager {
|
||||||
* @returns {{colors: {textDisabled: string, agendaDayTextColor: string, surface: string, background: string, dividerBackground: string, accent: string, agendaBackgroundColor: string, tabIcon: string, card: string, primary: string}}}
|
* @returns {{colors: {textDisabled: string, agendaDayTextColor: string, surface: string, background: string, dividerBackground: string, accent: string, agendaBackgroundColor: string, tabIcon: string, card: string, primary: string}}}
|
||||||
*/
|
*/
|
||||||
static getAprilFoolsTheme(
|
static getAprilFoolsTheme(
|
||||||
currentTheme: ReactNativePaper.Theme,
|
currentTheme: ReactNativePaper.Theme
|
||||||
): ReactNativePaper.Theme {
|
): ReactNativePaper.Theme {
|
||||||
return {
|
return {
|
||||||
...currentTheme,
|
...currentTheme,
|
||||||
|
|
|
@ -155,7 +155,7 @@ export default class AsyncStorageManager {
|
||||||
*/
|
*/
|
||||||
static set(
|
static set(
|
||||||
key: string,
|
key: string,
|
||||||
value: number | string | boolean | object | Array<any>,
|
value: number | string | boolean | object | Array<any>
|
||||||
) {
|
) {
|
||||||
AsyncStorageManager.getInstance().setPreference(key, value);
|
AsyncStorageManager.getInstance().setPreference(key, value);
|
||||||
}
|
}
|
||||||
|
@ -209,7 +209,7 @@ export default class AsyncStorageManager {
|
||||||
* @return {Promise<void>}
|
* @return {Promise<void>}
|
||||||
*/
|
*/
|
||||||
async loadPreferences() {
|
async loadPreferences() {
|
||||||
return new Promise((resolve: () => void) => {
|
return new Promise((resolve: (val: void) => void) => {
|
||||||
const prefKeys: Array<string> = [];
|
const prefKeys: Array<string> = [];
|
||||||
// Get all available keys
|
// Get all available keys
|
||||||
Object.keys(AsyncStorageManager.PREFERENCES).forEach((key: string) => {
|
Object.keys(AsyncStorageManager.PREFERENCES).forEach((key: string) => {
|
||||||
|
@ -240,7 +240,7 @@ export default class AsyncStorageManager {
|
||||||
*/
|
*/
|
||||||
setPreference(
|
setPreference(
|
||||||
key: string,
|
key: string,
|
||||||
value: number | string | boolean | object | Array<any>,
|
value: number | string | boolean | object | Array<any>
|
||||||
) {
|
) {
|
||||||
if (AsyncStorageManager.PREFERENCES[key] != null) {
|
if (AsyncStorageManager.PREFERENCES[key] != null) {
|
||||||
let convertedValue;
|
let convertedValue;
|
||||||
|
|
|
@ -17,8 +17,6 @@
|
||||||
* along with Campus INSAT. If not, see <https://www.gnu.org/licenses/>.
|
* along with Campus INSAT. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @flow
|
|
||||||
|
|
||||||
import * as Keychain from 'react-native-keychain';
|
import * as Keychain from 'react-native-keychain';
|
||||||
import type { ApiDataLoginType } from '../utils/WebData';
|
import type { ApiDataLoginType } from '../utils/WebData';
|
||||||
import { apiRequest, ERROR_TYPE } from '../utils/WebData';
|
import { apiRequest, ERROR_TYPE } from '../utils/WebData';
|
||||||
|
@ -84,7 +82,7 @@ export default class ConnectionManager {
|
||||||
}
|
}
|
||||||
resolve();
|
resolve();
|
||||||
})
|
})
|
||||||
.catch(resolve);
|
.catch(() => resolve());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -159,7 +157,7 @@ export default class ConnectionManager {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error: number): void => reject(error));
|
.catch((error: number): void => reject(error));
|
||||||
},
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,7 +170,7 @@ export default class ConnectionManager {
|
||||||
*/
|
*/
|
||||||
async authenticatedRequest<T>(
|
async authenticatedRequest<T>(
|
||||||
path: string,
|
path: string,
|
||||||
params: {[key: string]: any},
|
params: { [key: string]: any }
|
||||||
): Promise<T> {
|
): Promise<T> {
|
||||||
return new Promise(
|
return new Promise(
|
||||||
(resolve: (response: T) => void, reject: (error: number) => void) => {
|
(resolve: (response: T) => void, reject: (error: number) => void) => {
|
||||||
|
@ -187,7 +185,7 @@ export default class ConnectionManager {
|
||||||
} else {
|
} else {
|
||||||
reject(ERROR_TYPE.TOKEN_RETRIEVE);
|
reject(ERROR_TYPE.TOKEN_RETRIEVE);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,6 @@
|
||||||
* along with Campus INSAT. If not, see <https://www.gnu.org/licenses/>.
|
* along with Campus INSAT. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @flow
|
|
||||||
|
|
||||||
import type { ServiceItemType } from './ServicesManager';
|
import type { ServiceItemType } from './ServicesManager';
|
||||||
import ServicesManager from './ServicesManager';
|
import ServicesManager from './ServicesManager';
|
||||||
import { getSublistWithIds } from '../utils/Services';
|
import { getSublistWithIds } from '../utils/Services';
|
||||||
|
@ -27,7 +25,7 @@ import AsyncStorageManager from './AsyncStorageManager';
|
||||||
export default class DashboardManager extends ServicesManager {
|
export default class DashboardManager extends ServicesManager {
|
||||||
getCurrentDashboard(): Array<ServiceItemType | null> {
|
getCurrentDashboard(): Array<ServiceItemType | null> {
|
||||||
const dashboardIdList = AsyncStorageManager.getObject<Array<string>>(
|
const dashboardIdList = AsyncStorageManager.getObject<Array<string>>(
|
||||||
AsyncStorageManager.PREFERENCES.dashboardItems.key,
|
AsyncStorageManager.PREFERENCES.dashboardItems.key
|
||||||
);
|
);
|
||||||
const allDatasets = [
|
const allDatasets = [
|
||||||
...this.amicaleDataset,
|
...this.amicaleDataset,
|
||||||
|
|
|
@ -84,7 +84,7 @@ export default class DateManager {
|
||||||
date.setFullYear(
|
date.setFullYear(
|
||||||
parseInt(dateArray[0], 10),
|
parseInt(dateArray[0], 10),
|
||||||
parseInt(dateArray[1], 10) - 1,
|
parseInt(dateArray[1], 10) - 1,
|
||||||
parseInt(dateArray[2], 10),
|
parseInt(dateArray[2], 10)
|
||||||
);
|
);
|
||||||
return `${this.daysOfWeek[date.getDay()]} ${date.getDate()} ${
|
return `${this.daysOfWeek[date.getDay()]} ${date.getDate()} ${
|
||||||
this.monthsOfYear[date.getMonth()]
|
this.monthsOfYear[date.getMonth()]
|
||||||
|
|
|
@ -235,14 +235,14 @@ export default class ThemeManager {
|
||||||
static getNightMode(): boolean {
|
static getNightMode(): boolean {
|
||||||
return (
|
return (
|
||||||
(AsyncStorageManager.getBool(
|
(AsyncStorageManager.getBool(
|
||||||
AsyncStorageManager.PREFERENCES.nightMode.key,
|
AsyncStorageManager.PREFERENCES.nightMode.key
|
||||||
) &&
|
) &&
|
||||||
(!AsyncStorageManager.getBool(
|
(!AsyncStorageManager.getBool(
|
||||||
AsyncStorageManager.PREFERENCES.nightModeFollowSystem.key,
|
AsyncStorageManager.PREFERENCES.nightModeFollowSystem.key
|
||||||
) ||
|
) ||
|
||||||
colorScheme === 'no-preference')) ||
|
colorScheme === 'no-preference')) ||
|
||||||
(AsyncStorageManager.getBool(
|
(AsyncStorageManager.getBool(
|
||||||
AsyncStorageManager.PREFERENCES.nightModeFollowSystem.key,
|
AsyncStorageManager.PREFERENCES.nightModeFollowSystem.key
|
||||||
) &&
|
) &&
|
||||||
colorScheme === 'dark')
|
colorScheme === 'dark')
|
||||||
);
|
);
|
||||||
|
@ -289,7 +289,7 @@ export default class ThemeManager {
|
||||||
setNightMode(isNightMode: boolean) {
|
setNightMode(isNightMode: boolean) {
|
||||||
AsyncStorageManager.set(
|
AsyncStorageManager.set(
|
||||||
AsyncStorageManager.PREFERENCES.nightMode.key,
|
AsyncStorageManager.PREFERENCES.nightMode.key,
|
||||||
isNightMode,
|
isNightMode
|
||||||
);
|
);
|
||||||
if (this.updateThemeCallback != null) {
|
if (this.updateThemeCallback != null) {
|
||||||
this.updateThemeCallback();
|
this.updateThemeCallback();
|
||||||
|
|
|
@ -18,7 +18,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import {createStackNavigator, TransitionPresets} from '@react-navigation/stack';
|
import {
|
||||||
|
createStackNavigator,
|
||||||
|
TransitionPresets,
|
||||||
|
} from '@react-navigation/stack';
|
||||||
import i18n from 'i18n-js';
|
import i18n from 'i18n-js';
|
||||||
import { Platform } from 'react-native';
|
import { Platform } from 'react-native';
|
||||||
import SettingsScreen from '../screens/Other/Settings/SettingsScreen';
|
import SettingsScreen from '../screens/Other/Settings/SettingsScreen';
|
||||||
|
@ -81,13 +84,13 @@ export enum MainRoutes {
|
||||||
type DefaultParams = { [key in MainRoutes]: object | undefined };
|
type DefaultParams = { [key in MainRoutes]: object | undefined };
|
||||||
|
|
||||||
export interface FullParamsList extends DefaultParams {
|
export interface FullParamsList extends DefaultParams {
|
||||||
login: {nextScreen: string};
|
'login': { nextScreen: string };
|
||||||
'equipment-confirm': {
|
'equipment-confirm': {
|
||||||
item?: DeviceType;
|
item?: DeviceType;
|
||||||
dates: [string, string];
|
dates: [string, string];
|
||||||
};
|
};
|
||||||
'equipment-rent': { item?: DeviceType };
|
'equipment-rent': { item?: DeviceType };
|
||||||
gallery: {images: Array<{url: string}>};
|
'gallery': { images: Array<{ url: string }> };
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't know why but TS is complaining without this
|
// Don't know why but TS is complaining without this
|
||||||
|
@ -114,7 +117,8 @@ function MainStackComponent(props: {createTabNavigator: () => JSX.Element}) {
|
||||||
<MainStack.Navigator
|
<MainStack.Navigator
|
||||||
initialRouteName={MainRoutes.Main}
|
initialRouteName={MainRoutes.Main}
|
||||||
headerMode="screen"
|
headerMode="screen"
|
||||||
screenOptions={defaultScreenOptions}>
|
screenOptions={defaultScreenOptions}
|
||||||
|
>
|
||||||
<MainStack.Screen
|
<MainStack.Screen
|
||||||
name={MainRoutes.Main}
|
name={MainRoutes.Main}
|
||||||
component={createTabNavigator}
|
component={createTabNavigator}
|
||||||
|
@ -135,31 +139,31 @@ function MainStackComponent(props: {createTabNavigator: () => JSX.Element}) {
|
||||||
MainRoutes.Settings,
|
MainRoutes.Settings,
|
||||||
MainStack,
|
MainStack,
|
||||||
SettingsScreen,
|
SettingsScreen,
|
||||||
i18n.t('screens.settings.title'),
|
i18n.t('screens.settings.title')
|
||||||
)}
|
)}
|
||||||
{CreateScreenCollapsibleStack(
|
{CreateScreenCollapsibleStack(
|
||||||
MainRoutes.DashboardEdit,
|
MainRoutes.DashboardEdit,
|
||||||
MainStack,
|
MainStack,
|
||||||
DashboardEditScreen,
|
DashboardEditScreen,
|
||||||
i18n.t('screens.settings.dashboardEdit.title'),
|
i18n.t('screens.settings.dashboardEdit.title')
|
||||||
)}
|
)}
|
||||||
{CreateScreenCollapsibleStack(
|
{CreateScreenCollapsibleStack(
|
||||||
MainRoutes.About,
|
MainRoutes.About,
|
||||||
MainStack,
|
MainStack,
|
||||||
AboutScreen,
|
AboutScreen,
|
||||||
i18n.t('screens.about.title'),
|
i18n.t('screens.about.title')
|
||||||
)}
|
)}
|
||||||
{CreateScreenCollapsibleStack(
|
{CreateScreenCollapsibleStack(
|
||||||
MainRoutes.Dependencies,
|
MainRoutes.Dependencies,
|
||||||
MainStack,
|
MainStack,
|
||||||
AboutDependenciesScreen,
|
AboutDependenciesScreen,
|
||||||
i18n.t('screens.about.libs'),
|
i18n.t('screens.about.libs')
|
||||||
)}
|
)}
|
||||||
{CreateScreenCollapsibleStack(
|
{CreateScreenCollapsibleStack(
|
||||||
MainRoutes.Debug,
|
MainRoutes.Debug,
|
||||||
MainStack,
|
MainStack,
|
||||||
DebugScreen,
|
DebugScreen,
|
||||||
i18n.t('screens.about.debug'),
|
i18n.t('screens.about.debug')
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{CreateScreenCollapsibleStack(
|
{CreateScreenCollapsibleStack(
|
||||||
|
@ -169,7 +173,7 @@ function MainStackComponent(props: {createTabNavigator: () => JSX.Element}) {
|
||||||
i18n.t('screens.game.title'),
|
i18n.t('screens.game.title'),
|
||||||
true,
|
true,
|
||||||
undefined,
|
undefined,
|
||||||
'transparent',
|
'transparent'
|
||||||
)}
|
)}
|
||||||
<MainStack.Screen
|
<MainStack.Screen
|
||||||
name={MainRoutes.GameMain}
|
name={MainRoutes.GameMain}
|
||||||
|
@ -185,7 +189,7 @@ function MainStackComponent(props: {createTabNavigator: () => JSX.Element}) {
|
||||||
i18n.t('screens.login.title'),
|
i18n.t('screens.login.title'),
|
||||||
true,
|
true,
|
||||||
{ headerTintColor: '#fff' },
|
{ headerTintColor: '#fff' },
|
||||||
'transparent',
|
'transparent'
|
||||||
)}
|
)}
|
||||||
{getWebsiteStack('website', MainStack, WebsiteScreen, '')}
|
{getWebsiteStack('website', MainStack, WebsiteScreen, '')}
|
||||||
|
|
||||||
|
@ -193,19 +197,19 @@ function MainStackComponent(props: {createTabNavigator: () => JSX.Element}) {
|
||||||
MainRoutes.SelfMenu,
|
MainRoutes.SelfMenu,
|
||||||
MainStack,
|
MainStack,
|
||||||
SelfMenuScreen,
|
SelfMenuScreen,
|
||||||
i18n.t('screens.menu.title'),
|
i18n.t('screens.menu.title')
|
||||||
)}
|
)}
|
||||||
{CreateScreenCollapsibleStack(
|
{CreateScreenCollapsibleStack(
|
||||||
MainRoutes.Proximo,
|
MainRoutes.Proximo,
|
||||||
MainStack,
|
MainStack,
|
||||||
ProximoMainScreen,
|
ProximoMainScreen,
|
||||||
i18n.t('screens.proximo.title'),
|
i18n.t('screens.proximo.title')
|
||||||
)}
|
)}
|
||||||
{CreateScreenCollapsibleStack(
|
{CreateScreenCollapsibleStack(
|
||||||
MainRoutes.ProximoList,
|
MainRoutes.ProximoList,
|
||||||
MainStack,
|
MainStack,
|
||||||
ProximoListScreen,
|
ProximoListScreen,
|
||||||
i18n.t('screens.proximo.articleList'),
|
i18n.t('screens.proximo.articleList')
|
||||||
)}
|
)}
|
||||||
{CreateScreenCollapsibleStack(
|
{CreateScreenCollapsibleStack(
|
||||||
MainRoutes.ProximoAbout,
|
MainRoutes.ProximoAbout,
|
||||||
|
@ -213,20 +217,20 @@ function MainStackComponent(props: {createTabNavigator: () => JSX.Element}) {
|
||||||
ProximoAboutScreen,
|
ProximoAboutScreen,
|
||||||
i18n.t('screens.proximo.title'),
|
i18n.t('screens.proximo.title'),
|
||||||
true,
|
true,
|
||||||
{...modalTransition},
|
{ ...modalTransition }
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{CreateScreenCollapsibleStack(
|
{CreateScreenCollapsibleStack(
|
||||||
MainRoutes.Profile,
|
MainRoutes.Profile,
|
||||||
MainStack,
|
MainStack,
|
||||||
ProfileScreen,
|
ProfileScreen,
|
||||||
i18n.t('screens.profile.title'),
|
i18n.t('screens.profile.title')
|
||||||
)}
|
)}
|
||||||
{CreateScreenCollapsibleStack(
|
{CreateScreenCollapsibleStack(
|
||||||
MainRoutes.ClubList,
|
MainRoutes.ClubList,
|
||||||
MainStack,
|
MainStack,
|
||||||
ClubListScreen,
|
ClubListScreen,
|
||||||
i18n.t('screens.clubs.title'),
|
i18n.t('screens.clubs.title')
|
||||||
)}
|
)}
|
||||||
{CreateScreenCollapsibleStack(
|
{CreateScreenCollapsibleStack(
|
||||||
MainRoutes.ClubInformation,
|
MainRoutes.ClubInformation,
|
||||||
|
@ -234,7 +238,7 @@ function MainStackComponent(props: {createTabNavigator: () => JSX.Element}) {
|
||||||
ClubDisplayScreen,
|
ClubDisplayScreen,
|
||||||
i18n.t('screens.clubs.details'),
|
i18n.t('screens.clubs.details'),
|
||||||
true,
|
true,
|
||||||
{...modalTransition},
|
{ ...modalTransition }
|
||||||
)}
|
)}
|
||||||
{CreateScreenCollapsibleStack(
|
{CreateScreenCollapsibleStack(
|
||||||
MainRoutes.ClubAbout,
|
MainRoutes.ClubAbout,
|
||||||
|
@ -242,37 +246,37 @@ function MainStackComponent(props: {createTabNavigator: () => JSX.Element}) {
|
||||||
ClubAboutScreen,
|
ClubAboutScreen,
|
||||||
i18n.t('screens.clubs.title'),
|
i18n.t('screens.clubs.title'),
|
||||||
true,
|
true,
|
||||||
{...modalTransition},
|
{ ...modalTransition }
|
||||||
)}
|
)}
|
||||||
{CreateScreenCollapsibleStack(
|
{CreateScreenCollapsibleStack(
|
||||||
MainRoutes.EquipmentList,
|
MainRoutes.EquipmentList,
|
||||||
MainStack,
|
MainStack,
|
||||||
EquipmentScreen,
|
EquipmentScreen,
|
||||||
i18n.t('screens.equipment.title'),
|
i18n.t('screens.equipment.title')
|
||||||
)}
|
)}
|
||||||
{CreateScreenCollapsibleStack(
|
{CreateScreenCollapsibleStack(
|
||||||
MainRoutes.EquipmentRent,
|
MainRoutes.EquipmentRent,
|
||||||
MainStack,
|
MainStack,
|
||||||
EquipmentLendScreen,
|
EquipmentLendScreen,
|
||||||
i18n.t('screens.equipment.book'),
|
i18n.t('screens.equipment.book')
|
||||||
)}
|
)}
|
||||||
{CreateScreenCollapsibleStack(
|
{CreateScreenCollapsibleStack(
|
||||||
MainRoutes.EquipmentConfirm,
|
MainRoutes.EquipmentConfirm,
|
||||||
MainStack,
|
MainStack,
|
||||||
EquipmentConfirmScreen,
|
EquipmentConfirmScreen,
|
||||||
i18n.t('screens.equipment.confirm'),
|
i18n.t('screens.equipment.confirm')
|
||||||
)}
|
)}
|
||||||
{CreateScreenCollapsibleStack(
|
{CreateScreenCollapsibleStack(
|
||||||
MainRoutes.Vote,
|
MainRoutes.Vote,
|
||||||
MainStack,
|
MainStack,
|
||||||
VoteScreen,
|
VoteScreen,
|
||||||
i18n.t('screens.vote.title'),
|
i18n.t('screens.vote.title')
|
||||||
)}
|
)}
|
||||||
{CreateScreenCollapsibleStack(
|
{CreateScreenCollapsibleStack(
|
||||||
MainRoutes.Feedback,
|
MainRoutes.Feedback,
|
||||||
MainStack,
|
MainStack,
|
||||||
BugReportScreen,
|
BugReportScreen,
|
||||||
i18n.t('screens.feedback.title'),
|
i18n.t('screens.feedback.title')
|
||||||
)}
|
)}
|
||||||
</MainStack.Navigator>
|
</MainStack.Navigator>
|
||||||
);
|
);
|
||||||
|
|
|
@ -18,11 +18,14 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import {createStackNavigator, TransitionPresets} from '@react-navigation/stack';
|
import {
|
||||||
|
createStackNavigator,
|
||||||
|
TransitionPresets,
|
||||||
|
} from '@react-navigation/stack';
|
||||||
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
|
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
|
||||||
|
|
||||||
import { Title, useTheme } from 'react-native-paper';
|
import { Title, useTheme } from 'react-native-paper';
|
||||||
import {Platform} from 'react-native';
|
import { Platform, StyleSheet } from 'react-native';
|
||||||
import i18n from 'i18n-js';
|
import i18n from 'i18n-js';
|
||||||
import { createCollapsibleStack } from 'react-navigation-collapsible';
|
import { createCollapsibleStack } from 'react-navigation-collapsible';
|
||||||
import { View } from 'react-native-animatable';
|
import { View } from 'react-native-animatable';
|
||||||
|
@ -58,6 +61,20 @@ const defaultScreenOptions = {
|
||||||
...modalTransition,
|
...modalTransition,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
header: {
|
||||||
|
flexDirection: 'row',
|
||||||
|
},
|
||||||
|
mascot: {
|
||||||
|
width: 50,
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
marginLeft: 10,
|
||||||
|
marginTop: 'auto',
|
||||||
|
marginBottom: 'auto',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
const ServicesStack = createStackNavigator();
|
const ServicesStack = createStackNavigator();
|
||||||
|
|
||||||
function ServicesStackComponent() {
|
function ServicesStackComponent() {
|
||||||
|
@ -65,24 +82,25 @@ function ServicesStackComponent() {
|
||||||
<ServicesStack.Navigator
|
<ServicesStack.Navigator
|
||||||
initialRouteName="index"
|
initialRouteName="index"
|
||||||
headerMode="screen"
|
headerMode="screen"
|
||||||
screenOptions={defaultScreenOptions}>
|
screenOptions={defaultScreenOptions}
|
||||||
|
>
|
||||||
{CreateScreenCollapsibleStack(
|
{CreateScreenCollapsibleStack(
|
||||||
'index',
|
'index',
|
||||||
ServicesStack,
|
ServicesStack,
|
||||||
WebsitesHomeScreen,
|
WebsitesHomeScreen,
|
||||||
i18n.t('screens.services.title'),
|
i18n.t('screens.services.title')
|
||||||
)}
|
)}
|
||||||
{CreateScreenCollapsibleStack(
|
{CreateScreenCollapsibleStack(
|
||||||
'services-section',
|
'services-section',
|
||||||
ServicesStack,
|
ServicesStack,
|
||||||
ServicesSectionScreen,
|
ServicesSectionScreen,
|
||||||
'SECTION',
|
'SECTION'
|
||||||
)}
|
)}
|
||||||
{CreateScreenCollapsibleStack(
|
{CreateScreenCollapsibleStack(
|
||||||
'amicale-contact',
|
'amicale-contact',
|
||||||
ServicesStack,
|
ServicesStack,
|
||||||
AmicaleContactScreen,
|
AmicaleContactScreen,
|
||||||
i18n.t('screens.amicaleAbout.title'),
|
i18n.t('screens.amicaleAbout.title')
|
||||||
)}
|
)}
|
||||||
</ServicesStack.Navigator>
|
</ServicesStack.Navigator>
|
||||||
);
|
);
|
||||||
|
@ -95,18 +113,19 @@ function ProxiwashStackComponent() {
|
||||||
<ProxiwashStack.Navigator
|
<ProxiwashStack.Navigator
|
||||||
initialRouteName="index"
|
initialRouteName="index"
|
||||||
headerMode="screen"
|
headerMode="screen"
|
||||||
screenOptions={defaultScreenOptions}>
|
screenOptions={defaultScreenOptions}
|
||||||
|
>
|
||||||
{CreateScreenCollapsibleStack(
|
{CreateScreenCollapsibleStack(
|
||||||
'index',
|
'index',
|
||||||
ProxiwashStack,
|
ProxiwashStack,
|
||||||
ProxiwashScreen,
|
ProxiwashScreen,
|
||||||
i18n.t('screens.proxiwash.title'),
|
i18n.t('screens.proxiwash.title')
|
||||||
)}
|
)}
|
||||||
{CreateScreenCollapsibleStack(
|
{CreateScreenCollapsibleStack(
|
||||||
'proxiwash-about',
|
'proxiwash-about',
|
||||||
ProxiwashStack,
|
ProxiwashStack,
|
||||||
ProxiwashAboutScreen,
|
ProxiwashAboutScreen,
|
||||||
i18n.t('screens.proxiwash.title'),
|
i18n.t('screens.proxiwash.title')
|
||||||
)}
|
)}
|
||||||
</ProxiwashStack.Navigator>
|
</ProxiwashStack.Navigator>
|
||||||
);
|
);
|
||||||
|
@ -119,7 +138,8 @@ function PlanningStackComponent() {
|
||||||
<PlanningStack.Navigator
|
<PlanningStack.Navigator
|
||||||
initialRouteName="index"
|
initialRouteName="index"
|
||||||
headerMode="screen"
|
headerMode="screen"
|
||||||
screenOptions={defaultScreenOptions}>
|
screenOptions={defaultScreenOptions}
|
||||||
|
>
|
||||||
<PlanningStack.Screen
|
<PlanningStack.Screen
|
||||||
name="index"
|
name="index"
|
||||||
component={PlanningScreen}
|
component={PlanningScreen}
|
||||||
|
@ -129,7 +149,7 @@ function PlanningStackComponent() {
|
||||||
'planning-information',
|
'planning-information',
|
||||||
PlanningStack,
|
PlanningStack,
|
||||||
PlanningDisplayScreen,
|
PlanningDisplayScreen,
|
||||||
i18n.t('screens.planning.eventDetails'),
|
i18n.t('screens.planning.eventDetails')
|
||||||
)}
|
)}
|
||||||
</PlanningStack.Navigator>
|
</PlanningStack.Navigator>
|
||||||
);
|
);
|
||||||
|
@ -139,7 +159,7 @@ const HomeStack = createStackNavigator();
|
||||||
|
|
||||||
function HomeStackComponent(
|
function HomeStackComponent(
|
||||||
initialRoute: string | null,
|
initialRoute: string | null,
|
||||||
defaultData: {[key: string]: string},
|
defaultData: { [key: string]: string }
|
||||||
) {
|
) {
|
||||||
let params;
|
let params;
|
||||||
if (initialRoute) {
|
if (initialRoute) {
|
||||||
|
@ -150,7 +170,8 @@ function HomeStackComponent(
|
||||||
<HomeStack.Navigator
|
<HomeStack.Navigator
|
||||||
initialRouteName="index"
|
initialRouteName="index"
|
||||||
headerMode="screen"
|
headerMode="screen"
|
||||||
screenOptions={defaultScreenOptions}>
|
screenOptions={defaultScreenOptions}
|
||||||
|
>
|
||||||
{createCollapsibleStack(
|
{createCollapsibleStack(
|
||||||
<HomeStack.Screen
|
<HomeStack.Screen
|
||||||
name="index"
|
name="index"
|
||||||
|
@ -161,11 +182,9 @@ function HomeStackComponent(
|
||||||
backgroundColor: colors.surface,
|
backgroundColor: colors.surface,
|
||||||
},
|
},
|
||||||
headerTitle: () => (
|
headerTitle: () => (
|
||||||
<View style={{flexDirection: 'row'}}>
|
<View style={styles.header}>
|
||||||
<Mascot
|
<Mascot
|
||||||
style={{
|
style={styles.mascot}
|
||||||
width: 50,
|
|
||||||
}}
|
|
||||||
emotion={MASCOT_STYLE.RANDOM}
|
emotion={MASCOT_STYLE.RANDOM}
|
||||||
animated
|
animated
|
||||||
entryAnimation={{
|
entryAnimation={{
|
||||||
|
@ -178,12 +197,7 @@ function HomeStackComponent(
|
||||||
iterationCount: 'infinite',
|
iterationCount: 'infinite',
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Title
|
<Title style={styles.title}>
|
||||||
style={{
|
|
||||||
marginLeft: 10,
|
|
||||||
marginTop: 'auto',
|
|
||||||
marginBottom: 'auto',
|
|
||||||
}}>
|
|
||||||
{i18n.t('screens.home.title')}
|
{i18n.t('screens.home.title')}
|
||||||
</Title>
|
</Title>
|
||||||
</View>
|
</View>
|
||||||
|
@ -194,7 +208,7 @@ function HomeStackComponent(
|
||||||
{
|
{
|
||||||
collapsedColor: colors.surface,
|
collapsedColor: colors.surface,
|
||||||
useNativeDriver: true,
|
useNativeDriver: true,
|
||||||
},
|
}
|
||||||
)}
|
)}
|
||||||
<HomeStack.Screen
|
<HomeStack.Screen
|
||||||
name="scanner"
|
name="scanner"
|
||||||
|
@ -206,19 +220,19 @@ function HomeStackComponent(
|
||||||
'club-information',
|
'club-information',
|
||||||
HomeStack,
|
HomeStack,
|
||||||
ClubDisplayScreen,
|
ClubDisplayScreen,
|
||||||
i18n.t('screens.clubs.details'),
|
i18n.t('screens.clubs.details')
|
||||||
)}
|
)}
|
||||||
{CreateScreenCollapsibleStack(
|
{CreateScreenCollapsibleStack(
|
||||||
'feed-information',
|
'feed-information',
|
||||||
HomeStack,
|
HomeStack,
|
||||||
FeedItemScreen,
|
FeedItemScreen,
|
||||||
i18n.t('screens.home.feed'),
|
i18n.t('screens.home.feed')
|
||||||
)}
|
)}
|
||||||
{CreateScreenCollapsibleStack(
|
{CreateScreenCollapsibleStack(
|
||||||
'planning-information',
|
'planning-information',
|
||||||
HomeStack,
|
HomeStack,
|
||||||
PlanningDisplayScreen,
|
PlanningDisplayScreen,
|
||||||
i18n.t('screens.planning.eventDetails'),
|
i18n.t('screens.planning.eventDetails')
|
||||||
)}
|
)}
|
||||||
</HomeStack.Navigator>
|
</HomeStack.Navigator>
|
||||||
);
|
);
|
||||||
|
@ -231,18 +245,19 @@ function PlanexStackComponent() {
|
||||||
<PlanexStack.Navigator
|
<PlanexStack.Navigator
|
||||||
initialRouteName="index"
|
initialRouteName="index"
|
||||||
headerMode="screen"
|
headerMode="screen"
|
||||||
screenOptions={defaultScreenOptions}>
|
screenOptions={defaultScreenOptions}
|
||||||
|
>
|
||||||
{getWebsiteStack(
|
{getWebsiteStack(
|
||||||
'index',
|
'index',
|
||||||
PlanexStack,
|
PlanexStack,
|
||||||
PlanexScreen,
|
PlanexScreen,
|
||||||
i18n.t('screens.planex.title'),
|
i18n.t('screens.planex.title')
|
||||||
)}
|
)}
|
||||||
{CreateScreenCollapsibleStack(
|
{CreateScreenCollapsibleStack(
|
||||||
'group-select',
|
'group-select',
|
||||||
PlanexStack,
|
PlanexStack,
|
||||||
GroupSelectionScreen,
|
GroupSelectionScreen,
|
||||||
'',
|
''
|
||||||
)}
|
)}
|
||||||
</PlanexStack.Navigator>
|
</PlanexStack.Navigator>
|
||||||
);
|
);
|
||||||
|
@ -264,7 +279,7 @@ export default class TabNavigator extends React.Component<PropsType> {
|
||||||
this.defaultRoute = 'home';
|
this.defaultRoute = 'home';
|
||||||
if (!props.defaultHomeRoute) {
|
if (!props.defaultHomeRoute) {
|
||||||
this.defaultRoute = AsyncStorageManager.getString(
|
this.defaultRoute = AsyncStorageManager.getString(
|
||||||
AsyncStorageManager.PREFERENCES.defaultStartScreen.key,
|
AsyncStorageManager.PREFERENCES.defaultStartScreen.key
|
||||||
).toLowerCase();
|
).toLowerCase();
|
||||||
}
|
}
|
||||||
this.createHomeStackComponent = () =>
|
this.createHomeStackComponent = () =>
|
||||||
|
@ -275,7 +290,8 @@ export default class TabNavigator extends React.Component<PropsType> {
|
||||||
return (
|
return (
|
||||||
<Tab.Navigator
|
<Tab.Navigator
|
||||||
initialRouteName={this.defaultRoute}
|
initialRouteName={this.defaultRoute}
|
||||||
tabBar={(tabProps) => <CustomTabBar {...tabProps} />}>
|
tabBar={(tabProps) => <CustomTabBar {...tabProps} />}
|
||||||
|
>
|
||||||
<Tab.Screen
|
<Tab.Screen
|
||||||
name="services"
|
name="services"
|
||||||
component={ServicesStackComponent}
|
component={ServicesStackComponent}
|
||||||
|
|
|
@ -70,7 +70,7 @@ export default class AboutDependenciesScreen extends React.Component<{}> {
|
||||||
|
|
||||||
getItemLayout = (
|
getItemLayout = (
|
||||||
data: Array<ListItemType> | null | undefined,
|
data: Array<ListItemType> | null | undefined,
|
||||||
index: number,
|
index: number
|
||||||
): { length: number; offset: number; index: number } => ({
|
): { length: number; offset: number; index: number } => ({
|
||||||
length: LIST_ITEM_HEIGHT,
|
length: LIST_ITEM_HEIGHT,
|
||||||
offset: LIST_ITEM_HEIGHT * index,
|
offset: LIST_ITEM_HEIGHT * index,
|
||||||
|
|
|
@ -18,7 +18,14 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import {FlatList, Linking, Platform, Image, View} from 'react-native';
|
import {
|
||||||
|
FlatList,
|
||||||
|
Linking,
|
||||||
|
Platform,
|
||||||
|
Image,
|
||||||
|
View,
|
||||||
|
StyleSheet,
|
||||||
|
} from 'react-native';
|
||||||
import i18n from 'i18n-js';
|
import i18n from 'i18n-js';
|
||||||
import { Avatar, Card, List } from 'react-native-paper';
|
import { Avatar, Card, List } from 'react-native-paper';
|
||||||
import { StackNavigationProp } from '@react-navigation/stack';
|
import { StackNavigationProp } from '@react-navigation/stack';
|
||||||
|
@ -26,6 +33,7 @@ import packageJson from '../../../package.json';
|
||||||
import CollapsibleFlatList from '../../components/Collapsible/CollapsibleFlatList';
|
import CollapsibleFlatList from '../../components/Collapsible/CollapsibleFlatList';
|
||||||
import OptionsDialog from '../../components/Dialogs/OptionsDialog';
|
import OptionsDialog from '../../components/Dialogs/OptionsDialog';
|
||||||
import type { OptionsDialogButtonType } from '../../components/Dialogs/OptionsDialog';
|
import type { OptionsDialogButtonType } from '../../components/Dialogs/OptionsDialog';
|
||||||
|
import GENERAL_STYLES from '../../constants/Styles';
|
||||||
|
|
||||||
const APP_LOGO = require('../../../assets/android.icon.round.png');
|
const APP_LOGO = require('../../../assets/android.icon.round.png');
|
||||||
|
|
||||||
|
@ -69,6 +77,15 @@ type StateType = {
|
||||||
dialogButtons: Array<OptionsDialogButtonType>;
|
dialogButtons: Array<OptionsDialogButtonType>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
card: {
|
||||||
|
marginBottom: 10,
|
||||||
|
},
|
||||||
|
list: {
|
||||||
|
padding: 5,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens a link in the device's browser
|
* Opens a link in the device's browser
|
||||||
* @param link The link to open
|
* @param link The link to open
|
||||||
|
@ -348,7 +365,7 @@ class AboutScreen extends React.Component<PropsType, StateType> {
|
||||||
*/
|
*/
|
||||||
getAppCard() {
|
getAppCard() {
|
||||||
return (
|
return (
|
||||||
<Card style={{marginBottom: 10}}>
|
<Card style={styles.card}>
|
||||||
<Card.Title
|
<Card.Title
|
||||||
title="Campus"
|
title="Campus"
|
||||||
subtitle={packageJson.version}
|
subtitle={packageJson.version}
|
||||||
|
@ -377,7 +394,7 @@ class AboutScreen extends React.Component<PropsType, StateType> {
|
||||||
*/
|
*/
|
||||||
getTeamCard() {
|
getTeamCard() {
|
||||||
return (
|
return (
|
||||||
<Card style={{marginBottom: 10}}>
|
<Card style={styles.card}>
|
||||||
<Card.Title
|
<Card.Title
|
||||||
title={i18n.t('screens.about.team')}
|
title={i18n.t('screens.about.team')}
|
||||||
left={(iconProps) => (
|
left={(iconProps) => (
|
||||||
|
@ -402,7 +419,7 @@ class AboutScreen extends React.Component<PropsType, StateType> {
|
||||||
*/
|
*/
|
||||||
getThanksCard() {
|
getThanksCard() {
|
||||||
return (
|
return (
|
||||||
<Card style={{marginBottom: 10}}>
|
<Card style={styles.card}>
|
||||||
<Card.Title
|
<Card.Title
|
||||||
title={i18n.t('screens.about.thanks')}
|
title={i18n.t('screens.about.thanks')}
|
||||||
left={(iconProps) => (
|
left={(iconProps) => (
|
||||||
|
@ -427,7 +444,7 @@ class AboutScreen extends React.Component<PropsType, StateType> {
|
||||||
*/
|
*/
|
||||||
getTechnoCard() {
|
getTechnoCard() {
|
||||||
return (
|
return (
|
||||||
<Card style={{marginBottom: 10}}>
|
<Card style={styles.card}>
|
||||||
<Card.Title
|
<Card.Title
|
||||||
title={i18n.t('screens.about.technologies')}
|
title={i18n.t('screens.about.technologies')}
|
||||||
left={(iconProps) => (
|
left={(iconProps) => (
|
||||||
|
@ -478,7 +495,7 @@ class AboutScreen extends React.Component<PropsType, StateType> {
|
||||||
marginRight: number;
|
marginRight: number;
|
||||||
marginVertical?: number;
|
marginVertical?: number;
|
||||||
};
|
};
|
||||||
},
|
}
|
||||||
) {
|
) {
|
||||||
return (
|
return (
|
||||||
<List.Icon color={props.color} style={props.style} icon={item.icon} />
|
<List.Icon color={props.color} style={props.style} icon={item.icon} />
|
||||||
|
@ -553,12 +570,9 @@ class AboutScreen extends React.Component<PropsType, StateType> {
|
||||||
render() {
|
render() {
|
||||||
const { state } = this;
|
const { state } = this;
|
||||||
return (
|
return (
|
||||||
<View
|
<View style={GENERAL_STYLES.flex}>
|
||||||
style={{
|
|
||||||
height: '100%',
|
|
||||||
}}>
|
|
||||||
<CollapsibleFlatList
|
<CollapsibleFlatList
|
||||||
style={{padding: 5}}
|
style={styles.list}
|
||||||
data={this.dataOrder}
|
data={this.dataOrder}
|
||||||
renderItem={this.getMainCard}
|
renderItem={this.getMainCard}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import {View} from 'react-native';
|
import { StyleSheet, View } from 'react-native';
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
List,
|
List,
|
||||||
|
@ -47,6 +47,17 @@ type StateType = {
|
||||||
currentPreferences: Array<PreferenceItemType>;
|
currentPreferences: Array<PreferenceItemType>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
container: {
|
||||||
|
flex: 1,
|
||||||
|
padding: 20,
|
||||||
|
},
|
||||||
|
buttonContainer: {
|
||||||
|
flexDirection: 'row',
|
||||||
|
marginTop: 10,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class defining the Debug screen.
|
* Class defining the Debug screen.
|
||||||
* This screen allows the user to get and modify information on the app/device.
|
* This screen allows the user to get and modify information on the app/device.
|
||||||
|
@ -95,11 +106,7 @@ class DebugScreen extends React.Component<PropsType, StateType> {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View
|
<View style={styles.container}>
|
||||||
style={{
|
|
||||||
flex: 1,
|
|
||||||
padding: 20,
|
|
||||||
}}>
|
|
||||||
<Title>{key}</Title>
|
<Title>{key}</Title>
|
||||||
<Subheading>Default: {defaultValue}</Subheading>
|
<Subheading>Default: {defaultValue}</Subheading>
|
||||||
<Subheading>Current: {current}</Subheading>
|
<Subheading>Current: {current}</Subheading>
|
||||||
|
@ -109,18 +116,15 @@ class DebugScreen extends React.Component<PropsType, StateType> {
|
||||||
this.modalInputValue = text;
|
this.modalInputValue = text;
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<View
|
<View style={styles.buttonContainer}>
|
||||||
style={{
|
|
||||||
flexDirection: 'row',
|
|
||||||
marginTop: 10,
|
|
||||||
}}>
|
|
||||||
<Button
|
<Button
|
||||||
mode="contained"
|
mode="contained"
|
||||||
dark
|
dark
|
||||||
color={props.theme.colors.success}
|
color={props.theme.colors.success}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
this.saveNewPrefs(key, this.modalInputValue);
|
this.saveNewPrefs(key, this.modalInputValue);
|
||||||
}}>
|
}}
|
||||||
|
>
|
||||||
Save new value
|
Save new value
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
|
@ -129,7 +133,8 @@ class DebugScreen extends React.Component<PropsType, StateType> {
|
||||||
color={props.theme.colors.danger}
|
color={props.theme.colors.danger}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
this.saveNewPrefs(key, defaultValue);
|
this.saveNewPrefs(key, defaultValue);
|
||||||
}}>
|
}}
|
||||||
|
>
|
||||||
Reset to default
|
Reset to default
|
||||||
</Button>
|
</Button>
|
||||||
</View>
|
</View>
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import {FlatList, Image, Linking, View} from 'react-native';
|
import { FlatList, Image, Linking, StyleSheet, View } from 'react-native';
|
||||||
import { Avatar, Card, List, Text } from 'react-native-paper';
|
import { Avatar, Card, List, Text } from 'react-native-paper';
|
||||||
import i18n from 'i18n-js';
|
import i18n from 'i18n-js';
|
||||||
import CollapsibleFlatList from '../../components/Collapsible/CollapsibleFlatList';
|
import CollapsibleFlatList from '../../components/Collapsible/CollapsibleFlatList';
|
||||||
|
@ -31,6 +31,24 @@ type DatasetItemType = {
|
||||||
icon: string;
|
icon: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
imageContainer: {
|
||||||
|
width: '100%',
|
||||||
|
height: 100,
|
||||||
|
marginTop: 20,
|
||||||
|
marginBottom: 20,
|
||||||
|
justifyContent: 'center',
|
||||||
|
alignItems: 'center',
|
||||||
|
},
|
||||||
|
image: {
|
||||||
|
flex: 1,
|
||||||
|
resizeMode: 'contain',
|
||||||
|
},
|
||||||
|
card: {
|
||||||
|
margin: 5,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class defining a planning event information page.
|
* Class defining a planning event information page.
|
||||||
*/
|
*/
|
||||||
|
@ -129,22 +147,14 @@ class AmicaleContactScreen extends React.Component<{}> {
|
||||||
getScreen = () => {
|
getScreen = () => {
|
||||||
return (
|
return (
|
||||||
<View>
|
<View>
|
||||||
<View
|
<View style={styles.imageContainer}>
|
||||||
style={{
|
|
||||||
width: '100%',
|
|
||||||
height: 100,
|
|
||||||
marginTop: 20,
|
|
||||||
marginBottom: 20,
|
|
||||||
justifyContent: 'center',
|
|
||||||
alignItems: 'center',
|
|
||||||
}}>
|
|
||||||
<Image
|
<Image
|
||||||
source={AMICALE_LOGO}
|
source={AMICALE_LOGO}
|
||||||
style={{flex: 1, resizeMode: 'contain'}}
|
style={styles.image}
|
||||||
resizeMode="contain"
|
resizeMode="contain"
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
<Card style={{margin: 5}}>
|
<Card style={styles.card}>
|
||||||
<Card.Title
|
<Card.Title
|
||||||
title={i18n.t('screens.amicaleAbout.title')}
|
title={i18n.t('screens.amicaleAbout.title')}
|
||||||
subtitle={i18n.t('screens.amicaleAbout.subtitle')}
|
subtitle={i18n.t('screens.amicaleAbout.subtitle')}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import {Image, View} from 'react-native';
|
import { Image, StyleSheet, View } from 'react-native';
|
||||||
import { Card, Avatar, Text } from 'react-native-paper';
|
import { Card, Avatar, Text } from 'react-native-paper';
|
||||||
import i18n from 'i18n-js';
|
import i18n from 'i18n-js';
|
||||||
import Autolink from 'react-native-autolink';
|
import Autolink from 'react-native-autolink';
|
||||||
|
@ -27,26 +27,39 @@ const AMICALE_ICON = require('../../../../assets/amicale.png');
|
||||||
|
|
||||||
const CONTACT_LINK = 'clubs@amicale-insat.fr';
|
const CONTACT_LINK = 'clubs@amicale-insat.fr';
|
||||||
|
|
||||||
function ClubAboutScreen() {
|
const styles = StyleSheet.create({
|
||||||
return (
|
container: {
|
||||||
<CollapsibleScrollView style={{padding: 5}}>
|
padding: 5,
|
||||||
<View
|
},
|
||||||
style={{
|
imageContainer: {
|
||||||
width: '100%',
|
width: '100%',
|
||||||
height: 100,
|
height: 100,
|
||||||
marginTop: 20,
|
marginTop: 20,
|
||||||
marginBottom: 20,
|
marginBottom: 20,
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
}}>
|
},
|
||||||
|
image: {
|
||||||
|
flex: 1,
|
||||||
|
resizeMode: 'contain',
|
||||||
|
},
|
||||||
|
card: {
|
||||||
|
margin: 5,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
function ClubAboutScreen() {
|
||||||
|
return (
|
||||||
|
<CollapsibleScrollView style={styles.container}>
|
||||||
|
<View style={styles.imageContainer}>
|
||||||
<Image
|
<Image
|
||||||
source={AMICALE_ICON}
|
source={AMICALE_ICON}
|
||||||
style={{flex: 1, resizeMode: 'contain'}}
|
style={styles.image}
|
||||||
resizeMode="contain"
|
resizeMode="contain"
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
<Text>{i18n.t('screens.clubs.about.text')}</Text>
|
<Text>{i18n.t('screens.clubs.about.text')}</Text>
|
||||||
<Card style={{margin: 5}}>
|
<Card style={styles.card}>
|
||||||
<Card.Title
|
<Card.Title
|
||||||
title={i18n.t('screens.clubs.about.title')}
|
title={i18n.t('screens.clubs.about.title')}
|
||||||
subtitle={i18n.t('screens.clubs.about.subtitle')}
|
subtitle={i18n.t('screens.clubs.about.subtitle')}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import {Linking, View} from 'react-native';
|
import { Linking, StyleSheet, View } from 'react-native';
|
||||||
import {
|
import {
|
||||||
Avatar,
|
Avatar,
|
||||||
Button,
|
Button,
|
||||||
|
@ -51,6 +51,37 @@ type PropsType = {
|
||||||
|
|
||||||
const AMICALE_MAIL = 'clubs@amicale-insat.fr';
|
const AMICALE_MAIL = 'clubs@amicale-insat.fr';
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
category: {
|
||||||
|
marginRight: 5,
|
||||||
|
},
|
||||||
|
categoryContainer: {
|
||||||
|
flexDirection: 'row',
|
||||||
|
marginTop: 5,
|
||||||
|
},
|
||||||
|
card: {
|
||||||
|
marginTop: 10,
|
||||||
|
},
|
||||||
|
icon: {
|
||||||
|
backgroundColor: 'transparent',
|
||||||
|
},
|
||||||
|
emailButton: {
|
||||||
|
marginLeft: 'auto',
|
||||||
|
},
|
||||||
|
scroll: {
|
||||||
|
paddingLeft: 5,
|
||||||
|
paddingRight: 5,
|
||||||
|
},
|
||||||
|
imageButton: {
|
||||||
|
width: 300,
|
||||||
|
height: 300,
|
||||||
|
marginLeft: 'auto',
|
||||||
|
marginRight: 'auto',
|
||||||
|
marginTop: 10,
|
||||||
|
marginBottom: 10,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class defining a club event information page.
|
* Class defining a club event information page.
|
||||||
* If called with data and categories navigation parameters, will use those to display the data.
|
* If called with data and categories navigation parameters, will use those to display the data.
|
||||||
|
@ -117,13 +148,13 @@ class ClubDisplayScreen extends React.Component<PropsType> {
|
||||||
categories.forEach((cat: number | null) => {
|
categories.forEach((cat: number | null) => {
|
||||||
if (cat != null) {
|
if (cat != null) {
|
||||||
final.push(
|
final.push(
|
||||||
<Chip style={{marginRight: 5}} key={cat}>
|
<Chip style={styles.category} key={cat}>
|
||||||
{this.getCategoryName(cat)}
|
{this.getCategoryName(cat)}
|
||||||
</Chip>,
|
</Chip>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return <View style={{flexDirection: 'row', marginTop: 5}}>{final}</View>;
|
return <View style={styles.categoryContainer}>{final}</View>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -142,7 +173,11 @@ class ClubDisplayScreen extends React.Component<PropsType> {
|
||||||
const hasManagers = managers.length > 0;
|
const hasManagers = managers.length > 0;
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
style={{marginTop: 10, marginBottom: CustomTabBar.TAB_BAR_HEIGHT + 20}}>
|
style={{
|
||||||
|
marginBottom: CustomTabBar.TAB_BAR_HEIGHT + 20,
|
||||||
|
...styles.card,
|
||||||
|
}}
|
||||||
|
>
|
||||||
<Card.Title
|
<Card.Title
|
||||||
title={i18n.t('screens.clubs.managers')}
|
title={i18n.t('screens.clubs.managers')}
|
||||||
subtitle={
|
subtitle={
|
||||||
|
@ -153,7 +188,7 @@ class ClubDisplayScreen extends React.Component<PropsType> {
|
||||||
left={(iconProps) => (
|
left={(iconProps) => (
|
||||||
<Avatar.Icon
|
<Avatar.Icon
|
||||||
size={iconProps.size}
|
size={iconProps.size}
|
||||||
style={{backgroundColor: 'transparent'}}
|
style={styles.icon}
|
||||||
color={
|
color={
|
||||||
hasManagers
|
hasManagers
|
||||||
? props.theme.colors.success
|
? props.theme.colors.success
|
||||||
|
@ -193,7 +228,8 @@ class ClubDisplayScreen extends React.Component<PropsType> {
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
Linking.openURL(`mailto:${destinationEmail}`);
|
Linking.openURL(`mailto:${destinationEmail}`);
|
||||||
}}
|
}}
|
||||||
style={{marginLeft: 'auto'}}>
|
style={styles.emailButton}
|
||||||
|
>
|
||||||
{text}
|
{text}
|
||||||
</Button>
|
</Button>
|
||||||
</Card.Actions>
|
</Card.Actions>
|
||||||
|
@ -205,19 +241,12 @@ class ClubDisplayScreen extends React.Component<PropsType> {
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
this.updateHeaderTitle(data);
|
this.updateHeaderTitle(data);
|
||||||
return (
|
return (
|
||||||
<CollapsibleScrollView style={{paddingLeft: 5, paddingRight: 5}} hasTab>
|
<CollapsibleScrollView style={styles.scroll} hasTab>
|
||||||
{this.getCategoriesRender(data.category)}
|
{this.getCategoriesRender(data.category)}
|
||||||
{data.logo !== null ? (
|
{data.logo !== null ? (
|
||||||
<ImageGalleryButton
|
<ImageGalleryButton
|
||||||
images={[{ url: data.logo }]}
|
images={[{ url: data.logo }]}
|
||||||
style={{
|
style={styles.imageButton}
|
||||||
width: 300,
|
|
||||||
height: 300,
|
|
||||||
marginLeft: 'auto',
|
|
||||||
marginRight: 'auto',
|
|
||||||
marginTop: 10,
|
|
||||||
marginBottom: 10,
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<View />
|
<View />
|
||||||
|
|
|
@ -24,7 +24,10 @@ import i18n from 'i18n-js';
|
||||||
import { StackNavigationProp } from '@react-navigation/stack';
|
import { StackNavigationProp } from '@react-navigation/stack';
|
||||||
import AuthenticatedScreen from '../../../components/Amicale/AuthenticatedScreen';
|
import AuthenticatedScreen from '../../../components/Amicale/AuthenticatedScreen';
|
||||||
import ClubListItem from '../../../components/Lists/Clubs/ClubListItem';
|
import ClubListItem from '../../../components/Lists/Clubs/ClubListItem';
|
||||||
import {isItemInCategoryFilter, stringMatchQuery} from '../../../utils/Search';
|
import {
|
||||||
|
isItemInCategoryFilter,
|
||||||
|
stringMatchQuery,
|
||||||
|
} from '../../../utils/Search';
|
||||||
import ClubListHeader from '../../../components/Lists/Clubs/ClubListHeader';
|
import ClubListHeader from '../../../components/Lists/Clubs/ClubListHeader';
|
||||||
import MaterialHeaderButtons, {
|
import MaterialHeaderButtons, {
|
||||||
Item,
|
Item,
|
||||||
|
@ -147,7 +150,7 @@ class ClubListScreen extends React.Component<PropsType, StateType> {
|
||||||
data: Array<{
|
data: Array<{
|
||||||
categories: Array<ClubCategoryType>;
|
categories: Array<ClubCategoryType>;
|
||||||
clubs: Array<ClubType>;
|
clubs: Array<ClubType>;
|
||||||
} | null>,
|
} | null>
|
||||||
) => {
|
) => {
|
||||||
let categoryList: Array<ClubCategoryType> = [];
|
let categoryList: Array<ClubCategoryType> = [];
|
||||||
let clubList: Array<ClubType> = [];
|
let clubList: Array<ClubType> = [];
|
||||||
|
@ -222,7 +225,7 @@ class ClubListScreen extends React.Component<PropsType, StateType> {
|
||||||
|
|
||||||
itemLayout = (
|
itemLayout = (
|
||||||
data: Array<ClubType> | null | undefined,
|
data: Array<ClubType> | null | undefined,
|
||||||
index: number,
|
index: number
|
||||||
): { length: number; offset: number; index: number } => ({
|
): { length: number; offset: number; index: number } => ({
|
||||||
length: LIST_ITEM_HEIGHT,
|
length: LIST_ITEM_HEIGHT,
|
||||||
offset: LIST_ITEM_HEIGHT * index,
|
offset: LIST_ITEM_HEIGHT * index,
|
||||||
|
|
|
@ -26,12 +26,13 @@ import {
|
||||||
Title,
|
Title,
|
||||||
useTheme,
|
useTheme,
|
||||||
} from 'react-native-paper';
|
} from 'react-native-paper';
|
||||||
import {View} from 'react-native';
|
import { StyleSheet, View } from 'react-native';
|
||||||
import i18n from 'i18n-js';
|
import i18n from 'i18n-js';
|
||||||
import { getRelativeDateString } from '../../../utils/EquipmentBooking';
|
import { getRelativeDateString } from '../../../utils/EquipmentBooking';
|
||||||
import CollapsibleScrollView from '../../../components/Collapsible/CollapsibleScrollView';
|
import CollapsibleScrollView from '../../../components/Collapsible/CollapsibleScrollView';
|
||||||
import { StackScreenProps } from '@react-navigation/stack';
|
import { StackScreenProps } from '@react-navigation/stack';
|
||||||
import { MainStackParamsList } from '../../../navigation/MainNavigator';
|
import { MainStackParamsList } from '../../../navigation/MainNavigator';
|
||||||
|
import GENERAL_STYLES from '../../../constants/Styles';
|
||||||
|
|
||||||
type EquipmentConfirmScreenNavigationProp = StackScreenProps<
|
type EquipmentConfirmScreenNavigationProp = StackScreenProps<
|
||||||
MainStackParamsList,
|
MainStackParamsList,
|
||||||
|
@ -40,6 +41,32 @@ type EquipmentConfirmScreenNavigationProp = StackScreenProps<
|
||||||
|
|
||||||
type Props = EquipmentConfirmScreenNavigationProp;
|
type Props = EquipmentConfirmScreenNavigationProp;
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
card: {
|
||||||
|
margin: 5,
|
||||||
|
},
|
||||||
|
titleContainer: {
|
||||||
|
marginLeft: 'auto',
|
||||||
|
marginRight: 'auto',
|
||||||
|
flexDirection: 'row',
|
||||||
|
flexWrap: 'wrap',
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
textAlign: 'center',
|
||||||
|
},
|
||||||
|
caption: {
|
||||||
|
textAlign: 'center',
|
||||||
|
lineHeight: 35,
|
||||||
|
marginLeft: 10,
|
||||||
|
},
|
||||||
|
subtitle: {
|
||||||
|
textAlign: 'center',
|
||||||
|
},
|
||||||
|
text: {
|
||||||
|
textAlign: 'center',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
function EquipmentConfirmScreen(props: Props) {
|
function EquipmentConfirmScreen(props: Props) {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const item = props.route.params?.item;
|
const item = props.route.params?.item;
|
||||||
|
@ -63,31 +90,20 @@ function EquipmentConfirmScreen(props: Props) {
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<CollapsibleScrollView>
|
<CollapsibleScrollView>
|
||||||
<Card style={{margin: 5}}>
|
<Card style={styles.card}>
|
||||||
<Card.Content>
|
<Card.Content>
|
||||||
<View style={{flex: 1}}>
|
<View style={GENERAL_STYLES.flex}>
|
||||||
<View
|
<View style={styles.titleContainer}>
|
||||||
style={{
|
<Headline style={styles.title}>{item.name}</Headline>
|
||||||
marginLeft: 'auto',
|
<Caption style={styles.caption}>
|
||||||
marginRight: 'auto',
|
|
||||||
flexDirection: 'row',
|
|
||||||
flexWrap: 'wrap',
|
|
||||||
}}>
|
|
||||||
<Headline style={{textAlign: 'center'}}>{item.name}</Headline>
|
|
||||||
<Caption
|
|
||||||
style={{
|
|
||||||
textAlign: 'center',
|
|
||||||
lineHeight: 35,
|
|
||||||
marginLeft: 10,
|
|
||||||
}}>
|
|
||||||
({i18n.t('screens.equipment.bail', { cost: item.caution })})
|
({i18n.t('screens.equipment.bail', { cost: item.caution })})
|
||||||
</Caption>
|
</Caption>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<Title style={{color: theme.colors.success, textAlign: 'center'}}>
|
<Title style={{ color: theme.colors.success, ...styles.subtitle }}>
|
||||||
{buttonText}
|
{buttonText}
|
||||||
</Title>
|
</Title>
|
||||||
<Paragraph style={{textAlign: 'center'}}>
|
<Paragraph style={styles.text}>
|
||||||
{i18n.t('screens.equipment.bookingConfirmedMessage')}
|
{i18n.t('screens.equipment.bookingConfirmedMessage')}
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
</Card.Content>
|
</Card.Content>
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import {View} from 'react-native';
|
import { StyleSheet, View } from 'react-native';
|
||||||
import { Button } from 'react-native-paper';
|
import { Button } from 'react-native-paper';
|
||||||
import { StackNavigationProp } from '@react-navigation/stack';
|
import { StackNavigationProp } from '@react-navigation/stack';
|
||||||
import i18n from 'i18n-js';
|
import i18n from 'i18n-js';
|
||||||
|
@ -28,6 +28,7 @@ import MascotPopup from '../../../components/Mascot/MascotPopup';
|
||||||
import { MASCOT_STYLE } from '../../../components/Mascot/Mascot';
|
import { MASCOT_STYLE } from '../../../components/Mascot/Mascot';
|
||||||
import AsyncStorageManager from '../../../managers/AsyncStorageManager';
|
import AsyncStorageManager from '../../../managers/AsyncStorageManager';
|
||||||
import CollapsibleFlatList from '../../../components/Collapsible/CollapsibleFlatList';
|
import CollapsibleFlatList from '../../../components/Collapsible/CollapsibleFlatList';
|
||||||
|
import GENERAL_STYLES from '../../../constants/Styles';
|
||||||
|
|
||||||
type PropsType = {
|
type PropsType = {
|
||||||
navigation: StackNavigationProp<any>;
|
navigation: StackNavigationProp<any>;
|
||||||
|
@ -53,6 +54,14 @@ export type RentedDeviceType = {
|
||||||
|
|
||||||
const LIST_ITEM_HEIGHT = 64;
|
const LIST_ITEM_HEIGHT = 64;
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
headerContainer: {
|
||||||
|
width: '100%',
|
||||||
|
marginTop: 10,
|
||||||
|
marginBottom: 10,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
class EquipmentListScreen extends React.Component<PropsType, StateType> {
|
class EquipmentListScreen extends React.Component<PropsType, StateType> {
|
||||||
userRents: null | Array<RentedDeviceType>;
|
userRents: null | Array<RentedDeviceType>;
|
||||||
|
|
||||||
|
@ -65,7 +74,7 @@ class EquipmentListScreen extends React.Component<PropsType, StateType> {
|
||||||
this.userRents = null;
|
this.userRents = null;
|
||||||
this.state = {
|
this.state = {
|
||||||
mascotDialogVisible: AsyncStorageManager.getBool(
|
mascotDialogVisible: AsyncStorageManager.getBool(
|
||||||
AsyncStorageManager.PREFERENCES.equipmentShowMascot.key,
|
AsyncStorageManager.PREFERENCES.equipmentShowMascot.key
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
this.canRefresh = false;
|
this.canRefresh = false;
|
||||||
|
@ -115,20 +124,13 @@ class EquipmentListScreen extends React.Component<PropsType, StateType> {
|
||||||
*/
|
*/
|
||||||
getListHeader() {
|
getListHeader() {
|
||||||
return (
|
return (
|
||||||
<View
|
<View style={styles.headerContainer}>
|
||||||
style={{
|
|
||||||
width: '100%',
|
|
||||||
marginTop: 10,
|
|
||||||
marginBottom: 10,
|
|
||||||
}}>
|
|
||||||
<Button
|
<Button
|
||||||
mode="contained"
|
mode="contained"
|
||||||
icon="help-circle"
|
icon="help-circle"
|
||||||
onPress={this.showMascotDialog}
|
onPress={this.showMascotDialog}
|
||||||
style={{
|
style={GENERAL_STYLES.centerHorizontal}
|
||||||
marginRight: 'auto',
|
>
|
||||||
marginLeft: 'auto',
|
|
||||||
}}>
|
|
||||||
{i18n.t('screens.equipment.mascotDialog.title')}
|
{i18n.t('screens.equipment.mascotDialog.title')}
|
||||||
</Button>
|
</Button>
|
||||||
</View>
|
</View>
|
||||||
|
@ -145,8 +147,10 @@ class EquipmentListScreen extends React.Component<PropsType, StateType> {
|
||||||
*/
|
*/
|
||||||
getScreen = (
|
getScreen = (
|
||||||
data: Array<
|
data: Array<
|
||||||
{devices: Array<DeviceType>} | {locations: Array<RentedDeviceType>} | null
|
| { devices: Array<DeviceType> }
|
||||||
>,
|
| { locations: Array<RentedDeviceType> }
|
||||||
|
| null
|
||||||
|
>
|
||||||
) => {
|
) => {
|
||||||
const [allDevices, userRents] = data;
|
const [allDevices, userRents] = data;
|
||||||
if (userRents) {
|
if (userRents) {
|
||||||
|
@ -175,7 +179,7 @@ class EquipmentListScreen extends React.Component<PropsType, StateType> {
|
||||||
hideMascotDialog = () => {
|
hideMascotDialog = () => {
|
||||||
AsyncStorageManager.set(
|
AsyncStorageManager.set(
|
||||||
AsyncStorageManager.PREFERENCES.equipmentShowMascot.key,
|
AsyncStorageManager.PREFERENCES.equipmentShowMascot.key,
|
||||||
false,
|
false
|
||||||
);
|
);
|
||||||
this.setState({ mascotDialogVisible: false });
|
this.setState({ mascotDialogVisible: false });
|
||||||
};
|
};
|
||||||
|
@ -183,7 +187,7 @@ class EquipmentListScreen extends React.Component<PropsType, StateType> {
|
||||||
render() {
|
render() {
|
||||||
const { props, state } = this;
|
const { props, state } = this;
|
||||||
return (
|
return (
|
||||||
<View style={{flex: 1}}>
|
<View style={GENERAL_STYLES.flex}>
|
||||||
<AuthenticatedScreen
|
<AuthenticatedScreen
|
||||||
navigation={props.navigation}
|
navigation={props.navigation}
|
||||||
ref={this.authRef}
|
ref={this.authRef}
|
||||||
|
|
|
@ -27,7 +27,7 @@ import {
|
||||||
withTheme,
|
withTheme,
|
||||||
} from 'react-native-paper';
|
} from 'react-native-paper';
|
||||||
import { StackNavigationProp, StackScreenProps } from '@react-navigation/stack';
|
import { StackNavigationProp, StackScreenProps } from '@react-navigation/stack';
|
||||||
import {BackHandler, View} from 'react-native';
|
import { BackHandler, StyleSheet, View } from 'react-native';
|
||||||
import * as Animatable from 'react-native-animatable';
|
import * as Animatable from 'react-native-animatable';
|
||||||
import i18n from 'i18n-js';
|
import i18n from 'i18n-js';
|
||||||
import { CalendarList, PeriodMarking } from 'react-native-calendars';
|
import { CalendarList, PeriodMarking } from 'react-native-calendars';
|
||||||
|
@ -45,6 +45,7 @@ import {
|
||||||
import ConnectionManager from '../../../managers/ConnectionManager';
|
import ConnectionManager from '../../../managers/ConnectionManager';
|
||||||
import CollapsibleScrollView from '../../../components/Collapsible/CollapsibleScrollView';
|
import CollapsibleScrollView from '../../../components/Collapsible/CollapsibleScrollView';
|
||||||
import { MainStackParamsList } from '../../../navigation/MainNavigator';
|
import { MainStackParamsList } from '../../../navigation/MainNavigator';
|
||||||
|
import GENERAL_STYLES from '../../../constants/Styles';
|
||||||
|
|
||||||
type EquipmentRentScreenNavigationProp = StackScreenProps<
|
type EquipmentRentScreenNavigationProp = StackScreenProps<
|
||||||
MainStackParamsList,
|
MainStackParamsList,
|
||||||
|
@ -67,6 +68,50 @@ type StateType = {
|
||||||
currentError: number;
|
currentError: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
titleContainer: {
|
||||||
|
marginLeft: 'auto',
|
||||||
|
marginRight: 'auto',
|
||||||
|
flexDirection: 'row',
|
||||||
|
flexWrap: 'wrap',
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
textAlign: 'center',
|
||||||
|
},
|
||||||
|
caption: {
|
||||||
|
textAlign: 'center',
|
||||||
|
lineHeight: 35,
|
||||||
|
marginLeft: 10,
|
||||||
|
},
|
||||||
|
card: {
|
||||||
|
margin: 5,
|
||||||
|
},
|
||||||
|
subtitle: {
|
||||||
|
textAlign: 'center',
|
||||||
|
marginBottom: 10,
|
||||||
|
minHeight: 50,
|
||||||
|
},
|
||||||
|
calendar: {
|
||||||
|
marginBottom: 50,
|
||||||
|
},
|
||||||
|
buttonContainer: {
|
||||||
|
position: 'absolute',
|
||||||
|
bottom: 0,
|
||||||
|
left: 0,
|
||||||
|
width: '100%',
|
||||||
|
flex: 1,
|
||||||
|
transform: [{ translateY: 100 }],
|
||||||
|
},
|
||||||
|
button: {
|
||||||
|
width: '80%',
|
||||||
|
flex: 1,
|
||||||
|
marginLeft: 'auto',
|
||||||
|
marginRight: 'auto',
|
||||||
|
marginBottom: 20,
|
||||||
|
borderRadius: 10,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
class EquipmentRentScreen extends React.Component<Props, StateType> {
|
class EquipmentRentScreen extends React.Component<Props, StateType> {
|
||||||
item: DeviceType | null;
|
item: DeviceType | null;
|
||||||
|
|
||||||
|
@ -108,7 +153,7 @@ class EquipmentRentScreen extends React.Component<Props, StateType> {
|
||||||
const range = getValidRange(
|
const range = getValidRange(
|
||||||
new Date(date.begin),
|
new Date(date.begin),
|
||||||
new Date(date.end),
|
new Date(date.end),
|
||||||
null,
|
null
|
||||||
);
|
);
|
||||||
this.lockedDates = {
|
this.lockedDates = {
|
||||||
...this.lockedDates,
|
...this.lockedDates,
|
||||||
|
@ -126,13 +171,13 @@ class EquipmentRentScreen extends React.Component<Props, StateType> {
|
||||||
navigation.addListener('focus', () => {
|
navigation.addListener('focus', () => {
|
||||||
BackHandler.addEventListener(
|
BackHandler.addEventListener(
|
||||||
'hardwareBackPress',
|
'hardwareBackPress',
|
||||||
this.onBackButtonPressAndroid,
|
this.onBackButtonPressAndroid
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
navigation.addListener('blur', () => {
|
navigation.addListener('blur', () => {
|
||||||
BackHandler.removeEventListener(
|
BackHandler.removeEventListener(
|
||||||
'hardwareBackPress',
|
'hardwareBackPress',
|
||||||
this.onBackButtonPressAndroid,
|
this.onBackButtonPressAndroid
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -315,28 +360,17 @@ class EquipmentRentScreen extends React.Component<Props, StateType> {
|
||||||
const isAvailable = isEquipmentAvailable(item);
|
const isAvailable = isEquipmentAvailable(item);
|
||||||
const firstAvailability = getFirstEquipmentAvailability(item);
|
const firstAvailability = getFirstEquipmentAvailability(item);
|
||||||
return (
|
return (
|
||||||
<View style={{flex: 1}}>
|
<View style={GENERAL_STYLES.flex}>
|
||||||
<CollapsibleScrollView>
|
<CollapsibleScrollView>
|
||||||
<Card style={{margin: 5}}>
|
<Card style={styles.card}>
|
||||||
<Card.Content>
|
<Card.Content>
|
||||||
<View style={{flex: 1}}>
|
<View style={GENERAL_STYLES.flex}>
|
||||||
<View
|
<View style={styles.titleContainer}>
|
||||||
style={{
|
<Headline style={styles.title}>{item.name}</Headline>
|
||||||
marginLeft: 'auto',
|
<Caption style={styles.caption}>
|
||||||
marginRight: 'auto',
|
(
|
||||||
flexDirection: 'row',
|
{i18n.t('screens.equipment.bail', { cost: item.caution })}
|
||||||
flexWrap: 'wrap',
|
)
|
||||||
}}>
|
|
||||||
<Headline style={{textAlign: 'center'}}>
|
|
||||||
{item.name}
|
|
||||||
</Headline>
|
|
||||||
<Caption
|
|
||||||
style={{
|
|
||||||
textAlign: 'center',
|
|
||||||
lineHeight: 35,
|
|
||||||
marginLeft: 10,
|
|
||||||
}}>
|
|
||||||
({i18n.t('screens.equipment.bail', {cost: item.caution})})
|
|
||||||
</Caption>
|
</Caption>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
@ -348,17 +382,13 @@ class EquipmentRentScreen extends React.Component<Props, StateType> {
|
||||||
? props.theme.colors.success
|
? props.theme.colors.success
|
||||||
: props.theme.colors.primary
|
: props.theme.colors.primary
|
||||||
}
|
}
|
||||||
mode="text">
|
mode="text"
|
||||||
|
>
|
||||||
{i18n.t('screens.equipment.available', {
|
{i18n.t('screens.equipment.available', {
|
||||||
date: getRelativeDateString(firstAvailability),
|
date: getRelativeDateString(firstAvailability),
|
||||||
})}
|
})}
|
||||||
</Button>
|
</Button>
|
||||||
<Subheading
|
<Subheading style={styles.subtitle}>
|
||||||
style={{
|
|
||||||
textAlign: 'center',
|
|
||||||
marginBottom: 10,
|
|
||||||
minHeight: 50,
|
|
||||||
}}>
|
|
||||||
{subHeadingText}
|
{subHeadingText}
|
||||||
</Subheading>
|
</Subheading>
|
||||||
</Card.Content>
|
</Card.Content>
|
||||||
|
@ -384,28 +414,28 @@ class EquipmentRentScreen extends React.Component<Props, StateType> {
|
||||||
markingType={'period'}
|
markingType={'period'}
|
||||||
markedDates={{ ...this.lockedDates, ...state.markedDates }}
|
markedDates={{ ...this.lockedDates, ...state.markedDates }}
|
||||||
theme={{
|
theme={{
|
||||||
backgroundColor: props.theme.colors.agendaBackgroundColor,
|
'backgroundColor': props.theme.colors.agendaBackgroundColor,
|
||||||
calendarBackground: props.theme.colors.background,
|
'calendarBackground': props.theme.colors.background,
|
||||||
textSectionTitleColor: props.theme.colors.agendaDayTextColor,
|
'textSectionTitleColor': props.theme.colors.agendaDayTextColor,
|
||||||
selectedDayBackgroundColor: props.theme.colors.primary,
|
'selectedDayBackgroundColor': props.theme.colors.primary,
|
||||||
selectedDayTextColor: '#ffffff',
|
'selectedDayTextColor': '#ffffff',
|
||||||
todayTextColor: props.theme.colors.text,
|
'todayTextColor': props.theme.colors.text,
|
||||||
dayTextColor: props.theme.colors.text,
|
'dayTextColor': props.theme.colors.text,
|
||||||
textDisabledColor: props.theme.colors.agendaDayTextColor,
|
'textDisabledColor': props.theme.colors.agendaDayTextColor,
|
||||||
dotColor: props.theme.colors.primary,
|
'dotColor': props.theme.colors.primary,
|
||||||
selectedDotColor: '#ffffff',
|
'selectedDotColor': '#ffffff',
|
||||||
arrowColor: props.theme.colors.primary,
|
'arrowColor': props.theme.colors.primary,
|
||||||
monthTextColor: props.theme.colors.text,
|
'monthTextColor': props.theme.colors.text,
|
||||||
indicatorColor: props.theme.colors.primary,
|
'indicatorColor': props.theme.colors.primary,
|
||||||
textDayFontFamily: 'monospace',
|
'textDayFontFamily': 'monospace',
|
||||||
textMonthFontFamily: 'monospace',
|
'textMonthFontFamily': 'monospace',
|
||||||
textDayHeaderFontFamily: 'monospace',
|
'textDayHeaderFontFamily': 'monospace',
|
||||||
textDayFontWeight: '300',
|
'textDayFontWeight': '300',
|
||||||
textMonthFontWeight: 'bold',
|
'textMonthFontWeight': 'bold',
|
||||||
textDayHeaderFontWeight: '300',
|
'textDayHeaderFontWeight': '300',
|
||||||
textDayFontSize: 16,
|
'textDayFontSize': 16,
|
||||||
textMonthFontSize: 16,
|
'textMonthFontSize': 16,
|
||||||
textDayHeaderFontSize: 16,
|
'textDayHeaderFontSize': 16,
|
||||||
'stylesheet.day.period': {
|
'stylesheet.day.period': {
|
||||||
base: {
|
base: {
|
||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
|
@ -415,7 +445,7 @@ class EquipmentRentScreen extends React.Component<Props, StateType> {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
style={{marginBottom: 50}}
|
style={styles.calendar}
|
||||||
/>
|
/>
|
||||||
</CollapsibleScrollView>
|
</CollapsibleScrollView>
|
||||||
<LoadingConfirmDialog
|
<LoadingConfirmDialog
|
||||||
|
@ -435,26 +465,14 @@ class EquipmentRentScreen extends React.Component<Props, StateType> {
|
||||||
<Animatable.View
|
<Animatable.View
|
||||||
ref={this.bookRef}
|
ref={this.bookRef}
|
||||||
useNativeDriver
|
useNativeDriver
|
||||||
style={{
|
style={styles.buttonContainer}
|
||||||
position: 'absolute',
|
>
|
||||||
bottom: 0,
|
|
||||||
left: 0,
|
|
||||||
width: '100%',
|
|
||||||
flex: 1,
|
|
||||||
transform: [{translateY: 100}],
|
|
||||||
}}>
|
|
||||||
<Button
|
<Button
|
||||||
icon="bookmark-check"
|
icon="bookmark-check"
|
||||||
mode="contained"
|
mode="contained"
|
||||||
onPress={this.showDialog}
|
onPress={this.showDialog}
|
||||||
style={{
|
style={styles.button}
|
||||||
width: '80%',
|
>
|
||||||
flex: 1,
|
|
||||||
marginLeft: 'auto',
|
|
||||||
marginRight: 'auto',
|
|
||||||
marginBottom: 20,
|
|
||||||
borderRadius: 10,
|
|
||||||
}}>
|
|
||||||
{i18n.t('screens.equipment.bookButton')}
|
{i18n.t('screens.equipment.bookButton')}
|
||||||
</Button>
|
</Button>
|
||||||
</Animatable.View>
|
</Animatable.View>
|
||||||
|
|
|
@ -37,6 +37,7 @@ import {MASCOT_STYLE} from '../../components/Mascot/Mascot';
|
||||||
import MascotPopup from '../../components/Mascot/MascotPopup';
|
import MascotPopup from '../../components/Mascot/MascotPopup';
|
||||||
import CollapsibleScrollView from '../../components/Collapsible/CollapsibleScrollView';
|
import CollapsibleScrollView from '../../components/Collapsible/CollapsibleScrollView';
|
||||||
import { MainStackParamsList } from '../../navigation/MainNavigator';
|
import { MainStackParamsList } from '../../navigation/MainNavigator';
|
||||||
|
import GENERAL_STYLES from '../../constants/Styles';
|
||||||
|
|
||||||
type LoginScreenNavigationProp = StackScreenProps<MainStackParamsList, 'login'>;
|
type LoginScreenNavigationProp = StackScreenProps<MainStackParamsList, 'login'>;
|
||||||
|
|
||||||
|
@ -63,9 +64,6 @@ const RESET_PASSWORD_PATH = 'https://www.amicale-insat.fr/password/reset';
|
||||||
const emailRegex = /^.+@.+\..+$/;
|
const emailRegex = /^.+@.+\..+$/;
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
container: {
|
|
||||||
flex: 1,
|
|
||||||
},
|
|
||||||
card: {
|
card: {
|
||||||
marginTop: 'auto',
|
marginTop: 'auto',
|
||||||
marginBottom: 'auto',
|
marginBottom: 'auto',
|
||||||
|
@ -74,10 +72,18 @@ const styles = StyleSheet.create({
|
||||||
fontSize: 36,
|
fontSize: 36,
|
||||||
marginBottom: 48,
|
marginBottom: 48,
|
||||||
},
|
},
|
||||||
textInput: {},
|
text: {
|
||||||
btnContainer: {
|
color: '#ffffff',
|
||||||
marginTop: 5,
|
},
|
||||||
marginBottom: 10,
|
buttonContainer: {
|
||||||
|
flexWrap: 'wrap',
|
||||||
|
},
|
||||||
|
lockButton: {
|
||||||
|
marginRight: 'auto',
|
||||||
|
marginBottom: 20,
|
||||||
|
},
|
||||||
|
sendButton: {
|
||||||
|
marginLeft: 'auto',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -113,7 +119,7 @@ class LoginScreen extends React.Component<Props, StateType> {
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
dialogError: 0,
|
dialogError: 0,
|
||||||
mascotDialogVisible: AsyncStorageManager.getBool(
|
mascotDialogVisible: AsyncStorageManager.getBool(
|
||||||
AsyncStorageManager.PREFERENCES.loginShowMascot.key,
|
AsyncStorageManager.PREFERENCES.loginShowMascot.key
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -249,9 +255,9 @@ class LoginScreen extends React.Component<Props, StateType> {
|
||||||
<View style={styles.card}>
|
<View style={styles.card}>
|
||||||
<Card.Title
|
<Card.Title
|
||||||
title={i18n.t('screens.login.title')}
|
title={i18n.t('screens.login.title')}
|
||||||
titleStyle={{color: '#fff'}}
|
titleStyle={styles.text}
|
||||||
subtitle={i18n.t('screens.login.subtitle')}
|
subtitle={i18n.t('screens.login.subtitle')}
|
||||||
subtitleStyle={{color: '#fff'}}
|
subtitleStyle={styles.text}
|
||||||
left={({ size }) => (
|
left={({ size }) => (
|
||||||
<Image
|
<Image
|
||||||
source={ICON_AMICALE}
|
source={ICON_AMICALE}
|
||||||
|
@ -264,13 +270,14 @@ class LoginScreen extends React.Component<Props, StateType> {
|
||||||
/>
|
/>
|
||||||
<Card.Content>
|
<Card.Content>
|
||||||
{this.getFormInput()}
|
{this.getFormInput()}
|
||||||
<Card.Actions style={{flexWrap: 'wrap'}}>
|
<Card.Actions style={styles.buttonContainer}>
|
||||||
<Button
|
<Button
|
||||||
icon="lock-question"
|
icon="lock-question"
|
||||||
mode="contained"
|
mode="contained"
|
||||||
onPress={this.onResetPasswordClick}
|
onPress={this.onResetPasswordClick}
|
||||||
color={props.theme.colors.warning}
|
color={props.theme.colors.warning}
|
||||||
style={{marginRight: 'auto', marginBottom: 20}}>
|
style={styles.lockButton}
|
||||||
|
>
|
||||||
{i18n.t('screens.login.resetPassword')}
|
{i18n.t('screens.login.resetPassword')}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
|
@ -279,7 +286,8 @@ class LoginScreen extends React.Component<Props, StateType> {
|
||||||
disabled={!this.shouldEnableLogin()}
|
disabled={!this.shouldEnableLogin()}
|
||||||
loading={state.loading}
|
loading={state.loading}
|
||||||
onPress={this.onSubmit}
|
onPress={this.onSubmit}
|
||||||
style={{marginLeft: 'auto'}}>
|
style={styles.sendButton}
|
||||||
|
>
|
||||||
{i18n.t('screens.login.title')}
|
{i18n.t('screens.login.title')}
|
||||||
</Button>
|
</Button>
|
||||||
</Card.Actions>
|
</Card.Actions>
|
||||||
|
@ -288,10 +296,8 @@ class LoginScreen extends React.Component<Props, StateType> {
|
||||||
icon="help-circle"
|
icon="help-circle"
|
||||||
mode="contained"
|
mode="contained"
|
||||||
onPress={this.showMascotDialog}
|
onPress={this.showMascotDialog}
|
||||||
style={{
|
style={GENERAL_STYLES.centerHorizontal}
|
||||||
marginLeft: 'auto',
|
>
|
||||||
marginRight: 'auto',
|
|
||||||
}}>
|
|
||||||
{i18n.t('screens.login.mascotDialog.title')}
|
{i18n.t('screens.login.mascotDialog.title')}
|
||||||
</Button>
|
</Button>
|
||||||
</Card.Actions>
|
</Card.Actions>
|
||||||
|
@ -317,7 +323,7 @@ class LoginScreen extends React.Component<Props, StateType> {
|
||||||
hideMascotDialog = () => {
|
hideMascotDialog = () => {
|
||||||
AsyncStorageManager.set(
|
AsyncStorageManager.set(
|
||||||
AsyncStorageManager.PREFERENCES.loginShowMascot.key,
|
AsyncStorageManager.PREFERENCES.loginShowMascot.key,
|
||||||
false,
|
false
|
||||||
);
|
);
|
||||||
this.setState({ mascotDialogVisible: false });
|
this.setState({ mascotDialogVisible: false });
|
||||||
};
|
};
|
||||||
|
@ -351,7 +357,7 @@ class LoginScreen extends React.Component<Props, StateType> {
|
||||||
// Do not show the home login banner again
|
// Do not show the home login banner again
|
||||||
AsyncStorageManager.set(
|
AsyncStorageManager.set(
|
||||||
AsyncStorageManager.PREFERENCES.homeShowMascot.key,
|
AsyncStorageManager.PREFERENCES.homeShowMascot.key,
|
||||||
false,
|
false
|
||||||
);
|
);
|
||||||
if (this.nextScreen == null) {
|
if (this.nextScreen == null) {
|
||||||
navigation.goBack();
|
navigation.goBack();
|
||||||
|
@ -423,20 +429,20 @@ class LoginScreen extends React.Component<Props, StateType> {
|
||||||
const { mascotDialogVisible, dialogVisible, dialogError } = this.state;
|
const { mascotDialogVisible, dialogVisible, dialogError } = this.state;
|
||||||
return (
|
return (
|
||||||
<LinearGradient
|
<LinearGradient
|
||||||
style={{
|
style={GENERAL_STYLES.flex}
|
||||||
height: '100%',
|
|
||||||
}}
|
|
||||||
colors={['#9e0d18', '#530209']}
|
colors={['#9e0d18', '#530209']}
|
||||||
start={{ x: 0, y: 0.1 }}
|
start={{ x: 0, y: 0.1 }}
|
||||||
end={{x: 0.1, y: 1}}>
|
end={{ x: 0.1, y: 1 }}
|
||||||
|
>
|
||||||
<KeyboardAvoidingView
|
<KeyboardAvoidingView
|
||||||
behavior="height"
|
behavior="height"
|
||||||
contentContainerStyle={styles.container}
|
contentContainerStyle={GENERAL_STYLES.flex}
|
||||||
style={styles.container}
|
style={GENERAL_STYLES.flex}
|
||||||
enabled
|
enabled
|
||||||
keyboardVerticalOffset={100}>
|
keyboardVerticalOffset={100}
|
||||||
|
>
|
||||||
<CollapsibleScrollView>
|
<CollapsibleScrollView>
|
||||||
<View style={{height: '100%'}}>{this.getMainCard()}</View>
|
<View style={GENERAL_STYLES.flex}>{this.getMainCard()}</View>
|
||||||
<MascotPopup
|
<MascotPopup
|
||||||
visible={mascotDialogVisible}
|
visible={mascotDialogVisible}
|
||||||
title={i18n.t('screens.login.mascotDialog.title')}
|
title={i18n.t('screens.login.mascotDialog.title')}
|
||||||
|
|
|
@ -41,6 +41,7 @@ import Mascot, {MASCOT_STYLE} from '../../components/Mascot/Mascot';
|
||||||
import ServicesManager, { SERVICES_KEY } from '../../managers/ServicesManager';
|
import ServicesManager, { SERVICES_KEY } from '../../managers/ServicesManager';
|
||||||
import CollapsibleFlatList from '../../components/Collapsible/CollapsibleFlatList';
|
import CollapsibleFlatList from '../../components/Collapsible/CollapsibleFlatList';
|
||||||
import type { ServiceItemType } from '../../managers/ServicesManager';
|
import type { ServiceItemType } from '../../managers/ServicesManager';
|
||||||
|
import GENERAL_STYLES from '../../constants/Styles';
|
||||||
|
|
||||||
type PropsType = {
|
type PropsType = {
|
||||||
navigation: StackNavigationProp<any>;
|
navigation: StackNavigationProp<any>;
|
||||||
|
@ -79,6 +80,12 @@ const styles = StyleSheet.create({
|
||||||
editButton: {
|
editButton: {
|
||||||
marginLeft: 'auto',
|
marginLeft: 'auto',
|
||||||
},
|
},
|
||||||
|
mascot: {
|
||||||
|
width: 60,
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
marginLeft: 10,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
class ProfileScreen extends React.Component<PropsType, StateType> {
|
class ProfileScreen extends React.Component<PropsType, StateType> {
|
||||||
|
@ -131,7 +138,7 @@ class ProfileScreen extends React.Component<PropsType, StateType> {
|
||||||
const { dialogVisible } = this.state;
|
const { dialogVisible } = this.state;
|
||||||
this.data = data[0];
|
this.data = data[0];
|
||||||
return (
|
return (
|
||||||
<View style={{flex: 1}}>
|
<View style={GENERAL_STYLES.flex}>
|
||||||
<CollapsibleFlatList
|
<CollapsibleFlatList
|
||||||
renderItem={this.getRenderItem}
|
renderItem={this.getRenderItem}
|
||||||
data={this.flatListData}
|
data={this.flatListData}
|
||||||
|
@ -181,9 +188,7 @@ class ProfileScreen extends React.Component<PropsType, StateType> {
|
||||||
})}
|
})}
|
||||||
left={() => (
|
left={() => (
|
||||||
<Mascot
|
<Mascot
|
||||||
style={{
|
style={styles.mascot}
|
||||||
width: 60,
|
|
||||||
}}
|
|
||||||
emotion={MASCOT_STYLE.COOL}
|
emotion={MASCOT_STYLE.COOL}
|
||||||
animated
|
animated
|
||||||
entryAnimation={{
|
entryAnimation={{
|
||||||
|
@ -192,7 +197,7 @@ class ProfileScreen extends React.Component<PropsType, StateType> {
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
titleStyle={{marginLeft: 10}}
|
titleStyle={styles.title}
|
||||||
/>
|
/>
|
||||||
<Card.Content>
|
<Card.Content>
|
||||||
<Divider />
|
<Divider />
|
||||||
|
@ -207,7 +212,8 @@ class ProfileScreen extends React.Component<PropsType, StateType> {
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
navigation.navigate('feedback');
|
navigation.navigate('feedback');
|
||||||
}}
|
}}
|
||||||
style={styles.editButton}>
|
style={styles.editButton}
|
||||||
|
>
|
||||||
{i18n.t('screens.feedback.homeButtonTitle')}
|
{i18n.t('screens.feedback.homeButtonTitle')}
|
||||||
</Button>
|
</Button>
|
||||||
</Card.Actions>
|
</Card.Actions>
|
||||||
|
@ -297,7 +303,8 @@ class ProfileScreen extends React.Component<PropsType, StateType> {
|
||||||
title: i18n.t('screens.websites.amicale'),
|
title: i18n.t('screens.websites.amicale'),
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
style={styles.editButton}>
|
style={styles.editButton}
|
||||||
|
>
|
||||||
{i18n.t('screens.profile.editInformation')}
|
{i18n.t('screens.profile.editInformation')}
|
||||||
</Button>
|
</Button>
|
||||||
</Card.Actions>
|
</Card.Actions>
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import {RefreshControl, View} from 'react-native';
|
import { RefreshControl, StyleSheet, View } from 'react-native';
|
||||||
import { StackNavigationProp } from '@react-navigation/stack';
|
import { StackNavigationProp } from '@react-navigation/stack';
|
||||||
import i18n from 'i18n-js';
|
import i18n from 'i18n-js';
|
||||||
import { Button } from 'react-native-paper';
|
import { Button } from 'react-native-paper';
|
||||||
|
@ -33,6 +33,7 @@ import MascotPopup from '../../components/Mascot/MascotPopup';
|
||||||
import AsyncStorageManager from '../../managers/AsyncStorageManager';
|
import AsyncStorageManager from '../../managers/AsyncStorageManager';
|
||||||
import VoteNotAvailable from '../../components/Amicale/Vote/VoteNotAvailable';
|
import VoteNotAvailable from '../../components/Amicale/Vote/VoteNotAvailable';
|
||||||
import CollapsibleFlatList from '../../components/Collapsible/CollapsibleFlatList';
|
import CollapsibleFlatList from '../../components/Collapsible/CollapsibleFlatList';
|
||||||
|
import GENERAL_STYLES from '../../constants/Styles';
|
||||||
|
|
||||||
export type VoteTeamType = {
|
export type VoteTeamType = {
|
||||||
id: number;
|
id: number;
|
||||||
|
@ -118,6 +119,14 @@ type StateType = {
|
||||||
mascotDialogVisible: boolean;
|
mascotDialogVisible: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
button: {
|
||||||
|
marginLeft: 'auto',
|
||||||
|
marginRight: 'auto',
|
||||||
|
marginTop: 20,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Screen displaying vote information and controls
|
* Screen displaying vote information and controls
|
||||||
*/
|
*/
|
||||||
|
@ -146,7 +155,7 @@ export default class VoteScreen extends React.Component<PropsType, StateType> {
|
||||||
this.state = {
|
this.state = {
|
||||||
hasVoted: false,
|
hasVoted: false,
|
||||||
mascotDialogVisible: AsyncStorageManager.getBool(
|
mascotDialogVisible: AsyncStorageManager.getBool(
|
||||||
AsyncStorageManager.PREFERENCES.voteShowMascot.key,
|
AsyncStorageManager.PREFERENCES.voteShowMascot.key
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
this.hasVoted = false;
|
this.hasVoted = false;
|
||||||
|
@ -182,11 +191,8 @@ export default class VoteScreen extends React.Component<PropsType, StateType> {
|
||||||
mode="contained"
|
mode="contained"
|
||||||
icon="help-circle"
|
icon="help-circle"
|
||||||
onPress={this.showMascotDialog}
|
onPress={this.showMascotDialog}
|
||||||
style={{
|
style={styles.button}
|
||||||
marginLeft: 'auto',
|
>
|
||||||
marginRight: 'auto',
|
|
||||||
marginTop: 20,
|
|
||||||
}}>
|
|
||||||
{i18n.t('screens.vote.mascotDialog.title')}
|
{i18n.t('screens.vote.mascotDialog.title')}
|
||||||
</Button>
|
</Button>
|
||||||
</View>
|
</View>
|
||||||
|
@ -270,7 +276,7 @@ export default class VoteScreen extends React.Component<PropsType, StateType> {
|
||||||
teams={this.teams}
|
teams={this.teams}
|
||||||
dateEnd={this.getDateString(
|
dateEnd={this.getDateString(
|
||||||
this.dates.date_result_end,
|
this.dates.date_result_end,
|
||||||
this.datesString.date_result_end,
|
this.datesString.date_result_end
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
@ -287,7 +293,7 @@ export default class VoteScreen extends React.Component<PropsType, StateType> {
|
||||||
<VoteTease
|
<VoteTease
|
||||||
startDate={this.getDateString(
|
startDate={this.getDateString(
|
||||||
this.dates.date_begin,
|
this.dates.date_begin,
|
||||||
this.datesString.date_begin,
|
this.datesString.date_begin
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
@ -308,7 +314,7 @@ export default class VoteScreen extends React.Component<PropsType, StateType> {
|
||||||
) {
|
) {
|
||||||
startDate = this.getDateString(
|
startDate = this.getDateString(
|
||||||
this.dates.date_result_begin,
|
this.dates.date_result_begin,
|
||||||
this.datesString.date_result_begin,
|
this.datesString.date_result_begin
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
|
@ -345,7 +351,7 @@ export default class VoteScreen extends React.Component<PropsType, StateType> {
|
||||||
hideMascotDialog = () => {
|
hideMascotDialog = () => {
|
||||||
AsyncStorageManager.set(
|
AsyncStorageManager.set(
|
||||||
AsyncStorageManager.PREFERENCES.voteShowMascot.key,
|
AsyncStorageManager.PREFERENCES.voteShowMascot.key,
|
||||||
false,
|
false
|
||||||
);
|
);
|
||||||
this.setState({ mascotDialogVisible: false });
|
this.setState({ mascotDialogVisible: false });
|
||||||
};
|
};
|
||||||
|
@ -414,7 +420,7 @@ export default class VoteScreen extends React.Component<PropsType, StateType> {
|
||||||
render() {
|
render() {
|
||||||
const { props, state } = this;
|
const { props, state } = this;
|
||||||
return (
|
return (
|
||||||
<View style={{flex: 1}}>
|
<View style={GENERAL_STYLES.flex}>
|
||||||
<AuthenticatedScreen<TeamResponseType | VoteDatesStringType>
|
<AuthenticatedScreen<TeamResponseType | VoteDatesStringType>
|
||||||
navigation={props.navigation}
|
navigation={props.navigation}
|
||||||
ref={this.authRef}
|
ref={this.authRef}
|
||||||
|
|
|
@ -17,8 +17,6 @@
|
||||||
* along with Campus INSAT. If not, see <https://www.gnu.org/licenses/>.
|
* along with Campus INSAT. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @flow
|
|
||||||
|
|
||||||
export type CoordinatesType = {
|
export type CoordinatesType = {
|
||||||
x: number;
|
x: number;
|
||||||
y: number;
|
y: number;
|
||||||
|
|
|
@ -17,9 +17,6 @@
|
||||||
* along with Campus INSAT. If not, see <https://www.gnu.org/licenses/>.
|
* along with Campus INSAT. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* eslint-disable */
|
|
||||||
|
|
||||||
import React from 'react';
|
|
||||||
import GridManager from '../logic/GridManager';
|
import GridManager from '../logic/GridManager';
|
||||||
import ScoreManager from '../logic/ScoreManager';
|
import ScoreManager from '../logic/ScoreManager';
|
||||||
import Piece from '../logic/Piece';
|
import Piece from '../logic/Piece';
|
||||||
|
|
|
@ -17,9 +17,6 @@
|
||||||
* along with Campus INSAT. If not, see <https://www.gnu.org/licenses/>.
|
* along with Campus INSAT. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* eslint-disable */
|
|
||||||
|
|
||||||
import React from 'react';
|
|
||||||
import Piece from '../logic/Piece';
|
import Piece from '../logic/Piece';
|
||||||
import ShapeI from '../Shapes/ShapeI';
|
import ShapeI from '../Shapes/ShapeI';
|
||||||
|
|
||||||
|
@ -33,9 +30,7 @@ let theme = {
|
||||||
jest.mock('../Shapes/ShapeI');
|
jest.mock('../Shapes/ShapeI');
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
jest
|
jest.spyOn(Piece.prototype, 'getRandomShape').mockImplementation((colors) => {
|
||||||
.spyOn(Piece.prototype, 'getRandomShape')
|
|
||||||
.mockImplementation((colors: Object) => {
|
|
||||||
return new ShapeI(colors);
|
return new ShapeI(colors);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -17,9 +17,6 @@
|
||||||
* along with Campus INSAT. If not, see <https://www.gnu.org/licenses/>.
|
* along with Campus INSAT. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* eslint-disable */
|
|
||||||
|
|
||||||
import React from 'react';
|
|
||||||
import ScoreManager from '../logic/ScoreManager';
|
import ScoreManager from '../logic/ScoreManager';
|
||||||
|
|
||||||
test('incrementScore', () => {
|
test('incrementScore', () => {
|
||||||
|
|
|
@ -17,9 +17,6 @@
|
||||||
* along with Campus INSAT. If not, see <https://www.gnu.org/licenses/>.
|
* along with Campus INSAT. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* eslint-disable */
|
|
||||||
|
|
||||||
import React from 'react';
|
|
||||||
import BaseShape from '../Shapes/BaseShape';
|
import BaseShape from '../Shapes/BaseShape';
|
||||||
import ShapeI from '../Shapes/ShapeI';
|
import ShapeI from '../Shapes/ShapeI';
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import {View} from 'react-native';
|
import { StyleSheet, View } from 'react-native';
|
||||||
|
|
||||||
export type CellType = { color: string; isEmpty: boolean; key: string };
|
export type CellType = { color: string; isEmpty: boolean; key: string };
|
||||||
|
|
||||||
|
@ -26,17 +26,24 @@ type PropsType = {
|
||||||
cell: CellType;
|
cell: CellType;
|
||||||
};
|
};
|
||||||
|
|
||||||
function CellComponent(props: PropsType) {
|
const styles = StyleSheet.create({
|
||||||
const item = props.cell;
|
cell: {
|
||||||
return (
|
|
||||||
<View
|
|
||||||
style={{
|
|
||||||
flex: 1,
|
flex: 1,
|
||||||
backgroundColor: item.isEmpty ? 'transparent' : item.color,
|
|
||||||
borderColor: 'transparent',
|
borderColor: 'transparent',
|
||||||
borderRadius: 4,
|
borderRadius: 4,
|
||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
aspectRatio: 1,
|
aspectRatio: 1,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
function CellComponent(props: PropsType) {
|
||||||
|
const item = props.cell;
|
||||||
|
const backgroundColor = item.isEmpty ? 'transparent' : item.color;
|
||||||
|
return (
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
backgroundColor: backgroundColor,
|
||||||
|
...styles.cell,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import {View, ViewStyle} from 'react-native';
|
import { StyleSheet, View, ViewStyle } from 'react-native';
|
||||||
import type { CellType } from './CellComponent';
|
import type { CellType } from './CellComponent';
|
||||||
import CellComponent from './CellComponent';
|
import CellComponent from './CellComponent';
|
||||||
|
|
||||||
|
@ -31,13 +31,22 @@ type PropsType = {
|
||||||
style: ViewStyle;
|
style: ViewStyle;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
row: {
|
||||||
|
flexDirection: 'row',
|
||||||
|
},
|
||||||
|
grid: {
|
||||||
|
borderRadius: 4,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
const getCellRender = (item: CellType) => {
|
const getCellRender = (item: CellType) => {
|
||||||
return <CellComponent cell={item} key={item.key} />;
|
return <CellComponent cell={item} key={item.key} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
function getRow(grid: GridType, rowNumber: number) {
|
function getRow(grid: GridType, rowNumber: number) {
|
||||||
return (
|
return (
|
||||||
<View style={{flexDirection: 'row'}} key={rowNumber.toString()}>
|
<View style={styles.row} key={rowNumber.toString()}>
|
||||||
{grid[rowNumber].map(getCellRender)}
|
{grid[rowNumber].map(getCellRender)}
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
@ -57,9 +66,10 @@ function GridComponent(props: PropsType) {
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
aspectRatio: width / height,
|
aspectRatio: width / height,
|
||||||
borderRadius: 4,
|
|
||||||
...style,
|
...style,
|
||||||
}}>
|
...styles.grid,
|
||||||
|
}}
|
||||||
|
>
|
||||||
{getGrid(grid, height)}
|
{getGrid(grid, height)}
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import {View, ViewStyle} from 'react-native';
|
import { StyleSheet, View, ViewStyle } from 'react-native';
|
||||||
import type { GridType } from './GridComponent';
|
import type { GridType } from './GridComponent';
|
||||||
import GridComponent from './GridComponent';
|
import GridComponent from './GridComponent';
|
||||||
|
|
||||||
|
@ -27,17 +27,21 @@ type PropsType = {
|
||||||
style: ViewStyle;
|
style: ViewStyle;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
grid: {
|
||||||
|
marginRight: 5,
|
||||||
|
marginLeft: 5,
|
||||||
|
marginBottom: 5,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
function getGridRender(item: GridType, index: number) {
|
function getGridRender(item: GridType, index: number) {
|
||||||
return (
|
return (
|
||||||
<GridComponent
|
<GridComponent
|
||||||
width={item[0].length}
|
width={item[0].length}
|
||||||
height={item.length}
|
height={item.length}
|
||||||
grid={item}
|
grid={item}
|
||||||
style={{
|
style={styles.grid}
|
||||||
marginRight: 5,
|
|
||||||
marginLeft: 5,
|
|
||||||
marginBottom: 5,
|
|
||||||
}}
|
|
||||||
key={index.toString()}
|
key={index.toString()}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
|
@ -25,7 +25,7 @@ import type {GridType} from '../components/GridComponent';
|
||||||
export type TickCallbackType = (
|
export type TickCallbackType = (
|
||||||
score: number,
|
score: number,
|
||||||
level: number,
|
level: number,
|
||||||
grid: GridType,
|
grid: GridType
|
||||||
) => void;
|
) => void;
|
||||||
|
|
||||||
export type ClockCallbackType = (time: number) => void;
|
export type ClockCallbackType = (time: number) => void;
|
||||||
|
@ -33,7 +33,7 @@ export type ClockCallbackType = (time: number) => void;
|
||||||
export type EndCallbackType = (
|
export type EndCallbackType = (
|
||||||
time: number,
|
time: number,
|
||||||
score: number,
|
score: number,
|
||||||
isRestart: boolean,
|
isRestart: boolean
|
||||||
) => void;
|
) => void;
|
||||||
|
|
||||||
export type MovementCallbackType = (grid: GridType, score?: number) => void;
|
export type MovementCallbackType = (grid: GridType, score?: number) => void;
|
||||||
|
@ -101,7 +101,7 @@ export default class GameLogic {
|
||||||
this.gridManager = new GridManager(
|
this.gridManager = new GridManager(
|
||||||
this.getWidth(),
|
this.getWidth(),
|
||||||
this.getHeight(),
|
this.getHeight(),
|
||||||
this.theme,
|
this.theme
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,14 +179,14 @@ export default class GameLogic {
|
||||||
this.gridManager.getCurrentGrid(),
|
this.gridManager.getCurrentGrid(),
|
||||||
this.getWidth(),
|
this.getWidth(),
|
||||||
this.getHeight(),
|
this.getHeight(),
|
||||||
this.onFreeze,
|
this.onFreeze
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (callback) {
|
if (callback) {
|
||||||
callback(
|
callback(
|
||||||
this.scoreManager.getScore(),
|
this.scoreManager.getScore(),
|
||||||
this.scoreManager.getLevel(),
|
this.scoreManager.getLevel(),
|
||||||
this.gridManager.getCurrentGrid(),
|
this.gridManager.getCurrentGrid()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (this.scoreManager.canLevelUp()) {
|
if (this.scoreManager.canLevelUp()) {
|
||||||
|
@ -224,7 +224,7 @@ export default class GameLogic {
|
||||||
isInitial: boolean,
|
isInitial: boolean,
|
||||||
callback: MovementCallbackType,
|
callback: MovementCallbackType,
|
||||||
x: number,
|
x: number,
|
||||||
y: number,
|
y: number
|
||||||
) {
|
) {
|
||||||
if (!this.canUseInput() || !this.isPressedIn) {
|
if (!this.canUseInput() || !this.isPressedIn) {
|
||||||
return;
|
return;
|
||||||
|
@ -237,14 +237,14 @@ export default class GameLogic {
|
||||||
this.gridManager.getCurrentGrid(),
|
this.gridManager.getCurrentGrid(),
|
||||||
this.getWidth(),
|
this.getWidth(),
|
||||||
this.getHeight(),
|
this.getHeight(),
|
||||||
this.onFreeze,
|
this.onFreeze
|
||||||
);
|
);
|
||||||
if (moved) {
|
if (moved) {
|
||||||
if (y === 1) {
|
if (y === 1) {
|
||||||
this.scoreManager.incrementScore();
|
this.scoreManager.incrementScore();
|
||||||
callback(
|
callback(
|
||||||
this.gridManager.getCurrentGrid(),
|
this.gridManager.getCurrentGrid(),
|
||||||
this.scoreManager.getScore(),
|
this.scoreManager.getScore()
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
callback(this.gridManager.getCurrentGrid());
|
callback(this.gridManager.getCurrentGrid());
|
||||||
|
@ -254,7 +254,7 @@ export default class GameLogic {
|
||||||
() => {
|
() => {
|
||||||
this.movePressedRepeat(false, callback, x, y);
|
this.movePressedRepeat(false, callback, x, y);
|
||||||
},
|
},
|
||||||
isInitial ? this.autoRepeatActivationDelay : this.autoRepeatDelay,
|
isInitial ? this.autoRepeatActivationDelay : this.autoRepeatDelay
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ export default class GameLogic {
|
||||||
this.currentObject.tryRotate(
|
this.currentObject.tryRotate(
|
||||||
this.gridManager.getCurrentGrid(),
|
this.gridManager.getCurrentGrid(),
|
||||||
this.getWidth(),
|
this.getWidth(),
|
||||||
this.getHeight(),
|
this.getHeight()
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
callback(this.gridManager.getCurrentGrid());
|
callback(this.gridManager.getCurrentGrid());
|
||||||
|
@ -315,7 +315,7 @@ export default class GameLogic {
|
||||||
!this.currentObject.isPositionValid(
|
!this.currentObject.isPositionValid(
|
||||||
this.gridManager.getCurrentGrid(),
|
this.gridManager.getCurrentGrid(),
|
||||||
this.getWidth(),
|
this.getWidth(),
|
||||||
this.getHeight(),
|
this.getHeight()
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
this.endGame(false);
|
this.endGame(false);
|
||||||
|
@ -346,7 +346,7 @@ export default class GameLogic {
|
||||||
startGame(
|
startGame(
|
||||||
tickCallback: TickCallbackType,
|
tickCallback: TickCallbackType,
|
||||||
clockCallback: ClockCallbackType,
|
clockCallback: ClockCallbackType,
|
||||||
endCallback: EndCallbackType,
|
endCallback: EndCallbackType
|
||||||
) {
|
) {
|
||||||
if (this.gameRunning) {
|
if (this.gameRunning) {
|
||||||
this.endGame(true);
|
this.endGame(true);
|
||||||
|
@ -359,7 +359,7 @@ export default class GameLogic {
|
||||||
this.gridManager = new GridManager(
|
this.gridManager = new GridManager(
|
||||||
this.getWidth(),
|
this.getWidth(),
|
||||||
this.getHeight(),
|
this.getHeight(),
|
||||||
this.theme,
|
this.theme
|
||||||
);
|
);
|
||||||
this.nextPieces = [];
|
this.nextPieces = [];
|
||||||
this.generateNextPieces();
|
this.generateNextPieces();
|
||||||
|
@ -367,7 +367,7 @@ export default class GameLogic {
|
||||||
tickCallback(
|
tickCallback(
|
||||||
this.scoreManager.getScore(),
|
this.scoreManager.getScore(),
|
||||||
this.scoreManager.getLevel(),
|
this.scoreManager.getLevel(),
|
||||||
this.gridManager.getCurrentGrid(),
|
this.gridManager.getCurrentGrid()
|
||||||
);
|
);
|
||||||
clockCallback(this.gameTime);
|
clockCallback(this.gameTime);
|
||||||
this.startTick();
|
this.startTick();
|
||||||
|
|
|
@ -134,7 +134,7 @@ export default class GridManager {
|
||||||
freezeTetromino(currentObject: Piece, scoreManager: ScoreManager) {
|
freezeTetromino(currentObject: Piece, scoreManager: ScoreManager) {
|
||||||
this.clearLines(
|
this.clearLines(
|
||||||
this.getLinesToClear(currentObject.getCoordinates()),
|
this.getLinesToClear(currentObject.getCoordinates()),
|
||||||
scoreManager,
|
scoreManager
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ export default class Piece {
|
||||||
*/
|
*/
|
||||||
removeFromGrid(grid: GridType) {
|
removeFromGrid(grid: GridType) {
|
||||||
const pos: Array<CoordinatesType> = this.currentShape.getCellsCoordinates(
|
const pos: Array<CoordinatesType> = this.currentShape.getCellsCoordinates(
|
||||||
true,
|
true
|
||||||
);
|
);
|
||||||
pos.forEach((coordinates: CoordinatesType) => {
|
pos.forEach((coordinates: CoordinatesType) => {
|
||||||
grid[coordinates.y][coordinates.x] = {
|
grid[coordinates.y][coordinates.x] = {
|
||||||
|
@ -85,7 +85,7 @@ export default class Piece {
|
||||||
*/
|
*/
|
||||||
toGrid(grid: GridType, isPreview: boolean) {
|
toGrid(grid: GridType, isPreview: boolean) {
|
||||||
const pos: Array<CoordinatesType> = this.currentShape.getCellsCoordinates(
|
const pos: Array<CoordinatesType> = this.currentShape.getCellsCoordinates(
|
||||||
!isPreview,
|
!isPreview
|
||||||
);
|
);
|
||||||
pos.forEach((coordinates: CoordinatesType) => {
|
pos.forEach((coordinates: CoordinatesType) => {
|
||||||
grid[coordinates.y][coordinates.x] = {
|
grid[coordinates.y][coordinates.x] = {
|
||||||
|
@ -107,7 +107,7 @@ export default class Piece {
|
||||||
isPositionValid(grid: GridType, width: number, height: number): boolean {
|
isPositionValid(grid: GridType, width: number, height: number): boolean {
|
||||||
let isValid = true;
|
let isValid = true;
|
||||||
const pos: Array<CoordinatesType> = this.currentShape.getCellsCoordinates(
|
const pos: Array<CoordinatesType> = this.currentShape.getCellsCoordinates(
|
||||||
true,
|
true
|
||||||
);
|
);
|
||||||
for (let i = 0; i < pos.length; i += 1) {
|
for (let i = 0; i < pos.length; i += 1) {
|
||||||
if (
|
if (
|
||||||
|
@ -141,7 +141,7 @@ export default class Piece {
|
||||||
grid: GridType,
|
grid: GridType,
|
||||||
width: number,
|
width: number,
|
||||||
height: number,
|
height: number,
|
||||||
freezeCallback: () => void,
|
freezeCallback: () => void
|
||||||
): boolean {
|
): boolean {
|
||||||
let newX = x;
|
let newX = x;
|
||||||
let newY = y;
|
let newY = y;
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import {View} from 'react-native';
|
import { StyleSheet, View } from 'react-native';
|
||||||
import { Caption, IconButton, Text, withTheme } from 'react-native-paper';
|
import { Caption, IconButton, Text, withTheme } from 'react-native-paper';
|
||||||
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||||
import i18n from 'i18n-js';
|
import i18n from 'i18n-js';
|
||||||
|
@ -32,6 +32,7 @@ import MaterialHeaderButtons, {
|
||||||
} from '../../../components/Overrides/CustomHeaderButton';
|
} from '../../../components/Overrides/CustomHeaderButton';
|
||||||
import type { OptionsDialogButtonType } from '../../../components/Dialogs/OptionsDialog';
|
import type { OptionsDialogButtonType } from '../../../components/Dialogs/OptionsDialog';
|
||||||
import OptionsDialog from '../../../components/Dialogs/OptionsDialog';
|
import OptionsDialog from '../../../components/Dialogs/OptionsDialog';
|
||||||
|
import GENERAL_STYLES from '../../../constants/Styles';
|
||||||
|
|
||||||
type PropsType = {
|
type PropsType = {
|
||||||
navigation: StackNavigationProp<any>;
|
navigation: StackNavigationProp<any>;
|
||||||
|
@ -52,6 +53,67 @@ type StateType = {
|
||||||
onDialogDismiss: () => void;
|
onDialogDismiss: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
container: {
|
||||||
|
flex: 1,
|
||||||
|
flexDirection: 'row',
|
||||||
|
},
|
||||||
|
gridContainer: {
|
||||||
|
flex: 4,
|
||||||
|
},
|
||||||
|
centerSmallMargin: {
|
||||||
|
...GENERAL_STYLES.centerHorizontal,
|
||||||
|
marginBottom: 5,
|
||||||
|
},
|
||||||
|
centerVerticalSmallMargin: {
|
||||||
|
...GENERAL_STYLES.centerVertical,
|
||||||
|
marginLeft: 5,
|
||||||
|
},
|
||||||
|
centerBigMargin: {
|
||||||
|
marginLeft: 'auto',
|
||||||
|
marginRight: 'auto',
|
||||||
|
marginBottom: 20,
|
||||||
|
},
|
||||||
|
statusContainer: {
|
||||||
|
flexDirection: 'row',
|
||||||
|
},
|
||||||
|
statusIcon: {
|
||||||
|
marginLeft: 5,
|
||||||
|
},
|
||||||
|
scoreMainContainer: {
|
||||||
|
marginTop: 10,
|
||||||
|
marginBottom: 10,
|
||||||
|
},
|
||||||
|
scoreCurrentContainer: {
|
||||||
|
flexDirection: 'row',
|
||||||
|
marginLeft: 'auto',
|
||||||
|
marginRight: 'auto',
|
||||||
|
},
|
||||||
|
scoreText: {
|
||||||
|
marginLeft: 5,
|
||||||
|
fontSize: 20,
|
||||||
|
},
|
||||||
|
scoreBestContainer: {
|
||||||
|
flexDirection: 'row',
|
||||||
|
marginLeft: 'auto',
|
||||||
|
marginRight: 'auto',
|
||||||
|
marginTop: 5,
|
||||||
|
},
|
||||||
|
controlsContainer: {
|
||||||
|
height: 80,
|
||||||
|
flexDirection: 'row',
|
||||||
|
},
|
||||||
|
directionsContainer: {
|
||||||
|
flexDirection: 'row',
|
||||||
|
flex: 4,
|
||||||
|
},
|
||||||
|
preview: {
|
||||||
|
marginLeft: 'auto',
|
||||||
|
marginRight: 'auto',
|
||||||
|
marginTop: 10,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
class GameMainScreen extends React.Component<PropsType, StateType> {
|
class GameMainScreen extends React.Component<PropsType, StateType> {
|
||||||
static getFormattedTime(seconds: number): string {
|
static getFormattedTime(seconds: number): string {
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
|
@ -151,27 +213,15 @@ class GameMainScreen extends React.Component<PropsType, StateType> {
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
flex: 1,
|
...GENERAL_STYLES.flex,
|
||||||
marginTop: 'auto',
|
...GENERAL_STYLES.centerVertical,
|
||||||
marginBottom: 'auto',
|
}}
|
||||||
}}>
|
>
|
||||||
<View
|
<View style={GENERAL_STYLES.centerHorizontal}>
|
||||||
style={{
|
<Caption style={styles.centerSmallMargin}>
|
||||||
marginLeft: 'auto',
|
|
||||||
marginRight: 'auto',
|
|
||||||
}}>
|
|
||||||
<Caption
|
|
||||||
style={{
|
|
||||||
marginLeft: 'auto',
|
|
||||||
marginRight: 'auto',
|
|
||||||
marginBottom: 5,
|
|
||||||
}}>
|
|
||||||
{i18n.t('screens.game.time')}
|
{i18n.t('screens.game.time')}
|
||||||
</Caption>
|
</Caption>
|
||||||
<View
|
<View style={styles.statusContainer}>
|
||||||
style={{
|
|
||||||
flexDirection: 'row',
|
|
||||||
}}>
|
|
||||||
<MaterialCommunityIcons
|
<MaterialCommunityIcons
|
||||||
name="timer"
|
name="timer"
|
||||||
color={props.theme.colors.subtitle}
|
color={props.theme.colors.subtitle}
|
||||||
|
@ -179,42 +229,25 @@ class GameMainScreen extends React.Component<PropsType, StateType> {
|
||||||
/>
|
/>
|
||||||
<Text
|
<Text
|
||||||
style={{
|
style={{
|
||||||
marginLeft: 5,
|
...styles.statusIcon,
|
||||||
color: props.theme.colors.subtitle,
|
color: props.theme.colors.subtitle,
|
||||||
}}>
|
}}
|
||||||
|
>
|
||||||
{GameMainScreen.getFormattedTime(state.gameTime)}
|
{GameMainScreen.getFormattedTime(state.gameTime)}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View
|
<View style={styles.centerBigMargin}>
|
||||||
style={{
|
<Caption style={styles.centerSmallMargin}>
|
||||||
marginLeft: 'auto',
|
|
||||||
marginRight: 'auto',
|
|
||||||
marginTop: 20,
|
|
||||||
}}>
|
|
||||||
<Caption
|
|
||||||
style={{
|
|
||||||
marginLeft: 'auto',
|
|
||||||
marginRight: 'auto',
|
|
||||||
marginBottom: 5,
|
|
||||||
}}>
|
|
||||||
{i18n.t('screens.game.level')}
|
{i18n.t('screens.game.level')}
|
||||||
</Caption>
|
</Caption>
|
||||||
<View
|
<View style={styles.statusContainer}>
|
||||||
style={{
|
|
||||||
flexDirection: 'row',
|
|
||||||
}}>
|
|
||||||
<MaterialCommunityIcons
|
<MaterialCommunityIcons
|
||||||
name="gamepad-square"
|
name="gamepad-square"
|
||||||
color={props.theme.colors.text}
|
color={props.theme.colors.text}
|
||||||
size={20}
|
size={20}
|
||||||
/>
|
/>
|
||||||
<Text
|
<Text style={styles.statusIcon}>{state.gameLevel}</Text>
|
||||||
style={{
|
|
||||||
marginLeft: 5,
|
|
||||||
}}>
|
|
||||||
{state.gameLevel}
|
|
||||||
</Text>
|
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
@ -228,59 +261,32 @@ class GameMainScreen extends React.Component<PropsType, StateType> {
|
||||||
? state.gameScore
|
? state.gameScore
|
||||||
: this.highScore;
|
: this.highScore;
|
||||||
return (
|
return (
|
||||||
<View
|
<View style={styles.scoreMainContainer}>
|
||||||
style={{
|
<View style={styles.scoreCurrentContainer}>
|
||||||
marginTop: 10,
|
<Text style={styles.scoreText}>
|
||||||
marginBottom: 10,
|
|
||||||
}}>
|
|
||||||
<View
|
|
||||||
style={{
|
|
||||||
flexDirection: 'row',
|
|
||||||
marginLeft: 'auto',
|
|
||||||
marginRight: 'auto',
|
|
||||||
}}>
|
|
||||||
<Text
|
|
||||||
style={{
|
|
||||||
marginLeft: 5,
|
|
||||||
fontSize: 20,
|
|
||||||
}}>
|
|
||||||
{i18n.t('screens.game.score', { score: state.gameScore })}
|
{i18n.t('screens.game.score', { score: state.gameScore })}
|
||||||
</Text>
|
</Text>
|
||||||
<MaterialCommunityIcons
|
<MaterialCommunityIcons
|
||||||
name="star"
|
name="star"
|
||||||
color={props.theme.colors.tetrisScore}
|
color={props.theme.colors.tetrisScore}
|
||||||
size={20}
|
size={20}
|
||||||
style={{
|
style={styles.centerVerticalSmallMargin}
|
||||||
marginTop: 'auto',
|
|
||||||
marginBottom: 'auto',
|
|
||||||
marginLeft: 5,
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
<View
|
<View style={styles.scoreBestContainer}>
|
||||||
style={{
|
|
||||||
flexDirection: 'row',
|
|
||||||
marginLeft: 'auto',
|
|
||||||
marginRight: 'auto',
|
|
||||||
marginTop: 5,
|
|
||||||
}}>
|
|
||||||
<Text
|
<Text
|
||||||
style={{
|
style={{
|
||||||
marginLeft: 5,
|
...styles.scoreText,
|
||||||
fontSize: 10,
|
|
||||||
color: props.theme.colors.textDisabled,
|
color: props.theme.colors.textDisabled,
|
||||||
}}>
|
}}
|
||||||
|
>
|
||||||
{i18n.t('screens.game.highScore', { score: highScore })}
|
{i18n.t('screens.game.highScore', { score: highScore })}
|
||||||
</Text>
|
</Text>
|
||||||
<MaterialCommunityIcons
|
<MaterialCommunityIcons
|
||||||
name="star"
|
name="star"
|
||||||
color={props.theme.colors.tetrisScore}
|
color={props.theme.colors.tetrisScore}
|
||||||
size={10}
|
size={10}
|
||||||
style={{
|
style={styles.centerVerticalSmallMargin}
|
||||||
marginTop: 'auto',
|
|
||||||
marginBottom: 'auto',
|
|
||||||
marginLeft: 5,
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
@ -290,28 +296,20 @@ class GameMainScreen extends React.Component<PropsType, StateType> {
|
||||||
getControlButtons() {
|
getControlButtons() {
|
||||||
const { props } = this;
|
const { props } = this;
|
||||||
return (
|
return (
|
||||||
<View
|
<View style={styles.controlsContainer}>
|
||||||
style={{
|
|
||||||
height: 80,
|
|
||||||
flexDirection: 'row',
|
|
||||||
}}>
|
|
||||||
<IconButton
|
<IconButton
|
||||||
icon="rotate-right-variant"
|
icon="rotate-right-variant"
|
||||||
size={40}
|
size={40}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
this.logic.rotatePressed(this.updateGrid);
|
this.logic.rotatePressed(this.updateGrid);
|
||||||
}}
|
}}
|
||||||
style={{flex: 1}}
|
style={GENERAL_STYLES.flex}
|
||||||
/>
|
/>
|
||||||
<View
|
<View style={styles.directionsContainer}>
|
||||||
style={{
|
|
||||||
flexDirection: 'row',
|
|
||||||
flex: 4,
|
|
||||||
}}>
|
|
||||||
<IconButton
|
<IconButton
|
||||||
icon="chevron-left"
|
icon="chevron-left"
|
||||||
size={40}
|
size={40}
|
||||||
style={{flex: 1}}
|
style={GENERAL_STYLES.flex}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
this.logic.pressedOut();
|
this.logic.pressedOut();
|
||||||
}}
|
}}
|
||||||
|
@ -322,7 +320,7 @@ class GameMainScreen extends React.Component<PropsType, StateType> {
|
||||||
<IconButton
|
<IconButton
|
||||||
icon="chevron-right"
|
icon="chevron-right"
|
||||||
size={40}
|
size={40}
|
||||||
style={{flex: 1}}
|
style={GENERAL_STYLES.flex}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
this.logic.pressedOut();
|
this.logic.pressedOut();
|
||||||
}}
|
}}
|
||||||
|
@ -340,7 +338,7 @@ class GameMainScreen extends React.Component<PropsType, StateType> {
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
this.logic.pressedOut();
|
this.logic.pressedOut();
|
||||||
}}
|
}}
|
||||||
style={{flex: 1}}
|
style={GENERAL_STYLES.flex}
|
||||||
color={props.theme.colors.tetrisScore}
|
color={props.theme.colors.tetrisScore}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
|
@ -422,14 +420,10 @@ class GameMainScreen extends React.Component<PropsType, StateType> {
|
||||||
render() {
|
render() {
|
||||||
const { props, state } = this;
|
const { props, state } = this;
|
||||||
return (
|
return (
|
||||||
<View style={{flex: 1}}>
|
<View style={GENERAL_STYLES.flex}>
|
||||||
<View
|
<View style={styles.container}>
|
||||||
style={{
|
|
||||||
flex: 1,
|
|
||||||
flexDirection: 'row',
|
|
||||||
}}>
|
|
||||||
{this.getStatusIcons()}
|
{this.getStatusIcons()}
|
||||||
<View style={{flex: 4}}>
|
<View style={styles.gridContainer}>
|
||||||
{this.getScoreIcon()}
|
{this.getScoreIcon()}
|
||||||
<GridComponent
|
<GridComponent
|
||||||
width={this.logic.getWidth()}
|
width={this.logic.getWidth()}
|
||||||
|
@ -437,21 +431,16 @@ class GameMainScreen extends React.Component<PropsType, StateType> {
|
||||||
grid={state.grid}
|
grid={state.grid}
|
||||||
style={{
|
style={{
|
||||||
backgroundColor: props.theme.colors.tetrisBackground,
|
backgroundColor: props.theme.colors.tetrisBackground,
|
||||||
flex: 1,
|
...GENERAL_STYLES.flex,
|
||||||
marginLeft: 'auto',
|
...GENERAL_STYLES.centerHorizontal,
|
||||||
marginRight: 'auto',
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View style={{flex: 1}}>
|
<View style={GENERAL_STYLES.flex}>
|
||||||
<Preview
|
<Preview
|
||||||
items={this.logic.getNextPiecesPreviews()}
|
items={this.logic.getNextPiecesPreviews()}
|
||||||
style={{
|
style={styles.preview}
|
||||||
marginLeft: 'auto',
|
|
||||||
marginRight: 'auto',
|
|
||||||
marginTop: 10,
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
|
@ -28,7 +28,7 @@ import {
|
||||||
Text,
|
Text,
|
||||||
withTheme,
|
withTheme,
|
||||||
} from 'react-native-paper';
|
} from 'react-native-paper';
|
||||||
import {View} from 'react-native';
|
import { StyleSheet, View } from 'react-native';
|
||||||
import i18n from 'i18n-js';
|
import i18n from 'i18n-js';
|
||||||
import * as Animatable from 'react-native-animatable';
|
import * as Animatable from 'react-native-animatable';
|
||||||
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||||
|
@ -42,6 +42,7 @@ import GridManager from '../logic/GridManager';
|
||||||
import Piece from '../logic/Piece';
|
import Piece from '../logic/Piece';
|
||||||
import SpeechArrow from '../../../components/Mascot/SpeechArrow';
|
import SpeechArrow from '../../../components/Mascot/SpeechArrow';
|
||||||
import CollapsibleScrollView from '../../../components/Collapsible/CollapsibleScrollView';
|
import CollapsibleScrollView from '../../../components/Collapsible/CollapsibleScrollView';
|
||||||
|
import GENERAL_STYLES from '../../../constants/Styles';
|
||||||
|
|
||||||
type GameStatsType = {
|
type GameStatsType = {
|
||||||
score: number;
|
score: number;
|
||||||
|
@ -57,6 +58,87 @@ type PropsType = {
|
||||||
theme: ReactNativePaper.Theme;
|
theme: ReactNativePaper.Theme;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
pieceContainer: {
|
||||||
|
position: 'absolute',
|
||||||
|
width: '100%',
|
||||||
|
height: '100%',
|
||||||
|
},
|
||||||
|
pieceBackground: {
|
||||||
|
position: 'absolute',
|
||||||
|
},
|
||||||
|
playButton: {
|
||||||
|
marginLeft: 'auto',
|
||||||
|
marginRight: 'auto',
|
||||||
|
marginTop: 10,
|
||||||
|
},
|
||||||
|
recapCard: {
|
||||||
|
borderWidth: 2,
|
||||||
|
marginLeft: 20,
|
||||||
|
marginRight: 20,
|
||||||
|
},
|
||||||
|
recapContainer: {
|
||||||
|
flexDirection: 'row',
|
||||||
|
marginLeft: 'auto',
|
||||||
|
marginRight: 'auto',
|
||||||
|
},
|
||||||
|
recapScoreContainer: {
|
||||||
|
flexDirection: 'row',
|
||||||
|
marginLeft: 'auto',
|
||||||
|
marginRight: 'auto',
|
||||||
|
marginTop: 10,
|
||||||
|
marginBottom: 10,
|
||||||
|
},
|
||||||
|
recapScore: {
|
||||||
|
fontSize: 20,
|
||||||
|
},
|
||||||
|
recapScoreIcon: {
|
||||||
|
marginLeft: 5,
|
||||||
|
},
|
||||||
|
recapIcon: {
|
||||||
|
marginRight: 5,
|
||||||
|
marginLeft: 5,
|
||||||
|
},
|
||||||
|
welcomeMascot: {
|
||||||
|
width: '40%',
|
||||||
|
marginLeft: 'auto',
|
||||||
|
marginRight: 'auto',
|
||||||
|
},
|
||||||
|
welcomeCard: {
|
||||||
|
borderWidth: 2,
|
||||||
|
marginLeft: 10,
|
||||||
|
marginRight: 10,
|
||||||
|
},
|
||||||
|
centertext: {
|
||||||
|
textAlign: 'center',
|
||||||
|
},
|
||||||
|
welcomeText: {
|
||||||
|
textAlign: 'center',
|
||||||
|
marginTop: 10,
|
||||||
|
},
|
||||||
|
speechArrow: {
|
||||||
|
marginLeft: '60%',
|
||||||
|
},
|
||||||
|
podiumContainer: {
|
||||||
|
flexDirection: 'column',
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'flex-end',
|
||||||
|
},
|
||||||
|
podiumIconContainer: {
|
||||||
|
position: 'absolute',
|
||||||
|
top: -20,
|
||||||
|
},
|
||||||
|
topScoreContainer: {
|
||||||
|
marginBottom: 20,
|
||||||
|
marginTop: 20,
|
||||||
|
},
|
||||||
|
topScoreSubcontainer: {
|
||||||
|
flexDirection: 'row',
|
||||||
|
marginLeft: 'auto',
|
||||||
|
marginRight: 'auto',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
class GameStartScreen extends React.Component<PropsType> {
|
class GameStartScreen extends React.Component<PropsType> {
|
||||||
gridManager: GridManager;
|
gridManager: GridManager;
|
||||||
|
|
||||||
|
@ -71,7 +153,7 @@ class GameStartScreen extends React.Component<PropsType> {
|
||||||
this.isHighScore = false;
|
this.isHighScore = false;
|
||||||
this.gridManager = new GridManager(4, 4, props.theme);
|
this.gridManager = new GridManager(4, 4, props.theme);
|
||||||
this.scores = AsyncStorageManager.getObject(
|
this.scores = AsyncStorageManager.getObject(
|
||||||
AsyncStorageManager.PREFERENCES.gameScores.key,
|
AsyncStorageManager.PREFERENCES.gameScores.key
|
||||||
);
|
);
|
||||||
this.scores.sort((a: number, b: number): number => b - a);
|
this.scores.sort((a: number, b: number): number => b - a);
|
||||||
if (props.route.params != null) {
|
if (props.route.params != null) {
|
||||||
|
@ -88,12 +170,7 @@ class GameStartScreen extends React.Component<PropsType> {
|
||||||
piece.toGrid(gridList[i], true);
|
piece.toGrid(gridList[i], true);
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<View
|
<View style={styles.pieceContainer}>
|
||||||
style={{
|
|
||||||
position: 'absolute',
|
|
||||||
width: '100%',
|
|
||||||
height: '100%',
|
|
||||||
}}>
|
|
||||||
{gridList.map((item: GridType, index: number) => {
|
{gridList.map((item: GridType, index: number) => {
|
||||||
const size = 10 + Math.floor(Math.random() * 30);
|
const size = 10 + Math.floor(Math.random() * 30);
|
||||||
const top = Math.floor(Math.random() * 100);
|
const top = Math.floor(Math.random() * 100);
|
||||||
|
@ -110,10 +187,11 @@ class GameStartScreen extends React.Component<PropsType> {
|
||||||
key={`piece${index.toString()}`}
|
key={`piece${index.toString()}`}
|
||||||
style={{
|
style={{
|
||||||
width: `${size}%`,
|
width: `${size}%`,
|
||||||
position: 'absolute',
|
|
||||||
top: `${top}%`,
|
top: `${top}%`,
|
||||||
left: `${left}%`,
|
left: `${left}%`,
|
||||||
}}>
|
...styles.pieceBackground,
|
||||||
|
}}
|
||||||
|
>
|
||||||
<GridComponent
|
<GridComponent
|
||||||
width={4}
|
width={4}
|
||||||
height={4}
|
height={4}
|
||||||
|
@ -131,98 +209,71 @@ class GameStartScreen extends React.Component<PropsType> {
|
||||||
|
|
||||||
getPostGameContent(stats: GameStatsType) {
|
getPostGameContent(stats: GameStatsType) {
|
||||||
const { props } = this;
|
const { props } = this;
|
||||||
|
const width = this.isHighScore ? '50%' : '30%';
|
||||||
|
const margin = this.isHighScore ? 'auto' : undefined;
|
||||||
|
const marginLeft = this.isHighScore ? '60%' : '20%';
|
||||||
|
const color = this.isHighScore
|
||||||
|
? props.theme.colors.gameGold
|
||||||
|
: props.theme.colors.primary;
|
||||||
return (
|
return (
|
||||||
<View
|
<View style={GENERAL_STYLES.flex}>
|
||||||
style={{
|
|
||||||
flex: 1,
|
|
||||||
}}>
|
|
||||||
<Mascot
|
<Mascot
|
||||||
emotion={this.isHighScore ? MASCOT_STYLE.LOVE : MASCOT_STYLE.NORMAL}
|
emotion={this.isHighScore ? MASCOT_STYLE.LOVE : MASCOT_STYLE.NORMAL}
|
||||||
animated={this.isHighScore}
|
animated={this.isHighScore}
|
||||||
style={{
|
style={{
|
||||||
width: this.isHighScore ? '50%' : '30%',
|
width: width,
|
||||||
marginLeft: this.isHighScore ? 'auto' : undefined,
|
marginLeft: margin,
|
||||||
marginRight: this.isHighScore ? 'auto' : undefined,
|
marginRight: margin,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<SpeechArrow
|
<SpeechArrow
|
||||||
style={{marginLeft: this.isHighScore ? '60%' : '20%'}}
|
style={{ marginLeft: marginLeft }}
|
||||||
size={20}
|
size={20}
|
||||||
color={props.theme.colors.mascotMessageArrow}
|
color={props.theme.colors.mascotMessageArrow}
|
||||||
/>
|
/>
|
||||||
<Card
|
<Card
|
||||||
style={{
|
style={{
|
||||||
borderColor: props.theme.colors.mascotMessageArrow,
|
borderColor: props.theme.colors.mascotMessageArrow,
|
||||||
borderWidth: 2,
|
...styles.recapCard,
|
||||||
marginLeft: 20,
|
}}
|
||||||
marginRight: 20,
|
>
|
||||||
}}>
|
|
||||||
<Card.Content>
|
<Card.Content>
|
||||||
<Headline
|
<Headline
|
||||||
style={{
|
style={{
|
||||||
textAlign: 'center',
|
color: color,
|
||||||
color: this.isHighScore
|
...styles.centertext,
|
||||||
? props.theme.colors.gameGold
|
}}
|
||||||
: props.theme.colors.primary,
|
>
|
||||||
}}>
|
|
||||||
{this.isHighScore
|
{this.isHighScore
|
||||||
? i18n.t('screens.game.newHighScore')
|
? i18n.t('screens.game.newHighScore')
|
||||||
: i18n.t('screens.game.gameOver')}
|
: i18n.t('screens.game.gameOver')}
|
||||||
</Headline>
|
</Headline>
|
||||||
<Divider />
|
<Divider />
|
||||||
<View
|
<View style={styles.recapScoreContainer}>
|
||||||
style={{
|
<Text style={styles.recapScore}>
|
||||||
flexDirection: 'row',
|
|
||||||
marginLeft: 'auto',
|
|
||||||
marginRight: 'auto',
|
|
||||||
marginTop: 10,
|
|
||||||
marginBottom: 10,
|
|
||||||
}}>
|
|
||||||
<Text
|
|
||||||
style={{
|
|
||||||
fontSize: 20,
|
|
||||||
}}>
|
|
||||||
{i18n.t('screens.game.score', { score: stats.score })}
|
{i18n.t('screens.game.score', { score: stats.score })}
|
||||||
</Text>
|
</Text>
|
||||||
<MaterialCommunityIcons
|
<MaterialCommunityIcons
|
||||||
name="star"
|
name="star"
|
||||||
color={props.theme.colors.tetrisScore}
|
color={props.theme.colors.tetrisScore}
|
||||||
size={30}
|
size={30}
|
||||||
style={{
|
style={styles.recapScoreIcon}
|
||||||
marginLeft: 5,
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
<View
|
<View style={styles.recapContainer}>
|
||||||
style={{
|
|
||||||
flexDirection: 'row',
|
|
||||||
marginLeft: 'auto',
|
|
||||||
marginRight: 'auto',
|
|
||||||
}}>
|
|
||||||
<Text>{i18n.t('screens.game.level')}</Text>
|
<Text>{i18n.t('screens.game.level')}</Text>
|
||||||
<MaterialCommunityIcons
|
<MaterialCommunityIcons
|
||||||
style={{
|
style={styles.recapIcon}
|
||||||
marginRight: 5,
|
|
||||||
marginLeft: 5,
|
|
||||||
}}
|
|
||||||
name="gamepad-square"
|
name="gamepad-square"
|
||||||
size={20}
|
size={20}
|
||||||
color={props.theme.colors.textDisabled}
|
color={props.theme.colors.textDisabled}
|
||||||
/>
|
/>
|
||||||
<Text>{stats.level}</Text>
|
<Text>{stats.level}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View
|
<View style={styles.recapContainer}>
|
||||||
style={{
|
|
||||||
flexDirection: 'row',
|
|
||||||
marginLeft: 'auto',
|
|
||||||
marginRight: 'auto',
|
|
||||||
}}>
|
|
||||||
<Text>{i18n.t('screens.game.time')}</Text>
|
<Text>{i18n.t('screens.game.time')}</Text>
|
||||||
<MaterialCommunityIcons
|
<MaterialCommunityIcons
|
||||||
style={{
|
style={styles.recapIcon}
|
||||||
marginRight: 5,
|
|
||||||
marginLeft: 5,
|
|
||||||
}}
|
|
||||||
name="timer"
|
name="timer"
|
||||||
size={20}
|
size={20}
|
||||||
color={props.theme.colors.textDisabled}
|
color={props.theme.colors.textDisabled}
|
||||||
|
@ -239,40 +290,29 @@ class GameStartScreen extends React.Component<PropsType> {
|
||||||
const { props } = this;
|
const { props } = this;
|
||||||
return (
|
return (
|
||||||
<View>
|
<View>
|
||||||
<Mascot
|
<Mascot emotion={MASCOT_STYLE.COOL} style={styles.welcomeMascot} />
|
||||||
emotion={MASCOT_STYLE.COOL}
|
|
||||||
style={{
|
|
||||||
width: '40%',
|
|
||||||
marginLeft: 'auto',
|
|
||||||
marginRight: 'auto',
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<SpeechArrow
|
<SpeechArrow
|
||||||
style={{marginLeft: '60%'}}
|
style={styles.speechArrow}
|
||||||
size={20}
|
size={20}
|
||||||
color={props.theme.colors.mascotMessageArrow}
|
color={props.theme.colors.mascotMessageArrow}
|
||||||
/>
|
/>
|
||||||
<Card
|
<Card
|
||||||
style={{
|
style={{
|
||||||
borderColor: props.theme.colors.mascotMessageArrow,
|
borderColor: props.theme.colors.mascotMessageArrow,
|
||||||
borderWidth: 2,
|
...styles.welcomeCard,
|
||||||
marginLeft: 10,
|
}}
|
||||||
marginRight: 10,
|
>
|
||||||
}}>
|
|
||||||
<Card.Content>
|
<Card.Content>
|
||||||
<Headline
|
<Headline
|
||||||
style={{
|
style={{
|
||||||
textAlign: 'center',
|
|
||||||
color: props.theme.colors.primary,
|
color: props.theme.colors.primary,
|
||||||
}}>
|
...styles.centertext,
|
||||||
|
}}
|
||||||
|
>
|
||||||
{i18n.t('screens.game.welcomeTitle')}
|
{i18n.t('screens.game.welcomeTitle')}
|
||||||
</Headline>
|
</Headline>
|
||||||
<Divider />
|
<Divider />
|
||||||
<Paragraph
|
<Paragraph style={styles.welcomeText}>
|
||||||
style={{
|
|
||||||
textAlign: 'center',
|
|
||||||
marginTop: 10,
|
|
||||||
}}>
|
|
||||||
{i18n.t('screens.game.welcomeMessage')}
|
{i18n.t('screens.game.welcomeMessage')}
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
</Card.Content>
|
</Card.Content>
|
||||||
|
@ -298,15 +338,17 @@ class GameStartScreen extends React.Component<PropsType> {
|
||||||
fontSize = 15;
|
fontSize = 15;
|
||||||
size = 50;
|
size = 50;
|
||||||
}
|
}
|
||||||
|
const marginLeft = place === 2 ? 20 : 'auto';
|
||||||
|
const marginRight = place === 3 ? 20 : 'auto';
|
||||||
|
const fontWeight = place === 1 ? 'bold' : undefined;
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
marginLeft: place === 2 ? 20 : 'auto',
|
marginLeft: marginLeft,
|
||||||
marginRight: place === 3 ? 20 : 'auto',
|
marginRight: marginRight,
|
||||||
flexDirection: 'column',
|
...styles.podiumContainer,
|
||||||
alignItems: 'center',
|
}}
|
||||||
justifyContent: 'flex-end',
|
>
|
||||||
}}>
|
|
||||||
{this.isHighScore && place === 1 ? (
|
{this.isHighScore && place === 1 ? (
|
||||||
<Animatable.View
|
<Animatable.View
|
||||||
animation="swing"
|
animation="swing"
|
||||||
|
@ -314,14 +356,13 @@ class GameStartScreen extends React.Component<PropsType> {
|
||||||
duration={2000}
|
duration={2000}
|
||||||
delay={1000}
|
delay={1000}
|
||||||
useNativeDriver
|
useNativeDriver
|
||||||
style={{
|
style={styles.podiumIconContainer}
|
||||||
position: 'absolute',
|
>
|
||||||
top: -20,
|
|
||||||
}}>
|
|
||||||
<Animatable.View
|
<Animatable.View
|
||||||
animation="pulse"
|
animation="pulse"
|
||||||
iterationCount="infinite"
|
iterationCount="infinite"
|
||||||
useNativeDriver>
|
useNativeDriver
|
||||||
|
>
|
||||||
<MaterialCommunityIcons
|
<MaterialCommunityIcons
|
||||||
name="decagram"
|
name="decagram"
|
||||||
color={props.theme.colors.gameGold}
|
color={props.theme.colors.gameGold}
|
||||||
|
@ -337,10 +378,11 @@ class GameStartScreen extends React.Component<PropsType> {
|
||||||
/>
|
/>
|
||||||
<Text
|
<Text
|
||||||
style={{
|
style={{
|
||||||
textAlign: 'center',
|
fontWeight: fontWeight,
|
||||||
fontWeight: place === 1 ? 'bold' : undefined,
|
|
||||||
fontSize,
|
fontSize,
|
||||||
}}>
|
...styles.centertext,
|
||||||
|
}}
|
||||||
|
>
|
||||||
{score}
|
{score}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
|
@ -352,18 +394,9 @@ class GameStartScreen extends React.Component<PropsType> {
|
||||||
const silver = this.scores.length > 1 ? this.scores[1] : '-';
|
const silver = this.scores.length > 1 ? this.scores[1] : '-';
|
||||||
const bronze = this.scores.length > 2 ? this.scores[2] : '-';
|
const bronze = this.scores.length > 2 ? this.scores[2] : '-';
|
||||||
return (
|
return (
|
||||||
<View
|
<View style={styles.topScoreContainer}>
|
||||||
style={{
|
|
||||||
marginBottom: 20,
|
|
||||||
marginTop: 20,
|
|
||||||
}}>
|
|
||||||
{this.getPodiumRender(1, gold.toString())}
|
{this.getPodiumRender(1, gold.toString())}
|
||||||
<View
|
<View style={styles.topScoreSubcontainer}>
|
||||||
style={{
|
|
||||||
flexDirection: 'row',
|
|
||||||
marginLeft: 'auto',
|
|
||||||
marginRight: 'auto',
|
|
||||||
}}>
|
|
||||||
{this.getPodiumRender(3, bronze.toString())}
|
{this.getPodiumRender(3, bronze.toString())}
|
||||||
{this.getPodiumRender(2, silver.toString())}
|
{this.getPodiumRender(2, silver.toString())}
|
||||||
</View>
|
</View>
|
||||||
|
@ -374,7 +407,7 @@ class GameStartScreen extends React.Component<PropsType> {
|
||||||
getMainContent() {
|
getMainContent() {
|
||||||
const { props } = this;
|
const { props } = this;
|
||||||
return (
|
return (
|
||||||
<View style={{flex: 1}}>
|
<View style={GENERAL_STYLES.flex}>
|
||||||
{this.gameStats != null
|
{this.gameStats != null
|
||||||
? this.getPostGameContent(this.gameStats)
|
? this.getPostGameContent(this.gameStats)
|
||||||
: this.getWelcomeText()}
|
: this.getWelcomeText()}
|
||||||
|
@ -386,11 +419,8 @@ class GameStartScreen extends React.Component<PropsType> {
|
||||||
highScore: this.scores.length > 0 ? this.scores[0] : null,
|
highScore: this.scores.length > 0 ? this.scores[0] : null,
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
style={{
|
style={styles.playButton}
|
||||||
marginLeft: 'auto',
|
>
|
||||||
marginRight: 'auto',
|
|
||||||
marginTop: 10,
|
|
||||||
}}>
|
|
||||||
{i18n.t('screens.game.play')}
|
{i18n.t('screens.game.play')}
|
||||||
</Button>
|
</Button>
|
||||||
{this.getTopScoresRender()}
|
{this.getTopScoresRender()}
|
||||||
|
@ -420,7 +450,7 @@ class GameStartScreen extends React.Component<PropsType> {
|
||||||
}
|
}
|
||||||
AsyncStorageManager.set(
|
AsyncStorageManager.set(
|
||||||
AsyncStorageManager.PREFERENCES.gameScores.key,
|
AsyncStorageManager.PREFERENCES.gameScores.key,
|
||||||
this.scores,
|
this.scores
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -428,16 +458,17 @@ class GameStartScreen extends React.Component<PropsType> {
|
||||||
render() {
|
render() {
|
||||||
const { props } = this;
|
const { props } = this;
|
||||||
return (
|
return (
|
||||||
<View style={{flex: 1}}>
|
<View style={GENERAL_STYLES.flex}>
|
||||||
{this.getPiecesBackground()}
|
{this.getPiecesBackground()}
|
||||||
<LinearGradient
|
<LinearGradient
|
||||||
style={{flex: 1}}
|
style={GENERAL_STYLES.flex}
|
||||||
colors={[
|
colors={[
|
||||||
`${props.theme.colors.background}00`,
|
`${props.theme.colors.background}00`,
|
||||||
props.theme.colors.background,
|
props.theme.colors.background,
|
||||||
]}
|
]}
|
||||||
start={{ x: 0, y: 0 }}
|
start={{ x: 0, y: 0 }}
|
||||||
end={{x: 0, y: 1}}>
|
end={{ x: 0, y: 1 }}
|
||||||
|
>
|
||||||
<CollapsibleScrollView>
|
<CollapsibleScrollView>
|
||||||
{this.getMainContent()}
|
{this.getMainContent()}
|
||||||
<MascotPopup
|
<MascotPopup
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import {Linking, Image} from 'react-native';
|
import { Linking, Image, StyleSheet } from 'react-native';
|
||||||
import { Card, Text } from 'react-native-paper';
|
import { Card, Text } from 'react-native-paper';
|
||||||
import Autolink from 'react-native-autolink';
|
import Autolink from 'react-native-autolink';
|
||||||
import { StackNavigationProp } from '@react-navigation/stack';
|
import { StackNavigationProp } from '@react-navigation/stack';
|
||||||
|
@ -39,6 +39,22 @@ type PropsType = {
|
||||||
route: { params: { data: FeedItemType; date: string } };
|
route: { params: { data: FeedItemType; date: string } };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
container: {
|
||||||
|
margin: 5,
|
||||||
|
},
|
||||||
|
image: {
|
||||||
|
width: 48,
|
||||||
|
height: 48,
|
||||||
|
},
|
||||||
|
button: {
|
||||||
|
width: 250,
|
||||||
|
height: 250,
|
||||||
|
marginLeft: 'auto',
|
||||||
|
marginRight: 'auto',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class defining a feed item page.
|
* Class defining a feed item page.
|
||||||
*/
|
*/
|
||||||
|
@ -89,32 +105,21 @@ class FeedItemScreen extends React.Component<PropsType> {
|
||||||
const pageSource: NewsSourceType =
|
const pageSource: NewsSourceType =
|
||||||
NewsSourcesConstants[this.displayData.page_id as AvailablePages];
|
NewsSourcesConstants[this.displayData.page_id as AvailablePages];
|
||||||
return (
|
return (
|
||||||
<CollapsibleScrollView style={{margin: 5}} hasTab>
|
<CollapsibleScrollView style={styles.container} hasTab>
|
||||||
<Card.Title
|
<Card.Title
|
||||||
title={pageSource.name}
|
title={pageSource.name}
|
||||||
subtitle={this.date}
|
subtitle={this.date}
|
||||||
left={() => (
|
left={() => <Image source={pageSource.icon} style={styles.image} />}
|
||||||
<Image
|
|
||||||
source={pageSource.icon}
|
|
||||||
style={{
|
|
||||||
width: 48,
|
|
||||||
height: 48,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
/>
|
/>
|
||||||
{this.displayData.image ? (
|
{this.displayData.image ? (
|
||||||
<ImageGalleryButton
|
<ImageGalleryButton
|
||||||
images={[{ url: this.displayData.image }]}
|
images={[{ url: this.displayData.image }]}
|
||||||
style={{
|
style={styles.button}
|
||||||
width: 250,
|
|
||||||
height: 250,
|
|
||||||
marginLeft: 'auto',
|
|
||||||
marginRight: 'auto',
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
<Card.Content style={{paddingBottom: CustomTabBar.TAB_BAR_HEIGHT + 20}}>
|
<Card.Content
|
||||||
|
style={{ paddingBottom: CustomTabBar.TAB_BAR_HEIGHT + 20 }}
|
||||||
|
>
|
||||||
{this.displayData.message !== undefined ? (
|
{this.displayData.message !== undefined ? (
|
||||||
<Autolink
|
<Autolink
|
||||||
text={this.displayData.message}
|
text={this.displayData.message}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue