@olea-bps/base 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.
Files changed (268) hide show
  1. package/components/AppBar/index.js +84 -0
  2. package/components/AppBar/styles.js +27 -0
  3. package/components/BookDetail/index.js +268 -0
  4. package/components/BookDetail/styles.js +124 -0
  5. package/components/ComponentJobsFilter/index.js +188 -0
  6. package/components/ComponentJobsFilter/styles.js +12 -0
  7. package/components/ConnectivityWarning/index.js +65 -0
  8. package/components/ConnectivityWarning/styles.js +19 -0
  9. package/components/ContactDetail/index.js +232 -0
  10. package/components/ContactDetail/styles.js +32 -0
  11. package/components/CourseDetail/index.js +357 -0
  12. package/components/CourseDetail/styles.js +59 -0
  13. package/components/CourseDetailDialog/index.js +169 -0
  14. package/components/CourseDetailDialog/styles.js +116 -0
  15. package/components/CourseInfo/index.js +219 -0
  16. package/components/CourseInfo/styles.js +40 -0
  17. package/components/DevelopmentDialog/index.js +214 -0
  18. package/components/DevelopmentDialog/styles.js +10 -0
  19. package/components/EventCodeInput/index.js +149 -0
  20. package/components/EventCodeInput/styles.js +108 -0
  21. package/components/FlexMenuEntry/index.js +84 -0
  22. package/components/FlexMenuEntry/styles.js +27 -0
  23. package/components/MainMenuEntry/index.js +88 -0
  24. package/components/MainMenuEntry/styles.js +28 -0
  25. package/components/MealItem/index.js +87 -0
  26. package/components/MealItem/styles.js +84 -0
  27. package/components/MensaMenu/index.js +305 -0
  28. package/components/MensaMenu/styles.js +94 -0
  29. package/components/MensaSlider/index.js +188 -0
  30. package/components/MensaSlider/styles.js +53 -0
  31. package/components/Modal/index.js +106 -0
  32. package/components/Modal/styles.js +8 -0
  33. package/components/NewsDetail/index.js +377 -0
  34. package/components/NewsDetail/styles.js +77 -0
  35. package/components/NewsList/index.js +120 -0
  36. package/components/NewsList/styles.js +19 -0
  37. package/components/NewsListItem/index.js +89 -0
  38. package/components/NewsListItem/styles.js +32 -0
  39. package/components/OtherCourses/index.js +152 -0
  40. package/components/OtherCourses/styles.js +10 -0
  41. package/components/PtsDeparture/index.js +140 -0
  42. package/components/PtsDeparture/styles.js +7 -0
  43. package/components/PtsStation/index.js +186 -0
  44. package/components/PtsStation/styles.js +47 -0
  45. package/components/QuickLinks/index.js +127 -0
  46. package/components/QuickLinks/styles.js +45 -0
  47. package/components/RoomDetail/index.js +281 -0
  48. package/components/RoomDetail/styles.js +56 -0
  49. package/components/ScaledImage/index.js +92 -0
  50. package/components/SearchResults/index.js +362 -0
  51. package/components/SearchResults/styles.js +59 -0
  52. package/components/SettingSection/index.js +54 -0
  53. package/components/SettingSection/styles.js +15 -0
  54. package/components/SettingsDialog/index.js +52 -0
  55. package/components/SettingsDialog/styles.js +12 -0
  56. package/components/SettingsDialogRadio/index.js +66 -0
  57. package/components/SettingsDialogRadio/styles.js +7 -0
  58. package/components/SettingsDialogSelect/index.js +73 -0
  59. package/components/SettingsDialogSelect/styles.js +7 -0
  60. package/components/TimetableCodeInput/index.js +205 -0
  61. package/components/TimetableCodeInput/styles.js +28 -0
  62. package/components/TimetableDay/index.js +252 -0
  63. package/components/TimetableDay/styles.js +103 -0
  64. package/components/TimetableEvent/index.js +163 -0
  65. package/components/TimetableEvent/styles.js +108 -0
  66. package/components/TimetableList/index.js +180 -0
  67. package/components/TimetableList/styles.js +106 -0
  68. package/components/TimetableMonth/index.js +156 -0
  69. package/components/TimetableMonth/styles.js +29 -0
  70. package/components/TimetableWeek/index.js +230 -0
  71. package/components/TimetableWeek/styles.js +58 -0
  72. package/components/TopNews/index.js +282 -0
  73. package/components/TopNews/styles.js +125 -0
  74. package/components/TopNewsHtwk/index.js +279 -0
  75. package/components/TopNewsHtwk/styles.js +142 -0
  76. package/components/WebView/index.js +108 -0
  77. package/components/WebView/styles.js +11 -0
  78. package/context/context-callmanager/TucCallManager.js +74 -0
  79. package/context/context-callmanager/index.js +128 -0
  80. package/context/context-canteen/AsistServerApiProvider.js +126 -0
  81. package/context/context-canteen/CollektorVersion2ApiProvider.js +100 -0
  82. package/context/context-canteen/index.js +692 -0
  83. package/context/context-connectivity/index.js +85 -0
  84. package/context/context-event/AsistServerClient.js +82 -0
  85. package/context/context-event/index.js +205 -0
  86. package/context/context-flex-menu/AsistServerApiProvider.js +0 -0
  87. package/context/context-flex-menu/CollectorVersion2ApiProvider.js +32 -0
  88. package/context/context-flex-menu/index.js +160 -0
  89. package/context/context-info-dialog/CollektorVersion2ApiProvider.js +53 -0
  90. package/context/context-info-dialog/ProviderErrors.js +22 -0
  91. package/context/context-info-dialog/index.js +190 -0
  92. package/context/context-mails/MailService.js +147 -0
  93. package/context/context-mails/TucUnseenApiProvider.js +65 -0
  94. package/context/context-mails/index.js +131 -0
  95. package/context/context-news/CollektorVersion2ApiProvider.js +68 -0
  96. package/context/context-news/index.js +155 -0
  97. package/context/context-public-transport-ticket/CollektorVersion2ApiProvider.js +45 -0
  98. package/context/context-public-transport-ticket/ProviderErrors.js +11 -0
  99. package/context/context-public-transport-ticket/index.js +175 -0
  100. package/context/context-timetable/CollectorVersion2ApiProvider.js +102 -0
  101. package/context/context-timetable/ProviderErrors.js +22 -0
  102. package/context/context-timetable/TimetableService.js +357 -0
  103. package/context/context-timetable/index.js +215 -0
  104. package/context/context-user/index.js +586 -0
  105. package/index.js +178 -0
  106. package/libraries/base-api-provider/hooks.js +24 -0
  107. package/libraries/base-api-provider/http-api-provider.js +168 -0
  108. package/libraries/base-api-provider/index.js +20 -0
  109. package/libraries/core/api/canteens.js +88 -0
  110. package/libraries/core/api/corona.js +45 -0
  111. package/libraries/core/api/courses.js +54 -0
  112. package/libraries/core/api/device.js +98 -0
  113. package/libraries/core/api/feed.js +144 -0
  114. package/libraries/core/api/feedback.js +123 -0
  115. package/libraries/core/api/jobs.js +48 -0
  116. package/libraries/core/api/library.js +67 -0
  117. package/libraries/core/api/lostfound.js +77 -0
  118. package/libraries/core/api/occupancy.js +44 -0
  119. package/libraries/core/api/officehours.js +25 -0
  120. package/libraries/core/api/poi.js +25 -0
  121. package/libraries/core/api/pts.js +68 -0
  122. package/libraries/core/api/rooms.js +31 -0
  123. package/libraries/core/api/survey.js +121 -0
  124. package/libraries/core/api/telephone.js +32 -0
  125. package/libraries/core/api/tucrooms.js +31 -0
  126. package/libraries/core/constants/actions.js +75 -0
  127. package/libraries/core/constants/api.js +146 -0
  128. package/libraries/core/constants/enums.js +5 -0
  129. package/libraries/core/helper/date.js +9 -0
  130. package/libraries/core/helper/format.helper.js +2 -0
  131. package/libraries/core/index.js +60 -0
  132. package/libraries/core/redux/actions/notifications.js +6 -0
  133. package/libraries/core/redux/actions/setting.js +75 -0
  134. package/libraries/core/redux/actions/state.js +74 -0
  135. package/libraries/core/redux/asyncDispatch.js +27 -0
  136. package/libraries/core/redux/reducers/api.js +190 -0
  137. package/libraries/core/redux/reducers/index.js +32 -0
  138. package/libraries/core/redux/reducers/notifications.js +16 -0
  139. package/libraries/core/redux/reducers/setting.js +99 -0
  140. package/libraries/core/redux/reducers/state.js +122 -0
  141. package/libraries/core/redux/selectors.js +123 -0
  142. package/libraries/core/redux/store.js +40 -0
  143. package/libraries/core/services/data.js +96 -0
  144. package/libraries/core/services/root-navigation.js +36 -0
  145. package/libraries/core/services/search.js +175 -0
  146. package/libraries/core-plugins/enums/replaceTypes.js +53 -0
  147. package/libraries/core-plugins/index.js +21 -0
  148. package/libraries/core-plugins/redux/actions/plugin.js +13 -0
  149. package/libraries/core-plugins/redux/reducers/plugin.js +210 -0
  150. package/libraries/icons-openasist/index.js +143 -0
  151. package/libraries/notifications/index.js +268 -0
  152. package/libraries/notifications/services/subscriber.service.js +123 -0
  153. package/libraries/react-native-webview-autoheight/README.md +47 -0
  154. package/libraries/react-native-webview-autoheight/index.js +140 -0
  155. package/libraries/react-native-webview-autoheight/package.json +37 -0
  156. package/libraries/react-native-webview-autoheight/utils.js +268 -0
  157. package/libraries/redux-offline/.eslintignore +1 -0
  158. package/libraries/redux-offline/.github/ISSUE_TEMPLATE/redux-offline-core-issues-template.md +25 -0
  159. package/libraries/redux-offline/.prettierrc +6 -0
  160. package/libraries/redux-offline/LICENSE +21 -0
  161. package/libraries/redux-offline/README.md +133 -0
  162. package/libraries/redux-offline/flow-typed/npm/redux-logger_vx.x.x.js +109 -0
  163. package/libraries/redux-offline/flow-typed/npm/redux_v4.x.x.js +100 -0
  164. package/libraries/redux-offline/lib/actions.js +46 -0
  165. package/libraries/redux-offline/lib/config.js +15 -0
  166. package/libraries/redux-offline/lib/constants.js +17 -0
  167. package/libraries/redux-offline/lib/defaults/defaultCommit.js +11 -0
  168. package/libraries/redux-offline/lib/defaults/defaultRollback.js +11 -0
  169. package/libraries/redux-offline/lib/defaults/detectNetwork.js +33 -0
  170. package/libraries/redux-offline/lib/defaults/detectNetwork.native.js +211 -0
  171. package/libraries/redux-offline/lib/defaults/discard.js +18 -0
  172. package/libraries/redux-offline/lib/defaults/effect.js +87 -0
  173. package/libraries/redux-offline/lib/defaults/index.js +32 -0
  174. package/libraries/redux-offline/lib/defaults/offlineStateLens.js +24 -0
  175. package/libraries/redux-offline/lib/defaults/persist.js +9 -0
  176. package/libraries/redux-offline/lib/defaults/persist.native.js +17 -0
  177. package/libraries/redux-offline/lib/defaults/persistAutoRehydrate.js +8 -0
  178. package/libraries/redux-offline/lib/defaults/queue.js +27 -0
  179. package/libraries/redux-offline/lib/defaults/retry.js +29 -0
  180. package/libraries/redux-offline/lib/index.js +115 -0
  181. package/libraries/redux-offline/lib/middleware.js +56 -0
  182. package/libraries/redux-offline/lib/offlineActionTracker.js +43 -0
  183. package/libraries/redux-offline/lib/send.js +112 -0
  184. package/libraries/redux-offline/lib/types.js +3 -0
  185. package/libraries/redux-offline/lib/updater.js +111 -0
  186. package/libraries/redux-offline/package.json +69 -0
  187. package/libraries/redux-offline/src/__tests__/defaults/discard.js +22 -0
  188. package/libraries/redux-offline/src/__tests__/defaults/effect.js +118 -0
  189. package/libraries/redux-offline/src/__tests__/index.js +116 -0
  190. package/libraries/redux-offline/src/__tests__/middleware.js +185 -0
  191. package/libraries/redux-offline/src/__tests__/offlineActionTracker.js +54 -0
  192. package/libraries/redux-offline/src/__tests__/send.js +208 -0
  193. package/libraries/redux-offline/src/actions.js +36 -0
  194. package/libraries/redux-offline/src/config.js +9 -0
  195. package/libraries/redux-offline/src/constants.js +18 -0
  196. package/libraries/redux-offline/src/defaults/defaultCommit.js +7 -0
  197. package/libraries/redux-offline/src/defaults/defaultRollback.js +7 -0
  198. package/libraries/redux-offline/src/defaults/detectNetwork.js +16 -0
  199. package/libraries/redux-offline/src/defaults/detectNetwork.native.js +148 -0
  200. package/libraries/redux-offline/src/defaults/discard.js +19 -0
  201. package/libraries/redux-offline/src/defaults/effect.js +86 -0
  202. package/libraries/redux-offline/src/defaults/index.js +25 -0
  203. package/libraries/redux-offline/src/defaults/offlineStateLens.js +11 -0
  204. package/libraries/redux-offline/src/defaults/persist.js +4 -0
  205. package/libraries/redux-offline/src/defaults/persist.native.js +9 -0
  206. package/libraries/redux-offline/src/defaults/persistAutoRehydrate.js +4 -0
  207. package/libraries/redux-offline/src/defaults/queue.js +20 -0
  208. package/libraries/redux-offline/src/defaults/retry.js +18 -0
  209. package/libraries/redux-offline/src/index.js +138 -0
  210. package/libraries/redux-offline/src/middleware.js +52 -0
  211. package/libraries/redux-offline/src/offlineActionTracker.js +40 -0
  212. package/libraries/redux-offline/src/send.js +111 -0
  213. package/libraries/redux-offline/src/types.js +127 -0
  214. package/libraries/redux-offline/src/updater.js +141 -0
  215. package/libraries/redux-offline/typings.d.ts +150 -0
  216. package/libraries/redux-offline/yarn.lock +6460 -0
  217. package/libraries/stored-state/index.js +155 -0
  218. package/package.json +68 -0
  219. package/views/Callmanager/index.js +148 -0
  220. package/views/Callmanager/styles.js +62 -0
  221. package/views/Canteens/index.js +383 -0
  222. package/views/Canteens/styles.js +89 -0
  223. package/views/Dashboard/index.js +176 -0
  224. package/views/Dashboard/styles.js +16 -0
  225. package/views/DashboardHtwk/index.js +197 -0
  226. package/views/DashboardHtwk/styles.js +24 -0
  227. package/views/Event/index.js +373 -0
  228. package/views/Event/styles.js +63 -0
  229. package/views/FeedList/index.js +165 -0
  230. package/views/FeedList/styles.js +15 -0
  231. package/views/FeedNews/index.js +243 -0
  232. package/views/FeedNews/styles.js +32 -0
  233. package/views/Flexmenu/index.js +185 -0
  234. package/views/Flexmenu/styles.js +62 -0
  235. package/views/FlexmenuWebview/index.js +167 -0
  236. package/views/FlexmenuWebview/styles.js +16 -0
  237. package/views/Howhy/index.js +151 -0
  238. package/views/Howhy/styles.js +11 -0
  239. package/views/Jobs/index.js +217 -0
  240. package/views/Jobs/styles.js +41 -0
  241. package/views/MainMenu/index.js +283 -0
  242. package/views/MainMenu/styles.js +36 -0
  243. package/views/NewsTabbar/index.js +164 -0
  244. package/views/NewsTabbar/styles.js +27 -0
  245. package/views/Opal/index.js +136 -0
  246. package/views/Opal/styles.js +11 -0
  247. package/views/PublicTransportTicket/index.js +173 -0
  248. package/views/PublicTransportTicket/styles.js +17 -0
  249. package/views/Search/index.js +186 -0
  250. package/views/Search/styles.js +67 -0
  251. package/views/SettingsAccessibility/index.js +148 -0
  252. package/views/SettingsAccessibility/styles.js +13 -0
  253. package/views/SettingsAppInfo/index.js +86 -0
  254. package/views/SettingsAppInfo/styles.js +18 -0
  255. package/views/SettingsCanteens/index.js +249 -0
  256. package/views/SettingsCanteens/styles.js +33 -0
  257. package/views/SettingsGeneral/index.js +173 -0
  258. package/views/SettingsGeneral/styles.js +28 -0
  259. package/views/SettingsNotifications/index.js +204 -0
  260. package/views/SettingsNotifications/styles.js +38 -0
  261. package/views/SettingsUser/index.js +170 -0
  262. package/views/SettingsUser/styles.js +17 -0
  263. package/views/TimetableCalendar/index.js +387 -0
  264. package/views/TimetableCalendar/styles.js +121 -0
  265. package/views/TimetableList/index.js +402 -0
  266. package/views/TimetableList/styles.js +55 -0
  267. package/views/Webviews/index.js +158 -0
  268. package/views/Webviews/styles.js +11 -0
@@ -0,0 +1,163 @@
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 { useState, useMemo } from 'react';
16
+ import {
17
+ StyleSheet,
18
+ View,
19
+ TouchableOpacity,
20
+ Pressable,
21
+ Linking,
22
+ } from 'react-native';
23
+
24
+ import { connect } from 'react-redux'
25
+ import {
26
+ withTheme,
27
+ Text
28
+ } from 'react-native-paper';
29
+ import { withTranslation } from 'react-i18next';
30
+
31
+ import { onUpdateRefreshing } from '../../libraries/core';
32
+ import IconsOpenasist from '../../libraries/icons-openasist';
33
+
34
+ import componentStyles from './styles';
35
+
36
+ function TimetableEventComponent(props) {
37
+ const componentName = TimetableEventComponent.name;
38
+
39
+ const {
40
+ theme,
41
+ t,
42
+ settings,
43
+ times,
44
+ type,
45
+ title,
46
+ location,
47
+ locationUrl,
48
+ description,
49
+ starrable,
50
+ onSelectionChange
51
+ } = props;
52
+
53
+ const isBigFont = settings?.settingsAccessibility?.increaseFontSize ?? false;
54
+ const [isSelected, setIsSelected] = useState(false);
55
+
56
+ const styles = useMemo(
57
+ () => StyleSheet.create(componentStyles(theme)),
58
+ [theme]
59
+ )
60
+
61
+ const handleSelectionChange = () => {
62
+ setIsSelected(isSelected => !isSelected);
63
+
64
+ onSelectionChange?.(!isSelected)
65
+ };
66
+
67
+ const accessibilityStartTime = t('accessibility:timetable:startTime') + times?.start.slice(0, 2) + ' ' + t('accessibility:pts:speechTime') + ' ' + (times?.start.slice(3, 5) !== '00' ? times?.start.slice(3, 5) : '') + ',';
68
+ const accessibilityEndTime = t('accessibility:timetable:endTime') + times?.end.slice(0, 2) + ' ' + t('accessibility:pts:speechTime') + ' ' + (times?.end.slice(3, 5) !== '00' ? times?.end.slice(3, 5) : '') + ',';
69
+ const courseContainerBigFont = isBigFont ? styles.courseContainerBigFont : null;
70
+ const titleStyle = isBigFont ? styles.titleBigFont : styles.title;
71
+
72
+ return (
73
+ <View style={[isBigFont ? [styles.card, styles.courseCard] : styles.card, { backgroundColor: 'rgba(0, 95, 80, 0.25)', elevation: 0 }]} onPress={() => { console.log("Clicking is currently not working. Don't try it!") }}>
74
+ {
75
+ //times
76
+ // ? <View style={[isBigFont ? [styles.courseTimeContainer, styles.courseTimeContainerBigFont] : styles.courseTimeContainer, { backgroundColor: 'rgba(0, 95, 80, 0)' }]}>
77
+ // <Text accessibilityLabel={accessibilityStartTime} style={isBigFont ? [styles.timeText, styles.timeTextBig] : styles.timeText}>{times?.start || ''}</Text>
78
+ // <View style={styles.verticalSeperatorSmall} />
79
+ // <Text accessibilityLabel={accessibilityEndTime} style={isBigFont ? [styles.timeText, styles.timeTextBig] : styles.timeText}>{times?.end || ''}</Text>
80
+ // </View>
81
+ // : null
82
+ }
83
+ {
84
+ //times ? <View style={styles.verticalSeperator} /> : null
85
+ }
86
+ <View style={[styles.otherCourseContainer, { backgroundColor: 'rgba(0, 95, 80, 0)' }]}>
87
+ {
88
+ type || times
89
+ ? <Text style={styles.type}>
90
+ {
91
+ type
92
+ ? <Text style={{ fontWeight: 'bold' }}>
93
+ {type}
94
+ </Text>
95
+ : null
96
+ }
97
+ {
98
+ type && times
99
+ ? ' | '
100
+ : null
101
+ }
102
+ {
103
+ times
104
+ ? `${times?.start} - ${times?.end} `
105
+ : null
106
+ }
107
+ </Text>
108
+ : null
109
+ }
110
+ {title ? <Text style={styles.title}>{title}</Text> : null}
111
+ {
112
+ description
113
+ ? <Text style={styles.professorText}>
114
+ <Text style={styles.professorName}>{description}</Text>
115
+ </Text>
116
+ : null
117
+ }
118
+ {
119
+ location
120
+ ? <Pressable
121
+ onPress={
122
+ locationUrl
123
+ ? () => Linking.openURL(locationUrl)
124
+ .catch(
125
+ reason => {
126
+ console.debug(componentName, ':', 'can`t open link', ':', reason);
127
+ alert('Link konnte nicht geöffnet werden.');
128
+ }
129
+ )
130
+ : null
131
+ }
132
+ >
133
+ <Text
134
+ style={[styles.location, locationUrl ? styles.locationLink : null]}
135
+ >
136
+ {location}
137
+ </Text>
138
+ </Pressable>
139
+ : null
140
+ }
141
+ </View>
142
+ {
143
+ starrable
144
+ ? <View style={styles.starPosition}>
145
+ <TouchableOpacity onPress={handleSelectionChange}>
146
+ <IconsOpenasist icon={isSelected ? 'star-selected' : 'star'} size={25} color='#005F50' />
147
+ </TouchableOpacity>
148
+ </View>
149
+ : null
150
+ }
151
+ </View>
152
+ );
153
+ }
154
+
155
+ const mapStateToProps = state => {
156
+ return {
157
+ pluginComponent: state.pluginReducer.timetable.component,
158
+ pluginStyles: state.pluginReducer.timetable.styles,
159
+ settings: state.settingReducer
160
+ };
161
+ };
162
+
163
+ export default connect(mapStateToProps, { onUpdateRefreshing })(withTranslation()(withTheme(TimetableEventComponent)))
@@ -0,0 +1,108 @@
1
+ export default function(theme) {
2
+ return {
3
+ card: {
4
+ marginLeft: theme.paddings.default,
5
+ marginRight: theme.paddings.default,
6
+ marginTop: 10,
7
+ marginBottom: 10,
8
+ backgroundColor: theme.colors.background,
9
+ paddingVertical: theme.paddings.small,
10
+ paddingHorizontal: theme.paddings.default,
11
+ flex: 1,
12
+ flexDirection: 'row',
13
+ shadowColor: theme.colors.shadow,
14
+ shadowOffset: {
15
+ width: 0,
16
+ height: 1,
17
+ },
18
+ shadowOpacity: 0.15,
19
+ shadowRadius: 0.32,
20
+ elevation: 3
21
+ },
22
+ courseCard: {
23
+ paddingLeft: 5,
24
+ },
25
+ verticalSeperator: {
26
+ height: "100%",
27
+ marginLeft: theme.paddings.small,
28
+ width: 1,
29
+ backgroundColor: theme.colors.listSeperator2,
30
+ },
31
+ verticalSeperatorSmall: {
32
+ height: "15%",
33
+ width: 1,
34
+ backgroundColor: theme.colors.listSeperator2,
35
+
36
+ },
37
+ courseTimeContainer: {
38
+ width:"15%",
39
+ alignItems: "center",
40
+ justifyContent: "center",
41
+ backgroundColor:theme.colors.background
42
+ },
43
+ courseTimeContainerBigFont: {
44
+ width: "25%",
45
+ },
46
+ timeText: {
47
+ fontSize: theme.fontSizes.subtitle,
48
+ paddingTop: theme.paddings.small,
49
+ paddingBottom: theme.paddings.small
50
+ },
51
+ timeTextBig: {
52
+ fontSize: theme.fontSizes.m
53
+ },
54
+ courseContainer: {
55
+ paddingLeft: theme.paddings.small,
56
+ width:"100%",
57
+ backgroundColor:theme.colors.background,
58
+ paddingTop: theme.paddings.xsmall,
59
+ paddingBottom: theme.paddings.xsmall
60
+ },
61
+ courseContainerBigFont: {
62
+ width: "75%",
63
+ },
64
+ type: {
65
+ fontSize: theme.fontSizes.l,
66
+ color: theme.colors.lecturerNameText
67
+ },
68
+ title: {
69
+ fontSize: theme.fontSizes.xl,
70
+ paddingTop: theme.paddings.xsmall,
71
+ },
72
+ titleBigFont: {
73
+ fontSize: theme.fontSizes.xl,
74
+ paddingTop: theme.paddings.xsmall,
75
+ },
76
+ location: {
77
+ fontSize: theme.fontSizes.subtitle,
78
+ paddingTop: theme.paddings.xsmall,
79
+ color: theme.colors.secondaryText,
80
+ },
81
+ locationLink: {
82
+ textDecorationLine: 'underline',
83
+ color: 'blue'
84
+ },
85
+ addLeftRightPadding: {
86
+ paddingLeft: theme.paddings.xsmall,
87
+ paddingRight: theme.paddings.xsmall,
88
+ },
89
+ professorText: {
90
+ fontSize: theme.fontSizes.m,
91
+ paddingTop: theme.paddings.xsmall,
92
+ color: theme.colors.subtitle
93
+ },
94
+ professorName: {
95
+ color: theme.colors.lecturerNameText
96
+ },
97
+ otherCourseContainer:{
98
+ padding: theme.paddings.xsmall,
99
+ width: "100%",
100
+ backgroundColor: theme.colors.background
101
+ },
102
+ starPosition:{
103
+ position: 'absolute',
104
+ top: 10,
105
+ right: 10,
106
+ }
107
+ }
108
+ };
@@ -0,0 +1,180 @@
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 { useMemo } from 'react';
16
+ import {
17
+ StyleSheet,
18
+ TouchableOpacity,
19
+ View,
20
+ } from 'react-native';
21
+
22
+ import { connect } from 'react-redux'
23
+ import {
24
+ useTheme,
25
+ Text,
26
+ } from "react-native-paper";
27
+ import { useTranslation } from "react-i18next";
28
+
29
+ import { onUpdateRefreshing } from '../../libraries/core';
30
+
31
+ import { DateTime } from 'luxon';
32
+
33
+ import componentStyles from "./styles";
34
+
35
+ /**
36
+ * Timetable List Component
37
+ *
38
+ * Displays the list for timetable,
39
+ *
40
+ * Parameters:
41
+ * - none
42
+ *
43
+ * Navigation-Parameters:
44
+ * - none
45
+ *
46
+ * @param {object} props
47
+ * @param {(course: object) => void} [props.onCourseSelected]
48
+ */
49
+ function TimetableListComponent({ course, times, settings, onCourseSelected }) {
50
+ const { t } = useTranslation();
51
+ const theme = useTheme();
52
+ const { themeStyles, appSettings } = theme;
53
+
54
+ const courseTitle = course?.title?.data;
55
+ const courseType = course?.type?.data;
56
+ const courseRoom = course?.room?.data;
57
+ const courseStartDatetime = DateTime.fromISO(course.startDateTime);
58
+ const courseStarTimeText = courseStartDatetime.isValid
59
+ ? courseStartDatetime?.toLocaleString(DateTime.TIME_24_SIMPLE)
60
+ : undefined;
61
+ const courseEndDatetime = DateTime.fromISO(course.endDateTime);
62
+ const courseEndTimeText = courseEndDatetime.isValid
63
+ ? courseEndDatetime?.toLocaleString(DateTime.TIME_24_SIMPLE)
64
+ : undefined;
65
+ const courseTimesTextesAvaiable = courseStartDatetime && courseEndTimeText ? true : false;
66
+ const courseLecturers = course?.lecturer
67
+ ?.map(lecturer => lecturer.data);
68
+ const courseLecturersAmount = Array.isArray(courseLecturers)
69
+ ? courseLecturers.length
70
+ : 0;
71
+ const courseInfo = course?.info?.data;
72
+ const courseUrl = course?.url?.data;
73
+
74
+ const courseAccessibilityText = t(
75
+ 'accessibility:timetable:courseSummary',
76
+ {
77
+ type: courseType,
78
+ title: courseTitle,
79
+ startTime: courseStarTimeText,
80
+ endTime: courseEndTimeText,
81
+ room: courseRoom,
82
+ }
83
+ );
84
+
85
+ const isBigFont = settings.settingsAccessibility.increaseFontSize;
86
+ const showDetails = appSettings?.modules?.timetable?.showDetails;
87
+
88
+ const styles = useMemo(
89
+ () => StyleSheet.create(componentStyles(theme)),
90
+ [theme]
91
+ )
92
+
93
+ const courseContainerBigFont = isBigFont ? styles.courseContainerBigFont : null;
94
+ const titleStyle = isBigFont ? styles.titleBigFont : styles.title;
95
+ const coursePressable = showDetails &&
96
+ (
97
+ courseTitle ||
98
+ courseType ||
99
+ courseRoom ||
100
+ courseLecturersAmount ||
101
+ courseInfo ||
102
+ courseUrl ||
103
+ courseStarTimeText ||
104
+ courseEndTimeText
105
+ );
106
+
107
+ return (
108
+ <TouchableOpacity
109
+ style={isBigFont ? [themeStyles.card, styles.courseCard] : themeStyles.card}
110
+ accessibilityLabel={courseAccessibilityText}
111
+ onPress={
112
+ coursePressable
113
+ ? () => onCourseSelected?.(course)
114
+ : null
115
+ }
116
+ disabled={!coursePressable}
117
+ >
118
+ {
119
+ courseTimesTextesAvaiable
120
+ ? <View style={isBigFont ? [styles.courseTimeContainer, styles.courseTimeContainerBigFont] : styles.courseTimeContainer}>
121
+ <Text style={isBigFont ? [styles.timeText, styles.timeTextBig] : styles.timeText}>
122
+ {courseStarTimeText}
123
+ </Text>
124
+ <View style={styles.verticalSeperatorSmall} />
125
+ <Text style={isBigFont ? [styles.timeText, styles.timeTextBig] : styles.timeText}>
126
+ {courseEndTimeText}
127
+ </Text>
128
+ </View>
129
+ : null
130
+ }
131
+ {
132
+ courseTimesTextesAvaiable
133
+ ? <View style={styles.verticalSeperator} />
134
+ : null
135
+ }
136
+ <View style={courseTimesTextesAvaiable ? [styles.courseContainer, courseContainerBigFont] : styles.otherCourseContainer}>
137
+ {
138
+ courseType
139
+ ? <Text style={courseTimesTextesAvaiable ? [styles.type, styles.addLeftRightPadding] : styles.type} >
140
+ {courseType}
141
+ </Text>
142
+ : null
143
+ }
144
+ {
145
+ courseTitle
146
+ ? <Text style={courseTimesTextesAvaiable ? [titleStyle, styles.addLeftRightPadding] : styles.title}>
147
+ {courseTitle}
148
+ </Text>
149
+ : null}
150
+ {
151
+ courseRoom
152
+ ? <Text style={courseTimesTextesAvaiable ? [styles.room, styles.addLeftRightPadding] : styles.room} >
153
+ {courseRoom}
154
+ </Text>
155
+ : null
156
+ }
157
+ {
158
+ courseLecturersAmount ?
159
+ <Text style={courseTimesTextesAvaiable ? [styles.professorText, styles.addLeftRightPadding] : styles.professorText}>
160
+ Tutor:
161
+ <Text style={styles.professorName}>
162
+ {courseLecturers.join(', ')}
163
+ </Text>
164
+ </Text>
165
+ : null
166
+ }
167
+ </View>
168
+ </TouchableOpacity>
169
+ );
170
+ }
171
+
172
+ const mapStateTo = state => {
173
+ return {
174
+ pluginComponent: state.pluginReducer.timetable.component,
175
+ pluginStyles: state.pluginReducer.timetable.styles,
176
+ settings: state.settingReducer
177
+ };
178
+ };
179
+
180
+ export default connect(mapStateTo, { onUpdateRefreshing })(TimetableListComponent)
@@ -0,0 +1,106 @@
1
+ export default function (theme) {
2
+ return {
3
+ courseCard: {
4
+ paddingLeft: 5,
5
+ },
6
+ verticalSeperator: {
7
+ height: "100%",
8
+ marginLeft: theme.paddings.small,
9
+ width: 1,
10
+ backgroundColor: theme.colors.listSeperator
11
+ },
12
+ verticalSeperatorSmall: {
13
+ height: "15%",
14
+ width: 1,
15
+ backgroundColor: theme.colors.listSeperator,
16
+
17
+ },
18
+ courseTimeContainer: {
19
+ width: "15%",
20
+ alignItems: "center",
21
+ justifyContent: "center",
22
+ },
23
+ courseTimeContainerBigFont: {
24
+ width: "25%",
25
+ },
26
+ timeText: {
27
+ fontSize: theme.fontSizes.subtitle,
28
+ paddingTop: theme.paddings.small,
29
+ paddingBottom: theme.paddings.small
30
+ },
31
+ timeTextBig: {
32
+ fontSize: theme.fontSizes.m
33
+ },
34
+ courseContainer: {
35
+ flex: 1,
36
+ flexDirection: "column",
37
+ paddingLeft: theme.paddings.small,
38
+ width: "85%",
39
+ paddingTop: theme.paddings.xsmall,
40
+ paddingBottom: theme.paddings.xsmall
41
+ },
42
+ courseContainerBigFont: {
43
+ width: "75%",
44
+ },
45
+ type: {
46
+ fontSize: theme.fontSizes.subtitle,
47
+ color: theme.colors.subtitle
48
+ },
49
+ title: {
50
+ fontSize: theme.fontSizes.xl,
51
+ paddingTop: theme.paddings.xsmall,
52
+ },
53
+ titleBigFont: {
54
+ fontSize: theme.fontSizes.xl,
55
+ paddingTop: theme.paddings.xsmall,
56
+ },
57
+ room: {
58
+ fontSize: theme.fontSizes.l,
59
+ paddingTop: theme.paddings.xsmall,
60
+ fontWeight: "bold",
61
+ },
62
+ addLeftRightPadding: {
63
+ paddingLeft: theme.paddings.xsmall,
64
+ paddingRight: theme.paddings.xsmall,
65
+ },
66
+ professorText: {
67
+ fontSize: theme.fontSizes.l,
68
+ paddingTop: theme.paddings.xsmall,
69
+ color: theme.colors.subtitle
70
+ },
71
+ professorName: {
72
+ color: theme.colors.lecturerNameText
73
+ },
74
+ otherCourseContainer: {
75
+ padding: theme.paddings.xsmall,
76
+ width: "100%",
77
+ },
78
+ btnPosition: {
79
+ position: 'absolute',
80
+ bottom: 7,
81
+ right: 7
82
+ },
83
+ textDetail: {
84
+ fontSize: theme.fontSizes.l,
85
+ paddingTop: theme.paddings.small,
86
+ },
87
+ textDetailBigFont: {
88
+ fontSize: theme.fontSizes.xl,
89
+ paddingTop: theme.paddings.small,
90
+ },
91
+ indentedText: {
92
+ marginLeft: 10,
93
+ },
94
+ detailContainer: {
95
+ flexDirection: 'row',
96
+ alignItems: 'center',
97
+ },
98
+ detailLabel: {
99
+ width: '25%',
100
+ },
101
+ detailValue: {
102
+ flexShrink: 1,
103
+ width: '70%',
104
+ },
105
+ }
106
+ };