From 62441e01a00eb0fe351fc6af6f5f3b6dca3fb5c3 Mon Sep 17 00:00:00 2001 From: kiwihodl Date: Wed, 2 Apr 2025 12:16:11 -0500 Subject: [PATCH] feat: Implement ZapThreads with access control for paid content - Add to CourseDetails, CourseTemplate, CourseLesson - Block comments for unpaid users - Allow comments for free content and authorized paid users --- src/components/ZapThreadsWrapper.js | 82 +++++++-- .../carousels/templates/CourseTemplate.js | 46 ++++- .../content/courses/CourseDetails.js | 51 +++++- .../content/courses/CourseLesson.js | 171 +++++++++++++----- 4 files changed, 277 insertions(+), 73 deletions(-) diff --git a/src/components/ZapThreadsWrapper.js b/src/components/ZapThreadsWrapper.js index 31d6261..4e4f1ad 100644 --- a/src/components/ZapThreadsWrapper.js +++ b/src/components/ZapThreadsWrapper.js @@ -1,58 +1,100 @@ -import React, { useEffect, useRef } from 'react'; +import React, { useEffect, useRef } from "react"; -const ZapThreadsWrapper = ({ anchor, user, relays, disable, className }) => { +const ZapThreadsWrapper = ({ + anchor, + user, + relays, + disable, + className, + isAuthorized, +}) => { // Create a ref to store the reference to the
element const zapRef = useRef(null); useEffect(() => { + // Only load the script if the user is authorized + if (!isAuthorized) { + return; + } + // Create a new