Skip to content

Commit

Permalink
fix count for github
Browse files Browse the repository at this point in the history
  • Loading branch information
StefKors committed Nov 1, 2024
1 parent 68c4731 commit c5759ef
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
15 changes: 13 additions & 2 deletions Shared/UserInterface/Icons/DiscussionCountIcon.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,19 @@ import SwiftUI

struct DiscussionCountIcon: View {
var count: Int?
var provider: GitProvider

private var min: Int {
switch provider {
case .GitHub:
0
case .GitLab:
1
}
}

var body: some View {
if let count = count, count > 1 {
if let count = count, count > min {
if count <= 50 {
HStack(spacing: 2) {
Text(Image(systemName: "bubble.left.and.bubble.right"))
Expand All @@ -32,6 +43,6 @@ struct DiscussionCountIcon: View {

struct CommentIcon_Previews: PreviewProvider {
static var previews: some View {
DiscussionCountIcon(count: 12)
DiscussionCountIcon(count: 12, provider: .GitHub)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ struct DoubleLineMergeRequestSubRowView: View {

HStack(alignment: .center, spacing: 4) {
if let count = request.discussionCount, count > 1 {
DiscussionCountIcon(count: count)
DiscussionCountIcon(count: count, provider: request.provider)
}
MergeStatusView(request: request)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct HorizontalMergeRequestSubRowView: View {

Spacer()
if let count = request.discussionCount, count > 1 {
DiscussionCountIcon(count: count)
DiscussionCountIcon(count: count, provider: request.provider)
}
MergeStatusView(request: request)
// TODO: support github pipelines
Expand Down

0 comments on commit c5759ef

Please sign in to comment.