Improved UI and layout

This commit is contained in:
Arnaud Vergnet 2020-07-16 23:12:03 +02:00
parent b405f2aa6b
commit 96c64a98e0
5 changed files with 56 additions and 37 deletions

View file

@ -358,7 +358,7 @@
"feedbackDescription": "Tu veux voir une fonctionnalité ajoutée/modifiée/supprimée ? Tu veux donner ton opinion sur l'appli ou simplement discuter avec le développeur (c'est moi coucou) ? Utilise un des liens ci-dessous !", "feedbackDescription": "Tu veux voir une fonctionnalité ajoutée/modifiée/supprimée ? Tu veux donner ton opinion sur l'appli ou simplement discuter avec le développeur (c'est moi coucou) ? Utilise un des liens ci-dessous !",
"contactMeans": "L'utilisation de Gitea est recommandée, pour l'utiliser, connecte toi avec tes identifiants INSA.", "contactMeans": "L'utilisation de Gitea est recommandée, pour l'utiliser, connecte toi avec tes identifiants INSA.",
"homeButtonTitle": "Feedback/Bugs", "homeButtonTitle": "Feedback/Bugs",
"homeButtonSubtitle": "Contacter le développeur" "homeButtonSubtitle": "Contacte le développeur de l'appli"
}, },
"game": { "game": {
"title": "Le jeu trop ouf", "title": "Le jeu trop ouf",

View file

@ -24,7 +24,7 @@ class ActionsDashBoardItem extends React.Component<Props> {
<List.Item <List.Item
title={i18n.t("screens.feedback.homeButtonTitle")} title={i18n.t("screens.feedback.homeButtonTitle")}
description={i18n.t("screens.feedback.homeButtonSubtitle")} description={i18n.t("screens.feedback.homeButtonSubtitle")}
left={props => <List.Icon {...props} icon={"bug"}/>} left={props => <List.Icon {...props} icon={"comment-quote"}/>}
right={props => <List.Icon {...props} icon={"chevron-right"}/>} right={props => <List.Icon {...props} icon={"chevron-right"}/>}
onPress={() => this.props.navigation.navigate("feedback")} onPress={() => this.props.navigation.navigate("feedback")}
style={{paddingTop: 0, paddingBottom: 0, marginLeft: 10, marginRight: 10}} style={{paddingTop: 0, paddingBottom: 0, marginLeft: 10, marginRight: 10}}

View file

@ -39,8 +39,8 @@ class SmallDashboardItem extends React.Component<Props> {
onPress={this.props.onPress} onPress={this.props.onPress}
borderless={true} borderless={true}
style={{ style={{
marginLeft: 5, marginLeft: this.itemSize / 4,
marginRight: 5, marginRight: this.itemSize / 4,
}} }}
> >
<View style={{ <View style={{

View file

@ -3,7 +3,7 @@
import * as React from 'react'; import * as React from 'react';
import {StackNavigationProp} from "@react-navigation/stack"; import {StackNavigationProp} from "@react-navigation/stack";
import type {CustomTheme} from "../../../managers/ThemeManager"; import type {CustomTheme} from "../../../managers/ThemeManager";
import {Button, Paragraph, withTheme} from "react-native-paper"; import {Button, Card, Paragraph, withTheme} from "react-native-paper";
import type {ServiceCategory, ServiceItem} from "../../../managers/ServicesManager"; import type {ServiceCategory, ServiceItem} from "../../../managers/ServicesManager";
import DashboardManager from "../../../managers/DashboardManager"; import DashboardManager from "../../../managers/DashboardManager";
import DashboardItem from "../../../components/Home/EventDashboardItem"; import DashboardItem from "../../../components/Home/EventDashboardItem";
@ -97,7 +97,7 @@ class DashboardEditScreen extends React.Component<Props, State> {
); );
} }
undoDashboard= () => { undoDashboard = () => {
this.setState({ this.setState({
currentDashboard: [...this.initialDashboard], currentDashboard: [...this.initialDashboard],
currentDashboardIdList: [...this.initialDashboardIdList] currentDashboardIdList: [...this.initialDashboardIdList]
@ -132,13 +132,18 @@ class DashboardEditScreen extends React.Component<Props, State> {
</View> </View>
</View> </View>
<FlatList <FlatList
data={this.content} data={this.content}
renderItem={this.renderItem} renderItem={this.renderItem}
ListHeaderComponent={<Paragraph>{i18n.t("screens.settings.dashboardEdit.message")}</Paragraph>} ListHeaderComponent={<Card style={{margin: 5}}>
style={{ <Card.Content>
}} <Paragraph
/> style={{textAlign: "center"}}>{i18n.t("screens.settings.dashboardEdit.message")}</Paragraph>
</Card.Content>
</Card>}
style={{}}
/>
</View> </View>
); );
} }

View file

@ -172,6 +172,19 @@ class SettingsScreen extends React.Component<Props, State> {
); );
} }
getNavigateItem(route: string, icon: string, title: string, subtitle: string, onLongPress?: () => void) {
return (
<List.Item
title={title}
description={subtitle}
onPress={() => this.props.navigation.navigate(route)}
left={props => <List.Icon {...props} icon={icon}/>}
right={props => <List.Icon {...props} icon={"chevron-right"}/>}
onLongPress={onLongPress}
/>
);
}
render() { render() {
return ( return (
<ScrollView> <ScrollView>
@ -203,12 +216,12 @@ class SettingsScreen extends React.Component<Props, State> {
left={props => <List.Icon {...props} icon="power"/>} left={props => <List.Icon {...props} icon="power"/>}
/> />
{this.getStartScreenPicker()} {this.getStartScreenPicker()}
<List.Item {this.getNavigateItem(
title={i18n.t('screens.settings.dashboard')} "dashboard-edit",
description={i18n.t('screens.settings.dashboardSub')} "view-dashboard",
onPress={() => this.props.navigation.navigate("dashboard-edit")} i18n.t('screens.settings.dashboard'),
left={props => <List.Icon {...props} icon="view-dashboard"/>} i18n.t('screens.settings.dashboardSub')
/> )}
</List.Section> </List.Section>
</Card> </Card>
<Card style={{margin: 5}}> <Card style={{margin: 5}}>
@ -229,25 +242,26 @@ class SettingsScreen extends React.Component<Props, State> {
<Card.Title title={i18n.t('screens.settings.information')}/> <Card.Title title={i18n.t('screens.settings.information')}/>
<List.Section> <List.Section>
{this.state.isDebugUnlocked {this.state.isDebugUnlocked
? <List.Item ? this.getNavigateItem(
title={i18n.t('screens.debug.title')} "debug",
left={props => <List.Icon {...props} icon="bug-check"/>} "bug-check",
onPress={() => this.props.navigation.navigate("debug")} i18n.t('screens.debug.title'),
/> ""
)
: null} : null}
<List.Item {this.getNavigateItem(
title={i18n.t('screens.about.title')} "about",
description={i18n.t('screens.about.buttonDesc')} "information",
left={props => <List.Icon {...props} icon="information"/>} i18n.t('screens.about.title'),
onPress={() => this.props.navigation.navigate("about")} i18n.t('screens.about.buttonDesc'),
onLongPress={this.unlockDebugMode} this.unlockDebugMode,
/> )}
<List.Item {this.getNavigateItem(
title={i18n.t('screens.feedback.homeButtonTitle')} "feedback",
description={i18n.t('screens.feedback.homeButtonSubtitle')} "comment-quote",
left={props => <List.Icon {...props} icon="bug"/>} i18n.t('screens.feedback.homeButtonTitle'),
onPress={() => this.props.navigation.navigate("feedback")} i18n.t('screens.feedback.homeButtonSubtitle'),
/> )}
</List.Section> </List.Section>
</Card> </Card>
</ScrollView> </ScrollView>