Skip to content

Commit d8a9f87

Browse files
authored
feat(food): add new info screen and remove food card (#176)
1 parent a8b4374 commit d8a9f87

File tree

12 files changed

+733
-199
lines changed

12 files changed

+733
-199
lines changed

src/components/Cards/BaseCard.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,24 +31,21 @@ const BaseCard: React.FC<BaseCardProps> = ({
3131
const { hideDashboardEntry, resetOrder } = useContext(DashboardContext)
3232
const { userKind = USER_GUEST } = useContext(UserKindContext)
3333

34-
const foodKeys = ['mensa', 'mensaNeuburg', 'canisius', 'reimanns']
35-
const dynamicTitle = foodKeys.includes(title) ? 'food' : title
36-
3734
const cardContent = (
3835
<View style={styles.card}>
3936
<View style={styles.titleView}>
4037
<PlatformIcon
4138
ios={{
42-
name: cardIcons[dynamicTitle as keyof typeof cardIcons]?.ios,
39+
name: cardIcons[title as keyof typeof cardIcons]?.ios,
4340
size: 18
4441
}}
4542
android={{
46-
name: cardIcons[dynamicTitle as keyof typeof cardIcons]?.android,
43+
name: cardIcons[title as keyof typeof cardIcons]?.android,
4744
size: 24,
4845
variant: 'outlined'
4946
}}
5047
web={{
51-
name: cardIcons[dynamicTitle as keyof typeof cardIcons]?.web,
48+
name: cardIcons[title as keyof typeof cardIcons]?.web,
5249
size: 24
5350
}}
5451
/>

src/components/Cards/FoodCard.tsx

Lines changed: 0 additions & 169 deletions
This file was deleted.

src/components/Cards/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import BaseCard from './BaseCard'
22
import CalendarCard from './CalendarCard'
33
import EventsCard from './EventsCard'
4-
import FoodCard from './FoodCard'
54
import LinkCard from './LinkCard'
65
import LoginCard from './LoginCard'
76
import TimetableCard from './TimetableCard'
87

98
export {
10-
FoodCard,
119
EventsCard,
1210
CalendarCard,
1311
BaseCard,

src/components/Food/CurvedText.tsx

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import type React from 'react'
2+
import { Text, View } from 'react-native'
3+
import { useStyles } from 'react-native-unistyles'
4+
5+
interface CurvedTextProps {
6+
text: string
7+
radius: number
8+
size: number
9+
startAngle?: number
10+
}
11+
12+
/**
13+
* Component for creating curved text along a circular path
14+
*/
15+
export const CurvedText = ({
16+
text,
17+
radius,
18+
size,
19+
startAngle = 90
20+
}: CurvedTextProps): React.JSX.Element => {
21+
const characters = text.split('')
22+
const anglePerChar = 5
23+
const startAngleRad = (startAngle * Math.PI) / 180
24+
const { theme } = useStyles()
25+
26+
return (
27+
<View
28+
style={{ width: radius * 2, height: radius * 2, position: 'absolute' }}
29+
>
30+
{characters.map((char, index) => {
31+
const angle =
32+
startAngleRad -
33+
((characters.length - 1) / 2 - index) *
34+
((anglePerChar * Math.PI) / 180)
35+
36+
return (
37+
<View
38+
key={index}
39+
style={{
40+
position: 'absolute',
41+
left: radius + radius * Math.cos(angle) - size / 2 + 1.5,
42+
top: radius + radius * Math.sin(angle) - size / 2,
43+
width: size,
44+
height: size,
45+
transform: [{ rotate: `${angle + Math.PI / 2}rad` }],
46+
alignItems: 'center',
47+
justifyContent: 'center'
48+
}}
49+
>
50+
<Text
51+
style={{
52+
fontSize: size * 0.7,
53+
color: theme.colors.text,
54+
fontWeight: '300',
55+
opacity: 0.6
56+
}}
57+
>
58+
{char}
59+
</Text>
60+
</View>
61+
)
62+
})}
63+
</View>
64+
)
65+
}
66+
67+
export default CurvedText

0 commit comments

Comments
 (0)