@olea-bps/base 1.1.10 → 1.1.12
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/components/ComponentJobsFilter/index.js +137 -135
- package/components/CourseDetailDialog/index.js +100 -100
- package/components/NewsDetail/index.js +229 -289
- package/components/NewsDetail/styles.js +3 -4
- package/components/NewsListItem/index.js +77 -64
- package/components/NewsListItem/styles.js +34 -31
- package/components/RoomDetail/index.js +240 -212
- package/components/TabBarIcon/index.js +35 -0
- package/components/TimetableDay/index.js +211 -212
- package/components/TimetableMonth/index.js +57 -60
- package/components/TimetableWeek/index.js +72 -75
- package/components/TimetableWeek/styles.js +56 -56
- package/context/context-canteen/index.js +526 -498
- package/context/context-user/index.js +49 -64
- package/index.js +1 -0
- package/package.json +6 -1
- package/views/PublicTransportTicket/index.js +31 -3
- package/views/SettingsAppInfo/index.js +69 -50
- package/views/SettingsAppInfo/styles.js +25 -16
- package/views/SettingsUser/index.js +1 -1
|
@@ -12,78 +12,91 @@
|
|
|
12
12
|
* limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import { useMemo } from 'react'
|
|
15
|
+
import { useMemo } from 'react'
|
|
16
16
|
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
} from 'react-native'
|
|
17
|
+
Text,
|
|
18
|
+
StyleSheet,
|
|
19
|
+
View,
|
|
20
|
+
TouchableOpacity,
|
|
21
|
+
Image
|
|
22
|
+
} from 'react-native'
|
|
23
23
|
|
|
24
|
-
import { useTheme } from 'react-native-paper'
|
|
25
|
-
import { useTranslation } from 'react-i18next'
|
|
26
|
-
import { useNavigation } from '@react-navigation/native'
|
|
24
|
+
import { useTheme } from 'react-native-paper'
|
|
25
|
+
import { useTranslation } from 'react-i18next'
|
|
26
|
+
import { useNavigation } from '@react-navigation/native'
|
|
27
27
|
|
|
28
|
-
import { DateTime } from 'luxon'
|
|
28
|
+
import { DateTime } from 'luxon'
|
|
29
29
|
|
|
30
|
-
import { useLanguage } from '../../libraries/core'
|
|
31
|
-
import IconsOpenasist from '../../libraries/icons-openasist'
|
|
30
|
+
import { useLanguage } from '../../libraries/core'
|
|
31
|
+
import IconsOpenasist from '../../libraries/icons-openasist'
|
|
32
32
|
|
|
33
|
-
import componentStyles from './styles'
|
|
33
|
+
import componentStyles from './styles'
|
|
34
34
|
|
|
35
|
-
export default function NewsListItem({ news }) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
export default function NewsListItem ({ news }) {
|
|
36
|
+
const componentName = NewsListItem.name
|
|
37
|
+
const language = useLanguage()
|
|
38
|
+
const { t } = useTranslation()
|
|
39
|
+
const theme = useTheme()
|
|
40
|
+
const { themeStyles, colors, fontSizes, appSettings } = theme
|
|
41
|
+
const navigation = useNavigation()
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
const styles = useMemo(
|
|
44
|
+
() => StyleSheet.create(componentStyles(theme)),
|
|
45
|
+
[theme, componentStyles]
|
|
46
|
+
)
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
const description = news.shortDesc
|
|
49
|
+
.replace(/<(?:.|\n)*?>/gm, '')
|
|
50
|
+
.replace('Weiterlesen ›', '')
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
console.debug(componentName, ':', `news ${news?.guid} pub date`, ':', news.pubdate)
|
|
53
|
+
const publicationDate = news?.pubdate
|
|
54
|
+
? DateTime.fromISO(news.pubdate, { locale: language }).toLocaleString(DateTime.DATETIME_SHORT)
|
|
55
|
+
: null
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
57
|
+
// Keep the fallback enabled unless the app configuration explicitly disables it.
|
|
58
|
+
const showFallbackImage = appSettings?.modules?.news?.showFallbackImage !== false
|
|
59
|
+
|
|
60
|
+
let newsImageSource = news?.imageUrl
|
|
61
|
+
? { uri: news.imageUrl }
|
|
62
|
+
: null
|
|
63
|
+
|
|
64
|
+
// Show the app-specific fallback image so news without an image still have a visual preview.
|
|
65
|
+
// Each university can disable this fallback in its news settings.
|
|
66
|
+
if (newsImageSource == null && showFallbackImage) {
|
|
67
|
+
newsImageSource = appSettings.header
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<TouchableOpacity
|
|
72
|
+
onPress={() => navigation.navigate('NewsDetail', { news })}
|
|
73
|
+
accessible
|
|
74
|
+
accessibilityLabel={t('accessibility:feedNewsItem', { news: [news.title, description].join('. '), date: publicationDate })}
|
|
75
|
+
accessibilityHint={t('accessibility:feedNewsItemHint')}
|
|
76
|
+
>
|
|
77
|
+
<View style={themeStyles.flexRow}>
|
|
78
|
+
<View style={[themeStyles.cardContent, styles.contentContainer]}>
|
|
79
|
+
{newsImageSource != null
|
|
80
|
+
? (
|
|
81
|
+
<Image
|
|
82
|
+
source={newsImageSource}
|
|
83
|
+
resizeMode='cover'
|
|
84
|
+
style={styles.image}
|
|
85
|
+
/>
|
|
86
|
+
)
|
|
87
|
+
: null}
|
|
88
|
+
<Text style={styles.title}>{news.title}</Text>
|
|
89
|
+
<Text style={styles.description}>{description}</Text>
|
|
90
|
+
{publicationDate
|
|
91
|
+
? (
|
|
92
|
+
<View style={[themeStyles.flexRow, { alignItems: 'center', alignContent: 'center' }]}>
|
|
93
|
+
<IconsOpenasist icon='time' size={fontSizes.l} color={colors.iconSubtitle} />
|
|
94
|
+
<Text style={[themeStyles.cardSubTitle, styles.publicationDate]}>{publicationDate}</Text>
|
|
95
|
+
</View>
|
|
96
|
+
)
|
|
97
|
+
: null}
|
|
98
|
+
</View>
|
|
99
|
+
</View>
|
|
100
|
+
</TouchableOpacity>
|
|
101
|
+
)
|
|
89
102
|
}
|
|
@@ -1,32 +1,35 @@
|
|
|
1
|
-
export default function(theme) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
1
|
+
export default function (theme) {
|
|
2
|
+
return {
|
|
3
|
+
contentContainer: {
|
|
4
|
+
paddingTop: theme.paddings.default,
|
|
5
|
+
paddingLeft: theme.paddings.default,
|
|
6
|
+
paddingRight: theme.paddings.default,
|
|
7
|
+
marginBottom: theme.paddings.default
|
|
8
|
+
},
|
|
9
|
+
publicationDate: {
|
|
10
|
+
...theme.fonts.bold,
|
|
11
|
+
marginTop: 3,
|
|
12
|
+
paddingLeft: theme.paddings.small
|
|
13
|
+
},
|
|
14
|
+
image: {
|
|
15
|
+
width: '100%',
|
|
16
|
+
// Override the bundled image's intrinsic height so aspectRatio determines it.
|
|
17
|
+
height: undefined,
|
|
18
|
+
aspectRatio: 16 / 9,
|
|
19
|
+
paddingBottom: theme.paddings.small
|
|
20
|
+
},
|
|
21
|
+
title: {
|
|
22
|
+
...theme.fonts.bold,
|
|
23
|
+
fontSize: theme.fontSizes.subtitle,
|
|
24
|
+
lineHeight: theme.lineHeights.titleSmall,
|
|
25
|
+
marginTop: theme.paddings.default,
|
|
26
|
+
marginBottom: theme.paddings.small
|
|
27
|
+
},
|
|
28
|
+
description: {
|
|
29
|
+
...theme.fonts.regular,
|
|
30
|
+
fontSize: theme.fontSizes.itemText,
|
|
31
|
+
lineHeight: theme.lineHeights.s,
|
|
32
|
+
marginBottom: theme.paddings.small
|
|
31
33
|
}
|
|
32
|
-
}
|
|
34
|
+
}
|
|
35
|
+
}
|