diff --git a/src/components/banner/HeroBanner.js b/src/components/banner/HeroBanner.js index aa345f9..9638acc 100644 --- a/src/components/banner/HeroBanner.js +++ b/src/components/banner/HeroBanner.js @@ -39,16 +39,16 @@ const HeroBanner = () => { quality={100} className='opacity-70' /> -
-

Learn how to code

-

+

+

Learn how to code

+

Build{' '} {options[currentOption]} {' '}Apps

-

Become a developer

+

Become a developer

diff --git a/src/components/content/carousels/CoursesCarousel.js b/src/components/content/carousels/CoursesCarousel.js index 4eda6bd..8fadf98 100644 --- a/src/components/content/carousels/CoursesCarousel.js +++ b/src/components/content/carousels/CoursesCarousel.js @@ -50,7 +50,7 @@ export default function CoursesCarousel() { return ( <> -

Courses

+

Courses

-

Resources

+

Resources

-

Workshops

+

Workshops

{ const videoId = videoUrl.split('/').pop(); embedCode = `
`; } + else if (videoUrl.includes('.mp4') || videoUrl.includes('.mov') || videoUrl.includes('.avi') || videoUrl.includes('.wmv') || videoUrl.includes('.flv') || videoUrl.includes('.webm')) { + const baseUrl = process.env.NEXT_PUBLIC_API_URL || "http://localhost:3000"; + const videoEmbed = `
`; + embedCode = videoEmbed; + } // Add more conditions here for other video services const userResponse = await axios.get(`/api/users/${user.pubkey}`); diff --git a/src/components/sidebar/Sidebar.js b/src/components/sidebar/Sidebar.js index 0efa353..8b212fa 100644 --- a/src/components/sidebar/Sidebar.js +++ b/src/components/sidebar/Sidebar.js @@ -111,9 +111,10 @@ const Sidebar = () => {
session ? signOut() : router.push('/auth/signin')} className={`w-full flex flex-row items-center cursor-pointer py-2 my-2 hover:bg-gray-700 rounded-lg ${isActive('/auth/signin') ? 'bg-gray-700' : ''}`}>

{session ? 'Logout' : 'Login'}

-
+ {/* todo sidebar expand / contract */} + {/*

{isExpanded ? 'close' : 'open'}

-
+
*/} {/* todo: have to add this extra button to push the sidebar to the right space but it doesnt seem to cause any negative side effects? */}

Logout

diff --git a/src/pages/_app.js b/src/pages/_app.js index 9d45260..15978ba 100644 --- a/src/pages/_app.js +++ b/src/pages/_app.js @@ -24,19 +24,19 @@ const queryClient = new QueryClient() export default function MyApp({ Component, pageProps: { session, ...pageProps } }) { - const [sidebarExpanded, setSidebarExpanded] = useState(true); + // const [sidebarExpanded, setSidebarExpanded] = useState(true); - useEffect(() => { - const handleSidebarToggle = (event) => { - setSidebarExpanded(event.detail.isExpanded); - }; + // useEffect(() => { + // const handleSidebarToggle = (event) => { + // setSidebarExpanded(event.detail.isExpanded); + // }; - window.addEventListener('sidebarToggle', handleSidebarToggle); + // window.addEventListener('sidebarToggle', handleSidebarToggle); - return () => { - window.removeEventListener('sidebarToggle', handleSidebarToggle); - }; - }, []); + // return () => { + // window.removeEventListener('sidebarToggle', handleSidebarToggle); + // }; + // }, []); return ( diff --git a/src/pages/api/auth/[...nextauth].js b/src/pages/api/auth/[...nextauth].js index d2cf17c..b231631 100644 --- a/src/pages/api/auth/[...nextauth].js +++ b/src/pages/api/auth/[...nextauth].js @@ -143,7 +143,7 @@ export const authOptions = { }, pages: { signIn: "/auth/signin", - }, + } }; export default NextAuth(authOptions); diff --git a/src/pages/api/get-video-url.js b/src/pages/api/get-video-url.js index e4c0587..90e34b7 100644 --- a/src/pages/api/get-video-url.js +++ b/src/pages/api/get-video-url.js @@ -19,8 +19,6 @@ export default async function handler(req, res) { return res.status(401).json({ error: "Unauthorized" }) } - console.log("Session:", session) - const { videoKey } = req.query if (!videoKey) { @@ -34,10 +32,10 @@ export default async function handler(req, res) { }) const signedUrl = await getSignedUrl(s3Client, command, { - expiresIn: 10, // URL expires in 10 seconds + expiresIn: 3600, // URL expires in 1 hour }) - res.status(200).json({ url: signedUrl }) + res.redirect(signedUrl) } catch (error) { console.error("Error generating signed URL:", error) res.status(500).json({ error: "Failed to generate video URL" }) diff --git a/src/pages/draft/[slug]/index.js b/src/pages/draft/[slug]/index.js index 7377573..cb8f8b2 100644 --- a/src/pages/draft/[slug]/index.js +++ b/src/pages/draft/[slug]/index.js @@ -201,6 +201,18 @@ export default function Draft() { encryptedContent = await nip04.encrypt(process.env.NEXT_PUBLIC_APP_PRIV_KEY, process.env.NEXT_PUBLIC_APP_PUBLIC_KEY, draft.content); } + if (draft?.content.includes('.mp4') || draft?.content.includes('.mov') || draft?.content.includes('.avi') || draft?.content.includes('.wmv') || draft?.content.includes('.flv') || draft?.content.includes('.webm')) { + // todo update this for dev and prod + const baseUrl = process.env.NEXT_PUBLIC_API_URL || "http://localhost:3000" + const videoEmbed = `
`; + if (draft?.price) { + const encryptedVideoUrl = await nip04.encrypt(process.env.NEXT_PUBLIC_APP_PRIV_KEY, process.env.NEXT_PUBLIC_APP_PUBLIC_KEY, videoEmbed); + draft.content = encryptedVideoUrl; + } else { + draft.content = videoEmbed; + } + } + event.kind = draft?.price ? 30402 : 30023; event.content = draft?.price ? encryptedContent : draft.content; event.created_at = Math.floor(Date.now() / 1000); @@ -232,9 +244,8 @@ export default function Draft() {
- {/* List out topics */} {draft?.topics && draft.topics.map((topic, index) => { - if (topic === "plebdevs") return; + if (topic === "") return; return ( ) @@ -302,7 +313,9 @@ export default function Draft() {
{ - draft?.content && + ( + draft?.content && + ) }