Skip to content

Commit 7138903

Browse files
committed
Retire legacy Courses concepts, code, UI, data model
1 parent b04eaf6 commit 7138903

File tree

17 files changed

+28
-555
lines changed

17 files changed

+28
-555
lines changed

scripts/clean-og-images.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ const OUTPUT_DIR = path.join(process.cwd(), 'public', 'og-images');
1212
const CONTENT_DIR = path.join(process.cwd(), 'src', 'content');
1313

1414
// Access environment variables
15-
const COURSES_DISABLED = process.env.COURSES_DISABLED === 'true';
1615

1716
// Get slugs from filesystem
1817
async function getContentSlugs(contentType: string): Promise<string[]> {
@@ -37,9 +36,6 @@ async function cleanOrphanedImages() {
3736

3837
// Get all valid content slugs from different content types
3938
const contentTypes = ['blog', 'videos'];
40-
if (!COURSES_DISABLED) {
41-
contentTypes.push('learn/courses');
42-
}
4339

4440
// Get all valid slugs
4541
const validSlugs = (await Promise.all(

src/app/api/chat/route.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ export async function POST(req: Request) {
5050
const blogPath = path.basename(blogUrl.replace('page.mdx', ''))
5151
const metadata = await getContentItemByDirectorySlug('blog', blogPath)
5252

53-
if (metadata) {
54-
relatedBlogPosts.push({ ...metadata });
53+
if (metadata && (metadata.type === 'blog' || metadata.type === 'video' || metadata.type === 'demo')) {
54+
relatedBlogPosts.push(metadata as Blog);
5555
}
5656
}
5757
// Join all the chunks of text together, truncate to the maximum number of tokens, and return the result

src/app/api/webhooks/stripe/route.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import Stripe from 'stripe'
33
import { PrismaClient } from '@prisma/client'
44
import { sendReceiptEmail, SendReceiptEmailInput } from '@/lib/postmark'
55
import { getContentItemByDirectorySlug } from '@/lib/content-handlers'
6-
import { COURSES_DISABLED } from '@/types'
76
import { stripeLogger as logger } from '@/utils/logger' // Import centralized logger
87
import { getContentUrlFromObject } from '@/lib/content-url'
98
import { normalizeRouteOrFileSlug } from '@/lib/content-handlers'
@@ -162,14 +161,8 @@ export async function POST(req: Request) {
162161
logger.info('WEBHOOK: Fetching content details for slug:', slug)
163162
try {
164163
let content;
165-
if (type === 'article' || type === 'blog') {
164+
if (type === 'article' || type === 'blog' || type === 'video') {
166165
content = await getContentItemByDirectorySlug('blog', directorySlug)
167-
} else if (type === 'course') {
168-
logger.warn('WEBHOOK: Course purchase detected, using fallback content details as courses are disabled')
169-
content = {
170-
title: `Course: ${slug}`,
171-
description: 'Premium Course Content'
172-
};
173166
}
174167
logger.debug('WEBHOOK: Found content:', { title: content?.title })
175168
if (!content) {
@@ -204,10 +197,10 @@ export async function POST(req: Request) {
204197
TemplateModel: {
205198
CustomerName: user?.name || 'Valued Customer',
206199
ProductURL: productUrl,
207-
ProductName: content?.title || `${type === 'article' ? 'Article' : 'Course'}: ${slug}`,
200+
ProductName: content?.title || `Article: ${slug}`,
208201
Date: new Date().toLocaleDateString('en-US'),
209202
ReceiptDetails: {
210-
Description: content?.description || `Premium ${type === 'article' ? 'Article' : 'Course'} Access`,
203+
Description: content?.description || `Premium Article Access`,
211204
Amount: `$${session.amount_total! / 100}`,
212205
SupportURL: `${process.env.NEXT_PUBLIC_SITE_URL}/support`,
213206
},

src/app/blog/page.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Metadata } from 'next'
22
import BlogClient from './blog-client'
33
import { createMetadata } from '@/utils/createMetadata'
44
import { getAllContent } from '@/lib/content-handlers'
5+
import { Blog } from '@/types/content'
56

67
// Base metadata using createMetadata
78
const baseMetadata = createMetadata({
@@ -17,7 +18,7 @@ export const metadata: Metadata = {
1718

1819

1920
export default async function ArticlesIndex() {
20-
const articles = await getAllContent('blog');
21+
const articles = (await getAllContent('blog')).filter((a) => a.type === 'blog' || a.type === 'video' || a.type === 'demo') as Blog[];
2122

2223
const years = [...new Set(articles.map((a) => new Date(a.date).getFullYear().toString()))].sort((a, b) => parseInt(b) - parseInt(a));
2324

src/app/checkout/result/page.tsx

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -226,34 +226,6 @@ function CheckoutResultContent() {
226226
</div>
227227
</div>
228228
)}
229-
230-
{content.content.type === 'course' && (
231-
<div className="mb-8">
232-
<p className="mb-4">
233-
Your course is now available. You can start learning right away!
234-
</p>
235-
{authStatus === 'authenticated' ? (
236-
<Link
237-
href={contentUrl as any}
238-
className="inline-block px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600 transition-colors"
239-
>
240-
Start Learning
241-
</Link>
242-
) : (
243-
<button
244-
onClick={() => handleEmailSignIn(content.user.email, contentUrl)}
245-
className="inline-block px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600 transition-colors"
246-
>
247-
Sign in to Start Learning
248-
</button>
249-
)}
250-
{authStatus === 'unauthenticated' && (
251-
<p className="mt-2 text-sm text-gray-600">
252-
You&apos;ll need to verify your email before accessing the full course.
253-
</p>
254-
)}
255-
</div>
256-
)}
257229
</div>
258230
</Container>
259231
);

src/app/learn/[course]/[segment]/page.tsx

Lines changed: 0 additions & 171 deletions
This file was deleted.

src/app/learn/courses/[slug]/page.tsx

Lines changed: 0 additions & 93 deletions
This file was deleted.

0 commit comments

Comments
 (0)