UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.
dillion/github login (#10)
Dillion Vermae4403a54854a
diff --git a/app/(dashboard)/dashboard/settings/page.tsx b/app/(dashboard)/dashboard/settings/page.tsxindex 4914d21e..298d76fc 100644--- a/app/(dashboard)/dashboard/settings/page.tsx+++ b/app/(dashboard)/dashboard/settings/page.tsx@@ -1,6 +1,6 @@import { DashboardHeader } from "@/components/dashboard/header";import { DashboardShell } from "@/components/dashboard/shell";-import { UserNameForm } from "@/components/dashboard/user-name-form";+import { UserProfileForm } from "@/components/dashboard/user-profile-form";import { authOptions } from "@/lib/auth";import { getCurrentUser } from "@/lib/session";import { redirect } from "next/navigation";@@ -21,7 +21,7 @@ export default async function SettingsPage() {<DashboardShell><DashboardHeader heading="Settings" text="Manage account settings." /><div className="grid gap-10">- <UserNameForm user={{ id: user.id, name: user.name || "" }} />+ <UserProfileForm /></div></DashboardShell>);diff --git a/app/api/me/route.ts b/app/api/me/route.tsindex 8724f399..dea57c04 100644--- a/app/api/me/route.ts+++ b/app/api/me/route.ts@@ -21,6 +21,7 @@ export async function GET() {payments: true,},},+ accounts: true,},});diff --git a/app/api/repo/commits/route.ts b/app/api/repo/commits/route.tsnew file mode 100644index 00000000..0362418e--- /dev/null+++ b/app/api/repo/commits/route.ts@@ -0,0 +1,35 @@+import { NextRequest, NextResponse } from "next/server";+import { Octokit } from "octokit";+import { z } from "zod";++const octokit = new Octokit({+ auth: process.env.GITHUB_ACCESS_TOKEN,+});++const bodySchema = z.object({+ owner: z.string(),+ repo: z.string(),+});++export async function POST(request: NextRequest) {+ const body = await request.json();+ try {+ const { owner, repo } = bodySchema.parse(body);++ const response = await octokit.request(+ "GET /repos/{owner}/{repo}/commits",+ {+ owner,+ repo,+ per_page: 5,+ },+ );++ return NextResponse.json({ success: true, commits: response.data });+ } catch (error: any) {+ return NextResponse.json(+ { success: false, error: error.message },+ { status: 500 },+ );+ }+}diff --git a/app/api/repo/route.ts b/app/api/repo/download/route.tssimilarity index 87%rename from app/api/repo/route.tsrename to app/api/repo/download/route.tsindex a4260222..5bef5c78 100644--- a/app/api/repo/route.ts+++ b/app/api/repo/download/route.ts@@ -1,11 +1,7 @@+import { octokit } from "@/lib/octokit";import { NextRequest, NextResponse } from "next/server";-import { Octokit } from "octokit";import { z } from "zod";-const octokit = new Octokit({- auth: process.env.GITHUB_ACCESS_TOKEN,-});-const bodySchema = z.object({owner: z.string(),repo: z.string(),@@ -15,7 +11,6 @@ export async function POST(request: NextRequest) {const body = await request.json();try {const { owner, repo } = bodySchema.parse(body);-const response = await octokit.request("GET /repos/{owner}/{repo}/zipball",{@@ -28,7 +23,6 @@ export async function POST(request: NextRequest) {);const status = response.status;const downloadUrl = response.url;-return NextResponse.json({ success: true, status, downloadUrl });} catch (error: any) {return NextResponse.json(diff --git a/app/api/repo/invite/route.ts b/app/api/repo/invite/route.tsnew file mode 100644index 00000000..69559057--- /dev/null+++ b/app/api/repo/invite/route.ts@@ -0,0 +1,37 @@+import { octokit } from "@/lib/octokit";+import { NextRequest, NextResponse } from "next/server";+import { z } from "zod";++const bodySchema = z.object({+ owner: z.string(),+ repo: z.string(),+ username: z.string(),+});++export async function POST(request: NextRequest) {+ const body = await request.json();+ try {+ const { owner, repo, username } = bodySchema.parse(body);+ const response = await octokit.request(+ "PUT /repos/{owner}/{repo}/collaborators/{username}",+ {+ owner,+ repo,+ username,+ permission: "read",+ headers: {+ "X-GitHub-Api-Version": "2022-11-28",+ },+ },+ );++ const status = response.status;+ return NextResponse.json({ success: true, status });+ } catch (error: any) {+ console.log(error.response.data);+ return NextResponse.json(+ { success: false, error: error.message },+ { status: 500 },+ );+ }+}diff --git a/app/layout.tsx b/app/layout.tsxindex 65f28f8d..29fe7b53 100644--- a/app/layout.tsx+++ b/app/layout.tsx@@ -4,6 +4,7 @@ import { PHProvider } from "@/components/posthog-provider";import SessionProvider from "@/components/session-provider";import { ThemeProvider } from "@/components/theme-provider";import { Toaster } from "@/components/ui/sonner";+import { TooltipProvider } from "@/components/ui/tooltip";import { fontSans } from "@/lib/fonts";import { absoluteUrl, cn, constructMetadata } from "@/lib/utils";import "@/styles/globals.css";@@ -34,12 +35,14 @@ export default function RootLayout({<PHProvider><SessionProvider><ThemeProvider attribute="class" defaultTheme="dark" enableSystem>- {children}- <PosthogIdentify />+ <TooltipProvider>+ {children}+ <PosthogIdentify />- <Toaster />- <Analytics />- {/* <TailwindIndicator /> */}+ <Toaster />+ <Analytics />+ {/* <TailwindIndicator /> */}+ </TooltipProvider></ThemeProvider></SessionProvider></PHProvider>diff --git a/components/commit-list.tsx b/components/commit-list.tsxnew file mode 100644index 00000000..d315dacb--- /dev/null+++ b/components/commit-list.tsx@@ -0,0 +1,61 @@+"use client";++import { Badge } from "@/components/ui/badge";+import { formatDistanceToNow } from "date-fns";+import { useEffect, useState } from "react";+import { toast } from "sonner";++export default function CommitList({+ repo,+ owner,+}: {+ repo: string;+ owner: string;+}) {+ const [loading, setLoading] = useState(false);+ const [commits, setCommits] = useState<any[]>([]);++ useEffect(() => {+ const loadCommits = async () => {+ setLoading(true);+ try {+ const response = await fetch(+ `${process.env.NEXT_PUBLIC_APP_URL}/api/repo/commits`,+ {+ method: "POST",+ headers: {+ "Content-Type": "application/json",+ },+ body: JSON.stringify({ repo, owner }),+ },+ );+ if (!response.ok) {+ throw new Error(`HTTP error! status: ${response.status}`);+ }+ const data = await response.json();+ setCommits(data.commits);+ } catch (error) {+ toast.error("Error occurred while loading commits. Please try again.");+ console.error("error", error);+ } finally {+ setLoading(false);+ }+ };+ loadCommits();+ }, [repo, owner]);++ return (+ <ul>+ {commits.map((commit, index) => (+ <li key={index} className="not-prose">+ {commit?.commit?.message}{" "}+ <Badge className="ml-2">+ {formatDistanceToNow(new Date(commit?.commit?.author?.date), {+ addSuffix: true,+ })}+ </Badge>+ </li>+ ))}+ </ul>+ );+}diff --git a/components/dashboard/user-name-form.tsx b/components/dashboard/user-profile-form.tsxsimilarity index 66%rename from components/dashboard/user-name-form.tsxrename to components/dashboard/user-profile-form.tsxindex 8d587ca4..6af1fe2f 100644--- a/components/dashboard/user-name-form.tsx+++ b/components/dashboard/user-profile-form.tsx@@ -20,23 +20,32 @@ import {FormMessage,} from "@/components/ui/form";import { Input } from "@/components/ui/input";-import { toast } from "@/components/ui/use-toast";-import { cn } from "@/lib/utils";+import { cn, fetcher } from "@/lib/utils";import { userNameSchema } from "@/lib/validations/user";import { zodResolver } from "@hookform/resolvers/zod";-import { User } from "@prisma/client";+import { useSession } from "next-auth/react";import { useRouter } from "next/navigation";import { HTMLAttributes, useState } from "react";import { useForm } from "react-hook-form";+import { toast } from "sonner";+import useSWR from "swr";import * as z from "zod";-interface UserNameFormProps extends HTMLAttributes<HTMLFormElement> {- user: Pick<User, "id" | "name">;+interface UserProfileFormProps extends HTMLAttributes<HTMLFormElement> {+ // user: Pick<User, "id" | "name">;}type FormData = z.infer<typeof userNameSchema>;-export function UserNameForm({ user, className, ...props }: UserNameFormProps) {+export function UserProfileForm({ className, ...props }: UserProfileFormProps) {+ const { data: session, status } = useSession();+ const { data, isLoading } = useSWR(+ status === "authenticated" && "/api/me",+ fetcher,+ );++ const user = data?.user || null;+const router = useRouter();const form = useForm<FormData>({resolver: zodResolver(userNameSchema),@@ -49,7 +58,7 @@ export function UserNameForm({ user, className, ...props }: UserNameFormProps) {async function onSubmit(data: FormData) {setIsSaving(true);- const response = await fetch(`/api/users/${user.id}`, {+ const response = await fetch(`/api/users/${user?.id}`, {method: "PATCH",headers: {"Content-Type": "application/json",@@ -62,20 +71,22 @@ export function UserNameForm({ user, className, ...props }: UserNameFormProps) {setIsSaving(false);if (!response?.ok) {- return toast({- title: "Something went wrong.",- description: "Your name was not updated. Please try again.",- variant: "destructive",+ toast.error("Something went wrong.", {+ description: "Your profile was not updated. Please try again.",});}- toast({- description: "Your name has been updated.",- });+ toast.success("Your profile has been updated.");router.refresh();}+ if (status === "loading") return null;+ if (isLoading) return null;+ if (!user) return null;++ console.log(user);+return (<Form {...form}><form@@ -83,7 +94,7 @@ export function UserNameForm({ user, className, ...props }: UserNameFormProps) {onSubmit={form.handleSubmit(onSubmit)}{...props}>- <Card>+ <Card className="shadow-none"><CardHeader><CardTitle>Your Name</CardTitle><CardDescription>@@ -113,6 +124,20 @@ export function UserNameForm({ user, className, ...props }: UserNameFormProps) {)}/></div>++ {/* <Button+ type="button" // This already ensures the button does not trigger form submit+ className="gap-2"+ onClick={async (e) => {+ e.preventDefault(); // Explicitly prevent form submission+ await signIn("github", {+ callbackUrl: "/dashboard/settings",+ });+ }}+ >+ Connect to Github+ <GitHubLogoIcon className="h-4 w-4" />+ </Button> */}</CardContent><CardFooter><buttondiff --git a/components/github-invite.tsx b/components/github-invite.tsxnew file mode 100644index 00000000..f2e3e76d--- /dev/null+++ b/components/github-invite.tsx@@ -0,0 +1,60 @@+"use client";++import { Icons } from "@/components/icons";+import { Button } from "@/components/ui/button";+import { Download } from "lucide-react";+import { useState } from "react";+import { toast } from "sonner";++export default function GithubInvite({+ repo,+ owner,+ username,+}: {+ repo: string;+ owner: string;+ username: string;+}) {+ const [loading, setLoading] = useState(false);++ const handleDownload = async () => {+ setLoading(true);++ try {+ const response = await fetch(+ `${process.env.NEXT_PUBLIC_APP_URL}/api/repo/invite`,+ {+ method: "POST",+ headers: {+ "Content-Type": "application/json",+ },+ body: JSON.stringify({ repo, owner, username }),+ },+ );+ if (!response.ok) {+ throw new Error(`HTTP error! status: ${response.status}`);+ }+ const data = await response.json();+ console.log(data);+ } catch (error) {+ toast.error("Error occured while downloading. Please try again.");+ console.error("error", error);+ } finally {+ setLoading(false);+ }+ };++ return (+ <>+ <Button+ onClick={handleDownload}+ disabled={loading}+ className="not-prose group relative w-full gap-2"+ >+ {loading ? "Downloading" : "Download"}+ {!loading && <Download className="h-4 w-4" />}+ {loading && <Icons.spinner className="h-4 w-4 animate-spin" />}+ </Button>+ </>+ );+}diff --git a/components/landing/hero-client.tsx b/components/landing/hero-client.tsxindex 71fdb03c..6f432f48 100644--- a/components/landing/hero-client.tsx+++ b/components/landing/hero-client.tsx@@ -96,11 +96,12 @@ export default function HeroClient({type: "spring",}}>- Magic UI is the <strong>largest collection </strong> of- handcrafted animated components in the world{" "}- <strong>built for developers</strong>.<br />- Save thousands of hours, create a beautiful landing, and impress- your customers.+ Magic UI is a <strong>next generation UI library</strong>{" "}+ emphasizing <strong>microinteractions and animations</strong>{" "}+ built for developers.+ <br />+ Save thousands of hours, create a beautiful landing page, and+ impress your customers.</motion.p><motion.divdiff --git a/components/mdx-components.tsx b/components/mdx-components.tsxindex d13ddb00..574e4951 100644--- a/components/mdx-components.tsx+++ b/components/mdx-components.tsx@@ -1,5 +1,7 @@import { BlockPreview } from "@/components/block-preview";+import CommitList from "@/components/commit-list";import RepoDownload from "@/components/repo-download";+import TechStack from "@/components/tech-stack";import TemplatePreview from "@/components/template-preview";import {Accordion,@@ -40,6 +42,8 @@ const components = {AccordionContent,AccordionItem,AccordionTrigger,+ TechStack,+ CommitList,RepoDownload,TemplatePreview,h1: ({ className, ...props }: React.HTMLAttributes<HTMLHeadingElement>) => (@@ -116,10 +120,10 @@ const components = {/>),ul: ({ className, ...props }: React.HTMLAttributes<HTMLUListElement>) => (- <ul className={cn("my-6 ml-6 list-disc", className)} {...props} />+ <ul className={cn("my-6 list-disc", className)} {...props} />),ol: ({ className, ...props }: React.HTMLAttributes<HTMLOListElement>) => (- <ol className={cn("my-6 ml-6 list-decimal", className)} {...props} />+ <ol className={cn("my-6 list-decimal", className)} {...props} />),li: ({ className, ...props }: React.HTMLAttributes<HTMLElement>) => (<li className={cn("mt-2", className)} {...props} />diff --git a/components/repo-download.tsx b/components/repo-download.tsxindex 2c0145c3..d02ee9e5 100644--- a/components/repo-download.tsx+++ b/components/repo-download.tsx@@ -38,7 +38,7 @@ export default function RepoDownload({try {const response = await fetch(- `${process.env.NEXT_PUBLIC_APP_URL}/api/repo`,+ `${process.env.NEXT_PUBLIC_APP_URL}/api/repo/download`,{method: "POST",headers: {diff --git a/components/tech-stack.tsx b/components/tech-stack.tsxnew file mode 100644index 00000000..20683c54--- /dev/null+++ b/components/tech-stack.tsx@@ -0,0 +1,150 @@+import {+ Tooltip,+ TooltipContent,+ TooltipTrigger,+} from "@/components/ui/tooltip";++type TechComponentType = {+ name: string;+ icon: JSX.Element;+};++type TechComponents = Record<string, TechComponentType>;++const techComponents: TechComponents = {+ nextjs: {+ name: "Next.js 14",+ icon: (+ <svg+ role="img"+ viewBox="0 0 24 24"+ xmlns="http://www.w3.org/2000/svg"+ className="size-8"+ fill="currentColor"+ >+ <title>Next.js</title>+ <path d="M11.5725 0c-.1763 0-.3098.0013-.3584.0067-.0516.0053-.2159.021-.3636.0328-3.4088.3073-6.6017 2.1463-8.624 4.9728C1.1004 6.584.3802 8.3666.1082 10.255c-.0962.659-.108.8537-.108 1.7474s.012 1.0884.108 1.7476c.652 4.506 3.8591 8.2919 8.2087 9.6945.7789.2511 1.6.4223 2.5337.5255.3636.04 1.9354.04 2.299 0 1.6117-.1783 2.9772-.577 4.3237-1.2643.2065-.1056.2464-.1337.2183-.1573-.0188-.0139-.8987-1.1938-1.9543-2.62l-1.919-2.592-2.4047-3.5583c-1.3231-1.9564-2.4117-3.556-2.4211-3.556-.0094-.0026-.0187 1.5787-.0235 3.509-.0067 3.3802-.0093 3.5162-.0516 3.596-.061.115-.108.1618-.2064.2134-.075.0374-.1408.0445-.495.0445h-.406l-.1078-.068a.4383.4383 0 01-.1572-.1712l-.0493-.1056.0053-4.703.0067-4.7054.0726-.0915c.0376-.0493.1174-.1125.1736-.143.0962-.047.1338-.0517.5396-.0517.4787 0 .5584.0187.6827.1547.0353.0377 1.3373 1.9987 2.895 4.3608a10760.433 10760.433 0 004.7344 7.1706l1.9002 2.8782.096-.0633c.8518-.5536 1.7525-1.3418 2.4657-2.1627 1.5179-1.7429 2.4963-3.868 2.8247-6.134.0961-.6591.1078-.854.1078-1.7475 0-.8937-.012-1.0884-.1078-1.7476-.6522-4.506-3.8592-8.2919-8.2087-9.6945-.7672-.2487-1.5836-.42-2.4985-.5232-.169-.0176-1.0835-.0366-1.6123-.037zm4.0685 7.217c.3473 0 .4082.0053.4857.047.1127.0562.204.1642.237.2767.0186.061.0234 1.3653.0186 4.3044l-.0067 4.2175-.7436-1.14-.7461-1.14v-3.066c0-1.982.0093-3.0963.0234-3.1502.0375-.1313.1196-.2346.2323-.2955.0961-.0494.1313-.054.4997-.054z" />+ </svg>+ ),+ },+ react: {+ name: "React",+ icon: (+ <svg+ role="img"+ viewBox="0 0 32 32"+ xmlns="http://www.w3.org/2000/svg"+ className="size-8"+ fill="currentColor"+ >+ <title>React</title>+ <path d="m16 13.146c-1.573 0-2.854 1.281-2.854 2.854s1.281 2.854 2.854 2.854 2.854-1.281 2.854-2.854-1.281-2.854-2.854-2.854zm-7.99 8.526-.63-.156c-4.688-1.188-7.38-3.198-7.38-5.521s2.693-4.333 7.38-5.521l.63-.156.177.625c.474 1.635 1.083 3.229 1.818 4.771l.135.281-.135.286c-.734 1.536-1.344 3.13-1.818 4.771zm-.921-9.74c-3.563 1-5.75 2.536-5.75 4.063s2.188 3.057 5.75 4.063c.438-1.391.964-2.745 1.578-4.063-.615-1.318-1.141-2.672-1.578-4.063zm16.901 9.74-.177-.625c-.474-1.635-1.083-3.229-1.818-4.766l-.135-.286.135-.286c.734-1.536 1.344-3.13 1.818-4.771l.177-.62.63.156c4.688 1.188 7.38 3.198 7.38 5.521s-2.693 4.333-7.38 5.521zm-.657-5.677c.641 1.385 1.172 2.745 1.578 4.063 3.568-1.005 5.75-2.536 5.75-4.063s-2.188-3.057-5.75-4.063c-.438 1.385-.964 2.745-1.578 4.063zm-16.255-4.068-.177-.625c-1.318-4.646-.917-7.979 1.099-9.141 1.979-1.141 5.151.208 8.479 3.625l.453.464-.453.464c-1.182 1.229-2.26 2.552-3.229 3.958l-.182.255-.313.026c-1.703.135-3.391.406-5.047.813zm2.531-8.838c-.359 0-.677.073-.943.229-1.323.766-1.557 3.422-.646 7.005 1.422-.318 2.859-.542 4.313-.672.833-1.188 1.75-2.323 2.734-3.391-2.078-2.026-4.047-3.172-5.458-3.172zm12.787 27.145c-.005 0-.005 0 0 0-1.901 0-4.344-1.427-6.875-4.031l-.453-.464.453-.464c1.182-1.229 2.26-2.552 3.229-3.958l.177-.255.313-.031c1.703-.13 3.391-.401 5.052-.813l.63-.156.177.625c1.318 4.646.917 7.974-1.099 9.135-.49.281-1.042.422-1.604.411zm-5.464-4.505c2.078 2.026 4.047 3.172 5.458 3.172h.005c.354 0 .672-.078.938-.229 1.323-.766 1.563-3.422.646-7.005-1.422.318-2.865.542-4.313.667-.833 1.193-1.75 2.323-2.734 3.396zm7.99-13.802-.63-.161c-1.661-.406-3.349-.677-5.052-.813l-.313-.026-.177-.255c-.969-1.406-2.047-2.729-3.229-3.958l-.453-.464.453-.464c3.328-3.417 6.5-4.766 8.479-3.625 2.016 1.161 2.417 4.495 1.099 9.141zm-5.255-2.276c1.521.141 2.969.365 4.313.672.917-3.583.677-6.24-.646-7.005-1.318-.76-3.797.406-6.401 2.943.984 1.073 1.896 2.203 2.734 3.391zm-10.058 20.583c-.563.01-1.12-.13-1.609-.411-2.016-1.161-2.417-4.49-1.099-9.135l.177-.625.63.156c1.542.391 3.24.661 5.047.813l.313.031.177.255c.969 1.406 2.047 2.729 3.229 3.958l.453.464-.453.464c-2.526 2.604-4.969 4.031-6.865 4.031zm-1.588-8.567c-.917 3.583-.677 6.24.646 7.005 1.318.75 3.792-.406 6.401-2.943-.984-1.073-1.901-2.203-2.734-3.396-1.453-.125-2.891-.349-4.313-.667zm7.979.838c-1.099 0-2.224-.047-3.354-.141l-.313-.026-.182-.26c-.635-.917-1.24-1.859-1.797-2.828-.563-.969-1.078-1.958-1.557-2.969l-.135-.286.135-.286c.479-1.01.995-2 1.557-2.969.552-.953 1.156-1.906 1.797-2.828l.182-.26.313-.026c2.234-.188 4.479-.188 6.708 0l.313.026.182.26c1.276 1.833 2.401 3.776 3.354 5.797l.135.286-.135.286c-.953 2.021-2.073 3.964-3.354 5.797l-.182.26-.313.026c-1.125.094-2.255.141-3.354.141zm-2.927-1.448c1.969.151 3.885.151 5.859 0 1.099-1.609 2.078-3.302 2.927-5.063-.844-1.76-1.823-3.453-2.932-5.063-1.948-.151-3.906-.151-5.854 0-1.109 1.609-2.089 3.302-2.932 5.063.849 1.76 1.828 3.453 2.932 5.063z" />+ </svg>+ ),+ },+ typescript: {+ name: "Typescript ",+ icon: (+ <svg+ viewBox="0 0 32 32"+ xmlns="http://www.w3.org/2000/svg"+ className="size-8"+ fill="currentColor"+ >+ <path d="m0 16v16h32v-32h-32zm25.786-1.276c.813.203 1.432.568 2.005 1.156.292.312.729.885.766 1.026.01.042-1.38.974-2.224 1.495-.031.021-.156-.109-.292-.313-.411-.599-.844-.859-1.505-.906-.969-.063-1.594.443-1.589 1.292-.005.208.042.417.135.599.214.443.615.708 1.854 1.245 2.292.984 3.271 1.635 3.88 2.557.682 1.031.833 2.677.375 3.906-.51 1.328-1.771 2.234-3.542 2.531-.547.099-1.849.083-2.438-.026-1.286-.229-2.505-.865-3.255-1.698-.297-.323-.87-1.172-.833-1.229.016-.021.146-.104.292-.188s.682-.396 1.188-.688l.922-.536.193.286c.271.411.859.974 1.214 1.161 1.021.542 2.422.464 3.115-.156.281-.234.438-.594.417-.958 0-.37-.047-.536-.24-.813-.25-.354-.755-.656-2.198-1.281-1.651-.714-2.365-1.151-3.01-1.854-.406-.464-.708-1.01-.88-1.599-.12-.453-.151-1.589-.057-2.042.339-1.599 1.547-2.708 3.281-3.036.563-.109 1.875-.068 2.427.068zm-7.51 1.339.01 1.307h-4.167v11.839h-2.948v-11.839h-4.161v-1.281c0-.714.016-1.307.036-1.323.016-.021 2.547-.031 5.62-.026l5.594.016z" />+ </svg>+ ),+ },++ tailwindcss: {+ name: "Tailwind CSS",+ icon: (+ <svg+ role="img"+ viewBox="0 0 24 24"+ xmlns="http://www.w3.org/2000/svg"+ className="size-8"+ fill="currentColor"+ >+ <title>Tailwind CSS</title>+ <path d="m12.001 4.8c-3.2 0-5.2 1.6-6 4.8 1.2-1.6 2.6-2.2 4.2-1.8.913.228 1.565.89 2.288 1.624 1.177 1.194 2.538 2.576 5.512 2.576 3.2 0 5.2-1.6 6-4.8-1.2 1.6-2.6 2.2-4.2 1.8-.913-.228-1.565-.89-2.288-1.624-1.176-1.194-2.537-2.576-5.512-2.576zm-6 7.2c-3.2 0-5.2 1.6-6 4.8 1.2-1.6 2.6-2.2 4.2-1.8.913.228 1.565.89 2.288 1.624 1.177 1.194 2.538 2.576 5.512 2.576 3.2 0 5.2-1.6 6-4.8-1.2 1.6-2.6 2.2-4.2 1.8-.913-.228-1.565-.89-2.288-1.624-1.176-1.194-2.537-2.576-5.512-2.576z" />+ </svg>+ ),+ },+ framermotion: {+ name: "Framer Motion",+ icon: (+ <svg+ role="img"+ viewBox="0 0 24 24"+ xmlns="http://www.w3.org/2000/svg"+ className="size-8"+ fill="none"+ stroke="currentColor"+ strokeWidth="1"+ strokeLinecap="round"+ strokeLinejoin="round"+ >+ <title>Framer Motion</title>+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />+ <path d="M12 12l-8 -8v16l16 -16v16l-4 -4" />+ <path d="M20 12l-8 8l-4 -4" />+ </svg>+ ),+ },+ shadcn: {+ name: "shadcn",+ icon: (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 256 256"+ className="size-8"+ fill="none"+ stroke="currentColor"+ >+ {/* <rect width="256" height="256" fill="none"></rect> */}+ <line+ x1="208"+ y1="128"+ x2="128"+ y2="208"+ fill="none"+ stroke="currentColor"+ strokeLinecap="round"+ strokeLinejoin="round"+ strokeWidth="16"+ ></line>+ <line+ x1="192"+ y1="40"+ x2="40"+ y2="192"+ fill="none"+ stroke="currentColor"+ strokeLinecap="round"+ strokeLinejoin="round"+ strokeWidth="16"+ ></line>+ </svg>+ ),+ },+};++export default function TechStack({+ technologies,+}: {+ technologies: string[];+}) {+ return (+ <div className="not-prose flex flex-row gap-2">+ {technologies.map((tech) => (+ <Tooltip key={tech}>+ <TooltipTrigger>{techComponents[tech].icon}</TooltipTrigger>+ <TooltipContent>+ <p>{techComponents[tech].name}</p>+ </TooltipContent>+ </Tooltip>+ ))}+ </div>+ );+}diff --git a/components/ui/hover-card.tsx b/components/ui/hover-card.tsxnew file mode 100644index 00000000..e54d91cf--- /dev/null+++ b/components/ui/hover-card.tsx@@ -0,0 +1,29 @@+"use client"++import * as React from "react"+import * as HoverCardPrimitive from "@radix-ui/react-hover-card"++import { cn } from "@/lib/utils"++const HoverCard = HoverCardPrimitive.Root++const HoverCardTrigger = HoverCardPrimitive.Trigger++const HoverCardContent = React.forwardRef<+ React.ElementRef<typeof HoverCardPrimitive.Content>,+ React.ComponentPropsWithoutRef<typeof HoverCardPrimitive.Content>+>(({ className, align = "center", sideOffset = 4, ...props }, ref) => (+ <HoverCardPrimitive.Content+ ref={ref}+ align={align}+ sideOffset={sideOffset}+ className={cn(+ "z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",+ className+ )}+ {...props}+ />+))+HoverCardContent.displayName = HoverCardPrimitive.Content.displayName++export { HoverCard, HoverCardTrigger, HoverCardContent }diff --git a/components/ui/tooltip.tsx b/components/ui/tooltip.tsxnew file mode 100644index 00000000..9e748210--- /dev/null+++ b/components/ui/tooltip.tsx@@ -0,0 +1,30 @@+"use client"++import * as React from "react"+import * as TooltipPrimitive from "@radix-ui/react-tooltip"++import { cn } from "@/lib/utils"++const TooltipProvider = TooltipPrimitive.Provider++const Tooltip = TooltipPrimitive.Root++const TooltipTrigger = TooltipPrimitive.Trigger++const TooltipContent = React.forwardRef<+ React.ElementRef<typeof TooltipPrimitive.Content>,+ React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>+>(({ className, sideOffset = 4, ...props }, ref) => (+ <TooltipPrimitive.Content+ ref={ref}+ sideOffset={sideOffset}+ className={cn(+ "z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",+ className+ )}+ {...props}+ />+))+TooltipContent.displayName = TooltipPrimitive.Content.displayName++export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }diff --git a/content/docs/templates/startup.mdx b/content/docs/templates/startup.mdxindex d25da63f..3296bc65 100644--- a/content/docs/templates/startup.mdx+++ b/content/docs/templates/startup.mdx@@ -23,33 +23,35 @@ published: true</div>-### What is this?--A complete landing page template to launch a new project or idea (frontend only).-Uses the latest frontend technologies and best practices to unblock you and delight your customers.+### What is this?+A complete landing page template to launch a new project or idea (frontend only). Uses the latest frontend technologies and best practices to unblock you and delight your customers.-- Next.js-- Tailwindcss-- Framer Motion-- Magic UI-- shadcn### Who is this for?--You are an indiehacker, bootstrapper, YC startup, solopreneur, VC-backed startup, developer, or student.--You are thinking about launching a new idea or already have a prototype. Maybe it's an AI SaaS, a crazy drone robot company, or just a simple digital product.--But... you dread the idea of learning react or anything frontend 😩+You are an indiehacker, bootstrapper, YC startup, solopreneur, VC-backed startup, developer, or student. You are thinking about launching a new idea or already have a prototype. Maybe it's an AI SaaS, a crazy drone robot company, or just a simple digital product. But... you dread the idea of learning react or anything frontend 😩**This template is exactly what you're looking for.**### Why should I use this?-+- ✅ Save 100+ hours of work+- ✅ No need to learn advnaced animations+- ✅ Easy to configure and change- ✅ 1-click download and setup.- ✅ 5 minutes to update the text and images.-- ✅ Deploy live to vercel.-- ✅ More time to actually build your product instead of figuring out how to center a div.--{/* ### Features */}+- ✅ Deploy live to vercel++### Features+- Header Section+- Hero Section+- Social Proof Section+- Pricing Section+- Call To Action Section+- Footer Section+- Mobile Reponsive Navbar++### Tech Stack+<TechStack technologies={["nextjs", "react", "typescript", "tailwindcss", "framermotion", "shadcn" ]}/ >++### Changelog+<CommitList repo='startup-template' owner='dillionverma' />diff --git a/lib/auth.ts b/lib/auth.tsindex 97cb16ef..a540e802 100644--- a/lib/auth.ts+++ b/lib/auth.ts@@ -3,6 +3,7 @@ import { EMAIL_FROM } from "@/lib/emails/constants";import { PrismaAdapter } from "@next-auth/prisma-adapter";import { NextAuthOptions } from "next-auth";import EmailProvider from "next-auth/providers/email";+import GitHubProvider, { GithubProfile } from "next-auth/providers/github";import posthog from "posthog-js";import { sendLoginEmail } from "./emails/send-login-email";import { upsertCustomer } from "./stripe-utils";@@ -13,7 +14,22 @@ export const authOptions: NextAuthOptions = {pages: {signIn: "/login",},+providers: [+ GitHubProvider({+ clientId: process.env.GITHUB_ID!,+ clientSecret: process.env.GITHUB_SECRET!,+ allowDangerousEmailAccountLinking: true,+ profile(profile: GithubProfile) {+ return {+ id: profile.id.toString(),+ name: profile.name,+ userName: profile.login,+ email: profile.email,+ image: profile.avatar_url,+ };+ },+ }),EmailProvider({type: "email",server: "",diff --git a/lib/octokit.ts b/lib/octokit.tsnew file mode 100644index 00000000..df0028cf--- /dev/null+++ b/lib/octokit.ts@@ -0,0 +1,5 @@+import { Octokit } from "octokit";++export const octokit = new Octokit({+ auth: process.env.GITHUB_ACCESS_TOKEN,+});diff --git a/package.json b/package.jsonindex 001eda6f..93d3fe66 100644--- a/package.json+++ b/package.json@@ -34,6 +34,7 @@"@radix-ui/react-collapsible": "^1.0.3","@radix-ui/react-dialog": "^1.0.5","@radix-ui/react-dropdown-menu": "^2.0.5",+ "@radix-ui/react-hover-card": "^1.0.7","@radix-ui/react-icons": "^1.3.0","@radix-ui/react-label": "^2.0.2","@radix-ui/react-scroll-area": "^1.0.5",@@ -42,6 +43,7 @@"@radix-ui/react-switch": "^1.0.3","@radix-ui/react-tabs": "^1.0.4","@radix-ui/react-toast": "^1.1.4",+ "@radix-ui/react-tooltip": "^1.0.7","@react-email/body": "0.0.2","@react-email/button": "0.0.9","@react-email/column": "^0.0.7",diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 3ad69462..5f2f363e 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -41,6 +41,9 @@ dependencies:'@radix-ui/react-dropdown-menu':specifier: ^2.0.5version: 2.0.6(@types/[email protected])(@types/[email protected])([email protected])([email protected])+ '@radix-ui/react-hover-card':+ specifier: ^1.0.7+ version: 1.0.7(@types/[email protected])(@types/[email protected])([email protected])([email protected])'@radix-ui/react-icons':specifier: ^1.3.0version: 1.3.0([email protected])@@ -65,6 +68,9 @@ dependencies:'@radix-ui/react-toast':specifier: ^1.1.4version: 1.1.5(@types/[email protected])(@types/[email protected])([email protected])([email protected])+ '@radix-ui/react-tooltip':+ specifier: ^1.0.7+ version: 1.0.7(@types/[email protected])(@types/[email protected])([email protected])([email protected])'@react-email/body':specifier: 0.0.2version: 0.0.2@@ -3936,6 +3942,35 @@ packages:react-dom: 18.2.0([email protected])dev: false+ /@radix-ui/[email protected](@types/[email protected])(@types/[email protected])([email protected])([email protected]):+ resolution: {integrity: sha512-OcUN2FU0YpmajD/qkph3XzMcK/NmSk9hGWnjV68p6QiZMgILugusgQwnLSDs3oFSJYGKf3Y49zgFedhGh04k9A==}+ peerDependencies:+ '@types/react': '*'+ '@types/react-dom': '*'+ react: ^16.8 || ^17.0 || ^18.0+ react-dom: ^16.8 || ^17.0 || ^18.0+ peerDependenciesMeta:+ '@types/react':+ optional: true+ '@types/react-dom':+ optional: true+ dependencies:+ '@babel/runtime': 7.24.0+ '@radix-ui/primitive': 1.0.1+ '@radix-ui/react-compose-refs': 1.0.1(@types/[email protected])([email protected])+ '@radix-ui/react-context': 1.0.1(@types/[email protected])([email protected])+ '@radix-ui/react-dismissable-layer': 1.0.5(@types/[email protected])(@types/[email protected])([email protected])([email protected])+ '@radix-ui/react-popper': 1.1.3(@types/[email protected])(@types/[email protected])([email protected])([email protected])+ '@radix-ui/react-portal': 1.0.4(@types/[email protected])(@types/[email protected])([email protected])([email protected])+ '@radix-ui/react-presence': 1.0.1(@types/[email protected])(@types/[email protected])([email protected])([email protected])+ '@radix-ui/react-primitive': 1.0.3(@types/[email protected])(@types/[email protected])([email protected])([email protected])+ '@radix-ui/react-use-controllable-state': 1.0.1(@types/[email protected])([email protected])+ '@types/react': 18.2.12+ '@types/react-dom': 18.2.5+ react: 18.2.0+ react-dom: 18.2.0([email protected])+ dev: false+/@radix-ui/[email protected]([email protected]):resolution: {integrity: sha512-jQxj/0LKgp+j9BiTXz3O3sgs26RNet2iLWmsPyRz2SIcR4q/4SbazXfnYwbAr+vLYKSfc7qxzyGQA1HLlYiuNw==}peerDependencies:@@ -4350,6 +4385,38 @@ packages:react-dom: 18.2.0([email protected])dev: false+ /@radix-ui/[email protected](@types/[email protected])(@types/[email protected])([email protected])([email protected]):+ resolution: {integrity: sha512-lPh5iKNFVQ/jav/j6ZrWq3blfDJ0OH9R6FlNUHPMqdLuQ9vwDgFsRxvl8b7Asuy5c8xmoojHUxKHQSOAvMHxyw==}+ peerDependencies:+ '@types/react': '*'+ '@types/react-dom': '*'+ react: ^16.8 || ^17.0 || ^18.0+ react-dom: ^16.8 || ^17.0 || ^18.0+ peerDependenciesMeta:+ '@types/react':+ optional: true+ '@types/react-dom':+ optional: true+ dependencies:+ '@babel/runtime': 7.24.0+ '@radix-ui/primitive': 1.0.1+ '@radix-ui/react-compose-refs': 1.0.1(@types/[email protected])([email protected])+ '@radix-ui/react-context': 1.0.1(@types/[email protected])([email protected])+ '@radix-ui/react-dismissable-layer': 1.0.5(@types/[email protected])(@types/[email protected])([email protected])([email protected])+ '@radix-ui/react-id': 1.0.1(@types/[email protected])([email protected])+ '@radix-ui/react-popper': 1.1.3(@types/[email protected])(@types/[email protected])([email protected])([email protected])+ '@radix-ui/react-portal': 1.0.4(@types/[email protected])(@types/[email protected])([email protected])([email protected])+ '@radix-ui/react-presence': 1.0.1(@types/[email protected])(@types/[email protected])([email protected])([email protected])+ '@radix-ui/react-primitive': 1.0.3(@types/[email protected])(@types/[email protected])([email protected])([email protected])+ '@radix-ui/react-slot': 1.0.2(@types/[email protected])([email protected])+ '@radix-ui/react-use-controllable-state': 1.0.1(@types/[email protected])([email protected])+ '@radix-ui/react-visually-hidden': 1.0.3(@types/[email protected])(@types/[email protected])([email protected])([email protected])+ '@types/react': 18.2.12+ '@types/react-dom': 18.2.5+ react: 18.2.0+ react-dom: 18.2.0([email protected])+ dev: false+/@radix-ui/[email protected]([email protected]):resolution: {integrity: sha512-GZtyzoHz95Rhs6S63D2t/eqvdFCm7I+yHMLVQheKM7nBD8mbZIt+ct1jz4536MDnaOGKIxynJ8eHTkVGVVkoTg==}peerDependencies:diff --git a/registry/components/magicui/text-reveal.tsx b/registry/components/magicui/text-reveal.tsxindex fdc6af77..23f6c4b9 100644--- a/registry/components/magicui/text-reveal.tsx+++ b/registry/components/magicui/text-reveal.tsx@@ -6,22 +6,12 @@ import { FC, ReactNode, useRef } from "react";interface TextRevealByWordProps {text: string;- containerClassName?: string;- stickyClassName?: string;- paragraphContainerClassName?: string;- paragraphClassName?: string;- defaultTextOpacityClassName?: string;- highlightedWordClassName?: string;+ className?: string;}export const TextRevealByWord: FC<TextRevealByWordProps> = ({text,- containerClassName,- stickyClassName,- paragraphContainerClassName,- paragraphClassName,- defaultTextOpacityClassName,- highlightedWordClassName,+ className,}) => {const targetRef = useRef<HTMLDivElement | null>(null);@@ -31,46 +21,28 @@ export const TextRevealByWord: FC<TextRevealByWordProps> = ({const words = text.split(" ");return (- <div- ref={targetRef}- className={cn("relative z-0 h-[200vh]", containerClassName)}- >+ <div ref={targetRef} className={cn("relative z-0 h-[200vh]", className)}><div- className={cn(- "sticky top-0 flex h-[50%] items-center bg-transparent px-0 py-[5rem]",- stickyClassName,- )}+ className={+ "sticky top-0 mx-auto flex h-[50%] max-w-4xl items-center bg-transparent px-[1rem] py-[5rem]"+ }>- <div- className={cn(- "mx-auto max-w-4xl px-[1rem]",- paragraphContainerClassName,- )}+ <p+ ref={targetRef}+ className={+ "flex flex-wrap p-5 text-2xl font-bold text-black/20 dark:text-white/20 md:p-8 md:text-3xl lg:p-10 lg:text-4xl xl:text-5xl"+ }>- <p- ref={targetRef}- className={cn(- "flex flex-wrap p-5 text-2xl font-bold text-black/20 dark:text-white/20 md:p-8 md:text-3xl lg:p-10 lg:text-4xl xl:text-5xl",- paragraphClassName,- )}- >- {words.map((word, i) => {- const start = i / words.length;- const end = start + 1 / words.length;- return (- <Word- key={i}- progress={scrollYProgress}- range={[start, end]}- defaultTextOpacityClassName={defaultTextOpacityClassName}- highlightedWordClassName={highlightedWordClassName}- >- {word}- </Word>- );- })}- </p>- </div>+ {words.map((word, i) => {+ const start = i / words.length;+ const end = start + 1 / words.length;+ return (+ <Word key={i} progress={scrollYProgress} range={[start, end]}>+ {word}+ </Word>+ );+ })}+ </p></div></div>);@@ -80,26 +52,16 @@ interface WordProps {children: ReactNode;progress: any;range: [number, number];- defaultTextOpacityClassName?: string;- highlightedWordClassName?: string;}-const Word: FC<WordProps> = ({- children,- progress,- range,- defaultTextOpacityClassName,- highlightedWordClassName,-}) => {+const Word: FC<WordProps> = ({ children, progress, range }) => {const opacity = useTransform(progress, range, [0, 1]);return (<span className="xl:lg-3 relative mx-1 lg:mx-2.5">- <span className={cn("absolute opacity-30", defaultTextOpacityClassName)}>- {children}- </span>+ <span className={"absolute opacity-30"}>{children}</span><motion.spanstyle={{ opacity: opacity }}- className={cn("text-black dark:text-white", highlightedWordClassName)}+ className={"text-black dark:text-white"}>{children}</motion.span>