From c8d672e8a151bf70ede4bcbb1487e9ff66c1f138 Mon Sep 17 00:00:00 2001 From: Nicoll Date: Thu, 4 Jan 2024 12:59:54 -0600 Subject: [PATCH 1/2] adding tips in navigation and updating the thumbnail --- apps/scriptkit/next.config.js | 1 + apps/scriptkit/src/components/navigation.tsx | 1 + apps/scriptkit/src/lib/tips.ts | 3 +++ apps/scriptkit/src/pages/tips/index.tsx | 7 ++++--- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/apps/scriptkit/next.config.js b/apps/scriptkit/next.config.js index 75faab0..1e739e3 100644 --- a/apps/scriptkit/next.config.js +++ b/apps/scriptkit/next.config.js @@ -4,6 +4,7 @@ const IMAGE_HOST_DOMAINS = [ 'res.cloudinary.com', 'github.com', process.env.NEXT_PUBLIC_HOST, + `image.mux.com`, ] /** diff --git a/apps/scriptkit/src/components/navigation.tsx b/apps/scriptkit/src/components/navigation.tsx index 77e4b4f..2d7d845 100644 --- a/apps/scriptkit/src/components/navigation.tsx +++ b/apps/scriptkit/src/components/navigation.tsx @@ -11,6 +11,7 @@ import {twMerge} from 'tailwind-merge' const navItems = [ {name: 'Free Tutorials', href: '/tutorials'}, + {name: 'Tips', href: '/tips'}, {name: 'Community Scripts', href: '/scripts'}, {name: 'Docs', href: 'https://github.com/johnlindquist/kit/blob/main/API.md'}, { diff --git a/apps/scriptkit/src/lib/tips.ts b/apps/scriptkit/src/lib/tips.ts index 6cdc0f4..2963963 100644 --- a/apps/scriptkit/src/lib/tips.ts +++ b/apps/scriptkit/src/lib/tips.ts @@ -13,6 +13,7 @@ export const TipSchema = z.object({ body: z.string().nullable().optional(), summary: z.any().array().nullable().optional(), videoResourceId: z.nullable(z.string()).optional(), + muxPlaybackId: z.nullable(z.string()).optional(), transcript: z.nullable(z.string()).optional(), tweetId: z.nullable(z.string()).optional(), }) @@ -33,6 +34,7 @@ export const getAllTips = async (): Promise => { summary, body, "videoResourceId": resources[@->._type == 'videoResource'][0]->_id, + "muxPlaybackId": resources[@->._type == 'videoResource'][0]-> muxAsset.muxPlaybackId, "slug": slug.current, "transcript": resources[@->._type == 'videoResource'][0]-> castingwords.transcript, "tweetId": resources[@._type == 'tweet'][0].tweetId @@ -53,6 +55,7 @@ export const getTip = async (slug: string): Promise => { summary, body, "videoResourceId": resources[@->._type == 'videoResource'][0]->_id, + "muxPlaybackId": resources[@->._type == 'videoResource'][0]-> muxAsset.muxPlaybackId, "slug": slug.current, "transcript": resources[@->._type == 'videoResource'][0]-> castingwords.transcript, "tweetId": resources[@._type == 'tweet'][0].tweetId diff --git a/apps/scriptkit/src/pages/tips/index.tsx b/apps/scriptkit/src/pages/tips/index.tsx index 8788dfe..e650f1a 100644 --- a/apps/scriptkit/src/pages/tips/index.tsx +++ b/apps/scriptkit/src/pages/tips/index.tsx @@ -51,9 +51,10 @@ export default TipsIndex const TipCard: React.FC<{tip: Tip}> = ({tip}) => { const {title} = tip - const thumbnail = `${getBaseUrl()}/api/video-thumb?videoResourceId=${ - tip?.videoResourceId - }` + console.log('this is the tip info ', tip) + const muxPlaybackId = tip?.muxPlaybackId + const thumbnail = `https://image.mux.com/${muxPlaybackId}/thumbnail.png?width=720&height=405&fit_mode=preserve` + const router = useRouter() const {tipCompleted} = useTipComplete(tip.slug) From 3ce36594af4e2da932d7d1934190cdba4a59d3bf Mon Sep 17 00:00:00 2001 From: Nicoll Date: Thu, 4 Jan 2024 13:04:17 -0600 Subject: [PATCH 2/2] deleting console --- apps/scriptkit/src/pages/tips/index.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/scriptkit/src/pages/tips/index.tsx b/apps/scriptkit/src/pages/tips/index.tsx index e650f1a..ce756c4 100644 --- a/apps/scriptkit/src/pages/tips/index.tsx +++ b/apps/scriptkit/src/pages/tips/index.tsx @@ -51,7 +51,6 @@ export default TipsIndex const TipCard: React.FC<{tip: Tip}> = ({tip}) => { const {title} = tip - console.log('this is the tip info ', tip) const muxPlaybackId = tip?.muxPlaybackId const thumbnail = `https://image.mux.com/${muxPlaybackId}/thumbnail.png?width=720&height=405&fit_mode=preserve`