From 55b84f0087ab4db824bee3812309f595201edb0a Mon Sep 17 00:00:00 2001 From: Saeed Bashir Date: Tue, 3 Sep 2024 07:16:15 +0500 Subject: [PATCH] chore: limit the number of CTAs on the Primary Card on the Learn Tab (#73) --- .../Dashboard/Presentation/Elements/PrimaryCardView.swift | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Dashboard/Dashboard/Presentation/Elements/PrimaryCardView.swift b/Dashboard/Dashboard/Presentation/Elements/PrimaryCardView.swift index 261c11ad..86fbf8cb 100644 --- a/Dashboard/Dashboard/Presentation/Elements/PrimaryCardView.swift +++ b/Dashboard/Dashboard/Presentation/Elements/PrimaryCardView.swift @@ -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, @@ -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], @@ -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(