Compare commits
No commits in common. "1ede8f4e9ad7263dc14c0dc8d4905f5c5474c6c0" and "c48887a0d80581bc399fab9591d37b0868281f36" have entirely different histories.
1ede8f4e9a
...
c48887a0d8
12 changed files with 32 additions and 251 deletions
|
|
@ -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);
|
|
||||||
|
|
@ -8,7 +8,7 @@ import {View} from "react-native";
|
||||||
* @param props Props to pass to the component
|
* @param props Props to pass to the component
|
||||||
* @return {*}
|
* @return {*}
|
||||||
*/
|
*/
|
||||||
function SmallDashboardItem(props) {
|
function SquareDashboardItem(props) {
|
||||||
const {colors} = props.theme;
|
const {colors} = props.theme;
|
||||||
return (
|
return (
|
||||||
<View>
|
<View>
|
||||||
|
|
@ -37,4 +37,4 @@ function SmallDashboardItem(props) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default withTheme(SmallDashboardItem);
|
export default withTheme(SquareDashboardItem);
|
||||||
|
|
@ -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);
|
|
||||||
|
|
@ -57,7 +57,6 @@ class SideBar extends React.PureComponent<Props, State> {
|
||||||
route: "LoginScreen",
|
route: "LoginScreen",
|
||||||
icon: "login",
|
icon: "login",
|
||||||
onlyWhenLoggedOut: true,
|
onlyWhenLoggedOut: true,
|
||||||
shouldEmphasis: true,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: i18n.t('screens.profile'),
|
name: i18n.t('screens.profile'),
|
||||||
|
|
@ -207,7 +206,6 @@ class SideBar extends React.PureComponent<Props, State> {
|
||||||
const onListItemPress = this.onListItemPress.bind(this, item);
|
const onListItemPress = this.onListItemPress.bind(this, item);
|
||||||
const onlyWhenLoggedOut = item.onlyWhenLoggedOut !== undefined && item.onlyWhenLoggedOut === true;
|
const onlyWhenLoggedOut = item.onlyWhenLoggedOut !== undefined && item.onlyWhenLoggedOut === true;
|
||||||
const onlyWhenLoggedIn = item.onlyWhenLoggedIn !== undefined && item.onlyWhenLoggedIn === 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)
|
if (onlyWhenLoggedIn && !this.state.isLoggedIn || onlyWhenLoggedOut && this.state.isLoggedIn)
|
||||||
return null;
|
return null;
|
||||||
else if (item.icon !== undefined) {
|
else if (item.icon !== undefined) {
|
||||||
|
|
@ -216,7 +214,6 @@ class SideBar extends React.PureComponent<Props, State> {
|
||||||
title={item.name}
|
title={item.name}
|
||||||
icon={item.icon}
|
icon={item.icon}
|
||||||
onPress={onListItemPress}
|
onPress={onListItemPress}
|
||||||
shouldEmphasis={shouldEmphasis}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ function SidebarItem(props) {
|
||||||
focused={false}
|
focused={false}
|
||||||
onPress={props.onPress}
|
onPress={props.onPress}
|
||||||
icon={({color, size}) =>
|
icon={({color, size}) =>
|
||||||
<MaterialCommunityIcons color={props.shouldEmphasis ? colors.primary : color} size={size} name={props.icon}/>}
|
<MaterialCommunityIcons color={color} size={size} name={props.icon}/>}
|
||||||
style={{
|
style={{
|
||||||
marginLeft: 0,
|
marginLeft: 0,
|
||||||
marginRight: 0,
|
marginRight: 0,
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,8 @@ import HeaderButton from "../components/Custom/HeaderButton";
|
||||||
import i18n from "i18n-js";
|
import i18n from "i18n-js";
|
||||||
import LoginScreen from "../screens/Amicale/LoginScreen";
|
import LoginScreen from "../screens/Amicale/LoginScreen";
|
||||||
import ProfileScreen from "../screens/Amicale/ProfileScreen";
|
import ProfileScreen from "../screens/Amicale/ProfileScreen";
|
||||||
import ClubListScreen from "../screens/Amicale/Clubs/ClubListScreen";
|
import ClubListScreen from "../screens/Amicale/ClubListScreen";
|
||||||
import ClubDisplayScreen from "../screens/Amicale/Clubs/ClubDisplayScreen";
|
import ClubDisplayScreen from "../screens/Amicale/ClubDisplayScreen";
|
||||||
import ClubAboutScreen from "../screens/Amicale/Clubs/ClubAboutScreen";
|
|
||||||
|
|
||||||
const defaultScreenOptions = {
|
const defaultScreenOptions = {
|
||||||
gestureEnabled: true,
|
gestureEnabled: true,
|
||||||
|
|
@ -269,16 +268,6 @@ function ClubStackComponent() {
|
||||||
};
|
};
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<ClubStack.Screen
|
|
||||||
name="ClubAboutScreen"
|
|
||||||
component={ClubAboutScreen}
|
|
||||||
options={({navigation}) => {
|
|
||||||
return {
|
|
||||||
title: "ABOUT",
|
|
||||||
...TransitionPresets.ModalSlideFromBottomIOS,
|
|
||||||
};
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</ClubStack.Navigator>
|
</ClubStack.Navigator>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,12 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import * as React from 'react';
|
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 {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 i18n from "i18n-js";
|
||||||
import ClubListItem from "../../../components/Lists/ClubListItem";
|
import ClubListItem from "../../components/Lists/ClubListItem";
|
||||||
import {isItemInCategoryFilter, stringMatchQuery} from "../../../utils/Search";
|
import {isItemInCategoryFilter, stringMatchQuery} from "../../utils/Search";
|
||||||
import ClubListHeader from "../../../components/Lists/ClubListHeader";
|
|
||||||
import HeaderButton from "../../../components/Custom/HeaderButton";
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
navigation: Object,
|
navigation: Object,
|
||||||
|
|
@ -41,9 +39,9 @@ class ClubListScreen extends React.Component<Props, State> {
|
||||||
* Creates the header content
|
* Creates the header content
|
||||||
*/
|
*/
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
const title = this.getSearchBar.bind(this);
|
||||||
this.props.navigation.setOptions({
|
this.props.navigation.setOptions({
|
||||||
headerTitle: this.getSearchBar,
|
headerTitle: title,
|
||||||
headerRight: this.getHeaderButtons,
|
|
||||||
headerBackTitleVisible: false,
|
headerBackTitleVisible: false,
|
||||||
headerTitleContainerStyle: Platform.OS === 'ios' ?
|
headerTitleContainerStyle: Platform.OS === 'ios' ?
|
||||||
{marginHorizontal: 0, width: '70%'} :
|
{marginHorizontal: 0, width: '70%'} :
|
||||||
|
|
@ -56,23 +54,14 @@ class ClubListScreen extends React.Component<Props, State> {
|
||||||
*
|
*
|
||||||
* @return {*}
|
* @return {*}
|
||||||
*/
|
*/
|
||||||
getSearchBar = () => {
|
getSearchBar() {
|
||||||
return (
|
return (
|
||||||
<Searchbar
|
<Searchbar
|
||||||
placeholder={i18n.t('proximoScreen.search')}
|
placeholder={i18n.t('proximoScreen.search')}
|
||||||
onChangeText={this.onSearchStringChange}
|
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
|
* Callback used when the search changes
|
||||||
|
|
@ -114,7 +103,7 @@ class ClubListScreen extends React.Component<Props, State> {
|
||||||
if (index === -1)
|
if (index === -1)
|
||||||
newCategoriesState.push(categoryId);
|
newCategoriesState.push(categoryId);
|
||||||
else
|
else
|
||||||
newCategoriesState.splice(index, 1);
|
newCategoriesState.splice(index,1);
|
||||||
}
|
}
|
||||||
if (filterStr !== null || categoryId !== null)
|
if (filterStr !== null || categoryId !== null)
|
||||||
this.setState({
|
this.setState({
|
||||||
|
|
@ -137,10 +126,16 @@ class ClubListScreen extends React.Component<Props, State> {
|
||||||
};
|
};
|
||||||
|
|
||||||
getListHeader() {
|
getListHeader() {
|
||||||
return <ClubListHeader
|
let final = [];
|
||||||
categories={this.categories}
|
for (let i = 0; i < this.categories.length; i++) {
|
||||||
categoryRender={this.getChipRender}
|
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) => {
|
getCategoryOfId = (id: number) => {
|
||||||
|
|
@ -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);
|
|
||||||
|
|
@ -7,11 +7,10 @@ import DashboardItem from "../components/Home/EventDashboardItem";
|
||||||
import WebSectionList from "../components/Lists/WebSectionList";
|
import WebSectionList from "../components/Lists/WebSectionList";
|
||||||
import {Text, withTheme} from 'react-native-paper';
|
import {Text, withTheme} from 'react-native-paper';
|
||||||
import FeedItem from "../components/Home/FeedItem";
|
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 PreviewEventDashboardItem from "../components/Home/PreviewEventDashboardItem";
|
||||||
import {stringToDate} from "../utils/Planning";
|
import {stringToDate} from "../utils/Planning";
|
||||||
import {openBrowser} from "../utils/WebBrowser";
|
import {openBrowser} from "../utils/WebBrowser";
|
||||||
import ActionsDashBoardItem from "../components/Home/ActionsDashboardItem";
|
|
||||||
// import DATA from "../dashboard_data.json";
|
// import DATA from "../dashboard_data.json";
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -144,13 +143,9 @@ class HomeScreen extends React.Component<Props, State> {
|
||||||
let dataset = [
|
let dataset = [
|
||||||
|
|
||||||
{
|
{
|
||||||
id: 'top',
|
id: 'middle',
|
||||||
content: []
|
content: []
|
||||||
},
|
},
|
||||||
{
|
|
||||||
id: 'actions',
|
|
||||||
content: undefined
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
id: 'event',
|
id: 'event',
|
||||||
content: undefined
|
content: undefined
|
||||||
|
|
@ -159,7 +154,7 @@ class HomeScreen extends React.Component<Props, State> {
|
||||||
for (let [key, value] of Object.entries(dashboardData)) {
|
for (let [key, value] of Object.entries(dashboardData)) {
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case 'today_events':
|
case 'today_events':
|
||||||
dataset[2]['content'] = value;
|
dataset[1]['content'] = value;
|
||||||
break;
|
break;
|
||||||
case 'available_machines':
|
case 'available_machines':
|
||||||
dataset[0]['content'][0] = {id: key, data: value};
|
dataset[0]['content'][0] = {id: key, data: value};
|
||||||
|
|
@ -189,14 +184,8 @@ class HomeScreen extends React.Component<Props, State> {
|
||||||
let content = item['content'];
|
let content = item['content'];
|
||||||
if (item['id'] === 'event')
|
if (item['id'] === 'event')
|
||||||
return this.getDashboardEventItem(content);
|
return this.getDashboardEventItem(content);
|
||||||
else if (item['id'] === 'top')
|
else if (item['id'] === 'middle')
|
||||||
return this.getDashboardTopItem(content);
|
return this.getDashboardMiddleItem(content);
|
||||||
else if (item['id'] === 'actions')
|
|
||||||
return this.getActionsDashboardItem();
|
|
||||||
}
|
|
||||||
|
|
||||||
getActionsDashboardItem() {
|
|
||||||
return <ActionsDashBoardItem {...this.props}/>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -370,7 +359,7 @@ class HomeScreen extends React.Component<Props, State> {
|
||||||
* @param content
|
* @param content
|
||||||
* @return {*}
|
* @return {*}
|
||||||
*/
|
*/
|
||||||
getDashboardTopItem(content: Array<Object>) {
|
getDashboardMiddleItem(content: Array<Object>) {
|
||||||
let proxiwashData = content[0]['data'];
|
let proxiwashData = content[0]['data'];
|
||||||
let tutorinsaData = content[1]['data'];
|
let tutorinsaData = content[1]['data'];
|
||||||
let proximoData = content[2]['data'];
|
let proximoData = content[2]['data'];
|
||||||
|
|
|
||||||
|
|
@ -246,9 +246,7 @@
|
||||||
"clubList": "Club list",
|
"clubList": "Club list",
|
||||||
"managers": "Managers",
|
"managers": "Managers",
|
||||||
"managersSubtitle": "These people make the club live",
|
"managersSubtitle": "These people make the club live",
|
||||||
"managersUnavailable": "This club has no one :(",
|
"managersUnavailable": "This club has no one :("
|
||||||
"categories": "Categories",
|
|
||||||
"categoriesFilterMessage": "Click on a category to filter the list"
|
|
||||||
},
|
},
|
||||||
"dialog": {
|
"dialog": {
|
||||||
"ok": "OK",
|
"ok": "OK",
|
||||||
|
|
|
||||||
|
|
@ -247,9 +247,7 @@
|
||||||
"clubList": "Liste des clubs",
|
"clubList": "Liste des clubs",
|
||||||
"managers": "Responsables",
|
"managers": "Responsables",
|
||||||
"managersSubtitle": "Ces personnes font vivre le club",
|
"managersSubtitle": "Ces personnes font vivre le club",
|
||||||
"managersUnavailable": "Ce club est tout seul :(",
|
"managersUnavailable": "Ce club est tout seul :("
|
||||||
"categories": "Catégories",
|
|
||||||
"categoriesFilterMessage": "Cliquez sur une catégorie pour filtrer la list"
|
|
||||||
},
|
},
|
||||||
"dialog": {
|
"dialog": {
|
||||||
"ok": "OK",
|
"ok": "OK",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue