Skip to content

Commit

Permalink
chore: limit the number of CTAs on the Primary Card on the Learn Tab (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
saeedbashir authored Sep 3, 2024
1 parent 2132660 commit 55b84f0
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ public struct PrimaryCardView: View {
private var upgradeAction: () -> Void
private var isUpgradeable: Bool
@Environment(\.isHorizontal) var isHorizontal
private var canShowFutureAssignments: Bool {
return !isUpgradeable || pastAssignments.count <= 0
}

public init(
courseName: String,
Expand Down Expand Up @@ -160,7 +163,7 @@ public struct PrimaryCardView: View {
}

// futureAssignment
if !futureAssignments.isEmpty {
if !futureAssignments.isEmpty && canShowFutureAssignments {
if futureAssignments.count == 1, let futureAssignment = futureAssignments.first {
let daysRemaining = Calendar.current.dateComponents(
[.day],
Expand All @@ -179,7 +182,7 @@ public struct PrimaryCardView: View {
assignmentAction(futureAssignments.first?.firstComponentBlockId)
}
)
} else if futureAssignments.count > 1 {
} else if futureAssignments.count > 1 && canShowFutureAssignments {
if let firtsData = futureAssignments.sorted(by: { $0.date < $1.date }).first {
courseButton(
title: DashboardLocalization.Learn.PrimaryCard.futureAssignments(
Expand Down

0 comments on commit 55b84f0

Please sign in to comment.