diff --git a/src/content/components/CopyTranscriptButton.tsx b/src/content/components/CopyTranscriptButton.tsx index a239ef20..42c7a728 100644 --- a/src/content/components/CopyTranscriptButton.tsx +++ b/src/content/components/CopyTranscriptButton.tsx @@ -1,10 +1,26 @@ -import React, { useState } from 'react'; +import React, { useState, useEffect } from 'react'; import { getTranscript } from '../utils/transcript'; export const CopyTranscriptButton: React.FC = () => { const [status, setStatus] = useState< 'idle' | 'copying' | 'success' | 'error' >('idle'); + const [isLecturePage, setIsLecturePage] = useState(false); + + useEffect(() => { + const checkIfLecturePage = () => { + const url = window.location.href; + const learnMatch = url.match(/\/learn\/.*?\/lecture\//); + setIsLecturePage(!!learnMatch); + }; + + checkIfLecturePage(); + }, []); + + // Don't render the button if we're not on a lecture page + if (!isLecturePage) { + return null; + } const handleCopy = async () => { try { @@ -48,7 +64,8 @@ export const CopyTranscriptButton: React.FC = () => { return (