Updated intro slide and added settings and about buttons

This commit is contained in:
keplyx 2019-08-07 11:10:17 +02:00
parent f5c3f27f14
commit 1cb68a0d15
8 changed files with 72 additions and 33 deletions

37
App.js
View file

@ -48,30 +48,44 @@ const styles = StyleSheet.create({
const slides = [ const slides = [
{ {
key: '1', key: '1',
title: 'L\'application de l\'Amicale', title: 'Bienvenue sur COFFEE',
text: 'Toutes les informations du campus de Toulouse', text: ' La nouvelle app à consulter pendant la pause café pour être au courant de la vie du campus !',
image: require('./assets/amicale.png'), image: require('./assets/amicale.png'),
colors: ['#ff8a6d', '#aa1c0d'], colors: ['#ff8a6d', '#aa1c0d'],
}, },
{ {
key: '2', key: '2',
title: 'N\'oubliez plus votre linge', title: 'Restez informés',
text: 'Visualisez les disponibilités des machines et rajoutez des alarmes', text: 'COFFEE vous permettra bientôt d\'être au courant de tous les événements qui ont lieu sur le campus, de la vente de crêpes jusqu\'aux concerts enfoiros !',
icon: 'washing-machine', icon: 'calendar-range',
colors: ['#9cd6d3', '#3186be'], colors: ['#9cd6d3', '#3186be'],
}, },
{ {
key: '3', key: '3',
title: 'Le proximo', title: 'N\'oubliez plus votre linge !',
text: 'Regardez le stock de la supérette de l\'INSA depuis n\'importe où', text: 'COFFEE vous informe de la disponibilité des machines et vous permet d\'être notifiés lorsque la vôtre se termine bientôt !',
icon: 'shopping', icon: 'washing-machine',
colors: ['#f9a967', '#da5204'], colors: ['#f9a967', '#da5204'],
}, },
{ {
key: '4', key: '4',
title: 'Proximo',
text: 'Il vous manque des pâtes ? Ou un petit creux au gouter, regardez les stocks de votre supérette insaienne en temps réel',
icon: 'shopping',
colors: ['#f9a967', '#da5204'],
},
{
key: '5',
title: 'Planex',
text: 'Consultez votre emploi du temps sur COFFEE',
icon: 'timetable',
colors: ['#f9a967', '#da5204'],
},
{
key: '6',
title: 'Toujours en développement', title: 'Toujours en développement',
text: 'D\'autres fonctionnalités seront disponibles prochainement', text: 'D\'autres fonctionnalités arrivent bientôt, n\'hésitez pas à nous donner votre avis pour améliorer l\'appli',
icon: 'settings-outline', icon: 'cogs',
colors: ['#9be238', '#1e6a22'], colors: ['#9be238', '#1e6a22'],
}, },
]; ];
@ -114,7 +128,8 @@ export default class App extends React.Component<Props, State> {
this.setState({ this.setState({
isLoading: false, isLoading: false,
currentTheme: ThemeManager.getCurrentTheme(), currentTheme: ThemeManager.getCurrentTheme(),
showIntro: AsyncStorageManager.getInstance().preferences.showIntro.current === '1' // showIntro: AsyncStorageManager.getInstance().preferences.showIntro.current === '1'
showIntro: true
}); });
} }

View file

@ -13,7 +13,7 @@ import Touchable from "react-native-platform-touchable";
type Props = { type Props = {
navigation: Object, navigation: Object,
headerTitle: string, headerTitle: string,
headerRightMenu: React.Node, headerRightButton: React.Node,
children: React.Node children: React.Node
} }
@ -61,7 +61,7 @@ export default class BaseContainer extends React.Component<Props, State> {
icon="menu"/> icon="menu"/>
</Touchable> </Touchable>
} }
rightMenu={this.props.headerRightMenu}/> rightButton={this.props.headerRightButton}/>
{this.props.children} {this.props.children}
</Container> </Container>
</CustomSideMenu> </CustomSideMenu>

View file

@ -11,7 +11,7 @@ import CustomMaterialIcon from "./CustomMaterialIcon";
type Props = { type Props = {
hasBackButton: boolean, hasBackButton: boolean,
leftButton: React.Node, leftButton: React.Node,
rightMenu: React.Node, rightButton: React.Node,
title: string, title: string,
navigation: Object, navigation: Object,
hasTabs: boolean, hasTabs: boolean,
@ -30,7 +30,7 @@ export default class CustomHeader extends React.Component<Props> {
static defaultProps = { static defaultProps = {
hasBackButton: false, hasBackButton: false,
leftButton: <View/>, leftButton: <View/>,
rightMenu: <Right/>, rightButton: <View/>,
hasTabs: false, hasTabs: false,
}; };
@ -57,7 +57,17 @@ export default class CustomHeader extends React.Component<Props> {
<Body> <Body>
<Title>{this.props.title}</Title> <Title>{this.props.title}</Title>
</Body> </Body>
{this.props.rightMenu} <Right>
{this.props.rightButton}
{this.props.hasBackButton ? <View/> :
<Touchable
style={{padding: 6}}
onPress={() => this.props.navigation.navigate('SettingsScreen')}>
<CustomMaterialIcon
color={Platform.OS === 'ios' ? ThemeManager.getCurrentThemeVariables().brandPrimary : "#fff"}
icon="settings"/>
</Touchable>}
</Right>
</Header>); </Header>);
} }
}; };

View file

@ -1,9 +1,9 @@
// @flow // @flow
import {createAppContainer, createStackNavigator} from 'react-navigation'; import {createAppContainer, createStackNavigator} from 'react-navigation';
import MainDrawerNavigator from './MainDrawerNavigator';
import MainTabNavigator from './MainTabNavigator'; import MainTabNavigator from './MainTabNavigator';
import SettingsScreen from '../screens/SettingsScreen';
import AboutScreen from '../screens/About/AboutScreen';
import ProximoListScreen from '../screens/Proximo/ProximoListScreen'; import ProximoListScreen from '../screens/Proximo/ProximoListScreen';
import AboutDependenciesScreen from '../screens/About/AboutDependenciesScreen'; import AboutDependenciesScreen from '../screens/About/AboutDependenciesScreen';
@ -15,6 +15,8 @@ export default createAppContainer(
Tabs: MainTabNavigator, Tabs: MainTabNavigator,
// Drawer: MainDrawerNavigator, // Drawer: MainDrawerNavigator,
ProximoListScreen: {screen: ProximoListScreen}, ProximoListScreen: {screen: ProximoListScreen},
SettingsScreen: {screen: SettingsScreen},
AboutScreen: {screen: AboutScreen},
AboutDependenciesScreen: {screen: AboutDependenciesScreen}, AboutDependenciesScreen: {screen: AboutDependenciesScreen},
}, },
{ {

View file

@ -9,7 +9,7 @@ import PlanexScreen from '../screens/PlanexScreen';
import CustomMaterialIcon from "../components/CustomMaterialIcon"; import CustomMaterialIcon from "../components/CustomMaterialIcon";
const TAB_ICONS = { const TAB_ICONS = {
Home: 'home', Home: 'coffee',
Planning: 'calendar-range', Planning: 'calendar-range',
Proxiwash: 'washing-machine', Proxiwash: 'washing-machine',
Proximo: 'shopping', Proximo: 'shopping',

View file

@ -163,7 +163,7 @@ export default class AboutScreen extends React.Component<Props> {
const nav = this.props.navigation; const nav = this.props.navigation;
return ( return (
<Container> <Container>
<CustomHeader navigation={nav} title={i18n.t('screens.about')}/> <CustomHeader navigation={nav} title={i18n.t('screens.about')} hasBackButton={true}/>
<Content padder> <Content padder>
<Card> <Card>
<CardItem> <CardItem>

View file

@ -2,8 +2,7 @@
import * as React from 'react'; import * as React from 'react';
import {Platform, View} from 'react-native'; import {Platform, View} from 'react-native';
import {Container, Right, Spinner} from 'native-base'; import {Spinner} from 'native-base';
import CustomHeader from "../components/CustomHeader";
import WebView from "react-native-webview"; import WebView from "react-native-webview";
import Touchable from "react-native-platform-touchable"; import Touchable from "react-native-platform-touchable";
import CustomMaterialIcon from "../components/CustomMaterialIcon"; import CustomMaterialIcon from "../components/CustomMaterialIcon";
@ -36,15 +35,13 @@ export default class PlanningScreen extends React.Component<Props, State> {
getRefreshButton() { getRefreshButton() {
return ( return (
<Right> <Touchable
<Touchable style={{padding: 6}}
style={{padding: 6}} onPress={() => this.refreshWebview()}>
onPress={() => this.refreshWebview()}> <CustomMaterialIcon
<CustomMaterialIcon color={Platform.OS === 'ios' ? ThemeManager.getCurrentThemeVariables().brandPrimary : "#fff"}
color={Platform.OS === 'ios' ? ThemeManager.getCurrentThemeVariables().brandPrimary : "#fff"} icon="refresh"/>
icon="refresh"/> </Touchable>
</Touchable>
</Right>
); );
}; };
@ -56,7 +53,7 @@ export default class PlanningScreen extends React.Component<Props, State> {
render() { render() {
const nav = this.props.navigation; const nav = this.props.navigation;
return ( return (
<BaseContainer navigation={nav} headerTitle={'Planex'} headerRightMenu={this.getRefreshButton()}> <BaseContainer navigation={nav} headerTitle={'Planex'} headerRightButton={this.getRefreshButton()}>
<WebView <WebView
ref={ref => (this.webview = ref)} ref={ref => (this.webview = ref)}
source={{uri: PLANEX_URL}} source={{uri: PLANEX_URL}}

View file

@ -21,6 +21,8 @@ import i18n from "i18n-js";
import {NavigationActions, StackActions} from "react-navigation"; import {NavigationActions, StackActions} from "react-navigation";
import CustomMaterialIcon from "../components/CustomMaterialIcon"; import CustomMaterialIcon from "../components/CustomMaterialIcon";
import AsyncStorageManager from "../utils/AsyncStorageManager"; import AsyncStorageManager from "../utils/AsyncStorageManager";
import Touchable from "react-native-platform-touchable";
import {Platform} from "react-native";
type Props = { type Props = {
navigation: Object, navigation: Object,
@ -170,11 +172,24 @@ export default class SettingsScreen extends React.Component<Props, State> {
); );
} }
getRightButton() {
return (
<Touchable
style={{padding: 6}}
onPress={() => this.props.navigation.navigate('AboutScreen')}>
<CustomMaterialIcon
color={Platform.OS === 'ios' ? ThemeManager.getCurrentThemeVariables().brandPrimary : "#fff"}
icon="information"/>
</Touchable>
);
}
render() { render() {
const nav = this.props.navigation; const nav = this.props.navigation;
return ( return (
<Container> <Container>
<CustomHeader navigation={nav} title={i18n.t('screens.settings')}/> <CustomHeader navigation={nav} title={i18n.t('screens.settings')} hasBackButton={true}
rightButton={this.getRightButton()}/>
<Content padder> <Content padder>
<Card> <Card>
<CardItem header> <CardItem header>