File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ struct CommentsView: View {
2727 // `dropFirst` because `first` is the actual post
2828 if listings!. dropFirst ( ) . map ( { $0. data. children } ) . flatMap ( { $0. map { $0. data } } ) . count > 0 {
2929 ForEach ( listings!. dropFirst ( ) . map ( { $0. data. children } ) . flatMap { $0. map { $0. data } } , id: \. id) { comment in
30- CommentView ( comment: comment, nestLevel: 0 )
30+ CommentView ( comment: comment, postAuthor : self . post . author , nestLevel: 0 )
3131 }
3232 } else {
3333 self . noComments
@@ -42,6 +42,7 @@ struct CommentsView: View {
4242
4343struct CommentView : View {
4444 let comment : Comment
45+ let postAuthor : String
4546 let nestLevel : Int
4647
4748 var body : some View {
@@ -56,12 +57,17 @@ struct CommentView: View {
5657 /// Content
5758 VStack ( alignment: . leading) {
5859 HStack {
59- Text ( comment. author)
60+ if comment. author == postAuthor {
61+ Text ( comment. author)
62+ . foregroundColor ( . accentColor)
63+ } else {
64+ Text ( comment. author)
65+ }
6066 Image ( systemName: " arrow.up " )
6167 Text ( " \( comment. score) " )
6268 }
63- . font ( . caption)
64- . opacity ( 0.75 )
69+ . font ( . caption)
70+ . opacity ( 0.75 )
6571 Text ( comment. body ?? " " )
6672 }
6773 }
@@ -70,7 +76,7 @@ struct CommentView: View {
7076 /// Recursive comments
7177 if comment. replies != nil {
7278 ForEach ( comment. replies!. data. children. map { $0. data } , id: \. id) { reply in
73- CommentView ( comment: reply, nestLevel: self . nestLevel + 1 )
79+ CommentView ( comment: reply, postAuthor : self . postAuthor , nestLevel: self . nestLevel + 1 )
7480 }
7581 }
7682 }
You can’t perform that action at this time.
0 commit comments