Skip to content

Commit 7af5c68

Browse files
Fixed the display of the cup icon in Polls (#538)
1 parent 96c679f commit 7af5c68

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
99
### 🐞 Fixed
1010
- Smoother and more performant view updates in channel and message lists [#522](https://github.com/GetStream/stream-chat-swiftui/pull/522)
1111
- Fix scrolling location when jumping to a message not in the currently loaded message list [#533](https://github.com/GetStream/stream-chat-swiftui/pull/533)
12+
- Fix display of the most votes icon in Polls [#538](https://github.com/GetStream/stream-chat-swiftui/pull/538)
1213

1314
# [4.58.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.58.0)
1415
_June 27, 2024_

Sources/StreamChatSwiftUI/ChatChannel/MessageList/Polls/PollResultsView.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ struct PollResultsView: View {
4848
option.latestVotes.sorted(by: { $0.createdAt > $1.createdAt })
4949
.prefix(numberOfItemsShown)
5050
),
51+
hasMostVotes: viewModel.hasMostVotes(for: option),
5152
allButtonShown: option.latestVotes.count > numberOfItemsShown
5253
)
5354
}
@@ -80,6 +81,7 @@ struct PollOptionResultsView: View {
8081
var poll: Poll
8182
var option: PollOption
8283
var votes: [PollVote]
84+
var hasMostVotes: Bool = false
8385
var allButtonShown = false
8486
var onVoteAppear: ((PollVote) -> Void)?
8587

@@ -89,10 +91,12 @@ struct PollOptionResultsView: View {
8991
Text(option.text)
9092
.font(fonts.bodyBold)
9193
Spacer()
92-
Image(systemName: "trophy")
93-
.resizable()
94-
.aspectRatio(contentMode: .fit)
95-
.frame(height: 16)
94+
if hasMostVotes {
95+
Image(systemName: "trophy")
96+
.resizable()
97+
.aspectRatio(contentMode: .fit)
98+
.frame(height: 16)
99+
}
96100
Text(L10n.Message.Polls.votes(poll.voteCountsByOption?[option.id] ?? 0))
97101
}
98102

-1.17 KB
Loading

0 commit comments

Comments
 (0)