Skip to content

Commit 632d493

Browse files
committed
chore: remove course/lesson references from codebase
Courses have been removed from navigation and are no longer active. Route files already deleted. This commit cleans up all remaining references: - queries.ts: remove course/lesson queries, partials, and related content refs - types.ts: remove course/lesson from ContentType enum - more-content.tsx: remove course query case - algolia-search.tsx: remove course/lesson icon cases - layout.tsx: remove courses RSS link - sitemap.ts: remove course/lesson URL generation - user-related.tsx: remove course from related content check - internalLink.ts: remove course from reference types Sanity schemas (course.ts, lesson.ts) kept for Studio access to existing data.
1 parent 2dc1360 commit 632d493

File tree

8 files changed

+2
-107
lines changed

8 files changed

+2
-107
lines changed

app/(main)/layout.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ export async function generateMetadata(): Promise<Metadata> {
7474
types: {
7575
"application/rss+xml": [
7676
{ url: "/blog/rss.xml", title: "Blog" },
77-
{ url: "/courses/rss.xml", title: "Courses" },
7877
{ url: "/podcasts/rss.xml", title: "Podcasts" },
7978
],
8079
},

app/sitemap.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,8 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
3939
url: `${site}${c._type === ContentType.page ? `/${c.slug}` : `/${c._type}/${c.slug}`}`,
4040
lastModified: new Date(),
4141
changeFrequency: "monthly",
42-
priority: c._type === ContentType.course ? 0.8 : 0.5,
42+
priority: 0.5,
4343
});
44-
c?.sections?.map((s) =>
45-
s?.lesson?.map((l) => {
46-
sitemap.push({
47-
url: `${site}/course/${c.slug}/lesson/${l.slug}`,
48-
lastModified: new Date(),
49-
changeFrequency: "monthly",
50-
});
51-
}),
52-
);
5344
}
5445

5546
return sitemap;

components/algolia-search.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import { useEffect, useState } from "react";
66
import { Button } from "@/components/ui/button";
77
import { FaX } from "react-icons/fa6";
88

9-
import { GiTeacher } from "react-icons/gi"; // Course
10-
import { PiStudentBold } from "react-icons/pi"; // Lesson
119
import { FaPodcast } from "react-icons/fa"; // Podcast
1210
import { HiOutlinePencilAlt } from "react-icons/hi"; //Post
1311
import { FaCat } from "react-icons/fa"; // Author
@@ -76,12 +74,8 @@ export default function AlgoliaSearch({
7674
switch (type) {
7775
case ContentType.author:
7876
return <FaCat />;
79-
case ContentType.course:
80-
return <GiTeacher />;
8177
case ContentType.guest:
8278
return <FaRegUser />;
83-
case ContentType.lesson:
84-
return <PiStudentBold />;
8579
case ContentType.podcast:
8680
return <FaPodcast />;
8781
case ContentType.post:

components/more-content.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import { sanityFetch } from "@/sanity/lib/live";
1313
import {
1414
morePodcastQuery,
1515
morePostQuery,
16-
moreCourseQuery,
1716
moreAuthorQuery,
1817
moreGuestQuery,
1918
moreSponsorQuery,
@@ -32,8 +31,6 @@ export default async function MoreContent(params: {
3231
switch (params.type) {
3332
case ContentType.author:
3433
return moreAuthorQuery;
35-
case ContentType.course:
36-
return moreCourseQuery;
3734
case ContentType.guest:
3835
return moreGuestQuery;
3936
case ContentType.podcast:

components/user-related.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ export default async function UserRelated(
1212
related: NonNullable<AuthorQueryWithRelatedResult>["related"],
1313
) {
1414
if (
15-
!related?.course?.length &&
1615
!related?.podcast?.length &&
1716
!related?.post?.length
1817
) {

lib/types.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
import type {
2-
LessonsInCourseQueryResult,
32
PageQueryResult,
43
} from "@/sanity/types";
54

65
export type NonNull<T> = Exclude<T, null | undefined>;
76

87
export enum ContentType {
98
author = "author",
10-
course = "course",
119
framework = "framework",
1210
forum = "forum",
1311
guest = "guest",
1412
group = "group",
1513
language = "language",
16-
lesson = "lesson",
1714
page = "page",
1815
podcast = "podcast",
1916
post = "post",
@@ -40,13 +37,3 @@ export interface BookmarkPath extends BaseBookmarkContent {
4037
_cc_updated: number;
4138
}
4239

43-
export type BaseCompletedLesson = NonNullable<
44-
NonNullable<
45-
NonNullable<
46-
NonNullable<LessonsInCourseQueryResult>["sections"]
47-
>[0]["lesson"]
48-
>[0]
49-
>;
50-
export interface CompletedLesson extends BaseCompletedLesson {
51-
_cc_updated: number;
52-
}

sanity/lib/queries.ts

Lines changed: 1 addition & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,6 @@ const podcastFields = `
7373
spotify
7474
`;
7575

76-
const courseFields = `
77-
stripeProduct
78-
`;
79-
80-
const lessonFields = `
81-
locked,
82-
videoCloudinary
83-
`;
8476

8577
const userFields = `
8678
socials,
@@ -89,9 +81,6 @@ const userFields = `
8981

9082
const userRelated = `
9183
"related":{
92-
"course": *[_type == "course" && (^._id in author[]._ref || ^._id in guest[]._ref)] | order(date desc) [0...4] {
93-
${baseFieldsNoContent}
94-
},
9584
"podcast": *[_type == "podcast" && (^._id in author[]._ref || ^._id in guest[]._ref)] | order(date desc) [0...4] {
9685
${baseFieldsNoContent}
9786
},
@@ -103,9 +92,6 @@ const userRelated = `
10392

10493
const sponsorRelated = `
10594
"related":{
106-
"course": *[_type == "course" && ^._id in sponsor[]._ref] | order(date desc) [] {
107-
${baseFieldsNoContent}
108-
},
10995
"podcast": *[_type == "podcast" && ^._id in sponsor[]._ref] | order(date desc) [] {
11096
${baseFieldsNoContent}
11197
},
@@ -201,56 +187,6 @@ export const podcastQuery = groq`*[_type == "podcast" && slug.current == $slug]
201187
${contentFields},
202188
${podcastFields}
203189
}`;
204-
205-
// Courses
206-
207-
export const coursesQuery = groq`*[_type == "course" && defined(slug.current)] | order(date desc, _updatedAt desc) [0] {
208-
${baseFieldsNoContent},
209-
${courseFields},
210-
author[]->{
211-
...,
212-
"title": coalesce(title, "Anonymous"),
213-
"slug": slug.current,
214-
}
215-
}`;
216-
217-
export const moreCourseQuery = groq`*[_type == "course" && _id != $skip && defined(slug.current)] | order(date desc, _updatedAt desc) [$offset...$limit] {
218-
${baseFieldsNoContent},
219-
${courseFields},
220-
author[]->{
221-
...,
222-
"title": coalesce(title, "Anonymous"),
223-
"slug": slug.current,
224-
}
225-
}`;
226-
227-
export const courseQuery = groq`*[_type == "course" && slug.current == $courseSlug] [0] {
228-
${baseFieldsNoContent},
229-
${courseFields},
230-
${contentFields},
231-
${podcastFields}
232-
}`;
233-
234-
// Lessons
235-
236-
export const lessonsInCourseQuery = groq`*[_type == "course" && slug.current == $courseSlug] [0] {
237-
${baseFieldsNoContent},
238-
${courseFields},
239-
sections[]{
240-
title,
241-
lesson[]->{
242-
${baseFieldsNoContent},
243-
${lessonFields}
244-
}
245-
}
246-
}`;
247-
248-
export const lessonQuery = groq`*[_type == "lesson" && slug.current == $lessonSlug] [0] {
249-
${baseFieldsNoContent},
250-
${contentFields},
251-
${lessonFields}
252-
}`;
253-
254190
// Author
255191

256192
export const moreAuthorQuery = groq`*[_type == "author" && _id != $skip && defined(slug.current)] | order(title) [$offset...$limit] {
@@ -322,15 +258,8 @@ export const rssPodcastQuery = groq`*[_type == "podcast" && _id != $skip && defi
322258
}`;
323259

324260
// Sitemaps
325-
export const sitemapQuery = groq`*[_type in ["author", "course", "guest", "page", "podcast", "post", "sponsor"] && defined(slug.current)] | order(_type asc) | order(_updated desc) {
261+
export const sitemapQuery = groq`*[_type in ["author", "guest", "page", "podcast", "post", "sponsor"] && defined(slug.current)] | order(_type asc) | order(_updated desc) {
326262
_type,
327263
_updatedAt,
328264
"slug": slug.current,
329-
sections[]{
330-
lesson[]->{
331-
_type,
332-
_updatedAt,
333-
"slug": slug.current,
334-
}
335-
}
336265
}`;

sanity/schemas/custom/internalLink.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ export default defineType({
1414
to: [
1515
{ type: "post" },
1616
{ type: "podcast" },
17-
{ type: "course" },
1817
{ type: "page" },
1918
// other types you may want to link to
2019
],

0 commit comments

Comments
 (0)