Skip to content

Commit

Permalink
build: fixing ubild issues
Browse files Browse the repository at this point in the history
  • Loading branch information
wildduck2 committed Aug 14, 2024
1 parent 115efc4 commit 4be19b1
Show file tree
Hide file tree
Showing 98 changed files with 7,860 additions and 2,277 deletions.
File renamed without changes.
3 changes: 3 additions & 0 deletions docs/www/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
build/
./**.tsx
23 changes: 11 additions & 12 deletions docs/www/actions/edit-in-v0.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use server"
'use server'

import { track } from "@vercel/analytics/server"
import { track } from '@vercel/analytics/server'

const EDIT_IN_V0_SOURCE = "ui.shadcn.com"
const EDIT_IN_V0_SOURCE = 'ui.shadcn.com'

export async function editInV0({
name,
Expand All @@ -16,33 +16,32 @@ export async function editInV0({
code: string
}) {
try {
await track("edit_in_v0", {
await track('edit_in_v0', {
name,
description,
style,
})

// Replace "use client" in the code.
// v0 will handle this for us.
code = code.replace(`"use client"`, "")
code = code.replace(`"use client"`, '')

const response = await fetch(`${process.env.V0_URL}/api/edit`, {
method: "POST",
method: 'POST',
body: JSON.stringify({ description, code, source: EDIT_IN_V0_SOURCE }),
headers: {
"x-v0-edit-secret": process.env.V0_EDIT_SECRET!,
"x-vercel-protection-bypass":
process.env.DEPLOYMENT_PROTECTION_BYPASS || "not-set",
"Content-Type": "application/json",
'x-v0-edit-secret': process.env.V0_EDIT_SECRET!,
'x-vercel-protection-bypass': process.env.DEPLOYMENT_PROTECTION_BYPASS || 'not-set',
'Content-Type': 'application/json',
},
})

if (!response.ok) {
if (response.status === 403) {
throw new Error("Unauthorized")
throw new Error('Unauthorized')
}

throw new Error("Something went wrong. Please try again later.")
throw new Error('Something went wrong. Please try again later.')
}

const result = await response.json()
Expand Down
56 changes: 25 additions & 31 deletions docs/www/app/(app)/docs/[[...slug]]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import { notFound } from "next/navigation"
import { allDocs } from "contentlayer/generated"
import { notFound } from 'next/navigation'
import { allDocs } from 'contentlayer/generated'

import "@/styles/mdx.css"
import type { Metadata } from "next"
import Link from "next/link"
import { ChevronRightIcon, ExternalLinkIcon } from "@radix-ui/react-icons"
import Balancer from "react-wrap-balancer"
import '@/styles/mdx.css'
import type { Metadata } from 'next'
import Link from 'next/link'
import { ChevronRightIcon, ExternalLinkIcon } from '@radix-ui/react-icons'
import Balancer from 'react-wrap-balancer'

import { siteConfig } from "@/config/site"
import { getTableOfContents } from "@/lib/toc"
import { absoluteUrl, cn } from "@/lib/utils"
import { Mdx } from "@/components/mdx-components"
import { DocsPager } from "@/components/pager"
import { DashboardTableOfContents } from "@/components/toc"
import { badgeVariants } from "@/registry/default/ui/"
import { ScrollArea } from "@/registry/default/ui/"
import { siteConfig } from '@/config/site'
import { getTableOfContents } from '@/lib/toc'
import { absoluteUrl, cn } from '@/lib/utils'
import { Mdx } from '@/components/mdx-components'
import { DocsPager } from '@/components/pager'
import { DashboardTableOfContents } from '@/components/toc'
import { badgeVariants } from '@/registry/default/ui/'
import { ScrollArea } from '@/registry/default/ui/'

interface DocPageProps {
params: {
Expand All @@ -23,7 +23,7 @@ interface DocPageProps {
}

async function getDocFromParams({ params }: DocPageProps) {
const slug = params.slug?.join("/") || ""
const slug = params.slug?.join('/') || ''
const doc = allDocs.find((doc) => doc.slugAsParams === slug)

if (!doc) {
Expand All @@ -33,9 +33,7 @@ async function getDocFromParams({ params }: DocPageProps) {
return doc
}

export async function generateMetadata({
params,
}: DocPageProps): Promise<Metadata> {
export async function generateMetadata({ params }: DocPageProps): Promise<Metadata> {
const doc = await getDocFromParams({ params })

if (!doc) {
Expand All @@ -48,7 +46,7 @@ export async function generateMetadata({
openGraph: {
title: doc.title,
description: doc.description,
type: "article",
type: 'article',
url: absoluteUrl(doc.slug),
images: [
{
Expand All @@ -60,20 +58,18 @@ export async function generateMetadata({
],
},
twitter: {
card: "summary_large_image",
card: 'summary_large_image',
title: doc.title,
description: doc.description,
images: [siteConfig.ogImage],
creator: "@shadcn",
creator: '@shadcn',
},
}
}

export async function generateStaticParams(): Promise<
DocPageProps["params"][]
> {
export async function generateStaticParams(): Promise<DocPageProps['params'][]> {
return allDocs.map((doc) => ({
slug: doc.slugAsParams.split("/"),
slug: doc.slugAsParams.split('/'),
}))
}

Expand All @@ -95,9 +91,7 @@ export default async function DocPage({ params }: DocPageProps) {
<div className="text-foreground">{doc.title}</div>
</div>
<div className="space-y-2">
<h1 className={cn("scroll-m-20 text-3xl font-bold tracking-tight")}>
{doc.title}
</h1>
<h1 className={cn('scroll-m-20 text-3xl font-bold tracking-tight')}>{doc.title}</h1>
{doc.description && (
<p className="text-base text-muted-foreground">
<Balancer>{doc.description}</Balancer>
Expand All @@ -111,7 +105,7 @@ export default async function DocPage({ params }: DocPageProps) {
href={doc.links.doc}
target="_blank"
rel="noreferrer"
className={cn(badgeVariants({ variant: "secondary" }), "gap-1")}
className={cn(badgeVariants({ variant: 'secondary' }), 'gap-1')}
>
Docs
<ExternalLinkIcon className="h-3 w-3" />
Expand All @@ -122,7 +116,7 @@ export default async function DocPage({ params }: DocPageProps) {
href={doc.links.api}
target="_blank"
rel="noreferrer"
className={cn(badgeVariants({ variant: "secondary" }), "gap-1")}
className={cn(badgeVariants({ variant: 'secondary' }), 'gap-1')}
>
API Reference
<ExternalLinkIcon className="h-3 w-3" />
Expand Down
6 changes: 3 additions & 3 deletions docs/www/app/(app)/docs/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { docsConfig } from "@/config/docs"
import { DocsSidebarNav } from "@/components/sidebar-nav"
import { ScrollArea } from "@/registry/default/ui/"
import { docsConfig } from '@/config/docs'
import { DocsSidebarNav } from '@/components/sidebar-nav'
import { ScrollArea } from '@/registry/default/ui/'

interface DocsLayoutProps {
children: React.ReactNode
Expand Down
4 changes: 2 additions & 2 deletions docs/www/app/(app)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SiteFooter } from "@/components/site-footer"
import { SiteHeader } from "@/components/site-header"
import { SiteFooter } from '@/components/site-footer'
import { SiteHeader } from '@/components/site-header'

interface AppLayoutProps {
children: React.ReactNode
Expand Down
8 changes: 4 additions & 4 deletions docs/www/app/(app)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import { PageActions, PageHeader, PageHeaderDescription, PageHeaderHeading } fro
import { buttonVariants } from '@/registry/default/ui/'
import { CopyButton } from '@/components/copy-button'
import { toast } from 'sonner'
import { ThemeWrapper } from '@/components/theme-wrapper'
import { ThemeCustomizer } from '@/components/theme-customizer'
import { ThemesTabs } from './themes/tabs'
import { Announcement } from '@/components/announcement'
// import { ThemeWrapper } from '@/components/theme-wrapper'
// import { ThemeCustomizer } from '@/components/theme-customizer'
// import { ThemesTabs } from './themes/tabs'
// import { Announcement } from '@/components/announcement'

export default function IndexPage() {
return (
Expand Down
6 changes: 3 additions & 3 deletions docs/www/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import { fontSans } from '@/lib/fonts'
import { cn } from '@/lib/utils'
import { Analytics } from '@/components/analytics'
import { ThemeProvider } from '@/components/providers'
import { TailwindIndicator } from '@/components/tailwind-indicator'
// import { TailwindIndicator } from '@/components/tailwind-indicator'
import { ThemeSwitcher } from '@/components/theme-switcher'
import { Toaster as DefaultToaster } from '@/registry/default/ui/'
// import { Toaster as DefaultToaster } from '@/registry/default/ui/'
import { Toaster as DefaultSonner } from '@/registry/default/ui/'
import { Toaster as NewYorkToaster } from '@/registry/default/ui/'
// import { Toaster as NewYorkToaster } from '@/registry/default/ui/'

export const metadata: Metadata = {
title: {
Expand Down
4 changes: 2 additions & 2 deletions docs/www/components/analytics.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client"
'use client'

import { Analytics as VercelAnalytics } from "@vercel/analytics/react"
import { Analytics as VercelAnalytics } from '@vercel/analytics/react'

export function Analytics() {
return <VercelAnalytics />
Expand Down
19 changes: 10 additions & 9 deletions docs/www/components/announcement.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import Link from "next/link"
import { ArrowRightIcon } from "@radix-ui/react-icons"
import { Blocks, PieChart } from "lucide-react"
import Link from 'next/link'
import { ArrowRightIcon } from '@radix-ui/react-icons'
import { Blocks, PieChart } from 'lucide-react'

import { Separator } from "@/registry/default/ui/"
import { Separator } from '@/registry/default/ui/'

export function Announcement() {
return (
<Link
href="/docs/components/chart"
className="group inline-flex items-center px-0.5 text-sm font-medium"
>
<PieChart className="h-4 w-4" />{" "}
<Separator className="mx-2 h-4" orientation="vertical" />{" "}
<span className="underline-offset-4 group-hover:underline">
Introducing Charts
</span>
<PieChart className="h-4 w-4" />{' '}
<Separator
className="mx-2 h-4"
orientation="vertical"
/>{' '}
<span className="underline-offset-4 group-hover:underline">Introducing Charts</span>
<ArrowRightIcon className="ml-1 h-4 w-4" />
</Link>
)
Expand Down
27 changes: 12 additions & 15 deletions docs/www/components/block-chunk.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"use client"
'use client'

import * as React from "react"
import { AnimatePresence, motion } from "framer-motion"
import * as React from 'react'
import { AnimatePresence, motion } from 'framer-motion'

import { cn } from "@/lib/utils"
import { useLiftMode } from "@/hooks/use-lift-mode"
import { BlockCopyButton } from "@/components/block-copy-button"
import { V0Button } from "@/components/v0-button"
import { Block, type BlockChunk } from "@/registry/schema"
import { cn } from '@/lib/utils'
import { useLiftMode } from '@/hooks/use-lift-mode'
import { BlockCopyButton } from '@/components/block-copy-button'
import { V0Button } from '@/components/v0-button'
import { Block, type BlockChunk } from '@/registry/schema'

export function BlockChunk({
block,
Expand All @@ -29,12 +29,9 @@ export function BlockChunk({
x-chunk-container={chunk.name}
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0, transition: { ease: "easeOut", duration: 0.2 } }}
transition={{ ease: "easeIn", duration: 0.2 }}
className={cn(
"group rounded-xl bg-background shadow-xl transition",
chunk.container?.className
)}
exit={{ opacity: 0, transition: { ease: 'easeOut', duration: 0.2 } }}
transition={{ ease: 'easeIn', duration: 0.2 }}
className={cn('group rounded-xl bg-background shadow-xl transition', chunk.container?.className)}
{...props}
>
<div className="relative z-30">{children}</div>
Expand All @@ -50,7 +47,7 @@ export function BlockChunk({
size="icon"
block={{
name: chunk.name,
description: chunk.description || "",
description: chunk.description || '',
code: chunk.code,
style: block.style,
}}
Expand Down
25 changes: 9 additions & 16 deletions docs/www/components/block-copy-button.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
"use client"
'use client'

import * as React from "react"
import { CheckIcon, ClipboardIcon } from "lucide-react"
import * as React from 'react'
import { CheckIcon, ClipboardIcon } from 'lucide-react'

import { Event, trackEvent } from "@/lib/events"
import { cn } from "@/lib/utils"
import { Button, ButtonProps } from "@/registry/default/ui"
import {
Tooltip,
TooltipContent,
TooltipTrigger,
} from "@/registry/default/ui"
import { Event, trackEvent } from '@/lib/events'
import { cn } from '@/lib/utils'
import { Button, ButtonProps } from '@/registry/default/ui'
import { Tooltip, TooltipContent, TooltipTrigger } from '@/registry/default/ui'

export function BlockCopyButton({
event,
Expand All @@ -19,7 +15,7 @@ export function BlockCopyButton({
className,
...props
}: {
event: Event["name"]
event: Event['name']
name: string
code: string
} & ButtonProps) {
Expand All @@ -37,10 +33,7 @@ export function BlockCopyButton({
<Button
size="icon"
variant="outline"
className={cn(
"[&_svg]-h-3.5 h-7 w-7 rounded-[6px] [&_svg]:w-3.5",
className
)}
className={cn('[&_svg]-h-3.5 h-7 w-7 rounded-[6px] [&_svg]:w-3.5', className)}
onClick={() => {
navigator.clipboard.writeText(code)
trackEvent({
Expand Down
13 changes: 8 additions & 5 deletions docs/www/components/block-display.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getBlock } from "@/lib/blocks"
import { BlockPreview } from "@/components/block-preview"
import { styles } from "@/registry/styles"
import { getBlock } from '@/lib/blocks'
import { BlockPreview } from '@/components/block-preview'
import { styles } from '@/registry/styles'

export async function BlockDisplay({ name }: { name: string }) {
const blocks = await Promise.all(
Expand All @@ -16,14 +16,17 @@ export async function BlockDisplay({ name }: { name: string }) {
...block,
hasLiftMode,
}
})
}),
)

if (!blocks?.length) {
return null
}

return blocks.map((block) => (
<BlockPreview key={`${block.style}-${block.name}`} block={block} />
<BlockPreview
key={`${block.style}-${block.name}`}
block={block}
/>
))
}
Loading

0 comments on commit 4be19b1

Please sign in to comment.