1
1
import DesignSystem
2
2
import Models
3
+ import PostUI
4
+ import Router
3
5
import SwiftUI
4
6
5
7
public struct ProfileView : View {
8
+ @Environment ( Router . self) var router
6
9
public let profile : Profile
7
10
public let showBack : Bool
8
11
@@ -19,9 +22,58 @@ public struct ProfileView: View {
19
22
showBack: showBack
20
23
)
21
24
. padding ( . bottom)
25
+
26
+ NavigationLink (
27
+ value: RouterDestination . profilePosts ( profile: profile, filter: . postsWithNoReplies)
28
+ ) {
29
+ makeLabelButton ( title: " Posts " , icon: " bubble.fill " , color: . blueskyBackground)
30
+ }
31
+
32
+ NavigationLink (
33
+ value: RouterDestination . profilePosts ( profile: profile, filter: . postsWithReplies)
34
+ ) {
35
+ makeLabelButton ( title: " Replies " , icon: " arrowshape.turn.up.left.fill " , color: . teal)
36
+ }
37
+
38
+ NavigationLink (
39
+ value: RouterDestination . profilePosts ( profile: profile, filter: . postsWithMedia)
40
+ ) {
41
+ makeLabelButton ( title: " Medias " , icon: " photo.fill " , color: . gray)
42
+ }
43
+
44
+ NavigationLink (
45
+ value: RouterDestination . profilePosts ( profile: profile, filter: . postAndAuthorThreads)
46
+ ) {
47
+ makeLabelButton ( title: " Threads " , icon: " bubble.left.and.bubble.right.fill " , color: . green)
48
+ }
49
+
50
+ NavigationLink ( value: RouterDestination . profileLikes ( profile) ) {
51
+ makeLabelButton ( title: " Likes " , icon: " heart.fill " , color: . red)
52
+ }
22
53
}
23
54
. listStyle ( . plain)
24
55
. navigationBarBackButtonHidden ( )
25
56
. toolbar ( . hidden, for: . navigationBar)
26
57
}
58
+
59
+ private func makeLabelButton( title: String , icon: String , color: Color ) -> some View {
60
+ HStack {
61
+ Image ( systemName: icon)
62
+ . foregroundColor ( . white)
63
+ . shadow ( color: . white, radius: 3 )
64
+ . padding ( 12 )
65
+ . background (
66
+ LinearGradient (
67
+ colors: [ color, . indigo] ,
68
+ startPoint: . topLeading,
69
+ endPoint: . bottomTrailing)
70
+ )
71
+ . frame ( width: 40 , height: 40 )
72
+ . glowingRoundedRectangle ( )
73
+ Text ( title)
74
+ . font ( . title3)
75
+ . fontWeight ( . semibold)
76
+ Spacer ( )
77
+ }
78
+ }
27
79
}
0 commit comments