Browse Source

Improved planning display

keplyx 4 years ago
parent
commit
2f3e171b08
2 changed files with 25 additions and 24 deletions
  1. 14
    16
      screens/PlanningDisplayScreen.js
  2. 11
    8
      screens/PlanningScreen.js

+ 14
- 16
screens/PlanningDisplayScreen.js View File

6
 import HTML from "react-native-render-html";
6
 import HTML from "react-native-render-html";
7
 import {Linking} from "expo";
7
 import {Linking} from "expo";
8
 import PlanningEventManager from '../utils/PlanningEventManager';
8
 import PlanningEventManager from '../utils/PlanningEventManager';
9
-import {Subheading, Title} from 'react-native-paper';
9
+import {Card} from 'react-native-paper';
10
 
10
 
11
 type Props = {
11
 type Props = {
12
     navigation: Object,
12
     navigation: Object,
28
         // console.log("rendering planningDisplayScreen");
28
         // console.log("rendering planningDisplayScreen");
29
         return (
29
         return (
30
             <ScrollView style={{paddingLeft: 5, paddingRight: 5}}>
30
             <ScrollView style={{paddingLeft: 5, paddingRight: 5}}>
31
-                <Title>
32
-                    {this.displayData.title}
33
-                </Title>
34
-                <Subheading style={{marginTop: 10,}}>
35
-                    {PlanningEventManager.getFormattedTime(this.displayData)}
36
-                </Subheading>
31
+                <Card.Title
32
+                    title={this.displayData.title}
33
+                    subtitle={PlanningEventManager.getFormattedTime(this.displayData) + ' | ' + PlanningEventManager.getEventStartDate(this.displayData)}
34
+                />
37
                 {this.displayData.logo !== null ?
35
                 {this.displayData.logo !== null ?
38
-                    <View style={{width: '100%', height: 300, marginTop: 20, marginBottom: 20}}>
36
+                    <View style={{width: '100%', height: 300}}>
39
                         <Image style={{flex: 1, resizeMode: "contain"}}
37
                         <Image style={{flex: 1, resizeMode: "contain"}}
40
                                source={{uri: this.displayData.logo}}/>
38
                                source={{uri: this.displayData.logo}}/>
41
                     </View>
39
                     </View>
43
 
41
 
44
                 {this.displayData.description !== null ?
42
                 {this.displayData.description !== null ?
45
                     // Surround description with div to allow text styling if the description is not html
43
                     // Surround description with div to allow text styling if the description is not html
46
-                    <HTML html={"<div>" + this.displayData.description + "</div>"}
47
-                          tagsStyles={{
48
-                              p: {
49
-                                  color: ThemeManager.getCurrentThemeVariables().text,
50
-                              },
51
-                              div: {color: ThemeManager.getCurrentThemeVariables().text}
52
-                          }}
53
-                          onLinkPress={openWebLink}/>
44
+                    <Card.Content>
45
+                        <HTML html={"<div>" + this.displayData.description + "</div>"}
46
+                              tagsStyles={{
47
+                                  p: {color: ThemeManager.getCurrentThemeVariables().text,},
48
+                                  div: {color: ThemeManager.getCurrentThemeVariables().text}
49
+                              }}
50
+                              onLinkPress={openWebLink}/>
51
+                    </Card.Content>
54
                     : <View/>}
52
                     : <View/>}
55
             </ScrollView>
53
             </ScrollView>
56
         );
54
         );

+ 11
- 8
screens/PlanningScreen.js View File

1
 // @flow
1
 // @flow
2
 
2
 
3
 import * as React from 'react';
3
 import * as React from 'react';
4
-import {BackHandler, Image, View} from 'react-native';
4
+import {BackHandler, View} from 'react-native';
5
 import i18n from "i18n-js";
5
 import i18n from "i18n-js";
6
-import ThemeManager from "../utils/ThemeManager";
7
 import {LocaleConfig} from 'react-native-calendars';
6
 import {LocaleConfig} from 'react-native-calendars';
8
 import WebDataManager from "../utils/WebDataManager";
7
 import WebDataManager from "../utils/WebDataManager";
9
 import PlanningEventManager from '../utils/PlanningEventManager';
8
 import PlanningEventManager from '../utils/PlanningEventManager';
10
-import {Text, Title, List, Avatar, Divider} from 'react-native-paper';
9
+import {Avatar, Divider, List} from 'react-native-paper';
11
 import CustomAgenda from "../components/CustomAgenda";
10
 import CustomAgenda from "../components/CustomAgenda";
12
 
11
 
13
 LocaleConfig.locales['fr'] = {
12
 LocaleConfig.locales['fr'] = {
31
 
30
 
32
 const FETCH_URL = "https://amicale-insat.fr/event/json/list";
31
 const FETCH_URL = "https://amicale-insat.fr/event/json/list";
33
 
32
 
34
-const AGENDA_MONTH_SPAN = 6;
33
+const AGENDA_MONTH_SPAN = 3;
35
 
34
 
36
 /**
35
 /**
37
  * Class defining the app's planning screen
36
  * Class defining the app's planning screen
138
                     <List.Item
137
                     <List.Item
139
                         title={item.title}
138
                         title={item.title}
140
                         description={PlanningEventManager.getFormattedTime(item)}
139
                         description={PlanningEventManager.getFormattedTime(item)}
141
-                        left={props => <Avatar.Image source={{uri: item.logo}} />}
140
+                        left={props => <Avatar.Image
141
+                            source={{uri: item.logo}}
142
+                            style={{backgroundColor: 'transparent'}}
143
+                        />}
142
                         onPress={onPress}
144
                         onPress={onPress}
143
                     />
145
                     />
144
                 </View>
146
                 </View>
164
     }
166
     }
165
 
167
 
166
     rowHasChanged(r1: Object, r2: Object) {
168
     rowHasChanged(r1: Object, r2: Object) {
167
-        if (r1 !== undefined && r2 !== undefined)
168
-            return r1.title !== r2.title;
169
-        else return !(r1 === undefined && r2 === undefined);
169
+        return false;
170
+        // if (r1 !== undefined && r2 !== undefined)
171
+        //     return r1.title !== r2.title;
172
+        // else return !(r1 === undefined && r2 === undefined);
170
     }
173
     }
171
 
174
 
172
     /**
175
     /**

Loading…
Cancel
Save