Compare commits

..

5 commits

7 changed files with 41 additions and 41 deletions

View file

@ -26,7 +26,7 @@ class ClubListHeader extends React.Component<Props> {
selected={isItemInCategoryFilter(this.props.selectedCategories, [category.id])} selected={isItemInCategoryFilter(this.props.selectedCategories, [category.id])}
mode={'outlined'} mode={'outlined'}
onPress={onPress} onPress={onPress}
style={{marginRight: 5, marginBottom: 5}} style={{marginRight: 5, marginLeft: 5, marginBottom: 5}}
key={key} key={key}
> >
{category.name} {category.name}

View file

@ -55,7 +55,11 @@ class ClubListItem extends React.Component<Props> {
onPress={this.props.onPress} onPress={this.props.onPress}
left={(props) => <Avatar.Image left={(props) => <Avatar.Image
{...props} {...props}
style={{backgroundColor: 'transparent'}} style={{
backgroundColor: 'transparent',
marginLeft: 10,
marginRight: 10,
}}
size={64} size={64}
source={{uri: this.props.item.logo}}/>} source={{uri: this.props.item.logo}}/>}
right={(props) => <Avatar.Icon right={(props) => <Avatar.Icon

View file

@ -21,15 +21,25 @@ class CustomHTML extends React.Component<Props> {
return <Text {...passProps}>{children}</Text>; return <Text {...passProps}>{children}</Text>;
}; };
getListBullet = (htmlAttribs, children, convertedCSSStyles, passProps) => {
return (
<Text>- </Text>
);
};
render() { render() {
// Surround description with p to allow text styling if the description is not html // Surround description with p to allow text styling if the description is not html
return <HTML return <HTML
html={"<p>" + this.props.html + "</p>"} html={"<p>" + this.props.html + "</p>"}
renderers={{ renderers={{
p: this.getBasicText, p: this.getBasicText,
li: this.getBasicText,
}} }}
listsPrefixesRenderers={{
ul: this.getListBullet
}}
ignoredTags={['img']}
ignoredStyles={['color', 'background-color']} ignoredStyles={['color', 'background-color']}
onLinkPress={this.openWebLink}/>; onLinkPress={this.openWebLink}/>;
} }
} }

View file

@ -25,6 +25,7 @@ const links = {
"Coucou !\n\n", "Coucou !\n\n",
yohanLinkedin: 'https://www.linkedin.com/in/yohan-simard', yohanLinkedin: 'https://www.linkedin.com/in/yohan-simard',
react: 'https://facebook.github.io/react-native/', react: 'https://facebook.github.io/react-native/',
meme: "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
}; };
type Props = { type Props = {
@ -84,7 +85,7 @@ class AboutScreen extends React.Component<Props> {
*/ */
authorData: Array<Object> = [ authorData: Array<Object> = [
{ {
onPressCallback: () => console.log('cc'), onPressCallback: () => openWebLink(links.meme),
icon: 'account-circle', icon: 'account-circle',
text: 'Arnaud VERGNET', text: 'Arnaud VERGNET',
showChevron: false showChevron: false

View file

@ -11,6 +11,7 @@ import {Avatar, Card, Divider, List, TouchableRipple, withTheme} from "react-nat
import type {CustomTheme} from "../../managers/ThemeManager"; import type {CustomTheme} from "../../managers/ThemeManager";
import i18n from 'i18n-js'; import i18n from 'i18n-js';
import MaterialHeaderButtons, {Item} from "../../components/Overrides/CustomHeaderButton"; import MaterialHeaderButtons, {Item} from "../../components/Overrides/CustomHeaderButton";
import ConnectionManager from "../../managers/ConnectionManager";
type Props = { type Props = {
navigation: Object, navigation: Object,
@ -61,13 +62,13 @@ class ServicesScreen extends React.Component<Props, State> {
title: i18n.t('screens.clubsAbout'), title: i18n.t('screens.clubsAbout'),
subtitle: i18n.t('servicesScreen.descriptions.clubs'), subtitle: i18n.t('servicesScreen.descriptions.clubs'),
image: CLUBS_IMAGE, image: CLUBS_IMAGE,
onPress: () => nav.navigate("club-list"), onPress: () => this.onAmicaleServicePress("club-list"),
}, },
{ {
title: i18n.t('screens.profile'), title: i18n.t('screens.profile'),
subtitle: i18n.t('servicesScreen.descriptions.profile'), subtitle: i18n.t('servicesScreen.descriptions.profile'),
image: PROFILE_IMAGE, image: PROFILE_IMAGE,
onPress: () => nav.navigate("profile"), onPress: () => this.onAmicaleServicePress("profile"),
}, },
{ {
title: i18n.t('screens.amicaleWebsite'), title: i18n.t('screens.amicaleWebsite'),
@ -79,7 +80,7 @@ class ServicesScreen extends React.Component<Props, State> {
title: i18n.t('screens.vote'), title: i18n.t('screens.vote'),
subtitle: i18n.t('servicesScreen.descriptions.vote'), subtitle: i18n.t('servicesScreen.descriptions.vote'),
image: VOTE_IMAGE, image: VOTE_IMAGE,
onPress: () => nav.navigate("vote"), onPress: () => this.onAmicaleServicePress("vote"),
}, },
]; ];
this.studentsDataset = [ this.studentsDataset = [
@ -196,6 +197,13 @@ class ServicesScreen extends React.Component<Props, State> {
/> />
} }
onAmicaleServicePress(route: string) {
if (ConnectionManager.getInstance().isLoggedIn())
this.props.navigation.navigate(route);
else
this.props.navigation.navigate("login", {nextScreen: route});
}
renderItem = ({item}: { item: listItem }) => { renderItem = ({item}: { item: listItem }) => {
return ( return (
<TouchableRipple <TouchableRipple

View file

@ -6,10 +6,7 @@ import CustomTabBar from "../../components/Tabbar/CustomTabBar";
import {withCollapsible} from "../../utils/withCollapsible"; import {withCollapsible} from "../../utils/withCollapsible";
import {Collapsible} from "react-navigation-collapsible"; import {Collapsible} from "react-navigation-collapsible";
import {CommonActions} from "@react-navigation/native"; import {CommonActions} from "@react-navigation/native";
import ConnectionManager from "../../managers/ConnectionManager";
import type {listItem} from "./ServicesScreen"; import type {listItem} from "./ServicesScreen";
import ErrorView from "../../components/Screens/ErrorView";
import {ERROR_TYPE} from "../../utils/WebData";
type Props = { type Props = {
navigation: Object, navigation: Object,
@ -17,29 +14,13 @@ type Props = {
collapsibleStack: Collapsible, collapsibleStack: Collapsible,
} }
type State = { class ServicesSectionScreen extends React.Component<Props> {
isLoggedIn: boolean,
}
class ServicesSectionScreen extends React.Component<Props, State> {
finalDataset: listItem; finalDataset: listItem;
constructor(props) { constructor(props) {
super(props); super(props);
this.handleNavigationParams(); this.handleNavigationParams();
this.state = {
isLoggedIn: ConnectionManager.getInstance().isLoggedIn(),
}
}
componentDidMount() {
this.props.navigation.addListener('focus', this.onFocus);
}
onFocus = () => {
this.setState({isLoggedIn: ConnectionManager.getInstance().isLoggedIn()})
} }
handleNavigationParams() { handleNavigationParams() {
@ -57,19 +38,16 @@ class ServicesSectionScreen extends React.Component<Props, State> {
render() { render() {
const {containerPaddingTop, scrollIndicatorInsetTop, onScroll} = this.props.collapsibleStack; const {containerPaddingTop, scrollIndicatorInsetTop, onScroll} = this.props.collapsibleStack;
if (!this.state.isLoggedIn && this.finalDataset.shouldLogin) return <CardList
return <ErrorView {...this.props} errorCode={ERROR_TYPE.BAD_TOKEN}/>; dataset={this.finalDataset.content}
else isHorizontal={false}
return <CardList onScroll={onScroll}
dataset={this.finalDataset.content} contentContainerStyle={{
isHorizontal={false} paddingTop: containerPaddingTop,
onScroll={onScroll} paddingBottom: CustomTabBar.TAB_BAR_HEIGHT + 20
contentContainerStyle={{ }}
paddingTop: containerPaddingTop, scrollIndicatorInsets={{top: scrollIndicatorInsetTop}}
paddingBottom: CustomTabBar.TAB_BAR_HEIGHT + 20 />
}}
scrollIndicatorInsets={{top: scrollIndicatorInsetTop}}
/>
} }
} }

View file

@ -16,7 +16,6 @@ export const AmicaleWebsiteScreen = (props: Object) => {
path = path.replace(URL, ''); path = path.replace(URL, '');
} }
} }
console.log(URL + path);
return ( return (
<WebViewScreen <WebViewScreen
{...props} {...props}