@olea-bps/components 1.0.7 → 1.0.9
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/TimetableDay/index.js +7 -21
- package/TimetableList/index.js +108 -44
- package/TimetableList/styles.js +0 -3
- package/TimetableWeek/index.js +6 -20
- package/package.json +2 -2
package/TimetableDay/index.js
CHANGED
|
@@ -81,12 +81,14 @@ function CalendarDay({ selectedDate, theme, settings, calendarScrollOffsetMinute
|
|
|
81
81
|
course => (
|
|
82
82
|
{
|
|
83
83
|
title: course.title.data,
|
|
84
|
-
start: course.startDateTime,
|
|
85
|
-
end: course.endDateTime,
|
|
84
|
+
start: new Date(Date.parse(course.startDateTime)),
|
|
85
|
+
end: new Date(Date.parse(course.endDateTime)),
|
|
86
86
|
color: eventColor,
|
|
87
87
|
type: course.type?.data,
|
|
88
88
|
professor: course.lecturer[0]?.data,
|
|
89
89
|
room: course.room.data,
|
|
90
|
+
// Anfügen des Ürsprügnlichen Vorlesungsobjektes, damit es beim Klick zur Verfügung steht
|
|
91
|
+
origine: course,
|
|
90
92
|
}
|
|
91
93
|
)
|
|
92
94
|
) ?? [];
|
|
@@ -174,24 +176,8 @@ function CalendarDay({ selectedDate, theme, settings, calendarScrollOffsetMinute
|
|
|
174
176
|
swipeEnabled={false}
|
|
175
177
|
onPressEvent={
|
|
176
178
|
showDetails
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
const eventStartTime = event.start.getTime();
|
|
181
|
-
const originalCourse = courses[eventDateISO]
|
|
182
|
-
?.find(
|
|
183
|
-
course =>
|
|
184
|
-
eventStartTime === course.startDateTime.getTime()
|
|
185
|
-
&&
|
|
186
|
-
event?.title === course?.title?.data
|
|
187
|
-
&&
|
|
188
|
-
event?.professor === course?.lecturer[0]?.data
|
|
189
|
-
&&
|
|
190
|
-
event?.room === course?.room?.data
|
|
191
|
-
);
|
|
192
|
-
|
|
193
|
-
onCourseSelected(originalCourse);
|
|
194
|
-
}
|
|
179
|
+
// Wenn eine Vorlesung im Kalender angeklickt wird, wird die ursprüngliche Vorlesung ausgelesen und selektiert
|
|
180
|
+
? (event) => onCourseSelected(event.origine)
|
|
195
181
|
: null
|
|
196
182
|
}
|
|
197
183
|
scrollOffsetMinutes={calendarScrollOffsetMinutes}
|
|
@@ -263,4 +249,4 @@ const mapStateToProps = (state) => {
|
|
|
263
249
|
};
|
|
264
250
|
};
|
|
265
251
|
|
|
266
|
-
export default connect(mapStateToProps, { onUpdateRefreshing })(withTranslation()(withTheme(CalendarDay)));
|
|
252
|
+
export default connect(mapStateToProps, { onUpdateRefreshing })(withTranslation()(withTheme(CalendarDay)));
|
package/TimetableList/index.js
CHANGED
|
@@ -15,21 +15,23 @@
|
|
|
15
15
|
import { useMemo } from 'react';
|
|
16
16
|
import {
|
|
17
17
|
StyleSheet,
|
|
18
|
+
TouchableOpacity,
|
|
18
19
|
View,
|
|
19
20
|
} from 'react-native';
|
|
20
21
|
|
|
21
22
|
import { connect } from 'react-redux'
|
|
22
|
-
import {
|
|
23
|
+
import {
|
|
24
|
+
useTheme,
|
|
25
|
+
Text,
|
|
26
|
+
} from "react-native-paper";
|
|
23
27
|
import { useTranslation } from "react-i18next";
|
|
24
28
|
|
|
25
29
|
import { onUpdateRefreshing } from "@olea-bps/core";
|
|
26
30
|
|
|
27
|
-
import
|
|
31
|
+
import { DateTime } from 'luxon';
|
|
28
32
|
|
|
29
33
|
import componentStyles from "./styles";
|
|
30
34
|
|
|
31
|
-
|
|
32
|
-
|
|
33
35
|
/**
|
|
34
36
|
* Timetable List Component
|
|
35
37
|
*
|
|
@@ -47,10 +49,38 @@ import componentStyles from "./styles";
|
|
|
47
49
|
function TimetableListComponent({ course, times, settings, onCourseSelected }) {
|
|
48
50
|
const { t } = useTranslation();
|
|
49
51
|
const theme = useTheme();
|
|
50
|
-
const {
|
|
51
|
-
|
|
52
|
-
const
|
|
53
|
-
const
|
|
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
|
+
);
|
|
54
84
|
|
|
55
85
|
const isBigFont = settings.settingsAccessibility.increaseFontSize;
|
|
56
86
|
const showDetails = appSettings?.modules?.timetable?.showDetails;
|
|
@@ -60,48 +90,82 @@ function TimetableListComponent({ course, times, settings, onCourseSelected }) {
|
|
|
60
90
|
[theme]
|
|
61
91
|
)
|
|
62
92
|
|
|
63
|
-
const renderTimeSlot = (
|
|
64
|
-
<View style={isBigFont ? [styles.courseTimeContainer, styles.courseTimeContainerBigFont] : styles.courseTimeContainer}>
|
|
65
|
-
<Text accessibilityLabel={accessibilityStartTime} style={isBigFont ? [styles.timeText, styles.timeTextBig] : styles.timeText}>{times?.start || ''}</Text>
|
|
66
|
-
<View style={styles.verticalSeperatorSmall} />
|
|
67
|
-
<Text accessibilityLabel={accessibilityEndTime} style={isBigFont ? [styles.timeText, styles.timeTextBig] : styles.timeText}>{times?.end || ''}</Text>
|
|
68
|
-
</View>
|
|
69
|
-
);
|
|
70
|
-
var renderVerticalSeperator = (
|
|
71
|
-
<View
|
|
72
|
-
style={styles.verticalSeperator}
|
|
73
|
-
/>
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
const { type, title, room, lecturer, info, url } = course;
|
|
77
|
-
|
|
78
93
|
const courseContainerBigFont = isBigFont ? styles.courseContainerBigFont : null;
|
|
79
94
|
const titleStyle = isBigFont ? styles.titleBigFont : styles.title;
|
|
80
|
-
|
|
95
|
+
const coursePressable = showDetails &&
|
|
96
|
+
(
|
|
97
|
+
courseTitle ||
|
|
98
|
+
courseType ||
|
|
99
|
+
courseRoom ||
|
|
100
|
+
courseLecturersAmount ||
|
|
101
|
+
courseInfo ||
|
|
102
|
+
courseUrl ||
|
|
103
|
+
courseStarTimeText ||
|
|
104
|
+
courseEndTimeText
|
|
105
|
+
);
|
|
81
106
|
|
|
82
107
|
return (
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
{
|
|
86
|
-
{
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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
|
|
95
166
|
}
|
|
96
167
|
</View>
|
|
97
|
-
|
|
98
|
-
<View style={styles.btnPosition}>
|
|
99
|
-
<Button style={styles.btnAddionals} onPress={() => onCourseSelected?.(course)}>
|
|
100
|
-
<IconsOpenasist icon={"info"} color={colors.secondaryText} size={22} />
|
|
101
|
-
</Button>
|
|
102
|
-
</View>
|
|
103
|
-
: null}
|
|
104
|
-
</View>
|
|
168
|
+
</TouchableOpacity>
|
|
105
169
|
);
|
|
106
170
|
}
|
|
107
171
|
|
package/TimetableList/styles.js
CHANGED
|
@@ -19,7 +19,6 @@ export default function (theme) {
|
|
|
19
19
|
width: "15%",
|
|
20
20
|
alignItems: "center",
|
|
21
21
|
justifyContent: "center",
|
|
22
|
-
backgroundColor: theme.colors.background
|
|
23
22
|
},
|
|
24
23
|
courseTimeContainerBigFont: {
|
|
25
24
|
width: "25%",
|
|
@@ -37,7 +36,6 @@ export default function (theme) {
|
|
|
37
36
|
flexDirection: "column",
|
|
38
37
|
paddingLeft: theme.paddings.small,
|
|
39
38
|
width: "85%",
|
|
40
|
-
backgroundColor: theme.colors.background,
|
|
41
39
|
paddingTop: theme.paddings.xsmall,
|
|
42
40
|
paddingBottom: theme.paddings.xsmall
|
|
43
41
|
},
|
|
@@ -76,7 +74,6 @@ export default function (theme) {
|
|
|
76
74
|
otherCourseContainer: {
|
|
77
75
|
padding: theme.paddings.xsmall,
|
|
78
76
|
width: "100%",
|
|
79
|
-
backgroundColor: theme.colors.background
|
|
80
77
|
},
|
|
81
78
|
btnPosition: {
|
|
82
79
|
position: 'absolute',
|
package/TimetableWeek/index.js
CHANGED
|
@@ -89,12 +89,14 @@ function CalendarWeek(props) {
|
|
|
89
89
|
course => (
|
|
90
90
|
{
|
|
91
91
|
title: course.title.data,
|
|
92
|
-
start: course.startDateTime,
|
|
93
|
-
end: course.endDateTime,
|
|
92
|
+
start: new Date(Date.parse(course.startDateTime)),
|
|
93
|
+
end: new Date(Date.parse(course.endDateTime)),
|
|
94
94
|
color: eventColor,
|
|
95
95
|
type: course.type?.data,
|
|
96
96
|
professor: course.lecturer[0]?.data,
|
|
97
97
|
room: course.room.data,
|
|
98
|
+
// Anfügen des Ürsprügnlichen Vorlesungsobjektes, damit es beim Klick zur Verfügung steht
|
|
99
|
+
origine: course,
|
|
98
100
|
}
|
|
99
101
|
)
|
|
100
102
|
) ?? [];
|
|
@@ -170,24 +172,8 @@ function CalendarWeek(props) {
|
|
|
170
172
|
weekStartsOn={1}
|
|
171
173
|
date={route.weekbeginISODate}
|
|
172
174
|
onPressEvent={
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
const eventStartTime = event.start.getTime();
|
|
177
|
-
const originalCourse = courses[eventDateISO]
|
|
178
|
-
?.find(
|
|
179
|
-
course =>
|
|
180
|
-
eventStartTime === course.startDateTime.getTime()
|
|
181
|
-
&&
|
|
182
|
-
event?.title === course?.title?.data
|
|
183
|
-
&&
|
|
184
|
-
event?.professor === course?.lecturer[0]?.data
|
|
185
|
-
&&
|
|
186
|
-
event?.room === course?.room?.data
|
|
187
|
-
);
|
|
188
|
-
|
|
189
|
-
onCourseSelected(originalCourse);
|
|
190
|
-
}
|
|
175
|
+
// Wenn eine Vorlesung im Kalender angeklickt wird, wird die ursprüngliche Vorlesung ausgelesen und selektiert
|
|
176
|
+
(event) => onCourseSelected(event.origine)
|
|
191
177
|
}
|
|
192
178
|
swipeEnabled={false}
|
|
193
179
|
scrollOffsetMinutes={calendarScrollOffsetMinutes}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@olea-bps/components",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "Consolidated components for OLEA",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": "https://github.com/tuc-urz/olea.git",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"react-native-paper": "^5.14.5",
|
|
18
18
|
"@olea-bps/core": "^1.0.0",
|
|
19
19
|
"@olea-bps/context-connectivity": "^1.0.0",
|
|
20
|
-
"@olea-bps/context-event": "^1.0.
|
|
20
|
+
"@olea-bps/context-event": "^1.0.4",
|
|
21
21
|
"@olea-bps/context-news": "^1.0.0",
|
|
22
22
|
"@olea-bps/context-canteen": "^1.0.0",
|
|
23
23
|
"@olea-bps/context-timetable": "^1.0.0",
|