Compare commits

..

No commits in common. "1ede8f4e9ad7263dc14c0dc8d4905f5c5474c6c0" and "c48887a0d80581bc399fab9591d37b0868281f36" have entirely different histories.

12 changed files with 32 additions and 251 deletions

View file

@ -1,67 +0,0 @@
// @flow
import * as React from 'react';
import {Button, Card, withTheme} from 'react-native-paper';
import {StyleSheet} from "react-native";
type Props = {
navigation: Object,
theme: Object,
}
class ActionsDashBoardItem extends React.PureComponent<Props> {
colors: Object;
constructor(props) {
super(props);
this.colors = this.props.theme.colors;
}
openDrawer = () => this.props.navigation.openDrawer();
render() {
return (
<Card style={{
...styles.card,
borderColor: this.colors.primary,
}}>
<Card.Content style={styles.content}>
<Button
icon="information"
mode="contained"
onPress={this.openDrawer}
style={styles.button}
>
PLUS DE SERVICES
</Button>
</Card.Content>
</Card>
);
}
}
const styles = StyleSheet.create({
card: {
width: 'auto',
marginLeft: 10,
marginRight: 10,
marginTop: 10,
overflow: 'hidden',
elevation: 4,
borderWidth: 1,
},
avatar: {
backgroundColor: 'transparent'
},
content: {
flex: 1,
flexDirection: 'row',
},
button: {
marginLeft: 'auto',
marginRight: 'auto',
}
});
export default withTheme(ActionsDashBoardItem);

View file

@ -8,7 +8,7 @@ import {View} from "react-native";
* @param props Props to pass to the component
* @return {*}
*/
function SmallDashboardItem(props) {
function SquareDashboardItem(props) {
const {colors} = props.theme;
return (
<View>
@ -37,4 +37,4 @@ function SmallDashboardItem(props) {
);
}
export default withTheme(SmallDashboardItem);
export default withTheme(SquareDashboardItem);

View file

@ -1,79 +0,0 @@
// @flow
import * as React from 'react';
import {Card, List, Text, withTheme} from 'react-native-paper';
import {StyleSheet, View} from "react-native";
import i18n from 'i18n-js';
type Props = {
categoryRender: Function,
categories: Array<Object>,
}
type State = {
expanded: boolean,
}
class ClubListHeader extends React.Component<Props, State> {
state = {
expanded: true
};
colors: Object;
constructor(props) {
super(props);
this.colors = props.theme.colors;
}
getCategoriesRender() {
let final = [];
for (let i = 0; i < this.props.categories.length; i++) {
final.push(this.props.categoryRender(this.props.categories[i], this.props.categories[i].id));
}
return final;
}
onPress = () => this.setState({expanded: !this.state.expanded});
render() {
return (
<Card style={styles.card}>
<List.Accordion
title={i18n.t("clubs.categories")}
left={props => <List.Icon {...props} icon="star"/>}
expanded={this.state.expanded}
onPress={this.onPress}
>
<Text style={styles.text}>{i18n.t("clubs.categoriesFilterMessage")}</Text>
<View style={styles.chipContainer}>
{this.getCategoriesRender()}
</View>
</List.Accordion>
</Card>
);
}
}
const styles = StyleSheet.create({
card: {
margin: 5
},
text: {
paddingLeft: 0,
marginTop: 5,
marginBottom: 10,
marginLeft: 'auto',
marginRight: 'auto',
},
chipContainer: {
justifyContent: 'space-around',
flexDirection: 'row',
flexWrap: 'wrap',
paddingLeft: 0,
marginBottom: 5,
},
});
export default withTheme(ClubListHeader);

View file

@ -57,7 +57,6 @@ class SideBar extends React.PureComponent<Props, State> {
route: "LoginScreen",
icon: "login",
onlyWhenLoggedOut: true,
shouldEmphasis: true,
},
{
name: i18n.t('screens.profile'),
@ -207,7 +206,6 @@ class SideBar extends React.PureComponent<Props, State> {
const onListItemPress = this.onListItemPress.bind(this, item);
const onlyWhenLoggedOut = item.onlyWhenLoggedOut !== undefined && item.onlyWhenLoggedOut === true;
const onlyWhenLoggedIn = item.onlyWhenLoggedIn !== undefined && item.onlyWhenLoggedIn === true;
const shouldEmphasis = item.shouldEmphasis !== undefined && item.shouldEmphasis === true;
if (onlyWhenLoggedIn && !this.state.isLoggedIn || onlyWhenLoggedOut && this.state.isLoggedIn)
return null;
else if (item.icon !== undefined) {
@ -216,7 +214,6 @@ class SideBar extends React.PureComponent<Props, State> {
title={item.name}
icon={item.icon}
onPress={onListItemPress}
shouldEmphasis={shouldEmphasis}
/>
);
} else {

View file

@ -17,7 +17,7 @@ function SidebarItem(props) {
focused={false}
onPress={props.onPress}
icon={({color, size}) =>
<MaterialCommunityIcons color={props.shouldEmphasis ? colors.primary : color} size={size} name={props.icon}/>}
<MaterialCommunityIcons color={color} size={size} name={props.icon}/>}
style={{
marginLeft: 0,
marginRight: 0,

View file

@ -17,9 +17,8 @@ import HeaderButton from "../components/Custom/HeaderButton";
import i18n from "i18n-js";
import LoginScreen from "../screens/Amicale/LoginScreen";
import ProfileScreen from "../screens/Amicale/ProfileScreen";
import ClubListScreen from "../screens/Amicale/Clubs/ClubListScreen";
import ClubDisplayScreen from "../screens/Amicale/Clubs/ClubDisplayScreen";
import ClubAboutScreen from "../screens/Amicale/Clubs/ClubAboutScreen";
import ClubListScreen from "../screens/Amicale/ClubListScreen";
import ClubDisplayScreen from "../screens/Amicale/ClubDisplayScreen";
const defaultScreenOptions = {
gestureEnabled: true,
@ -269,16 +268,6 @@ function ClubStackComponent() {
};
}}
/>
<ClubStack.Screen
name="ClubAboutScreen"
component={ClubAboutScreen}
options={({navigation}) => {
return {
title: "ABOUT",
...TransitionPresets.ModalSlideFromBottomIOS,
};
}}
/>
</ClubStack.Navigator>
);
}

View file

@ -1,14 +1,12 @@
// @flow
import * as React from 'react';
import {FlatList, Platform} from "react-native";
import {FlatList, Platform, View} from "react-native";
import {Chip, Searchbar, withTheme} from 'react-native-paper';
import AuthenticatedScreen from "../../../components/Amicale/AuthenticatedScreen";
import AuthenticatedScreen from "../../components/Amicale/AuthenticatedScreen";
import i18n from "i18n-js";
import ClubListItem from "../../../components/Lists/ClubListItem";
import {isItemInCategoryFilter, stringMatchQuery} from "../../../utils/Search";
import ClubListHeader from "../../../components/Lists/ClubListHeader";
import HeaderButton from "../../../components/Custom/HeaderButton";
import ClubListItem from "../../components/Lists/ClubListItem";
import {isItemInCategoryFilter, stringMatchQuery} from "../../utils/Search";
type Props = {
navigation: Object,
@ -41,9 +39,9 @@ class ClubListScreen extends React.Component<Props, State> {
* Creates the header content
*/
componentDidMount() {
const title = this.getSearchBar.bind(this);
this.props.navigation.setOptions({
headerTitle: this.getSearchBar,
headerRight: this.getHeaderButtons,
headerTitle: title,
headerBackTitleVisible: false,
headerTitleContainerStyle: Platform.OS === 'ios' ?
{marginHorizontal: 0, width: '70%'} :
@ -56,23 +54,14 @@ class ClubListScreen extends React.Component<Props, State> {
*
* @return {*}
*/
getSearchBar = () => {
getSearchBar() {
return (
<Searchbar
placeholder={i18n.t('proximoScreen.search')}
onChangeText={this.onSearchStringChange}
/>
);
};
/**
* Gets the header button
* @return {*}
*/
getHeaderButtons = () => {
const onPress = this.props.navigation.navigate.bind(this, "ClubAboutScreen");
return <HeaderButton icon={'information'} onPress={onPress}/>;
};
}
/**
* Callback used when the search changes
@ -114,7 +103,7 @@ class ClubListScreen extends React.Component<Props, State> {
if (index === -1)
newCategoriesState.push(categoryId);
else
newCategoriesState.splice(index, 1);
newCategoriesState.splice(index,1);
}
if (filterStr !== null || categoryId !== null)
this.setState({
@ -137,10 +126,16 @@ class ClubListScreen extends React.Component<Props, State> {
};
getListHeader() {
return <ClubListHeader
categories={this.categories}
categoryRender={this.getChipRender}
/>;
let final = [];
for (let i = 0; i < this.categories.length; i++) {
final.push(this.getChipRender(this.categories[i], this.categories[i].id));
}
return <View style={{
justifyContent: 'space-around',
flexDirection: 'row',
flexWrap: 'wrap',
margin: 10,
}}>{final}</View>;
}
getCategoryOfId = (id: number) => {

View file

@ -1,39 +0,0 @@
// @flow
import * as React from 'react';
import {ScrollView} from 'react-native';
import {Linking} from "expo";
import {Text, withTheme} from 'react-native-paper';
type Props = {
};
type State = {
};
function openWebLink(event, link) {
Linking.openURL(link).catch((err) => console.error('Error opening link', err));
}
/**
* Class defining a planning event information page.
*/
class ClubAboutScreen extends React.Component<Props, State> {
colors: Object;
constructor(props) {
super(props);
this.colors = props.theme.colors;
}
render() {
return (
<ScrollView style={{padding: 5}}>
<Text>TEXT</Text>
</ScrollView>
);
}
}
export default withTheme(ClubAboutScreen);

View file

@ -7,11 +7,10 @@ import DashboardItem from "../components/Home/EventDashboardItem";
import WebSectionList from "../components/Lists/WebSectionList";
import {Text, withTheme} from 'react-native-paper';
import FeedItem from "../components/Home/FeedItem";
import SquareDashboardItem from "../components/Home/SmallDashboardItem";
import SquareDashboardItem from "../components/Home/SquareDashboardItem";
import PreviewEventDashboardItem from "../components/Home/PreviewEventDashboardItem";
import {stringToDate} from "../utils/Planning";
import {openBrowser} from "../utils/WebBrowser";
import ActionsDashBoardItem from "../components/Home/ActionsDashboardItem";
// import DATA from "../dashboard_data.json";
@ -144,13 +143,9 @@ class HomeScreen extends React.Component<Props, State> {
let dataset = [
{
id: 'top',
id: 'middle',
content: []
},
{
id: 'actions',
content: undefined
},
{
id: 'event',
content: undefined
@ -159,7 +154,7 @@ class HomeScreen extends React.Component<Props, State> {
for (let [key, value] of Object.entries(dashboardData)) {
switch (key) {
case 'today_events':
dataset[2]['content'] = value;
dataset[1]['content'] = value;
break;
case 'available_machines':
dataset[0]['content'][0] = {id: key, data: value};
@ -189,14 +184,8 @@ class HomeScreen extends React.Component<Props, State> {
let content = item['content'];
if (item['id'] === 'event')
return this.getDashboardEventItem(content);
else if (item['id'] === 'top')
return this.getDashboardTopItem(content);
else if (item['id'] === 'actions')
return this.getActionsDashboardItem();
}
getActionsDashboardItem() {
return <ActionsDashBoardItem {...this.props}/>;
else if (item['id'] === 'middle')
return this.getDashboardMiddleItem(content);
}
/**
@ -370,7 +359,7 @@ class HomeScreen extends React.Component<Props, State> {
* @param content
* @return {*}
*/
getDashboardTopItem(content: Array<Object>) {
getDashboardMiddleItem(content: Array<Object>) {
let proxiwashData = content[0]['data'];
let tutorinsaData = content[1]['data'];
let proximoData = content[2]['data'];

View file

@ -246,9 +246,7 @@
"clubList": "Club list",
"managers": "Managers",
"managersSubtitle": "These people make the club live",
"managersUnavailable": "This club has no one :(",
"categories": "Categories",
"categoriesFilterMessage": "Click on a category to filter the list"
"managersUnavailable": "This club has no one :("
},
"dialog": {
"ok": "OK",

View file

@ -247,9 +247,7 @@
"clubList": "Liste des clubs",
"managers": "Responsables",
"managersSubtitle": "Ces personnes font vivre le club",
"managersUnavailable": "Ce club est tout seul :(",
"categories": "Catégories",
"categoriesFilterMessage": "Cliquez sur une catégorie pour filtrer la list"
"managersUnavailable": "Ce club est tout seul :("
},
"dialog": {
"ok": "OK",