Skip to content

Commit

Permalink
Merge branch 'main' of github.com:skillrecordings/egghead-next
Browse files Browse the repository at this point in the history
  • Loading branch information
zacjones93 committed Nov 26, 2024
2 parents 6978feb + 1e8937b commit c03b991
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/lib/courses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ const courseQuery = groq`
"type": "lesson",
"tags": softwareLibraries[] {
...(library->{
name,
'label': slug.current,
'name': slug.current,
'label': name,
'http_url': url,
'image_url': image.url
})
Expand Down
14 changes: 8 additions & 6 deletions src/lib/lessons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
} from '@/utils/lesson-metadata'
import compactedMerge from '@/utils/compacted-merge'
import {convertUndefinedValuesToNull} from '@/utils/convert-undefined-values-to-null'
import fetchEggheadUser from '@/api/egghead/users/from-token'

// code_url is only used in a select few Kent C. Dodds lessons
const lessonQuery = groq`
Expand All @@ -21,7 +20,6 @@ const lessonQuery = groq`
'slug': slug.current,
description,
...resources[@->["_type"] == "videoResource"][0]->{
"hls_url": mediaUrls.hlsUrl,
"dash_url": mediaUrls.dashUrl,
"media_url": mediaUrls.hlsUrl,
"transcript": transcript.text,
Expand All @@ -47,8 +45,8 @@ const lessonQuery = groq`
},
'tags': softwareLibraries[] {
...(library-> {
name,
'label': slug.current,
'name': slug.current,
'label': name,
'http_url': url,
'image_url': image.url
}),
Expand Down Expand Up @@ -122,8 +120,6 @@ export async function loadLesson(
): Promise<LessonResource> {
token = token || getAccessTokenFromCookie()

const eggheadViewer = await fetchEggheadUser(token as string, true)

/******************************************
* Primary Lesson Metadata GraphQL Request
* ****************************************/
Expand All @@ -132,6 +128,8 @@ export async function loadLesson(
token,
)

console.log('lessonMetadataFromGraphQL', lessonMetadataFromGraphQL)

/**********************************************
* Load comments from separate GraphQL Request
* ********************************************/
Expand All @@ -145,6 +143,8 @@ export async function loadLesson(
// this will be used to override values from graphql
const lessonMetadataFromSanity = await loadLessonMetadataFromSanity(slug)

console.log('lessonMetadataFromSanity', lessonMetadataFromSanity)

/*************************************
* Merge All Lesson Metadata Together
* ***********************************/
Expand All @@ -156,6 +156,8 @@ export async function loadLesson(

lessonMetadata = convertUndefinedValuesToNull(lessonMetadata)

console.log('lessonMetadata', lessonMetadata)

// if (!eggheadViewer.is_pro && !lessonMetadata.free_forever) {
// delete lessonMetadata.hls_url
// delete lessonMetadata.dash_url
Expand Down

0 comments on commit c03b991

Please sign in to comment.