Skip to content

Commit

Permalink
adding tips in navigation and updating the thumbnail
Browse files Browse the repository at this point in the history
  • Loading branch information
nicollguarnizo committed Jan 4, 2024
1 parent 40c6013 commit c8d672e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions apps/scriptkit/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const IMAGE_HOST_DOMAINS = [
'res.cloudinary.com',
'github.com',
process.env.NEXT_PUBLIC_HOST,
`image.mux.com`,
]

/**
Expand Down
1 change: 1 addition & 0 deletions apps/scriptkit/src/components/navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'},
{
Expand Down
3 changes: 3 additions & 0 deletions apps/scriptkit/src/lib/tips.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
})
Expand All @@ -33,6 +34,7 @@ export const getAllTips = async (): Promise<Tip[]> => {
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
Expand All @@ -53,6 +55,7 @@ export const getTip = async (slug: string): Promise<Tip> => {
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
Expand Down
7 changes: 4 additions & 3 deletions apps/scriptkit/src/pages/tips/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit c8d672e

Please sign in to comment.