Display club managers status

This commit is contained in:
Arnaud Vergnet 2020-04-03 14:42:43 +02:00
parent 784872ed96
commit c148529b94
4 changed files with 20 additions and 4 deletions

View file

@ -66,14 +66,16 @@ class ClubDisplayScreen extends React.Component<Props, State> {
for (let i = 0; i < resp.length; i++) { for (let i = 0; i < resp.length; i++) {
final.push(<Paragraph>{resp[i]}</Paragraph>) final.push(<Paragraph>{resp[i]}</Paragraph>)
} }
const hasManagers = resp.length > 0;
return ( return (
<Card style={{marginTop: 10, marginBottom: 10}}> <Card style={{marginTop: 10, marginBottom: 10}}>
<Card.Title <Card.Title
title={i18n.t('clubs.managers')} title={i18n.t('clubs.managers')}
subtitle={i18n.t('clubs.managersSubtitle')} subtitle={hasManagers ? i18n.t('clubs.managersSubtitle') : i18n.t('clubs.managersUnavailable')}
left={(props) => <Avatar.Icon left={(props) => <Avatar.Icon
style={{backgroundColor: 'transparent'}}
{...props} {...props}
style={{backgroundColor: 'transparent'}}
color={hasManagers ? this.colors.success : this.colors.primary}
icon="account-tie"/>} icon="account-tie"/>}
/> />
<Card.Content> <Card.Content>

View file

@ -64,6 +64,7 @@ class ClubListScreen extends React.Component<Props, State> {
getRenderItem = ({item}: Object) => { getRenderItem = ({item}: Object) => {
const onPress = this.onListItemPress.bind(this, item); const onPress = this.onListItemPress.bind(this, item);
const categoriesRender = this.getCategoriesRender.bind(this, item.category); const categoriesRender = this.getCategoriesRender.bind(this, item.category);
const hasManagers = item.responsibles.length > 0;
return ( return (
<List.Item <List.Item
title={item.name} title={item.name}
@ -74,6 +75,17 @@ class ClubListScreen extends React.Component<Props, State> {
style={{backgroundColor: 'transparent'}} style={{backgroundColor: 'transparent'}}
size={64} size={64}
source={{uri: item.logo}}/>} source={{uri: item.logo}}/>}
right={(props) => <Avatar.Icon
{...props}
style={{
marginTop: 'auto',
marginBottom: 'auto',
backgroundColor: 'transparent',
}}
size={48}
icon={hasManagers ? "check-circle-outline" : "alert-circle-outline"}
color={hasManagers ? this.colors.success : this.colors.primary}
/>}
/> />
); );
}; };

View file

@ -245,7 +245,8 @@
"clubs": { "clubs": {
"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 :("
}, },
"dialog": { "dialog": {
"ok": "OK", "ok": "OK",

View file

@ -246,7 +246,8 @@
"clubs": { "clubs": {
"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 :("
}, },
"dialog": { "dialog": {
"ok": "OK", "ok": "OK",