@olea-bps/components 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AppBar/index.js +83 -0
- package/AppBar/styles.js +27 -0
- package/BookDetail/index.js +268 -0
- package/BookDetail/styles.js +124 -0
- package/Component/342/200/216JobsFilter/index.js +188 -0
- package/Component/342/200/216JobsFilter/styles.js +12 -0
- package/ConnectivityWarning/index.js +65 -0
- package/ConnectivityWarning/styles.js +19 -0
- package/ContactDetail/index.js +232 -0
- package/ContactDetail/styles.js +32 -0
- package/CourseDetail/index.js +357 -0
- package/CourseDetail/styles.js +59 -0
- package/CourseDetailDialog/index.js +169 -0
- package/CourseDetailDialog/styles.js +116 -0
- package/CourseInfo/index.js +219 -0
- package/CourseInfo/styles.js +40 -0
- package/DevelopmentDialog/index.js +208 -0
- package/DevelopmentDialog/styles.js +10 -0
- package/EventCodeInput/index.js +146 -0
- package/EventCodeInput/styles.js +108 -0
- package/FlexMenuEntry/index.js +84 -0
- package/FlexMenuEntry/styles.js +27 -0
- package/MainMenuEntry/index.js +88 -0
- package/MainMenuEntry/styles.js +28 -0
- package/MealItem/index.js +87 -0
- package/MealItem/styles.js +73 -0
- package/MensaMenu/index.js +307 -0
- package/MensaMenu/styles.js +94 -0
- package/MensaSlider/index.js +184 -0
- package/MensaSlider/styles.js +53 -0
- package/Modal/index.js +106 -0
- package/Modal/styles.js +8 -0
- package/NewsDetail/index.js +377 -0
- package/NewsDetail/styles.js +77 -0
- package/NewsList/index.js +120 -0
- package/NewsList/styles.js +19 -0
- package/NewsListItem/index.js +89 -0
- package/NewsListItem/styles.js +32 -0
- package/OtherCourses/index.js +152 -0
- package/OtherCourses/styles.js +10 -0
- package/PtsDeparture/index.js +140 -0
- package/PtsDeparture/styles.js +7 -0
- package/PtsStation/index.js +183 -0
- package/PtsStation/styles.js +47 -0
- package/QuickLinks/index.js +127 -0
- package/QuickLinks/styles.js +45 -0
- package/RoomDetail/index.js +281 -0
- package/RoomDetail/styles.js +56 -0
- package/ScaledImage/index.js +92 -0
- package/SearchResults/index.js +362 -0
- package/SearchResults/styles.js +59 -0
- package/SettingSection/index.js +54 -0
- package/SettingSection/styles.js +15 -0
- package/SettingsDialog/index.js +52 -0
- package/SettingsDialog/styles.js +12 -0
- package/SettingsDialogRadio/index.js +66 -0
- package/SettingsDialogRadio/styles.js +7 -0
- package/SettingsDialogSelect/index.js +73 -0
- package/SettingsDialogSelect/styles.js +7 -0
- package/TimetableCodeInput/index.js +201 -0
- package/TimetableCodeInput/styles.js +28 -0
- package/TimetableDay/index.js +266 -0
- package/TimetableDay/styles.js +103 -0
- package/TimetableEvent/index.js +163 -0
- package/TimetableEvent/styles.js +108 -0
- package/TimetableList/index.js +116 -0
- package/TimetableList/styles.js +109 -0
- package/TimetableMonth/index.js +156 -0
- package/TimetableMonth/styles.js +29 -0
- package/TimetableWeek/index.js +245 -0
- package/TimetableWeek/styles.js +58 -0
- package/TopNews/index.js +282 -0
- package/TopNews/styles.js +125 -0
- package/TopNewsHtwk/index.js +279 -0
- package/TopNewsHtwk/styles.js +142 -0
- package/WebView/index.js +108 -0
- package/WebView/styles.js +11 -0
- package/index.js +39 -0
- package/package.json +37 -0
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
* you may not use this file except in compliance with the License.
|
|
4
|
+
* You may obtain a copy of the License at
|
|
5
|
+
*
|
|
6
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
*
|
|
8
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
* See the License for the specific language governing permissions and
|
|
12
|
+
* limitations under the License.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import React from 'react';
|
|
16
|
+
import {
|
|
17
|
+
Animated,
|
|
18
|
+
Dimensions,
|
|
19
|
+
StyleSheet,
|
|
20
|
+
Text,
|
|
21
|
+
TouchableOpacity,
|
|
22
|
+
View
|
|
23
|
+
} from 'react-native';
|
|
24
|
+
|
|
25
|
+
import {connect} from 'react-redux';
|
|
26
|
+
import {withTheme} from "react-native-paper";
|
|
27
|
+
|
|
28
|
+
import merge from 'lodash/merge';
|
|
29
|
+
import NetInfo from '@react-native-community/netinfo';
|
|
30
|
+
|
|
31
|
+
import componentStyles from "./styles";
|
|
32
|
+
import PropTypes from "prop-types";
|
|
33
|
+
import {withTranslation} from "react-i18next";
|
|
34
|
+
import {handleHtmlEntities} from "@olea-bps/core/helper/format.helper";
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Top News Component
|
|
40
|
+
*
|
|
41
|
+
* Shows a single news item with the name and the logo of the university.
|
|
42
|
+
*
|
|
43
|
+
* Parameters:
|
|
44
|
+
* - animationRange: Animation Range for animation of the dashboard view
|
|
45
|
+
*
|
|
46
|
+
* Navigation-Parameters:
|
|
47
|
+
* - none
|
|
48
|
+
*/
|
|
49
|
+
class TopNewsComponent extends React.Component {
|
|
50
|
+
|
|
51
|
+
static propTypes = {
|
|
52
|
+
animationRange: PropTypes.any
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
// Styles of this component
|
|
56
|
+
styles;
|
|
57
|
+
|
|
58
|
+
animateHeader = null;
|
|
59
|
+
animateBackground = null;
|
|
60
|
+
topNews = null;
|
|
61
|
+
hasConnection = true;
|
|
62
|
+
netInfoUnsubscribe = null;
|
|
63
|
+
|
|
64
|
+
constructor(props) {
|
|
65
|
+
super(props);
|
|
66
|
+
|
|
67
|
+
// ------------------------------------------------------------------------
|
|
68
|
+
// PLUGIN FUNCTIONALITY
|
|
69
|
+
// ------------------------------------------------------------------------
|
|
70
|
+
|
|
71
|
+
const { pluginStyles,theme } = this.props;
|
|
72
|
+
this.styles = componentStyles(theme);
|
|
73
|
+
|
|
74
|
+
if(pluginStyles) {
|
|
75
|
+
this.styles = merge(this.styles, pluginStyles);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
this.styles = StyleSheet.create(this.styles);
|
|
79
|
+
// ------------------------------------------------------------------------
|
|
80
|
+
|
|
81
|
+
const height = Dimensions.get('window').height;
|
|
82
|
+
|
|
83
|
+
this.animateHeader = {
|
|
84
|
+
transform: [{
|
|
85
|
+
translateY: this.props.animationRange.interpolate({
|
|
86
|
+
inputRange: [0, 1],
|
|
87
|
+
outputRange: [0, height / 8],
|
|
88
|
+
})
|
|
89
|
+
}]
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
this.animateLogo = {
|
|
93
|
+
transform: [{
|
|
94
|
+
translateY: this.props.animationRange.interpolate({
|
|
95
|
+
inputRange: [0, 1],
|
|
96
|
+
outputRange: [30, (height / 50)],
|
|
97
|
+
})
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
scale: this.props.animationRange.interpolate({
|
|
101
|
+
inputRange: [0, 1],
|
|
102
|
+
outputRange: [1, .4],
|
|
103
|
+
})
|
|
104
|
+
}]
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
this.animateBackground = {
|
|
108
|
+
transform: [{
|
|
109
|
+
translateY: this.props.animationRange.interpolate({
|
|
110
|
+
inputRange: [0, 1],
|
|
111
|
+
outputRange: [0, height / 7],
|
|
112
|
+
extrapolate: 'clamp'
|
|
113
|
+
})
|
|
114
|
+
}]
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
this.netInfoUnsubscribe = NetInfo.addEventListener(state => {
|
|
118
|
+
this.hasConnection = state.isInternetReachable && state.isConnected;
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
componentWillUnmount() {
|
|
123
|
+
if(this.netInfoUnsubscribe) {
|
|
124
|
+
this.netInfoUnsubscribe();
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
render() {
|
|
129
|
+
|
|
130
|
+
// ------------------------------------------------------------------------
|
|
131
|
+
// PLUGIN FUNCTIONALITY
|
|
132
|
+
// ------------------------------------------------------------------------
|
|
133
|
+
const PluginComponent = this.props.pluginComponent;
|
|
134
|
+
if (PluginComponent) {
|
|
135
|
+
return <PluginComponent />;
|
|
136
|
+
}
|
|
137
|
+
// ------------------------------------------------------------------------
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
const {feeds, t} = this.props;
|
|
141
|
+
const {appSettings} = this.props.theme;
|
|
142
|
+
let topNews = this.props.topNews;
|
|
143
|
+
|
|
144
|
+
if(!Array.isArray(topNews)) {
|
|
145
|
+
topNews = [];
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
let topItem = null;
|
|
149
|
+
let imageSrc = null;
|
|
150
|
+
let feedTitle = null;
|
|
151
|
+
if(topNews[0]) {
|
|
152
|
+
topItem = topNews[0];
|
|
153
|
+
if(topItem.imageUrl) {
|
|
154
|
+
imageSrc = {uri: topItem.imageUrl};
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if(feeds && topItem && topItem.originFeedId) {
|
|
159
|
+
const feed = feeds.filter(feed => feed.feedid === topItem.originFeedId)[0];
|
|
160
|
+
|
|
161
|
+
if(feed && feed.title) {
|
|
162
|
+
feedTitle = feed.title.toUpperCase();
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if(!imageSrc)
|
|
167
|
+
imageSrc = appSettings.header;
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
// Top News available
|
|
171
|
+
this.topNews = topItem;
|
|
172
|
+
|
|
173
|
+
// Notice about "." in accessibilityLabels: This will set a short break in the sound output, like in a normal sentence.
|
|
174
|
+
|
|
175
|
+
return (
|
|
176
|
+
<View style={{overflow: 'hidden'}}>
|
|
177
|
+
<Animated.View
|
|
178
|
+
style={[this.styles.universityIconWrapper, this.animateBackground]}>
|
|
179
|
+
<Animated.Image
|
|
180
|
+
source={appSettings.logo}
|
|
181
|
+
resizeMode="contain"
|
|
182
|
+
fadeDuration={1000}
|
|
183
|
+
style={[this.styles.universityIcon]}/>
|
|
184
|
+
</Animated.View>
|
|
185
|
+
<TouchableOpacity
|
|
186
|
+
onPress={() => this._handlePressNews(topItem)}
|
|
187
|
+
>
|
|
188
|
+
<Animated.View stlyle={[this.styles.backgroundImageWrapper, this.animateBackground]}>
|
|
189
|
+
<Animated.Image
|
|
190
|
+
source={imageSrc}
|
|
191
|
+
resizeMode="cover"
|
|
192
|
+
fadeDuration={10}
|
|
193
|
+
style={[this.styles.newsImage]}
|
|
194
|
+
accessible={true}
|
|
195
|
+
accessibilityLabel={
|
|
196
|
+
!topItem && !this.hasConnection ?
|
|
197
|
+
t('home:noConnectionTitle')
|
|
198
|
+
: (!topItem ? t('home:noItemTitle') : handleHtmlEntities(topItem.title))}
|
|
199
|
+
accessibilityHint={!topItem ? '' : t('accessibility:topNewsHint')}
|
|
200
|
+
/>
|
|
201
|
+
</Animated.View>
|
|
202
|
+
|
|
203
|
+
{
|
|
204
|
+
(!topItem && !this.hasConnection) ? (
|
|
205
|
+
<Animated.View style={[this.styles.newsItem]}
|
|
206
|
+
accessible={true}
|
|
207
|
+
accessibilityLabel={t('home:noConnectionTitle')}>
|
|
208
|
+
<Text style={this.styles.newsItemTitle}>{t('home:noConnectionTitle')}</Text>
|
|
209
|
+
<Text style={this.styles.newsItemText}>{t('home:noConnectionText')}</Text>
|
|
210
|
+
<View style={this.styles.newsItemActionbar}>
|
|
211
|
+
<Text style={this.styles.newsItemDate}/>
|
|
212
|
+
</View>
|
|
213
|
+
</Animated.View>
|
|
214
|
+
) : ((!topItem) ? (
|
|
215
|
+
<Animated.View style={[this.styles.newsItem]}
|
|
216
|
+
accessible={true}
|
|
217
|
+
accessibilityLabel={t('home:noItemTitle')}>
|
|
218
|
+
<Text style={this.styles.newsItemTitle}>{t('home:noItemTitle')}</Text>
|
|
219
|
+
<Text style={this.styles.newsItemText}>{t('home:noItemText')}</Text>
|
|
220
|
+
<View style={this.styles.newsItemActionbar}>
|
|
221
|
+
<Text style={this.styles.newsItemDate}/>
|
|
222
|
+
</View>
|
|
223
|
+
</Animated.View>
|
|
224
|
+
) : (
|
|
225
|
+
<View
|
|
226
|
+
style={this.styles.newsItem}
|
|
227
|
+
accessible={true}
|
|
228
|
+
accessibilityLabel={handleHtmlEntities(topItem.title)}
|
|
229
|
+
accessibilityHint={t('accessibility:topNewsHint')}
|
|
230
|
+
>
|
|
231
|
+
{feedTitle && <Text style={this.styles.newsItemCategory}>{feedTitle}</Text>}
|
|
232
|
+
<Text style={this.styles.newsItemTitle}>{handleHtmlEntities(topItem.title)}</Text>
|
|
233
|
+
{topItem.shortDesc &&
|
|
234
|
+
<Text style={this.styles.newsItemText}>{handleHtmlEntities(topItem.shortDesc)}</Text>
|
|
235
|
+
}
|
|
236
|
+
{topItem.author &&
|
|
237
|
+
<Text style={this.styles.newsItemAuthor}>{handleHtmlEntities(topItem.author)}</Text>
|
|
238
|
+
}
|
|
239
|
+
<View style={this.styles.newsItemActionbar} />
|
|
240
|
+
</View>
|
|
241
|
+
))
|
|
242
|
+
}
|
|
243
|
+
</TouchableOpacity>
|
|
244
|
+
</View>
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* User has pressed the news item card.
|
|
251
|
+
* Shows the news details in a modal window.
|
|
252
|
+
*
|
|
253
|
+
* @param news
|
|
254
|
+
*
|
|
255
|
+
* @private
|
|
256
|
+
*/
|
|
257
|
+
_handlePressNews = (news) => {
|
|
258
|
+
if (news) {
|
|
259
|
+
this.props.navigation.navigate(
|
|
260
|
+
'TopNewsDetail',
|
|
261
|
+
{
|
|
262
|
+
news: {...news, 'feedId': 0},
|
|
263
|
+
newsType: "Default"
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
const mapStateToProps = state => {
|
|
271
|
+
return {
|
|
272
|
+
pluginComponent: state.pluginReducer.topNews.component,
|
|
273
|
+
pluginStyles: state.pluginReducer.topNews.styles,
|
|
274
|
+
topNews: state.apiReducer.topNews,
|
|
275
|
+
feeds: state.apiReducer.feeds
|
|
276
|
+
};
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
export default connect(mapStateToProps, null)(withTranslation()(withTheme(TopNewsComponent)))
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import {Platform, Dimensions} from "react-native";
|
|
2
|
+
|
|
3
|
+
export default function(theme) {
|
|
4
|
+
const width = Dimensions.get('window').width;
|
|
5
|
+
const height = Dimensions.get('window').height;
|
|
6
|
+
const headerImageHeight = height / 2;
|
|
7
|
+
return {
|
|
8
|
+
appHeader: {
|
|
9
|
+
flex: 1,
|
|
10
|
+
flexDirection: 'row',
|
|
11
|
+
alignItems: 'baseline',
|
|
12
|
+
},
|
|
13
|
+
appHeaderSearchButton: {
|
|
14
|
+
position: 'absolute',
|
|
15
|
+
top: Platform.OS === 'ios' ? theme.paddings.default : theme.paddings.xlarge,
|
|
16
|
+
right: theme.paddings.default
|
|
17
|
+
},
|
|
18
|
+
appHeaderSearch: {},
|
|
19
|
+
appHeaderContainer: {
|
|
20
|
+
flex: 1,
|
|
21
|
+
justifyContent: 'center',
|
|
22
|
+
alignContent: 'center',
|
|
23
|
+
alignItems: 'center',
|
|
24
|
+
height: headerImageHeight,
|
|
25
|
+
},
|
|
26
|
+
universityIconWrapper: {
|
|
27
|
+
flex: 1,
|
|
28
|
+
zIndex: 9,
|
|
29
|
+
backgroundColor: theme.colors.topNewsIconBackground,
|
|
30
|
+
},
|
|
31
|
+
universityIcon: {
|
|
32
|
+
width: width * .6,
|
|
33
|
+
height: (width) * .1,
|
|
34
|
+
margin: (width * .15) / 4,
|
|
35
|
+
marginLeft: theme.paddings.default,
|
|
36
|
+
|
|
37
|
+
},
|
|
38
|
+
universityTitle: {
|
|
39
|
+
marginTop: theme.paddings.large,
|
|
40
|
+
marginLeft: theme.paddings.default,
|
|
41
|
+
color: theme.colors.primaryText,
|
|
42
|
+
fontSize: theme.fontSizes.universityTitle,
|
|
43
|
+
...theme.fonts.bold,
|
|
44
|
+
lineHeight: theme.lineHeights.xxl,
|
|
45
|
+
textAlign: 'left',
|
|
46
|
+
alignSelf: 'flex-start',
|
|
47
|
+
marginBottom: theme.paddings.small
|
|
48
|
+
},
|
|
49
|
+
newsImage: {
|
|
50
|
+
height: width/16*9,
|
|
51
|
+
width: width
|
|
52
|
+
},
|
|
53
|
+
backgroundImageWrapper: {
|
|
54
|
+
position:'relative',
|
|
55
|
+
overflow: 'hidden',
|
|
56
|
+
backgroundColor: 'blue'
|
|
57
|
+
},
|
|
58
|
+
imageOverlay: {
|
|
59
|
+
height: headerImageHeight,
|
|
60
|
+
width: width,
|
|
61
|
+
flex: 1
|
|
62
|
+
},
|
|
63
|
+
newsItem: {
|
|
64
|
+
backgroundColor: theme.colors.background,
|
|
65
|
+
paddingHorizontal: theme.paddings.default,
|
|
66
|
+
paddingTop: theme.paddings.xsmall,
|
|
67
|
+
paddingBottom: theme.paddings.xsmall,
|
|
68
|
+
},
|
|
69
|
+
newsItemCategory: {
|
|
70
|
+
marginBottom: 5,
|
|
71
|
+
fontSize: theme.fontSizes.s
|
|
72
|
+
},
|
|
73
|
+
newsItemTitle: {
|
|
74
|
+
...theme.fonts.thin,
|
|
75
|
+
fontSize: theme.fontSizes.title,
|
|
76
|
+
lineHeight: theme.lineHeights.titleBig,
|
|
77
|
+
marginBottom: theme.paddings.small,
|
|
78
|
+
},
|
|
79
|
+
newsItemText: {
|
|
80
|
+
...theme.fonts.thin,
|
|
81
|
+
fontSize: theme.fontSizes.l,
|
|
82
|
+
lineHeight: theme.lineHeights.l
|
|
83
|
+
},
|
|
84
|
+
newsItemReadMore: {
|
|
85
|
+
textDecorationLine: 'underline'
|
|
86
|
+
},
|
|
87
|
+
newsItemActionbar: {
|
|
88
|
+
borderBottomColor: theme.colors.accent,
|
|
89
|
+
borderBottomWidth: 1,
|
|
90
|
+
//borderStyle: 'dotted', // TODO Not available on iOS at the moment (also dashed)
|
|
91
|
+
borderStyle: 'solid',
|
|
92
|
+
paddingBottom: theme.paddings.none,
|
|
93
|
+
marginTop: theme.paddings.none,
|
|
94
|
+
flex: 1,
|
|
95
|
+
flexDirection: 'row'
|
|
96
|
+
},
|
|
97
|
+
newsItemDate: {
|
|
98
|
+
fontSize: theme.fontSizes.s,
|
|
99
|
+
...theme.fonts.bold,
|
|
100
|
+
color: theme.colors.subtitle,
|
|
101
|
+
flex: 1,
|
|
102
|
+
alignItems: 'center',
|
|
103
|
+
alignSelf: 'center',
|
|
104
|
+
flexDirection: 'row',
|
|
105
|
+
},
|
|
106
|
+
newsItemAuthor: {
|
|
107
|
+
fontSize: theme.fontSizes.s,
|
|
108
|
+
...theme.fonts.bold,
|
|
109
|
+
color: theme.colors.subtitle,
|
|
110
|
+
flex: 1,
|
|
111
|
+
alignSelf: 'flex-start',
|
|
112
|
+
flexDirection: 'row',
|
|
113
|
+
},
|
|
114
|
+
newsItemActions: {
|
|
115
|
+
flex: 1,
|
|
116
|
+
alignItems: 'flex-end',
|
|
117
|
+
justifyContent: 'flex-end'
|
|
118
|
+
},
|
|
119
|
+
newsItemAction: {
|
|
120
|
+
marginRight: -4
|
|
121
|
+
},
|
|
122
|
+
modalContainer: {
|
|
123
|
+
flex: 1
|
|
124
|
+
},
|
|
125
|
+
tape: {
|
|
126
|
+
position: 'absolute',
|
|
127
|
+
top: '16.7%', // 16.7 % = 0.5/3 of height as per CI
|
|
128
|
+
bottom: '16.7%', // 16.7 % = 0.5/3 of height as per CI
|
|
129
|
+
zIndex: 10,
|
|
130
|
+
flex: 1,
|
|
131
|
+
width: width * 0.1143, // 11.43% width as per CI
|
|
132
|
+
resizeMode: 'cover',
|
|
133
|
+
backgroundColor: theme.colors.tapeColor
|
|
134
|
+
},
|
|
135
|
+
tapeLeft: {
|
|
136
|
+
left: theme.paddings.default - ((width * 0.1143) / 3) // 2/3 overlay
|
|
137
|
+
},
|
|
138
|
+
tapeRight: {
|
|
139
|
+
right: theme.paddings.default - ((width * 0.1143) / 3) // 2/3 overlay
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
};
|
package/WebView/index.js
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
* you may not use this file except in compliance with the License.
|
|
4
|
+
* You may obtain a copy of the License at
|
|
5
|
+
*
|
|
6
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
*
|
|
8
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
* See the License for the specific language governing permissions and
|
|
12
|
+
* limitations under the License.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import React from 'react';
|
|
16
|
+
import { StyleSheet, ActivityIndicator } from 'react-native';
|
|
17
|
+
import { connect } from 'react-redux'
|
|
18
|
+
import { withTheme } from "react-native-paper";
|
|
19
|
+
import { WebView } from 'react-native-webview';
|
|
20
|
+
import merge from 'lodash/merge';
|
|
21
|
+
|
|
22
|
+
import componentStyles from "./styles";
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Webview View
|
|
26
|
+
*
|
|
27
|
+
* Use this víew to show a webpage (via url).
|
|
28
|
+
*
|
|
29
|
+
* Parameters:
|
|
30
|
+
* - none
|
|
31
|
+
*
|
|
32
|
+
* Navigation-Parameters:
|
|
33
|
+
* - title: Header title
|
|
34
|
+
* - url: Webpage Url
|
|
35
|
+
*/
|
|
36
|
+
class WebviewComponent extends React.Component {
|
|
37
|
+
static navigationOptions = {
|
|
38
|
+
header: null
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
state = {
|
|
42
|
+
refreshing: false,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// Styles of this component
|
|
46
|
+
styles;
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
webView = {
|
|
51
|
+
canGoBack: false,
|
|
52
|
+
ref: null,
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
constructor(props) {
|
|
56
|
+
super(props);
|
|
57
|
+
|
|
58
|
+
// ------------------------------------------------------------------------
|
|
59
|
+
// PLUGIN FUNCTIONALITY
|
|
60
|
+
// ------------------------------------------------------------------------
|
|
61
|
+
|
|
62
|
+
const {pluginStyles, theme} = this.props;
|
|
63
|
+
this.styles = componentStyles(theme);
|
|
64
|
+
|
|
65
|
+
if (pluginStyles) {
|
|
66
|
+
this.styles = merge(this.styles, pluginStyles);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
this.styles = StyleSheet.create(this.styles);
|
|
70
|
+
|
|
71
|
+
// ------------------------------------------------------------------------
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
onShouldStartLoadWithRequest = (event) =>{
|
|
75
|
+
const {url, constPage} = this.props;
|
|
76
|
+
if(constPage){
|
|
77
|
+
if(event.url === url)
|
|
78
|
+
return true;
|
|
79
|
+
else
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
render() {
|
|
85
|
+
const {colors, customScript} = this.props.theme;
|
|
86
|
+
const {url} = this.props;
|
|
87
|
+
|
|
88
|
+
const script = `function hideHead(){document.getElementById("header").style.display = 'none';}hideHead();`
|
|
89
|
+
return (
|
|
90
|
+
<WebView
|
|
91
|
+
injectedJavaScript={url.includes("tuc.cloud") ? script + customScript : customScript}
|
|
92
|
+
javaScriptEnabled
|
|
93
|
+
onMessage={(event) => {}}
|
|
94
|
+
source={{uri: url}}
|
|
95
|
+
ref={ref => this.webView.ref = ref}
|
|
96
|
+
startInLoadingState={true}
|
|
97
|
+
renderLoading={() => <ActivityIndicator style={this.styles.activity} size="large" color={colors.loadingIndicator}/>}
|
|
98
|
+
/>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const mapStateToProps = state => {
|
|
104
|
+
return {
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export default connect(mapStateToProps, null)(withTheme(WebviewComponent))
|
package/index.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export { default as AppBar } from './AppBar';
|
|
2
|
+
export { default as BookDetail } from './BookDetail';
|
|
3
|
+
export { default as ConnectivityWarning } from './ConnectivityWarning';
|
|
4
|
+
export { default as ContactDetail } from './ContactDetail';
|
|
5
|
+
export { default as CourseDetail } from './CourseDetail';
|
|
6
|
+
export { default as CourseDetailDialog } from './CourseDetailDialog';
|
|
7
|
+
export { default as CourseInfo } from './CourseInfo';
|
|
8
|
+
export { default as DevelopmentDialog } from './DevelopmentDialog';
|
|
9
|
+
export { default as EventCodeInput } from './EventCodeInput';
|
|
10
|
+
export { default as FlexMenuEntry } from './FlexMenuEntry';
|
|
11
|
+
export { default as MainMenuEntry } from './MainMenuEntry';
|
|
12
|
+
export { default as MealItem } from './MealItem';
|
|
13
|
+
export { default as MensaMenu } from './MensaMenu';
|
|
14
|
+
export { default as MensaSlider } from './MensaSlider';
|
|
15
|
+
export { default as Modal } from './Modal';
|
|
16
|
+
export { default as NewsDetail } from './NewsDetail';
|
|
17
|
+
export { default as NewsList } from './NewsList';
|
|
18
|
+
export { default as NewsListItem } from './NewsListItem';
|
|
19
|
+
export { default as OtherCourses } from './OtherCourses';
|
|
20
|
+
export { default as PtsDeparture } from './PtsDeparture';
|
|
21
|
+
export { default as PtsStation } from './PtsStation';
|
|
22
|
+
export { default as QuickLinks } from './QuickLinks';
|
|
23
|
+
export { default as RoomDetail } from './RoomDetail';
|
|
24
|
+
export { default as ScaledImage } from './ScaledImage';
|
|
25
|
+
export { default as SearchResults } from './SearchResults';
|
|
26
|
+
export { default as SettingSection } from './SettingSection';
|
|
27
|
+
export { default as SettingsDialog } from './SettingsDialog';
|
|
28
|
+
export { default as SettingsDialogRadio } from './SettingsDialogRadio';
|
|
29
|
+
export { default as SettingsDialogSelect } from './SettingsDialogSelect';
|
|
30
|
+
export { default as TimetableCodeInput } from './TimetableCodeInput';
|
|
31
|
+
export { default as TimetableDay } from './TimetableDay';
|
|
32
|
+
export { default as TimetableEvent } from './TimetableEvent';
|
|
33
|
+
export { default as TimetableList } from './TimetableList';
|
|
34
|
+
export { default as TimetableMonth } from './TimetableMonth';
|
|
35
|
+
export { default as TimetableWeek } from './TimetableWeek';
|
|
36
|
+
export { default as TopNews } from './TopNews';
|
|
37
|
+
export { default as TopNewsHtwk } from './TopNewsHtwk';
|
|
38
|
+
export { default as WebView } from './WebView';
|
|
39
|
+
export { default as ComponentJobsFilter } from './ComponentJobsFilter';
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@olea-bps/components",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Consolidated components for OLEA",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/tuc-urz/olea.git",
|
|
9
|
+
"directory": "packages/components"
|
|
10
|
+
},
|
|
11
|
+
"author": "codeculture<info@codeculture.de>",
|
|
12
|
+
"license": "Apache-2.0",
|
|
13
|
+
"files": [
|
|
14
|
+
"index.js",
|
|
15
|
+
"*/index.js",
|
|
16
|
+
"*/styles.js",
|
|
17
|
+
"*/**/*"
|
|
18
|
+
],
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@olea-bps/icons-openasist": "^1.0.0",
|
|
21
|
+
"react-native-paper": "^5.14.5",
|
|
22
|
+
"@olea-bps/core": "^1.0.0",
|
|
23
|
+
"@olea-bps/context-connectivity": "^1.0.0",
|
|
24
|
+
"moment": "^2.29.4",
|
|
25
|
+
"react-native-tab-view": "^4.1.3",
|
|
26
|
+
"expo-linear-gradient": "^14.1.5",
|
|
27
|
+
"@olea-bps/react-native-webview-autoheight": "^1.0.0",
|
|
28
|
+
"react-native-webview": "13.15.0",
|
|
29
|
+
"@react-native-community/netinfo": "^11.4.1",
|
|
30
|
+
"@olea-bps/components": "^1.0.0"
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"react": "^19.0.0",
|
|
34
|
+
"react-native": "^0.81.0",
|
|
35
|
+
"react-native-paper": "^5.0.0"
|
|
36
|
+
}
|
|
37
|
+
}
|