-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
147 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { ConvexError, v } from 'convex/values'; | ||
|
||
import { mutation, query } from './_generated/server'; | ||
|
||
export const getAllTemplates = query({ | ||
handler: async (ctx) => { | ||
return await ctx.db.query('templates').collect(); | ||
}, | ||
}); | ||
|
||
export const createTemplate = mutation({ | ||
args: { | ||
name: v.string(), | ||
description: v.string(), | ||
createdBy: v.string(), | ||
image: v.id('_storage'), | ||
technology: v.optional(v.array(v.string())), | ||
link: v.string(), | ||
tags: v.optional(v.array(v.string())), | ||
isPaid: v.boolean(), | ||
}, | ||
handler: async (ctx, args) => { | ||
await ctx.db.insert('templates', { | ||
name: args.name, | ||
description: args.description, | ||
createdBy: args.createdBy, | ||
image: args.image, | ||
technology: args.technology, | ||
link: args.link, | ||
tags: args.tags, | ||
isPaid: args.isPaid, | ||
}); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
'use client'; | ||
|
||
import React from 'react'; | ||
|
||
import MaxWidthWrapper from '@/components/max-width-wrapper'; | ||
|
||
export default function BlogPage() { | ||
return ( | ||
<MaxWidthWrapper> | ||
<span className="text-2xl md:text-4xl font-bold">Blog</span> | ||
<div className="pb-6 pt-2 relative"></div> | ||
</MaxWidthWrapper> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,67 @@ | ||
'use client'; | ||
|
||
import React from 'react'; | ||
|
||
import Image from 'next/image'; | ||
import Link from 'next/link'; | ||
|
||
import MaxWidthWrapper from '@/components/max-width-wrapper'; | ||
import { Badge } from '@/components/ui/badge'; | ||
import { Card } from '@/components/ui/card'; | ||
import { api } from '@/convex/_generated/api'; | ||
import { Doc } from '@/convex/_generated/dataModel'; | ||
import { getImageUrl } from '@/lib/get-image-url'; | ||
import { useQuery } from 'convex/react'; | ||
|
||
function TemplateCard({ template }: { template: Doc<'templates'> }) { | ||
const imageUrl = getImageUrl(template.image); | ||
return ( | ||
<Card className="w-full rounded-xl shadow-sm hover:shadow-xl relative border-t-0 group sm:dark:hover:border-muted-foreground duration-200 transition-all"> | ||
<div className="relative"> | ||
<Link href={template.link} target="_blank"> | ||
<div> | ||
<div className="overflow-hidden rounded-xl border-t sm:dark:group-hover:border-muted-foreground duration-200 transition-all"> | ||
<Image | ||
src={imageUrl} | ||
alt={template.name} | ||
width={400} | ||
height={200} | ||
priority | ||
className="object-cover h-56 object-top w-full rounded-xl" | ||
/> | ||
</div> | ||
</div> | ||
<div className="p-4 text-start"> | ||
<h3 className="text-xl font-bold">{template.name}</h3> | ||
|
||
{template.tags && !template.tags.includes('') && ( | ||
<div className="flex gap-2 pt-2"> | ||
{template.tags.map((tag, idx) => ( | ||
<Badge variant="secondary" key={idx}> | ||
{tag} | ||
</Badge> | ||
))} | ||
</div> | ||
)} | ||
</div> | ||
</Link> | ||
</div> | ||
</Card> | ||
); | ||
} | ||
|
||
export default function TemplatesPage() { | ||
return <div>TemplatesPage</div>; | ||
const getAllTemplates = useQuery(api.templates.getAllTemplates); | ||
return ( | ||
<MaxWidthWrapper> | ||
<span className="text-2xl md:text-4xl font-bold">Templates</span> | ||
<div className="pb-6 pt-6 relative"> | ||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 lg:gap-6"> | ||
{getAllTemplates?.map((template) => ( | ||
<TemplateCard key={template._id} template={template} /> | ||
))} | ||
</div> | ||
</div> | ||
</MaxWidthWrapper> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters