From 3dd50a1f0978e6761e7efa237b11bc2d237f65f9 Mon Sep 17 00:00:00 2001
From: Kamran Ahmed <kamranahmed.se@gmail.com>
Date: Tue, 8 Apr 2025 18:54:52 +0100
Subject: [PATCH] Read sample button on page

---
 src/components/SQLCourse/BuyButton.tsx | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/components/SQLCourse/BuyButton.tsx b/src/components/SQLCourse/BuyButton.tsx
index 8dd80501e..2a314a479 100644
--- a/src/components/SQLCourse/BuyButton.tsx
+++ b/src/components/SQLCourse/BuyButton.tsx
@@ -230,15 +230,17 @@ export function BuyButton(props: BuyButtonProps) {
               </span>
             )}
           </button>
-          <button
-            onClick={onReadSampleClick}
-            className="group relative inline-flex items-center justify-center overflow-hidden rounded-xl border border-yellow-500/30 bg-transparent px-6 py-3 text-base font-medium text-yellow-500 transition-all duration-300 ease-out hover:bg-yellow-500/10 focus:outline-hidden active:ring-0 md:rounded-full"
-          >
-            <span className="relative flex items-center gap-2">
-              <BookOpen className="h-5 w-5" />
-              Read Sample
-            </span>
-          </button>
+          {!isLoadingPricing && !isAlreadyEnrolled && (
+            <button
+              onClick={onReadSampleClick}
+              className="group relative inline-flex items-center justify-center overflow-hidden rounded-xl border border-yellow-500/30 bg-transparent px-6 py-3 text-base font-medium text-yellow-500 transition-all duration-300 ease-out hover:bg-yellow-500/10 focus:outline-hidden active:ring-0 md:rounded-full"
+            >
+              <span className="relative flex items-center gap-2">
+                <BookOpen className="h-5 w-5" />
+                Read Sample
+              </span>
+            </button>
+          )}
         </div>
 
         {!isLoadingPricing && (