Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix: Minor fixes for UI Library (#34535)

Ivan Vasilov156e8fd9b724
diff --git a/apps/ui-library/__registry__/index.tsx b/apps/ui-library/__registry__/index.tsx
index 99400b2c1a6..84127d56e42 100644
--- a/apps/ui-library/__registry__/index.tsx
+++ b/apps/ui-library/__registry__/index.tsx
@@ -58,7 +58,7 @@ export const Index: Record<string, any> = {
"dropzone-nextjs": {
name: "dropzone-nextjs",
type: "registry:component",
- registryDependencies: ["button","tooltip","progress"],
+ registryDependencies: ["button"],
component: React.lazy(() => import("@/registry/default/blocks/dropzone/components/dropzone.tsx")),
source: "",
files: ["registry/default/blocks/dropzone/components/dropzone.tsx","registry/default/blocks/dropzone/hooks/use-supabase-upload.ts","registry/default/clients/nextjs/lib/supabase/client.ts","registry/default/clients/nextjs/lib/supabase/middleware.ts","registry/default/clients/nextjs/lib/supabase/server.ts"],
@@ -70,7 +70,7 @@ export const Index: Record<string, any> = {
"dropzone-react": {
name: "dropzone-react",
type: "registry:component",
- registryDependencies: ["button","tooltip","progress"],
+ registryDependencies: ["button"],
component: React.lazy(() => import("@/registry/default/blocks/dropzone/components/dropzone.tsx")),
source: "",
files: ["registry/default/blocks/dropzone/components/dropzone.tsx","registry/default/blocks/dropzone/hooks/use-supabase-upload.ts","registry/default/clients/react/lib/supabase/client.ts"],
@@ -82,7 +82,7 @@ export const Index: Record<string, any> = {
"dropzone-react-router": {
name: "dropzone-react-router",
type: "registry:component",
- registryDependencies: ["button","tooltip","progress"],
+ registryDependencies: ["button"],
component: React.lazy(() => import("@/registry/default/blocks/dropzone/components/dropzone.tsx")),
source: "",
files: ["registry/default/blocks/dropzone/components/dropzone.tsx","registry/default/blocks/dropzone/hooks/use-supabase-upload.ts","registry/default/clients/react-router/lib/supabase/client.ts","registry/default/clients/react-router/lib/supabase/server.ts"],
@@ -94,7 +94,7 @@ export const Index: Record<string, any> = {
"dropzone-tanstack": {
name: "dropzone-tanstack",
type: "registry:component",
- registryDependencies: ["button","tooltip","progress"],
+ registryDependencies: ["button"],
component: React.lazy(() => import("@/registry/default/blocks/dropzone/components/dropzone.tsx")),
source: "",
files: ["registry/default/blocks/dropzone/components/dropzone.tsx","registry/default/blocks/dropzone/hooks/use-supabase-upload.ts","registry/default/clients/tanstack/lib/supabase/client.ts","registry/default/clients/tanstack/lib/supabase/server.ts"],
diff --git a/apps/ui-library/app/example/base-injector.tsx b/apps/ui-library/app/example/base-injector.tsx
index 5d8941bfafd..ae29b2484c1 100644
--- a/apps/ui-library/app/example/base-injector.tsx
+++ b/apps/ui-library/app/example/base-injector.tsx
@@ -13,6 +13,12 @@ export function BaseInjector() {
base.href = `${process.env.NEXT_PUBLIC_BASE_PATH ?? ''}/example/password-based-auth/`
document.head.prepend(base)
+ // Add preview class to body to use shadcn theme vars
+ const bodyElement = document.querySelector('body')
+ if (bodyElement) {
+ bodyElement.classList.add('preview')
+ }
+
return () => {
base.remove()
}
diff --git a/apps/ui-library/app/example/realtime-avatar-stack-demo/layout.tsx b/apps/ui-library/app/example/realtime-avatar-stack-demo/layout.tsx
new file mode 100644
index 00000000000..2e352bd3d6a
--- /dev/null
+++ b/apps/ui-library/app/example/realtime-avatar-stack-demo/layout.tsx
@@ -0,0 +1,19 @@
+import { Metadata } from 'next'
+import { BaseInjector } from './../base-injector'
+
+export const metadata: Metadata = {
+ title: 'Realtime Avatar Stack Example',
+}
+
+export default function RootLayout({ children }: { children: React.ReactNode }) {
+ return (
+ <>
+ <BaseInjector />
+ <div className="flex w-full items-center justify-center p-6 md:p-10 preview bg-surface-100 h-screen">
+ <div className="w-full max-w-sm flex flex-col gap-4 justify-center items-center">
+ {children}
+ </div>
+ </div>
+ </>
+ )
+}
diff --git a/apps/ui-library/app/example/realtime-avatar-stack-demo/page.tsx b/apps/ui-library/app/example/realtime-avatar-stack-demo/page.tsx
new file mode 100644
index 00000000000..d17192cb797
--- /dev/null
+++ b/apps/ui-library/app/example/realtime-avatar-stack-demo/page.tsx
@@ -0,0 +1,9 @@
+'use client'
+
+import Demo from '@/registry/default/examples/realtime-avatar-stack-demo'
+
+const RealtimeAvatarStackDemoPage = () => {
+ return <Demo />
+}
+
+export default RealtimeAvatarStackDemoPage
diff --git a/apps/ui-library/app/example/realtime-chat/layout.tsx b/apps/ui-library/app/example/realtime-chat-demo/layout.tsx
similarity index 100%
rename from apps/ui-library/app/example/realtime-chat/layout.tsx
rename to apps/ui-library/app/example/realtime-chat-demo/layout.tsx
diff --git a/apps/ui-library/app/example/realtime-chat/page.tsx b/apps/ui-library/app/example/realtime-chat-demo/page.tsx
similarity index 58%
rename from apps/ui-library/app/example/realtime-chat/page.tsx
rename to apps/ui-library/app/example/realtime-chat-demo/page.tsx
index 9be00d34458..778d0692d49 100644
--- a/apps/ui-library/app/example/realtime-chat/page.tsx
+++ b/apps/ui-library/app/example/realtime-chat-demo/page.tsx
@@ -2,8 +2,8 @@
import Demo from '@/registry/default/examples/realtime-chat-demo'
-const RealtimeChatPage = () => {
+const RealtimeChatDemoPage = () => {
return <Demo />
}
-export default RealtimeChatPage
+export default RealtimeChatDemoPage
diff --git a/apps/ui-library/app/example/realtime-cursor/layout.tsx b/apps/ui-library/app/example/realtime-cursor-demo/layout.tsx
similarity index 100%
rename from apps/ui-library/app/example/realtime-cursor/layout.tsx
rename to apps/ui-library/app/example/realtime-cursor-demo/layout.tsx
diff --git a/apps/ui-library/app/example/realtime-cursor/page.tsx b/apps/ui-library/app/example/realtime-cursor-demo/page.tsx
similarity index 57%
rename from apps/ui-library/app/example/realtime-cursor/page.tsx
rename to apps/ui-library/app/example/realtime-cursor-demo/page.tsx
index c767de6d511..b5f8458073b 100644
--- a/apps/ui-library/app/example/realtime-cursor/page.tsx
+++ b/apps/ui-library/app/example/realtime-cursor-demo/page.tsx
@@ -2,8 +2,8 @@
import Demo from '@/registry/default/examples/realtime-cursor-demo'
-const RealtimeCursorPage = () => {
+const RealtimeCursorDemoPage = () => {
return <Demo />
}
-export default RealtimeCursorPage
+export default RealtimeCursorDemoPage
diff --git a/apps/ui-library/content/docs/getting-started/faq.mdx b/apps/ui-library/content/docs/getting-started/faq.mdx
index 63872d9d727..46efc66e1c3 100644
--- a/apps/ui-library/content/docs/getting-started/faq.mdx
+++ b/apps/ui-library/content/docs/getting-started/faq.mdx
@@ -16,7 +16,7 @@ description: Frequently asked questions
</AccordionContent>
</AccordionItem>
<AccordionItem value="overwrite">
- <AccordionTrigger>Will it overwrite my existing files?</AccordionTrigger>
+ <AccordionTrigger>Will it overwrite existing files?</AccordionTrigger>
<AccordionContent>
No. If you run a command in an existing project, it will <u>not</u> overwrite your existing
files. If there conflicting files, you will be asked what you want to do (leave them or
@@ -24,7 +24,7 @@ description: Frequently asked questions
</AccordionContent>
</AccordionItem>
<AccordionItem value="existing-project">
- <AccordionTrigger>I've already started my a project, what should I do?</AccordionTrigger>
+ <AccordionTrigger>I've already started a project, what should I do?</AccordionTrigger>
<AccordionContent>
You can still use these components, even if you've already started your project! The commands
won't overwrite your existing files, but you should still be careful with the changes to makes
@@ -59,7 +59,7 @@ description: Frequently asked questions
</AccordionContent>
</AccordionItem>
<AccordionItem value="ai-builder">
- <AccordionTrigger>I used an AI builder to build my app, what should I do?</AccordionTrigger>
+ <AccordionTrigger>I used an AI builder to build an app, what should I do?</AccordionTrigger>
<AccordionContent>
If your app is already built, you can use any of the commands to drop components into your
project. Your app likely already has a Supabase client set up, so you can just continue using
diff --git a/apps/ui-library/content/docs/getting-started/introduction.mdx b/apps/ui-library/content/docs/getting-started/introduction.mdx
index 69c40b4c2cf..9747238e25c 100644
--- a/apps/ui-library/content/docs/getting-started/introduction.mdx
+++ b/apps/ui-library/content/docs/getting-started/introduction.mdx
@@ -25,10 +25,10 @@ Our components are designed to be easily extensible. You can modify the code to
Our components are designed to be easily composable. You can combine them to create new components that are tailored to your needs. If you want to change the design or behavior of a component, you can easily do so in your own codebase.
-### Supabase Clients
+### Supabase clients
-The Supabase Clients are the backbone of your apps. They are designed to be easily integrated with your existing Supabase project. We provide both client-side and server-side clients for several major frameworks, and the code is designed to be easily integrated with your existing codebase.
+The Supabase clients are the backbone of your apps. They are designed to be easily integrated with your existing Supabase project. We provide both client-side and server-side clients for several major frameworks, and the code is designed to be easily integrated with your existing codebase.
-### Scaffolding for Hard Problems
+### Scaffolding for hard problems
Setting up something like Auth should be easy, so we've done the hard work for you. Our components are designed to be easily integrated with your new or existing Supabase projects. Installing them drops the files into place so you can get the hard parts out of the way quickly.
diff --git a/apps/ui-library/content/docs/nextjs/client.mdx b/apps/ui-library/content/docs/nextjs/client.mdx
index 08a7c5ca938..43e464a1801 100644
--- a/apps/ui-library/content/docs/nextjs/client.mdx
+++ b/apps/ui-library/content/docs/nextjs/client.mdx
@@ -1,5 +1,5 @@
---
-title: Next.js
+title: Supabase Client Libraries
description: Supabase client for Next.js
---
@@ -28,7 +28,7 @@ NEXT_PUBLIC_SUPABASE_ANON_KEY=
- If you're using supabase.com, you can find these values in the [Connect modal](https://supabase.com/dashboard/project/_?showConnect=true) under App Frameworks or in your project's [API settings](https://supabase.com/dashboard/project/_/settings/api).
-- If you're using a local instance of supabase, you can find these values by running `supabase start` or `supabase status` (if you already have it running).
+- If you're using a local instance of Supabase, you can find these values by running `supabase start` or `supabase status` (if you already have it running).
<Callout type="warning" className="mt-4">
{' '}
diff --git a/apps/ui-library/content/docs/nextjs/password-based-auth.mdx b/apps/ui-library/content/docs/nextjs/password-based-auth.mdx
index 3eade617e0c..9b21a5e020c 100644
--- a/apps/ui-library/content/docs/nextjs/password-based-auth.mdx
+++ b/apps/ui-library/content/docs/nextjs/password-based-auth.mdx
@@ -1,6 +1,6 @@
---
-title: Password-based Auth (Next.js)
-description: Password-based Auth block for Next.js app
+title: Password-based Authentication
+description: Password-based authentication block for Next.js
---
<BlockPreview name="password-based-auth/auth/sign-up" />
@@ -33,7 +33,7 @@ NEXT_PUBLIC_SUPABASE_ANON_KEY=
- If you're using supabase.com, you can find these values in the [Connect modal](https://supabase.com/dashboard/project/_?showConnect=true) under App Frameworks or in your project's [API settings](https://supabase.com/dashboard/project/_/settings/api).
-- If you're using a local instance of supabase, you can find these values by running `supabase start` or `supabase status` (if you already have it running).
+- If you're using a local instance of Supabase, you can find these values by running `supabase start` or `supabase status` (if you already have it running).
### Adding email templates
diff --git a/apps/ui-library/content/docs/nextjs/realtime-avatar-stack.mdx b/apps/ui-library/content/docs/nextjs/realtime-avatar-stack.mdx
index 9aee437e4e9..22b6b894035 100644
--- a/apps/ui-library/content/docs/nextjs/realtime-avatar-stack.mdx
+++ b/apps/ui-library/content/docs/nextjs/realtime-avatar-stack.mdx
@@ -3,7 +3,7 @@ title: Realtime Avatar Stack
description: Avatar stack in realtime
---
-<ComponentPreview name="realtime-avatar-stack-demo" showCode={false} />
+<BlockPreview name="realtime-avatar-stack-demo" />
## Installation
diff --git a/apps/ui-library/content/docs/nextjs/realtime-chat.mdx b/apps/ui-library/content/docs/nextjs/realtime-chat.mdx
index cf97ba02566..be6171a1489 100644
--- a/apps/ui-library/content/docs/nextjs/realtime-chat.mdx
+++ b/apps/ui-library/content/docs/nextjs/realtime-chat.mdx
@@ -4,8 +4,8 @@ description: Real-time chat component for collaborative applications
---
<div className="flex flex-row -space-x-px w-full">
- <BlockPreview name="realtime-chat" isPair />
- <BlockPreview name="realtime-chat" isPair />
+ <BlockPreview name="realtime-chat-demo" isPair />
+ <BlockPreview name="realtime-chat-demo" isPair />
</div>
## Installation
@@ -84,7 +84,7 @@ export default function ChatPage() {
| `onMessage?` | `(messages: ChatMessage[]) => void` | Optional callback to handle messages, useful for persistence. |
| `messages?` | `ChatMessage[]` | Optional initial messages to display in the chat. |
-### ChatMessage Type
+### ChatMessage type
```typescript
interface ChatMessage {
diff --git a/apps/ui-library/content/docs/nextjs/realtime-cursor.mdx b/apps/ui-library/content/docs/nextjs/realtime-cursor.mdx
index 170ddb0ee1f..3e0fe1938ab 100644
--- a/apps/ui-library/content/docs/nextjs/realtime-cursor.mdx
+++ b/apps/ui-library/content/docs/nextjs/realtime-cursor.mdx
@@ -4,8 +4,8 @@ description: Real-time cursor sharing for collaborative applications
---
<div className="flex flex-row -space-x-px w-full">
- <BlockPreview name="realtime-cursor" isPair />
- <BlockPreview name="realtime-cursor" isPair />
+ <BlockPreview name="realtime-cursor-demo" isPair />
+ <BlockPreview name="realtime-cursor-demo" isPair />
</div>
## Installation
diff --git a/apps/ui-library/content/docs/react-router/client.mdx b/apps/ui-library/content/docs/react-router/client.mdx
index dba310eb098..c125797a3cd 100644
--- a/apps/ui-library/content/docs/react-router/client.mdx
+++ b/apps/ui-library/content/docs/react-router/client.mdx
@@ -1,5 +1,5 @@
---
-title: Supabase Client for React Router
+title: Supabase Client Libraries
description: Supabase client for React Router
---
@@ -28,4 +28,4 @@ VITE_SUPABASE_ANON_KEY=
- If you're using supabase.com, you can find these values in the [Connect modal](https://supabase.com/dashboard/project/_?showConnect=true) under App Frameworks or in your project's [API settings](https://supabase.com/dashboard/project/_/settings/api).
-- If you're using a local instance of supabase, you can find these values by running `supabase start` or `supabase status` (if you already have it running).
+- If you're using a local instance of Supabase, you can find these values by running `supabase start` or `supabase status` (if you already have it running).
diff --git a/apps/ui-library/content/docs/react-router/password-based-auth.mdx b/apps/ui-library/content/docs/react-router/password-based-auth.mdx
index c2133d9f9a9..adcef492313 100644
--- a/apps/ui-library/content/docs/react-router/password-based-auth.mdx
+++ b/apps/ui-library/content/docs/react-router/password-based-auth.mdx
@@ -1,6 +1,6 @@
---
-title: Password-based Auth (React Router)
-description: Password-based Auth block for React Router app
+title: Password-based Authentication
+description: Password-based authentication block for React Router
---
<BlockPreview name="password-based-auth/auth/sign-up" />
@@ -33,7 +33,7 @@ VITE_SUPABASE_ANON_KEY=
- If you're using supabase.com, you can find these values in the [Connect modal](https://supabase.com/dashboard/project/_?showConnect=true) under App Frameworks or in your project's [API settings](https://supabase.com/dashboard/project/_/settings/api).
-- If you're using a local instance of supabase, you can find these values by running `supabase start` or `supabase status` (if you already have it running).
+- If you're using a local instance of Supabase, you can find these values by running `supabase start` or `supabase status` (if you already have it running).
### Adding email templates
diff --git a/apps/ui-library/content/docs/react-router/realtime-avatar-stack.mdx b/apps/ui-library/content/docs/react-router/realtime-avatar-stack.mdx
index 08e2b2d126a..c7585f55b39 100644
--- a/apps/ui-library/content/docs/react-router/realtime-avatar-stack.mdx
+++ b/apps/ui-library/content/docs/react-router/realtime-avatar-stack.mdx
@@ -3,7 +3,7 @@ title: Realtime Avatar Stack
description: Avatar stack in realtime
---
-<ComponentPreview name="realtime-avatar-stack-demo" showCode={false} />
+<BlockPreview name="realtime-avatar-stack-demo" />
## Installation
diff --git a/apps/ui-library/content/docs/react-router/realtime-chat.mdx b/apps/ui-library/content/docs/react-router/realtime-chat.mdx
index cf97ba02566..97f2db14086 100644
--- a/apps/ui-library/content/docs/react-router/realtime-chat.mdx
+++ b/apps/ui-library/content/docs/react-router/realtime-chat.mdx
@@ -4,20 +4,20 @@ description: Real-time chat component for collaborative applications
---
<div className="flex flex-row -space-x-px w-full">
- <BlockPreview name="realtime-chat" isPair />
- <BlockPreview name="realtime-chat" isPair />
+ <BlockPreview name="realtime-chat-demo" isPair />
+ <BlockPreview name="realtime-chat-demo" isPair />
</div>
## Installation
<BlockItem
- name="realtime-chat-nextjs"
+ name="realtime-chat-react-router"
description="Renders a real-time chat interface for users in a shared room."
/>
## Folder structure
-<RegistryBlock itemName="realtime-chat-nextjs" />
+<RegistryBlock itemName="realtime-chat-react-router" />
## Introduction
@@ -84,7 +84,7 @@ export default function ChatPage() {
| `onMessage?` | `(messages: ChatMessage[]) => void` | Optional callback to handle messages, useful for persistence. |
| `messages?` | `ChatMessage[]` | Optional initial messages to display in the chat. |
-### ChatMessage Type
+### ChatMessage type
```typescript
interface ChatMessage {
diff --git a/apps/ui-library/content/docs/react-router/realtime-cursor.mdx b/apps/ui-library/content/docs/react-router/realtime-cursor.mdx
index e0d9d6f98d7..b1593c8ef27 100644
--- a/apps/ui-library/content/docs/react-router/realtime-cursor.mdx
+++ b/apps/ui-library/content/docs/react-router/realtime-cursor.mdx
@@ -4,8 +4,8 @@ description: Real-time cursor sharing for collaborative applications
---
<div className="flex flex-row -space-x-px w-full">
- <BlockPreview name="realtime-cursor" isPair />
- <BlockPreview name="realtime-cursor" isPair />
+ <BlockPreview name="realtime-cursor-demo" isPair />
+ <BlockPreview name="realtime-cursor-demo" isPair />
</div>
## Installation
diff --git a/apps/ui-library/content/docs/react/client.mdx b/apps/ui-library/content/docs/react/client.mdx
index a09946ac173..0fb6d21e667 100644
--- a/apps/ui-library/content/docs/react/client.mdx
+++ b/apps/ui-library/content/docs/react/client.mdx
@@ -1,5 +1,5 @@
---
-title: React Single Page Applications
+title: Supabase Client Libraries
description: Supabase client for React Single Page Applications
---
diff --git a/apps/ui-library/content/docs/react/password-based-auth.mdx b/apps/ui-library/content/docs/react/password-based-auth.mdx
index a7ffabcce83..9c7f025a738 100644
--- a/apps/ui-library/content/docs/react/password-based-auth.mdx
+++ b/apps/ui-library/content/docs/react/password-based-auth.mdx
@@ -3,7 +3,7 @@ title: Password-based Authentication
description: Password-based authentication block for React Single Page Applications
---
-<BlockPreview name="password-based-auth/sign-up" />
+<BlockPreview name="password-based-auth/auth/sign-up" />
## Installation
@@ -31,7 +31,7 @@ VITE_SUPABASE_ANON_KEY=
- If you're using supabase.com, you can find these values in the [Connect modal](https://supabase.com/dashboard/project/_?showConnect=true) under App Frameworks or in your project's [API settings](https://supabase.com/dashboard/project/_/settings/api).
-- If you're using a local instance of supabase, you can find these values by running `supabase start` or `supabase status` (if you already have it running).
+- If you're using a local instance of Supabase, you can find these values by running `supabase start` or `supabase status` (if you already have it running).
### Adding email templates
diff --git a/apps/ui-library/content/docs/react/realtime-avatar-stack.mdx b/apps/ui-library/content/docs/react/realtime-avatar-stack.mdx
index 663581a8482..6ba200fde57 100644
--- a/apps/ui-library/content/docs/react/realtime-avatar-stack.mdx
+++ b/apps/ui-library/content/docs/react/realtime-avatar-stack.mdx
@@ -3,7 +3,7 @@ title: Realtime Avatar Stack
description: Avatar stack in realtime
---
-<ComponentPreview name="realtime-avatar-stack-demo" showCode={false} />
+<BlockPreview name="realtime-avatar-stack-demo" />
## Installation
diff --git a/apps/ui-library/content/docs/react/realtime-chat.mdx b/apps/ui-library/content/docs/react/realtime-chat.mdx
index cf97ba02566..795c0a5cc7e 100644
--- a/apps/ui-library/content/docs/react/realtime-chat.mdx
+++ b/apps/ui-library/content/docs/react/realtime-chat.mdx
@@ -4,20 +4,20 @@ description: Real-time chat component for collaborative applications
---
<div className="flex flex-row -space-x-px w-full">
- <BlockPreview name="realtime-chat" isPair />
- <BlockPreview name="realtime-chat" isPair />
+ <BlockPreview name="realtime-chat-demo" isPair />
+ <BlockPreview name="realtime-chat-demo" isPair />
</div>
## Installation
<BlockItem
- name="realtime-chat-nextjs"
+ name="realtime-chat-react"
description="Renders a real-time chat interface for users in a shared room."
/>
## Folder structure
-<RegistryBlock itemName="realtime-chat-nextjs" />
+<RegistryBlock itemName="realtime-chat-react" />
## Introduction
@@ -84,7 +84,7 @@ export default function ChatPage() {
| `onMessage?` | `(messages: ChatMessage[]) => void` | Optional callback to handle messages, useful for persistence. |
| `messages?` | `ChatMessage[]` | Optional initial messages to display in the chat. |
-### ChatMessage Type
+### ChatMessage type
```typescript
interface ChatMessage {
diff --git a/apps/ui-library/content/docs/react/realtime-cursor.mdx b/apps/ui-library/content/docs/react/realtime-cursor.mdx
index d4800cbdc19..e368ada52e7 100644
--- a/apps/ui-library/content/docs/react/realtime-cursor.mdx
+++ b/apps/ui-library/content/docs/react/realtime-cursor.mdx
@@ -4,8 +4,8 @@ description: Real-time cursor sharing for collaborative applications
---
<div className="flex flex-row -space-x-px w-full">
- <BlockPreview name="realtime-cursor" isPair />
- <BlockPreview name="realtime-cursor" isPair />
+ <BlockPreview name="realtime-cursor-demo" isPair />
+ <BlockPreview name="realtime-cursor-demo" isPair />
</div>
## Installation
diff --git a/apps/ui-library/content/docs/tanstack/client.mdx b/apps/ui-library/content/docs/tanstack/client.mdx
index bbf7646507d..e713ebd6616 100644
--- a/apps/ui-library/content/docs/tanstack/client.mdx
+++ b/apps/ui-library/content/docs/tanstack/client.mdx
@@ -1,5 +1,5 @@
---
-title: TanStack Start
+title: Supabase Client Libraries
description: Supabase client for TanStack Start
---
diff --git a/apps/ui-library/content/docs/tanstack/password-based-auth.mdx b/apps/ui-library/content/docs/tanstack/password-based-auth.mdx
index 9a453aaf81a..42a5d01a301 100644
--- a/apps/ui-library/content/docs/tanstack/password-based-auth.mdx
+++ b/apps/ui-library/content/docs/tanstack/password-based-auth.mdx
@@ -1,9 +1,9 @@
---
-title: TanStack Start
-description: Supabase client for TanStack Start
+title: Password-based Authentication
+description: Password-based authentication block for TanStack Start
---
-<BlockPreview name="password-based-auth/sign-up" />
+<BlockPreview name="password-based-auth/auth/sign-up" />
## Installation
@@ -28,7 +28,7 @@ VITE_SUPABASE_ANON_KEY=
- If you're using supabase.com, you can find these values in the [Connect modal](https://supabase.com/dashboard/project/_?showConnect=true) under App Frameworks or in your project's [API settings](https://supabase.com/dashboard/project/_/settings/api).
-- If you're using a local instance of supabase, you can find these values by running `supabase start` or `supabase status` (if you already have it running).
+- If you're using a local instance of Supabase, you can find these values by running `supabase start` or `supabase status` (if you already have it running).
### Adding email templates
diff --git a/apps/ui-library/content/docs/tanstack/realtime-avatar-stack.mdx b/apps/ui-library/content/docs/tanstack/realtime-avatar-stack.mdx
index 5f9211e8386..26dd223b0aa 100644
--- a/apps/ui-library/content/docs/tanstack/realtime-avatar-stack.mdx
+++ b/apps/ui-library/content/docs/tanstack/realtime-avatar-stack.mdx
@@ -3,7 +3,7 @@ title: Realtime Avatar Stack
description: Avatar stack in realtime
---
-<ComponentPreview name="realtime-avatar-stack-demo" showCode={false} />
+<BlockPreview name="realtime-avatar-stack-demo" />
## Installation
diff --git a/apps/ui-library/content/docs/tanstack/realtime-chat.mdx b/apps/ui-library/content/docs/tanstack/realtime-chat.mdx
index cf97ba02566..aebddc45a08 100644
--- a/apps/ui-library/content/docs/tanstack/realtime-chat.mdx
+++ b/apps/ui-library/content/docs/tanstack/realtime-chat.mdx
@@ -4,20 +4,20 @@ description: Real-time chat component for collaborative applications
---
<div className="flex flex-row -space-x-px w-full">
- <BlockPreview name="realtime-chat" isPair />
- <BlockPreview name="realtime-chat" isPair />
+ <BlockPreview name="realtime-chat-demo" isPair />
+ <BlockPreview name="realtime-chat-demo" isPair />
</div>
## Installation
<BlockItem
- name="realtime-chat-nextjs"
+ name="realtime-chat-tanstack"
description="Renders a real-time chat interface for users in a shared room."
/>
## Folder structure
-<RegistryBlock itemName="realtime-chat-nextjs" />
+<RegistryBlock itemName="realtime-chat-tanstack" />
## Introduction
@@ -84,7 +84,7 @@ export default function ChatPage() {
| `onMessage?` | `(messages: ChatMessage[]) => void` | Optional callback to handle messages, useful for persistence. |
| `messages?` | `ChatMessage[]` | Optional initial messages to display in the chat. |
-### ChatMessage Type
+### ChatMessage type
```typescript
interface ChatMessage {
diff --git a/apps/ui-library/content/docs/tanstack/realtime-cursor.mdx b/apps/ui-library/content/docs/tanstack/realtime-cursor.mdx
index 0d92b110959..5dbc26a91f8 100644
--- a/apps/ui-library/content/docs/tanstack/realtime-cursor.mdx
+++ b/apps/ui-library/content/docs/tanstack/realtime-cursor.mdx
@@ -4,8 +4,8 @@ description: Real-time cursor sharing for collaborative applications
---
<div className="flex flex-row -space-x-px w-full">
- <BlockPreview name="realtime-cursor" isPair />
- <BlockPreview name="realtime-cursor" isPair />
+ <BlockPreview name="realtime-cursor-demo" isPair />
+ <BlockPreview name="realtime-cursor-demo" isPair />
</div>
## Installation
diff --git a/apps/ui-library/package.json b/apps/ui-library/package.json
index bcc96afb20c..4058827010c 100644
--- a/apps/ui-library/package.json
+++ b/apps/ui-library/package.json
@@ -11,6 +11,7 @@
"build:llms": "tsx --tsconfig ./tsconfig.scripts.json ./scripts/build-llms-txt.ts",
"start": "next start",
"lint": "next lint",
+ "lint:mdx": "supa-mdx-lint content --config ../../supa-mdx-lint.config.toml",
"content:build": "contentlayer2 build",
"clean": "rimraf node_modules .next .turbo",
"typecheck": "contentlayer2 build && tsc --noEmit -p tsconfig.json"
@@ -22,6 +23,7 @@
"@radix-ui/react-slot": "^1.1.2",
"@radix-ui/react-tooltip": "^1.0.7",
"@react-router/fs-routes": "^7.4.0",
+ "@supabase/supa-mdx-lint": "0.2.6-alpha",
"class-variance-authority": "^0.6.0",
"common": "workspace:*",
"contentlayer2": "0.4.6",
diff --git a/apps/ui-library/public/r/ai-editor-rules.json b/apps/ui-library/public/r/ai-editor-rules.json
index a68c18d0334..041a453b732 100644
--- a/apps/ui-library/public/r/ai-editor-rules.json
+++ b/apps/ui-library/public/r/ai-editor-rules.json
@@ -11,31 +11,31 @@
"path": "registry/default/ai-editor-rules/create-db-functions.md",
"content": "---\n# Specify the following for Cursor rules\ndescription: Guidelines for writing Supabase database functions\nglobs: '**/*.sql'\n---\n\n# Database: Create functions\n\nYou're a Supabase Postgres expert in writing database functions. Generate **high-quality PostgreSQL functions** that adhere to the following best practices:\n\n## General Guidelines\n\n1. **Default to `SECURITY INVOKER`:**\n\n - Functions should run with the permissions of the user invoking the function, ensuring safer access control.\n - Use `SECURITY DEFINER` only when explicitly required and explain the rationale.\n\n2. **Set the `search_path` Configuration Parameter:**\n\n - Always set `search_path` to an empty string (`set search_path = '';`).\n - This avoids unexpected behavior and security risks caused by resolving object references in untrusted or unintended schemas.\n - Use fully qualified names (e.g., `schema_name.table_name`) for all database objects referenced within the function.\n\n3. **Adhere to SQL Standards and Validation:**\n - Ensure all queries within the function are valid PostgreSQL SQL queries and compatible with the specified context (ie. Supabase).\n\n## Best Practices\n\n1. **Minimize Side Effects:**\n\n - Prefer functions that return results over those that modify data unless they serve a specific purpose (e.g., triggers).\n\n2. **Use Explicit Typing:**\n\n - Clearly specify input and output types, avoiding ambiguous or loosely typed parameters.\n\n3. **Default to Immutable or Stable Functions:**\n\n - Where possible, declare functions as `IMMUTABLE` or `STABLE` to allow better optimization by PostgreSQL. Use `VOLATILE` only if the function modifies data or has side effects.\n\n4. **Triggers (if Applicable):**\n - If the function is used as a trigger, include a valid `CREATE TRIGGER` statement that attaches the function to the desired table and event (e.g., `BEFORE INSERT`).\n\n## Example Templates\n\n### Simple Function with `SECURITY INVOKER`\n\n```sql\ncreate or replace function my_schema.hello_world()\nreturns text\nlanguage plpgsql\nsecurity invoker\nset search_path = ''\nas $$\nbegin\n return 'hello world';\nend;\n$$;\n```\n\n### Function with Parameters and Fully Qualified Object Names\n\n```sql\ncreate or replace function public.calculate_total_price(order_id bigint)\nreturns numeric\nlanguage plpgsql\nsecurity invoker\nset search_path = ''\nas $$\ndeclare\n total numeric;\nbegin\n select sum(price * quantity)\n into total\n from public.order_items\n where order_id = calculate_total_price.order_id;\n\n return total;\nend;\n$$;\n```\n\n### Function as a Trigger\n\n```sql\ncreate or replace function my_schema.update_updated_at()\nreturns trigger\nlanguage plpgsql\nsecurity invoker\nset search_path = ''\nas $$\nbegin\n -- Update the \"updated_at\" column on row modification\n new.updated_at := now();\n return new;\nend;\n$$;\n\ncreate trigger update_updated_at_trigger\nbefore update on my_schema.my_table\nfor each row\nexecute function my_schema.update_updated_at();\n```\n\n### Function with Error Handling\n\n```sql\ncreate or replace function my_schema.safe_divide(numerator numeric, denominator numeric)\nreturns numeric\nlanguage plpgsql\nsecurity invoker\nset search_path = ''\nas $$\nbegin\n if denominator = 0 then\n raise exception 'Division by zero is not allowed';\n end if;\n\n return numerator / denominator;\nend;\n$$;\n```\n\n### Immutable Function for Better Optimization\n\n```sql\ncreate or replace function my_schema.full_name(first_name text, last_name text)\nreturns text\nlanguage sql\nsecurity invoker\nset search_path = ''\nimmutable\nas $$\n select first_name || ' ' || last_name;\n$$;\n```\n",
"type": "registry:file",
- "target": ".rules/create-db-functions.md"
+ "target": ".cursor/rules/create-db-functions.md"
},
{
"path": "registry/default/ai-editor-rules/create-migration.md",
"content": "---\n# Specify the following for Cursor rules\ndescription: Guidelines for writing Postgres migrations\nglobs: 'supabase/migrations/**/*.sql'\n---\n\n# Database: Create migration\n\nYou are a Postgres Expert who loves creating secure database schemas.\n\nThis project uses the migrations provided by the Supabase CLI.\n\n## Creating a migration file\n\nGiven the context of the user's message, create a database migration file inside the folder `supabase/migrations/`.\n\nThe file MUST following this naming convention:\n\nThe file MUST be named in the format `YYYYMMDDHHmmss_short_description.sql` with proper casing for months, minutes, and seconds in UTC time:\n\n1. `YYYY` - Four digits for the year (e.g., `2024`).\n2. `MM` - Two digits for the month (01 to 12).\n3. `DD` - Two digits for the day of the month (01 to 31).\n4. `HH` - Two digits for the hour in 24-hour format (00 to 23).\n5. `mm` - Two digits for the minute (00 to 59).\n6. `ss` - Two digits for the second (00 to 59).\n7. Add an appropriate description for the migration.\n\nFor example:\n\n```\n20240906123045_create_profiles.sql\n```\n\n## SQL Guidelines\n\nWrite Postgres-compatible SQL code for Supabase migration files that:\n\n- Includes a header comment with metadata about the migration, such as the purpose, affected tables/columns, and any special considerations.\n- Includes thorough comments explaining the purpose and expected behavior of each migration step.\n- Write all SQL in lowercase.\n- Add copious comments for any destructive SQL commands, including truncating, dropping, or column alterations.\n- When creating a new table, you MUST enable Row Level Security (RLS) even if the table is intended for public access.\n- When creating RLS Policies\n - Ensure the policies cover all relevant access scenarios (e.g. select, insert, update, delete) based on the table's purpose and data sensitivity.\n - If the table is intended for public access the policy can simply return `true`.\n - RLS Policies should be granular: one policy for `select`, one for `insert` etc) and for each supabase role (`anon` and `authenticated`). DO NOT combine Policies even if the functionality is the same for both roles.\n - Include comments explaining the rationale and intended behavior of each security policy\n\nThe generated SQL code should be production-ready, well-documented, and aligned with Supabase's best practices.\n",
"type": "registry:file",
- "target": ".rules/create-migration.md"
+ "target": ".cursor/rules/create-migration.md"
},
{
"path": "registry/default/ai-editor-rules/create-rls-policies.md",
"content": "---\n# Specify the following for Cursor rules\ndescription: Guidelines for writing Postgres Row Level Security policies\nglobs: '**/*.sql'\n---\n\n# Database: Create RLS policies\n\nYou're a Supabase Postgres expert in writing row level security policies. Your purpose is to generate a policy with the constraints given by the user. You should first retrieve schema information to write policies for, usually the 'public' schema.\n\nThe output should use the following instructions:\n\n- The generated SQL must be valid SQL.\n- You can use only CREATE POLICY or ALTER POLICY queries, no other queries are allowed.\n- Always use double apostrophe in SQL strings (eg. 'Night''s watch')\n- You can add short explanations to your messages.\n- The result should be a valid markdown. The SQL code should be wrapped in ``` (including sql language tag).\n- Always use \"auth.uid()\" instead of \"current_user\".\n- SELECT policies should always have USING but not WITH CHECK\n- INSERT policies should always have WITH CHECK but not USING\n- UPDATE policies should always have WITH CHECK and most often have USING\n- DELETE policies should always have USING but not WITH CHECK\n- Don't use `FOR ALL`. Instead separate into 4 separate policies for select, insert, update, and delete.\n- The policy name should be short but detailed text explaining the policy, enclosed in double quotes.\n- Always put explanations as separate text. Never use inline SQL comments.\n- If the user asks for something that's not related to SQL policies, explain to the user\n that you can only help with policies.\n- Discourage `RESTRICTIVE` policies and encourage `PERMISSIVE` policies, and explain why.\n\nThe output should look like this:\n\n```sql\nCREATE POLICY \"My descriptive policy.\" ON books FOR INSERT to authenticated USING ( (select auth.uid()) = author_id ) WITH ( true );\n```\n\nSince you are running in a Supabase environment, take note of these Supabase-specific additions below.\n\n## Authenticated and unauthenticated roles\n\nSupabase maps every request to one of the roles:\n\n- `anon`: an unauthenticated request (the user is not logged in)\n- `authenticated`: an authenticated request (the user is logged in)\n\nThese are actually [Postgres Roles](/docs/guides/database/postgres/roles). You can use these roles within your Policies using the `TO` clause:\n\n```sql\ncreate policy \"Profiles are viewable by everyone\"\non profiles\nfor select\nto authenticated, anon\nusing ( true );\n\n-- OR\n\ncreate policy \"Public profiles are viewable only by authenticated users\"\non profiles\nfor select\nto authenticated\nusing ( true );\n```\n\nNote that `for ...` must be added after the table but before the roles. `to ...` must be added after `for ...`:\n\n### Incorrect\n\n```sql\ncreate policy \"Public profiles are viewable only by authenticated users\"\non profiles\nto authenticated\nfor select\nusing ( true );\n```\n\n### Correct\n\n```sql\ncreate policy \"Public profiles are viewable only by authenticated users\"\non profiles\nfor select\nto authenticated\nusing ( true );\n```\n\n## Multiple operations\n\nPostgreSQL policies do not support specifying multiple operations in a single FOR clause. You need to create separate policies for each operation.\n\n### Incorrect\n\n```sql\ncreate policy \"Profiles can be created and deleted by any user\"\non profiles\nfor insert, delete -- cannot create a policy on multiple operators\nto authenticated\nwith check ( true )\nusing ( true );\n```\n\n### Correct\n\n```sql\ncreate policy \"Profiles can be created by any user\"\non profiles\nfor insert\nto authenticated\nwith check ( true );\n\ncreate policy \"Profiles can be deleted by any user\"\non profiles\nfor delete\nto authenticated\nusing ( true );\n```\n\n## Helper functions\n\nSupabase provides some helper functions that make it easier to write Policies.\n\n### `auth.uid()`\n\nReturns the ID of the user making the request.\n\n### `auth.jwt()`\n\nReturns the JWT of the user making the request. Anything that you store in the user's `raw_app_meta_data` column or the `raw_user_meta_data` column will be accessible using this function. It's important to know the distinction between these two:\n\n- `raw_user_meta_data` - can be updated by the authenticated user using the `supabase.auth.update()` function. It is not a good place to store authorization data.\n- `raw_app_meta_data` - cannot be updated by the user, so it's a good place to store authorization data.\n\nThe `auth.jwt()` function is extremely versatile. For example, if you store some team data inside `app_metadata`, you can use it to determine whether a particular user belongs to a team. For example, if this was an array of IDs:\n\n```sql\ncreate policy \"User is in team\"\non my_table\nto authenticated\nusing ( team_id in (select auth.jwt() -> 'app_metadata' -> 'teams'));\n```\n\n### MFA\n\nThe `auth.jwt()` function can be used to check for [Multi-Factor Authentication](/docs/guides/auth/auth-mfa#enforce-rules-for-mfa-logins). For example, you could restrict a user from updating their profile unless they have at least 2 levels of authentication (Assurance Level 2):\n\n```sql\ncreate policy \"Restrict updates.\"\non profiles\nas restrictive\nfor update\nto authenticated using (\n (select auth.jwt()->>'aal') = 'aal2'\n);\n```\n\n## RLS performance recommendations\n\nEvery authorization system has an impact on performance. While row level security is powerful, the performance impact is important to keep in mind. This is especially true for queries that scan every row in a table - like many `select` operations, including those using limit, offset, and ordering.\n\nBased on a series of [tests](https://github.com/GaryAustin1/RLS-Performance), we have a few recommendations for RLS:\n\n### Add indexes\n\nMake sure you've added [indexes](/docs/guides/database/postgres/indexes) on any columns used within the Policies which are not already indexed (or primary keys). For a Policy like this:\n\n```sql\ncreate policy \"Users can access their own records\" on test_table\nto authenticated\nusing ( (select auth.uid()) = user_id );\n```\n\nYou can add an index like:\n\n```sql\ncreate index userid\non test_table\nusing btree (user_id);\n```\n\n### Call functions with `select`\n\nYou can use `select` statement to improve policies that use functions. For example, instead of this:\n\n```sql\ncreate policy \"Users can access their own records\" on test_table\nto authenticated\nusing ( auth.uid() = user_id );\n```\n\nYou can do:\n\n```sql\ncreate policy \"Users can access their own records\" on test_table\nto authenticated\nusing ( (select auth.uid()) = user_id );\n```\n\nThis method works well for JWT functions like `auth.uid()` and `auth.jwt()` as well as `security definer` Functions. Wrapping the function causes an `initPlan` to be run by the Postgres optimizer, which allows it to \"cache\" the results per-statement, rather than calling the function on each row.\n\nCaution: You can only use this technique if the results of the query or function do not change based on the row data.\n\n### Minimize joins\n\nYou can often rewrite your Policies to avoid joins between the source and the target table. Instead, try to organize your policy to fetch all the relevant data from the target table into an array or set, then you can use an `IN` or `ANY` operation in your filter.\n\nFor example, this is an example of a slow policy which joins the source `test_table` to the target `team_user`:\n\n```sql\ncreate policy \"Users can access records belonging to their teams\" on test_table\nto authenticated\nusing (\n (select auth.uid()) in (\n select user_id\n from team_user\n where team_user.team_id = team_id -- joins to the source \"test_table.team_id\"\n )\n);\n```\n\nWe can rewrite this to avoid this join, and instead select the filter criteria into a set:\n\n```sql\ncreate policy \"Users can access records belonging to their teams\" on test_table\nto authenticated\nusing (\n team_id in (\n select team_id\n from team_user\n where user_id = (select auth.uid()) -- no join\n )\n);\n```\n\n### Specify roles in your policies\n\nAlways use the Role of inside your policies, specified by the `TO` operator. For example, instead of this query:\n\n```sql\ncreate policy \"Users can access their own records\" on rls_test\nusing ( auth.uid() = user_id );\n```\n\nUse:\n\n```sql\ncreate policy \"Users can access their own records\" on rls_test\nto authenticated\nusing ( (select auth.uid()) = user_id );\n```\n\nThis prevents the policy `( (select auth.uid()) = user_id )` from running for any `anon` users, since the execution stops at the `to authenticated` step.\n",
"type": "registry:file",
- "target": ".rules/create-rls-policies.md"
+ "target": ".cursor/rules/create-rls-policies.md"
},
{
"path": "registry/default/ai-editor-rules/postgres-sql-style-guide.md",
"content": "---\n# Specify the following for Cursor rules\ndescription: Guidelines for writing Postgres SQL\nglobs: '**/*.sql'\n---\n\n# Postgres SQL Style Guide\n\n## General\n\n- Use lowercase for SQL reserved words to maintain consistency and readability.\n- Employ consistent, descriptive identifiers for tables, columns, and other database objects.\n- Use white space and indentation to enhance the readability of your code.\n- Store dates in ISO 8601 format (`yyyy-mm-ddThh:mm:ss.sssss`).\n- Include comments for complex logic, using '/_ ... _/' for block comments and '--' for line comments.\n\n## Naming Conventions\n\n- Avoid SQL reserved words and ensure names are unique and under 63 characters.\n- Use snake_case for tables and columns.\n- Prefer plurals for table names\n- Prefer singular names for columns.\n\n## Tables\n\n- Avoid prefixes like 'tbl\\_' and ensure no table name matches any of its column names.\n- Always add an `id` column of type `identity generated always` unless otherwise specified.\n- Create all tables in the `public` schema unless otherwise specified.\n- Always add the schema to SQL queries for clarity.\n- Always add a comment to describe what the table does. The comment can be up to 1024 characters.\n\n## Columns\n\n- Use singular names and avoid generic names like 'id'.\n- For references to foreign tables, use the singular of the table name with the `_id` suffix. For example `user_id` to reference the `users` table\n- Always use lowercase except in cases involving acronyms or when readability would be enhanced by an exception.\n\n#### Examples:\n\n```sql\ncreate table books (\n id bigint generated always as identity primary key,\n title text not null,\n author_id bigint references authors (id)\n);\ncomment on table books is 'A list of all the books in the library.';\n```\n\n## Queries\n\n- When the query is shorter keep it on just a few lines. As it gets larger start adding newlines for readability\n- Add spaces for readability.\n\nSmaller queries:\n\n```sql\nselect *\nfrom employees\nwhere end_date is null;\n\nupdate employees\nset end_date = '2023-12-31'\nwhere employee_id = 1001;\n```\n\nLarger queries:\n\n```sql\nselect\n first_name,\n last_name\nfrom employees\nwhere start_date between '2021-01-01' and '2021-12-31' and status = 'employed';\n```\n\n### Joins and Subqueries\n\n- Format joins and subqueries for clarity, aligning them with related SQL clauses.\n- Prefer full table names when referencing tables. This helps for readability.\n\n```sql\nselect\n employees.employee_name,\n departments.department_name\nfrom\n employees\n join departments on employees.department_id = departments.department_id\nwhere employees.start_date > '2022-01-01';\n```\n\n## Aliases\n\n- Use meaningful aliases that reflect the data or transformation applied, and always include the 'as' keyword for clarity.\n\n```sql\nselect count(*) as total_employees\nfrom employees\nwhere end_date is null;\n```\n\n## Complex queries and CTEs\n\n- If a query is extremely complex, prefer a CTE.\n- Make sure the CTE is clear and linear. Prefer readability over performance.\n- Add comments to each block.\n\n```sql\nwith\n department_employees as (\n -- Get all employees and their departments\n select\n employees.department_id,\n employees.first_name,\n employees.last_name,\n departments.department_name\n from\n employees\n join departments on employees.department_id = departments.department_id\n ),\n employee_counts as (\n -- Count how many employees in each department\n select\n department_name,\n count(*) as num_employees\n from department_employees\n group by department_name\n )\nselect\n department_name,\n num_employees\nfrom employee_counts\norder by department_name;\n```\n",
"type": "registry:file",
- "target": ".rules/postgres-sql-style-guide.md"
+ "target": ".cursor/rules/postgres-sql-style-guide.md"
},
{
"path": "registry/default/ai-editor-rules/writing-supabase-edge-functions.md",
"content": "---\ndescription: Coding rules for Supabase Edge Functions\nglobs: 'supabase/functions/**/*.ts'\n---\n\n# Writing Supabase Edge Functions\n\nYou're an expert in writing TypeScript and Deno JavaScript runtime. Generate **high-quality Supabase Edge Functions** that adhere to the following best practices:\n\n## Guidelines\n\n1. Try to use Web APIs and Deno’s core APIs instead of external dependencies (eg: use fetch instead of Axios, use WebSockets API instead of node-ws)\n2. If you are reusing utility methods between Edge Functions, add them to `supabase/functions/_shared` and import using a relative path. Do NOT have cross dependencies between Edge Functions.\n3. Do NOT use bare specifiers when importing dependecnies. If you need to use an external dependency, make sure it's prefixed with either `npm:` or `jsr:`. For example, `@supabase/supabase-js` should be written as `npm:@supabase/supabase-js`.\n4. For external imports, always define a version. For example, `npm:@express` should be written as `npm:[email protected]`.\n5. For external dependencies, importing via `npm:` and `jsr:` is preferred. Minimize the use of imports from @`deno.land/x` , `esm.sh` and @`unpkg.com` . If you have a package from one of those CDNs, you can replace the CDN hostname with `npm:` specifier.\n6. You can also use Node built-in APIs. You will need to import them using `node:` specifier. For example, to import Node process: `import process from \"node:process\". Use Node APIs when you find gaps in Deno APIs.\n7. Do NOT use `import { serve } from \"https://deno.land/[email protected]/http/server.ts\"`. Instead use the built-in `Deno.serve`.\n8. Following environment variables (ie. secrets) are pre-populated in both local and hosted Supabase environments. Users don't need to manually set them:\n - SUPABASE_URL\n - SUPABASE_ANON_KEY\n - SUPABASE_SERVICE_ROLE_KEY\n - SUPABASE_DB_URL\n9. To set other environment variables (ie. secrets) users can put them in a env file and run the `supabase secrets set --env-file path/to/env-file`\n10. A single Edge Function can handle multiple routes. It is recommended to use a library like Express or Hono to handle the routes as it's easier for developer to understand and maintain. Each route must be prefixed with `/function-name` so they are routed correctly.\n11. File write operations are ONLY permitted on `/tmp` directory. You can use either Deno or Node File APIs.\n12. Use `EdgeRuntime.waitUntil(promise)` static method to run long-running tasks in the background without blocking response to a request. Do NOT assume it is available in the request / execution context.\n\n## Example Templates\n\n### Simple Hello World Function\n\n```tsx\ninterface reqPayload {\n name: string\n}\n\nconsole.info('server started')\n\nDeno.serve(async (req: Request) => {\n const { name }: reqPayload = await req.json()\n const data = {\n message: `Hello ${name} from foo!`,\n }\n\n return new Response(JSON.stringify(data), {\n headers: { 'Content-Type': 'application/json', Connection: 'keep-alive' },\n })\n})\n```\n\n### Example Function using Node built-in API\n\n```tsx\nimport { randomBytes } from 'node:crypto'\nimport { createServer } from 'node:http'\nimport process from 'node:process'\n\nconst generateRandomString = (length) => {\n const buffer = randomBytes(length)\n return buffer.toString('hex')\n}\n\nconst randomString = generateRandomString(10)\nconsole.log(randomString)\n\nconst server = createServer((req, res) => {\n const message = `Hello`\n res.end(message)\n})\n\nserver.listen(9999)\n```\n\n### Using npm packages in Functions\n\n```tsx\nimport express from 'npm:[email protected]'\n\nconst app = express()\n\napp.get(/(.*)/, (req, res) => {\n res.send('Welcome to Supabase')\n})\n\napp.listen(8000)\n```\n\n### Generate embeddings using built-in @Supabase.ai API\n\n```tsx\nconst model = new Supabase.ai.Session('gte-small')\n\nDeno.serve(async (req: Request) => {\n const params = new URL(req.url).searchParams\n const input = params.get('text')\n const output = await model.run(input, { mean_pool: true, normalize: true })\n return new Response(JSON.stringify(output), {\n headers: {\n 'Content-Type': 'application/json',\n Connection: 'keep-alive',\n },\n })\n})\n```\n",
"type": "registry:file",
- "target": ".rules/writing-supabase-edge-functions.md"
+ "target": ".cursor/rules/writing-supabase-edge-functions.md"
}
]
}
\ No newline at end of file
diff --git a/apps/ui-library/public/r/dropzone-nextjs.json b/apps/ui-library/public/r/dropzone-nextjs.json
index d6374662349..2b5cae2d2a4 100644
--- a/apps/ui-library/public/r/dropzone-nextjs.json
+++ b/apps/ui-library/public/r/dropzone-nextjs.json
@@ -10,9 +10,7 @@
"@supabase/ssr@latest"
],
"registryDependencies": [
- "button",
- "tooltip",
- "progress"
+ "button"
],
"files": [
{
diff --git a/apps/ui-library/public/r/dropzone-react-router.json b/apps/ui-library/public/r/dropzone-react-router.json
index b88b0ea28df..5e2c55a0da7 100644
--- a/apps/ui-library/public/r/dropzone-react-router.json
+++ b/apps/ui-library/public/r/dropzone-react-router.json
@@ -11,9 +11,7 @@
"@supabase/supabase-js@latest"
],
"registryDependencies": [
- "button",
- "tooltip",
- "progress"
+ "button"
],
"files": [
{
diff --git a/apps/ui-library/public/r/dropzone-react.json b/apps/ui-library/public/r/dropzone-react.json
index 926ebb63aea..96a316458f7 100644
--- a/apps/ui-library/public/r/dropzone-react.json
+++ b/apps/ui-library/public/r/dropzone-react.json
@@ -10,9 +10,7 @@
"@supabase/supabase-js@latest"
],
"registryDependencies": [
- "button",
- "tooltip",
- "progress"
+ "button"
],
"files": [
{
diff --git a/apps/ui-library/public/r/dropzone-tanstack.json b/apps/ui-library/public/r/dropzone-tanstack.json
index 76898f4264b..077c9a4d964 100644
--- a/apps/ui-library/public/r/dropzone-tanstack.json
+++ b/apps/ui-library/public/r/dropzone-tanstack.json
@@ -11,9 +11,7 @@
"@supabase/supabase-js@latest"
],
"registryDependencies": [
- "button",
- "tooltip",
- "progress"
+ "button"
],
"files": [
{
diff --git a/apps/ui-library/public/r/password-based-auth-react.json b/apps/ui-library/public/r/password-based-auth-react.json
index 644a4e9f91c..5ba8426a994 100644
--- a/apps/ui-library/public/r/password-based-auth-react.json
+++ b/apps/ui-library/public/r/password-based-auth-react.json
@@ -31,7 +31,7 @@
},
{
"path": "registry/default/blocks/password-based-auth-react/components/update-password-form.tsx",
- "content": "import { cn } from '@/lib/utils'\nimport { createClient } from '@/registry/default/clients/react/lib/supabase/client'\nimport { Button } from '@/registry/default/components/ui/button'\nimport {\n Card,\n CardContent,\n CardDescription,\n CardHeader,\n CardTitle,\n} from '@/registry/default/components/ui/card'\nimport { Input } from '@/registry/default/components/ui/input'\nimport { Label } from '@/registry/default/components/ui/label'\nimport { useState } from 'react'\n\nexport function UpdatePasswordForm({ className, ...props }: React.ComponentPropsWithoutRef<'div'>) {\n const [password, setPassword] = useState('')\n const [error, setError] = useState<string | null>(null)\n const [isLoading, setIsLoading] = useState(false)\n\n const handleForgotPassword = async (e: React.FormEvent) => {\n const supabase = createClient()\n e.preventDefault()\n setIsLoading(true)\n setError(null)\n\n try {\n const { error } = await supabase.auth.updateUser({ password })\n if (error) throw error\n // Update this route to redirect to an authenticated route. The user already has an active session.\n location.href = '/info'\n } catch (error: unknown) {\n setError(error instanceof Error ? error.message : 'An error occurred')\n } finally {\n setIsLoading(false)\n }\n }\n\n return (\n <div className={cn('flex flex-col gap-6', className)} {...props}>\n <Card>\n <CardHeader>\n <CardTitle className=\"text-2xl\">Reset Your Password</CardTitle>\n <CardDescription>Please enter your new password below.</CardDescription>\n </CardHeader>\n <CardContent>\n <form onSubmit={handleForgotPassword}>\n <div className=\"flex flex-col gap-6\">\n <div className=\"grid gap-2\">\n <Label htmlFor=\"password\">New password</Label>\n <Input\n id=\"password\"\n type=\"password\"\n placeholder=\"New password\"\n required\n value={password}\n onChange={(e) => setPassword(e.target.value)}\n />\n </div>\n {error && <p className=\"text-sm text-red-500\">{error}</p>}\n <Button type=\"submit\" className=\"w-full\" disabled={isLoading}>\n {isLoading ? 'Saving...' : 'Save new password'}\n </Button>\n </div>\n <div className=\"mt-4 text-center text-sm\">\n Already have an account?{' '}\n <a href=\"/login\" className=\"underline underline-offset-4\">\n Login\n </a>\n </div>\n </form>\n </CardContent>\n </Card>\n </div>\n )\n}\n",
+ "content": "import { cn } from '@/lib/utils'\nimport { createClient } from '@/registry/default/clients/react/lib/supabase/client'\nimport { Button } from '@/registry/default/components/ui/button'\nimport {\n Card,\n CardContent,\n CardDescription,\n CardHeader,\n CardTitle,\n} from '@/registry/default/components/ui/card'\nimport { Input } from '@/registry/default/components/ui/input'\nimport { Label } from '@/registry/default/components/ui/label'\nimport { useState } from 'react'\n\nexport function UpdatePasswordForm({ className, ...props }: React.ComponentPropsWithoutRef<'div'>) {\n const [password, setPassword] = useState('')\n const [error, setError] = useState<string | null>(null)\n const [isLoading, setIsLoading] = useState(false)\n\n const handleForgotPassword = async (e: React.FormEvent) => {\n const supabase = createClient()\n e.preventDefault()\n setIsLoading(true)\n setError(null)\n\n try {\n const { error } = await supabase.auth.updateUser({ password })\n if (error) throw error\n // Update this route to redirect to an authenticated route. The user already has an active session.\n location.href = '/info'\n } catch (error: unknown) {\n setError(error instanceof Error ? error.message : 'An error occurred')\n } finally {\n setIsLoading(false)\n }\n }\n\n return (\n <div className={cn('flex flex-col gap-6', className)} {...props}>\n <Card>\n <CardHeader>\n <CardTitle className=\"text-2xl\">Reset Your Password</CardTitle>\n <CardDescription>Please enter your new password below.</CardDescription>\n </CardHeader>\n <CardContent>\n <form onSubmit={handleForgotPassword}>\n <div className=\"flex flex-col gap-6\">\n <div className=\"grid gap-2\">\n <Label htmlFor=\"password\">New password</Label>\n <Input\n id=\"password\"\n type=\"password\"\n placeholder=\"New password\"\n required\n value={password}\n onChange={(e) => setPassword(e.target.value)}\n />\n </div>\n {error && <p className=\"text-sm text-red-500\">{error}</p>}\n <Button type=\"submit\" className=\"w-full\" disabled={isLoading}>\n {isLoading ? 'Saving...' : 'Save new password'}\n </Button>\n </div>\n </form>\n </CardContent>\n </Card>\n </div>\n )\n}\n",
"type": "registry:component"
},
{
diff --git a/apps/ui-library/public/r/password-based-auth-tanstack.json b/apps/ui-library/public/r/password-based-auth-tanstack.json
index 022039166b3..ab89d8656f4 100644
--- a/apps/ui-library/public/r/password-based-auth-tanstack.json
+++ b/apps/ui-library/public/r/password-based-auth-tanstack.json
@@ -64,7 +64,7 @@
},
{
"path": "registry/default/blocks/password-based-auth-tanstack/components/sign-up-form.tsx",
- "content": "import { cn } from '@/lib/utils'\nimport { createClient } from '@/registry/default/clients/tanstack/lib/supabase/client'\nimport { Button } from '@/registry/default/components/ui/button'\nimport {\n Card,\n CardContent,\n CardDescription,\n CardHeader,\n CardTitle,\n} from '@/registry/default/components/ui/card'\nimport { Input } from '@/registry/default/components/ui/input'\nimport { Label } from '@/registry/default/components/ui/label'\nimport { Link, useNavigate } from '@tanstack/react-router'\nimport { useState } from 'react'\n\nexport function SignUpForm({ className, ...props }: React.ComponentPropsWithoutRef<'div'>) {\n const [email, setEmail] = useState('')\n const [password, setPassword] = useState('')\n const [repeatPassword, setRepeatPassword] = useState('')\n const [error, setError] = useState<string | null>(null)\n const [isLoading, setIsLoading] = useState(false)\n const navigate = useNavigate()\n\n const handleSignUp = async (e: React.FormEvent) => {\n e.preventDefault()\n const supabase = createClient()\n setError(null)\n\n if (password !== repeatPassword) {\n setError('Passwords do not match')\n return\n }\n setIsLoading(true)\n\n try {\n const { error } = await supabase.auth.signUp({\n email,\n password,\n })\n if (error) throw error\n await navigate({ to: '/sign-up-success' })\n } catch (error: unknown) {\n setError(error instanceof Error ? error.message : 'An error occurred')\n } finally {\n setIsLoading(false)\n }\n }\n\n return (\n <div className={cn('flex flex-col gap-6', className)} {...props}>\n <Card>\n <CardHeader>\n <CardTitle className=\"text-2xl\">Sign up</CardTitle>\n <CardDescription>Create a new account</CardDescription>\n </CardHeader>\n <CardContent>\n <form onSubmit={handleSignUp}>\n <div className=\"flex flex-col gap-6\">\n <div className=\"grid gap-2\">\n <Label htmlFor=\"email\">Email</Label>\n <Input\n id=\"email\"\n type=\"email\"\n placeholder=\"[email protected]\"\n required\n value={email}\n onChange={(e) => setEmail(e.target.value)}\n />\n </div>\n <div className=\"grid gap-2\">\n <div className=\"flex items-center\">\n <Label htmlFor=\"password\">Password</Label>\n </div>\n <Input\n id=\"password\"\n type=\"password\"\n required\n value={password}\n onChange={(e) => setPassword(e.target.value)}\n />\n </div>\n <div className=\"grid gap-2\">\n <div className=\"flex items-center\">\n <Label htmlFor=\"repeat-password\">Repeat Password</Label>\n </div>\n <Input\n id=\"repeat-password\"\n type=\"password\"\n required\n value={repeatPassword}\n onChange={(e) => setRepeatPassword(e.target.value)}\n />\n </div>\n {error && <p className=\"text-sm text-red-500\">{error}</p>}\n <Button type=\"submit\" className=\"w-full\" disabled={isLoading}>\n {isLoading ? 'Creating an account...' : 'Sign up'}\n </Button>\n </div>\n <div className=\"mt-4 text-center text-sm\">\n Already have an account?{' '}\n <Link to=\"/login\" className=\"underline underline-offset-4\">\n Login\n </Link>\n </div>\n </form>\n </CardContent>\n </Card>\n </div>\n )\n}\n",
+ "content": "import { cn } from '@/lib/utils'\nimport { createClient } from '@/registry/default/clients/tanstack/lib/supabase/client'\nimport { Button } from '@/registry/default/components/ui/button'\nimport {\n Card,\n CardContent,\n CardDescription,\n CardHeader,\n CardTitle,\n} from '@/registry/default/components/ui/card'\nimport { Input } from '@/registry/default/components/ui/input'\nimport { Label } from '@/registry/default/components/ui/label'\nimport { Link, useNavigate } from '@tanstack/react-router'\nimport { useState } from 'react'\n\nexport function SignUpForm({ className, ...props }: React.ComponentPropsWithoutRef<'div'>) {\n const [email, setEmail] = useState('')\n const [password, setPassword] = useState('')\n const [repeatPassword, setRepeatPassword] = useState('')\n const [error, setError] = useState<string | null>(null)\n const [isLoading, setIsLoading] = useState(false)\n const navigate = useNavigate()\n\n const handleSignUp = async (e: React.FormEvent) => {\n e.preventDefault()\n const supabase = createClient()\n setError(null)\n\n if (password !== repeatPassword) {\n setError('Passwords do not match')\n return\n }\n setIsLoading(true)\n\n try {\n const { error } = await supabase.auth.signUp({\n email,\n password,\n options: {\n emailRedirectTo: `${window.location.origin}/protected`,\n },\n })\n if (error) throw error\n await navigate({ to: '/sign-up-success' })\n } catch (error: unknown) {\n setError(error instanceof Error ? error.message : 'An error occurred')\n } finally {\n setIsLoading(false)\n }\n }\n\n return (\n <div className={cn('flex flex-col gap-6', className)} {...props}>\n <Card>\n <CardHeader>\n <CardTitle className=\"text-2xl\">Sign up</CardTitle>\n <CardDescription>Create a new account</CardDescription>\n </CardHeader>\n <CardContent>\n <form onSubmit={handleSignUp}>\n <div className=\"flex flex-col gap-6\">\n <div className=\"grid gap-2\">\n <Label htmlFor=\"email\">Email</Label>\n <Input\n id=\"email\"\n type=\"email\"\n placeholder=\"[email protected]\"\n required\n value={email}\n onChange={(e) => setEmail(e.target.value)}\n />\n </div>\n <div className=\"grid gap-2\">\n <div className=\"flex items-center\">\n <Label htmlFor=\"password\">Password</Label>\n </div>\n <Input\n id=\"password\"\n type=\"password\"\n required\n value={password}\n onChange={(e) => setPassword(e.target.value)}\n />\n </div>\n <div className=\"grid gap-2\">\n <div className=\"flex items-center\">\n <Label htmlFor=\"repeat-password\">Repeat Password</Label>\n </div>\n <Input\n id=\"repeat-password\"\n type=\"password\"\n required\n value={repeatPassword}\n onChange={(e) => setRepeatPassword(e.target.value)}\n />\n </div>\n {error && <p className=\"text-sm text-red-500\">{error}</p>}\n <Button type=\"submit\" className=\"w-full\" disabled={isLoading}>\n {isLoading ? 'Creating an account...' : 'Sign up'}\n </Button>\n </div>\n <div className=\"mt-4 text-center text-sm\">\n Already have an account?{' '}\n <Link to=\"/login\" className=\"underline underline-offset-4\">\n Login\n </Link>\n </div>\n </form>\n </CardContent>\n </Card>\n </div>\n )\n}\n",
"type": "registry:component"
},
{
@@ -86,7 +86,7 @@
},
{
"path": "registry/default/blocks/password-based-auth-tanstack/components/update-password-form.tsx",
- "content": "import { cn } from '@/lib/utils'\nimport { createClient } from '@/registry/default/clients/tanstack/lib/supabase/client'\nimport { Button } from '@/registry/default/components/ui/button'\nimport {\n Card,\n CardContent,\n CardDescription,\n CardHeader,\n CardTitle,\n} from '@/registry/default/components/ui/card'\nimport { Input } from '@/registry/default/components/ui/input'\nimport { Label } from '@/registry/default/components/ui/label'\nimport { useNavigate } from '@tanstack/react-router'\nimport { useState } from 'react'\n\nexport function UpdatePasswordForm({ className, ...props }: React.ComponentPropsWithoutRef<'div'>) {\n const [password, setPassword] = useState('')\n const [error, setError] = useState<string | null>(null)\n const [isLoading, setIsLoading] = useState(false)\n const navigate = useNavigate()\n\n const handleForgotPassword = async (e: React.FormEvent) => {\n e.preventDefault()\n const supabase = createClient()\n setIsLoading(true)\n setError(null)\n\n try {\n const { error } = await supabase.auth.updateUser({ password })\n if (error) throw error\n // Update this route to redirect to an authenticated route. The user already has an active session.\n await navigate({ to: '/info' })\n } catch (error: unknown) {\n setError(error instanceof Error ? error.message : 'An error occurred')\n } finally {\n setIsLoading(false)\n }\n }\n\n return (\n <div className={cn('flex flex-col gap-6', className)} {...props}>\n <Card>\n <CardHeader>\n <CardTitle className=\"text-2xl\">Reset Your Password</CardTitle>\n <CardDescription>Please enter your new password below.</CardDescription>\n </CardHeader>\n <CardContent>\n <form onSubmit={handleForgotPassword}>\n <div className=\"flex flex-col gap-6\">\n <div className=\"grid gap-2\">\n <Label htmlFor=\"password\">New password</Label>\n <Input\n id=\"password\"\n type=\"password\"\n placeholder=\"New password\"\n required\n value={password}\n onChange={(e) => setPassword(e.target.value)}\n />\n </div>\n {error && <p className=\"text-sm text-red-500\">{error}</p>}\n <Button type=\"submit\" className=\"w-full\" disabled={isLoading}>\n {isLoading ? 'Saving...' : 'Save new password'}\n </Button>\n </div>\n <div className=\"mt-4 text-center text-sm\">\n Already have an account?{' '}\n <a href=\"/login\" className=\"underline underline-offset-4\">\n Login\n </a>\n </div>\n </form>\n </CardContent>\n </Card>\n </div>\n )\n}\n",
+ "content": "import { cn } from '@/lib/utils'\nimport { createClient } from '@/registry/default/clients/tanstack/lib/supabase/client'\nimport { Button } from '@/registry/default/components/ui/button'\nimport {\n Card,\n CardContent,\n CardDescription,\n CardHeader,\n CardTitle,\n} from '@/registry/default/components/ui/card'\nimport { Input } from '@/registry/default/components/ui/input'\nimport { Label } from '@/registry/default/components/ui/label'\nimport { useNavigate } from '@tanstack/react-router'\nimport { useState } from 'react'\n\nexport function UpdatePasswordForm({ className, ...props }: React.ComponentPropsWithoutRef<'div'>) {\n const [password, setPassword] = useState('')\n const [error, setError] = useState<string | null>(null)\n const [isLoading, setIsLoading] = useState(false)\n const navigate = useNavigate()\n\n const handleForgotPassword = async (e: React.FormEvent) => {\n e.preventDefault()\n const supabase = createClient()\n setIsLoading(true)\n setError(null)\n\n try {\n const { error } = await supabase.auth.updateUser({ password })\n if (error) throw error\n // Update this route to redirect to an authenticated route. The user already has an active session.\n await navigate({ to: '/info' })\n } catch (error: unknown) {\n setError(error instanceof Error ? error.message : 'An error occurred')\n } finally {\n setIsLoading(false)\n }\n }\n\n return (\n <div className={cn('flex flex-col gap-6', className)} {...props}>\n <Card>\n <CardHeader>\n <CardTitle className=\"text-2xl\">Reset Your Password</CardTitle>\n <CardDescription>Please enter your new password below.</CardDescription>\n </CardHeader>\n <CardContent>\n <form onSubmit={handleForgotPassword}>\n <div className=\"flex flex-col gap-6\">\n <div className=\"grid gap-2\">\n <Label htmlFor=\"password\">New password</Label>\n <Input\n id=\"password\"\n type=\"password\"\n placeholder=\"New password\"\n required\n value={password}\n onChange={(e) => setPassword(e.target.value)}\n />\n </div>\n {error && <p className=\"text-sm text-red-500\">{error}</p>}\n <Button type=\"submit\" className=\"w-full\" disabled={isLoading}>\n {isLoading ? 'Saving...' : 'Save new password'}\n </Button>\n </div>\n </form>\n </CardContent>\n </Card>\n </div>\n )\n}\n",
"type": "registry:component"
},
{
diff --git a/apps/ui-library/public/r/realtime-avatar-stack-nextjs.json b/apps/ui-library/public/r/realtime-avatar-stack-nextjs.json
index 8bf06332056..b852d452642 100644
--- a/apps/ui-library/public/r/realtime-avatar-stack-nextjs.json
+++ b/apps/ui-library/public/r/realtime-avatar-stack-nextjs.json
@@ -14,7 +14,7 @@
"files": [
{
"path": "registry/default/blocks/realtime-avatar-stack/components/avatar-stack.tsx",
- "content": "import { cn } from '@/lib/utils'\nimport { Avatar, AvatarFallback, AvatarImage } from '@/registry/default/components/ui/avatar'\nimport { Tooltip, TooltipContent, TooltipTrigger } from '@/registry/default/components/ui/tooltip'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nconst avatarStackVariants = cva('flex -space-x-4 -space-y-4', {\n variants: {\n orientation: {\n vertical: 'flex-row',\n horizontal: 'flex-col',\n },\n },\n defaultVariants: {\n orientation: 'vertical',\n },\n})\n\nexport interface AvatarStackProps\n extends React.HTMLAttributes<HTMLDivElement>,\n VariantProps<typeof avatarStackVariants> {\n avatars: { name: string; image: string }[]\n maxAvatarsAmount?: number\n}\n\nconst AvatarStack = ({\n className,\n orientation,\n avatars,\n maxAvatarsAmount = 3,\n ...props\n}: AvatarStackProps) => {\n const shownAvatars = avatars.slice(0, maxAvatarsAmount)\n const hiddenAvatars = avatars.slice(maxAvatarsAmount)\n\n return (\n <div\n className={cn(\n avatarStackVariants({ orientation }),\n className,\n orientation === 'horizontal' ? '-space-x-0' : '-space-y-0'\n )}\n {...props}\n >\n {shownAvatars.map(({ name, image }, index) => (\n <Tooltip key={`${name}-${image}-${index}`}>\n <TooltipTrigger asChild>\n <Avatar className={'hover:z-10'}>\n <AvatarImage src={image} />\n <AvatarFallback>\n {name\n ?.split(' ')\n ?.map((word) => word[0])\n ?.join('')\n ?.toUpperCase()}\n </AvatarFallback>\n </Avatar>\n </TooltipTrigger>\n <TooltipContent>\n <p>{name}</p>\n </TooltipContent>\n </Tooltip>\n ))}\n\n {hiddenAvatars.length ? (\n <Tooltip key=\"hidden-avatars\">\n <TooltipTrigger asChild>\n <Avatar>\n <AvatarFallback>+{avatars.length - shownAvatars.length}</AvatarFallback>\n </Avatar>\n </TooltipTrigger>\n <TooltipContent className=\"flex flex-col gap-2 bg-gray-100 p-2 rounded border\">\n {hiddenAvatars.map(({ name }, index) => (\n <p key={`${name}-${index}`}>{name}</p>\n ))}\n </TooltipContent>\n </Tooltip>\n ) : null}\n </div>\n )\n}\n\nexport { AvatarStack, avatarStackVariants }\n",
+ "content": "import { cn } from '@/lib/utils'\nimport { Avatar, AvatarFallback, AvatarImage } from '@/registry/default/components/ui/avatar'\nimport { Tooltip, TooltipContent, TooltipTrigger } from '@/registry/default/components/ui/tooltip'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nconst avatarStackVariants = cva('flex -space-x-4 -space-y-4', {\n variants: {\n orientation: {\n vertical: 'flex-row',\n horizontal: 'flex-col',\n },\n },\n defaultVariants: {\n orientation: 'vertical',\n },\n})\n\nexport interface AvatarStackProps\n extends React.HTMLAttributes<HTMLDivElement>,\n VariantProps<typeof avatarStackVariants> {\n avatars: { name: string; image: string }[]\n maxAvatarsAmount?: number\n}\n\nconst AvatarStack = ({\n className,\n orientation,\n avatars,\n maxAvatarsAmount = 3,\n ...props\n}: AvatarStackProps) => {\n const shownAvatars = avatars.slice(0, maxAvatarsAmount)\n const hiddenAvatars = avatars.slice(maxAvatarsAmount)\n\n return (\n <div\n className={cn(\n avatarStackVariants({ orientation }),\n className,\n orientation === 'horizontal' ? '-space-x-0' : '-space-y-0'\n )}\n {...props}\n >\n {shownAvatars.map(({ name, image }, index) => (\n <Tooltip key={`${name}-${image}-${index}`}>\n <TooltipTrigger asChild>\n <Avatar className=\"hover:z-10\">\n <AvatarImage src={image} />\n <AvatarFallback>\n {name\n ?.split(' ')\n ?.map((word) => word[0])\n ?.join('')\n ?.toUpperCase()}\n </AvatarFallback>\n </Avatar>\n </TooltipTrigger>\n <TooltipContent>\n <p>{name}</p>\n </TooltipContent>\n </Tooltip>\n ))}\n\n {hiddenAvatars.length ? (\n <Tooltip key=\"hidden-avatars\">\n <TooltipTrigger asChild>\n <Avatar>\n <AvatarFallback>+{avatars.length - shownAvatars.length}</AvatarFallback>\n </Avatar>\n </TooltipTrigger>\n <TooltipContent>\n {hiddenAvatars.map(({ name }, index) => (\n <p key={`${name}-${index}`}>{name}</p>\n ))}\n </TooltipContent>\n </Tooltip>\n ) : null}\n </div>\n )\n}\n\nexport { AvatarStack, avatarStackVariants }\n",
"type": "registry:component"
},
{
diff --git a/apps/ui-library/public/r/realtime-avatar-stack-react-router.json b/apps/ui-library/public/r/realtime-avatar-stack-react-router.json
index b4d74875cef..aa104595204 100644
--- a/apps/ui-library/public/r/realtime-avatar-stack-react-router.json
+++ b/apps/ui-library/public/r/realtime-avatar-stack-react-router.json
@@ -15,7 +15,7 @@
"files": [
{
"path": "registry/default/blocks/realtime-avatar-stack/components/avatar-stack.tsx",
- "content": "import { cn } from '@/lib/utils'\nimport { Avatar, AvatarFallback, AvatarImage } from '@/registry/default/components/ui/avatar'\nimport { Tooltip, TooltipContent, TooltipTrigger } from '@/registry/default/components/ui/tooltip'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nconst avatarStackVariants = cva('flex -space-x-4 -space-y-4', {\n variants: {\n orientation: {\n vertical: 'flex-row',\n horizontal: 'flex-col',\n },\n },\n defaultVariants: {\n orientation: 'vertical',\n },\n})\n\nexport interface AvatarStackProps\n extends React.HTMLAttributes<HTMLDivElement>,\n VariantProps<typeof avatarStackVariants> {\n avatars: { name: string; image: string }[]\n maxAvatarsAmount?: number\n}\n\nconst AvatarStack = ({\n className,\n orientation,\n avatars,\n maxAvatarsAmount = 3,\n ...props\n}: AvatarStackProps) => {\n const shownAvatars = avatars.slice(0, maxAvatarsAmount)\n const hiddenAvatars = avatars.slice(maxAvatarsAmount)\n\n return (\n <div\n className={cn(\n avatarStackVariants({ orientation }),\n className,\n orientation === 'horizontal' ? '-space-x-0' : '-space-y-0'\n )}\n {...props}\n >\n {shownAvatars.map(({ name, image }, index) => (\n <Tooltip key={`${name}-${image}-${index}`}>\n <TooltipTrigger asChild>\n <Avatar className={'hover:z-10'}>\n <AvatarImage src={image} />\n <AvatarFallback>\n {name\n ?.split(' ')\n ?.map((word) => word[0])\n ?.join('')\n ?.toUpperCase()}\n </AvatarFallback>\n </Avatar>\n </TooltipTrigger>\n <TooltipContent>\n <p>{name}</p>\n </TooltipContent>\n </Tooltip>\n ))}\n\n {hiddenAvatars.length ? (\n <Tooltip key=\"hidden-avatars\">\n <TooltipTrigger asChild>\n <Avatar>\n <AvatarFallback>+{avatars.length - shownAvatars.length}</AvatarFallback>\n </Avatar>\n </TooltipTrigger>\n <TooltipContent className=\"flex flex-col gap-2 bg-gray-100 p-2 rounded border\">\n {hiddenAvatars.map(({ name }, index) => (\n <p key={`${name}-${index}`}>{name}</p>\n ))}\n </TooltipContent>\n </Tooltip>\n ) : null}\n </div>\n )\n}\n\nexport { AvatarStack, avatarStackVariants }\n",
+ "content": "import { cn } from '@/lib/utils'\nimport { Avatar, AvatarFallback, AvatarImage } from '@/registry/default/components/ui/avatar'\nimport { Tooltip, TooltipContent, TooltipTrigger } from '@/registry/default/components/ui/tooltip'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nconst avatarStackVariants = cva('flex -space-x-4 -space-y-4', {\n variants: {\n orientation: {\n vertical: 'flex-row',\n horizontal: 'flex-col',\n },\n },\n defaultVariants: {\n orientation: 'vertical',\n },\n})\n\nexport interface AvatarStackProps\n extends React.HTMLAttributes<HTMLDivElement>,\n VariantProps<typeof avatarStackVariants> {\n avatars: { name: string; image: string }[]\n maxAvatarsAmount?: number\n}\n\nconst AvatarStack = ({\n className,\n orientation,\n avatars,\n maxAvatarsAmount = 3,\n ...props\n}: AvatarStackProps) => {\n const shownAvatars = avatars.slice(0, maxAvatarsAmount)\n const hiddenAvatars = avatars.slice(maxAvatarsAmount)\n\n return (\n <div\n className={cn(\n avatarStackVariants({ orientation }),\n className,\n orientation === 'horizontal' ? '-space-x-0' : '-space-y-0'\n )}\n {...props}\n >\n {shownAvatars.map(({ name, image }, index) => (\n <Tooltip key={`${name}-${image}-${index}`}>\n <TooltipTrigger asChild>\n <Avatar className=\"hover:z-10\">\n <AvatarImage src={image} />\n <AvatarFallback>\n {name\n ?.split(' ')\n ?.map((word) => word[0])\n ?.join('')\n ?.toUpperCase()}\n </AvatarFallback>\n </Avatar>\n </TooltipTrigger>\n <TooltipContent>\n <p>{name}</p>\n </TooltipContent>\n </Tooltip>\n ))}\n\n {hiddenAvatars.length ? (\n <Tooltip key=\"hidden-avatars\">\n <TooltipTrigger asChild>\n <Avatar>\n <AvatarFallback>+{avatars.length - shownAvatars.length}</AvatarFallback>\n </Avatar>\n </TooltipTrigger>\n <TooltipContent>\n {hiddenAvatars.map(({ name }, index) => (\n <p key={`${name}-${index}`}>{name}</p>\n ))}\n </TooltipContent>\n </Tooltip>\n ) : null}\n </div>\n )\n}\n\nexport { AvatarStack, avatarStackVariants }\n",
"type": "registry:component"
},
{
diff --git a/apps/ui-library/public/r/realtime-avatar-stack-react.json b/apps/ui-library/public/r/realtime-avatar-stack-react.json
index 6f4825557a2..ad3a5e35cc0 100644
--- a/apps/ui-library/public/r/realtime-avatar-stack-react.json
+++ b/apps/ui-library/public/r/realtime-avatar-stack-react.json
@@ -14,7 +14,7 @@
"files": [
{
"path": "registry/default/blocks/realtime-avatar-stack/components/avatar-stack.tsx",
- "content": "import { cn } from '@/lib/utils'\nimport { Avatar, AvatarFallback, AvatarImage } from '@/registry/default/components/ui/avatar'\nimport { Tooltip, TooltipContent, TooltipTrigger } from '@/registry/default/components/ui/tooltip'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nconst avatarStackVariants = cva('flex -space-x-4 -space-y-4', {\n variants: {\n orientation: {\n vertical: 'flex-row',\n horizontal: 'flex-col',\n },\n },\n defaultVariants: {\n orientation: 'vertical',\n },\n})\n\nexport interface AvatarStackProps\n extends React.HTMLAttributes<HTMLDivElement>,\n VariantProps<typeof avatarStackVariants> {\n avatars: { name: string; image: string }[]\n maxAvatarsAmount?: number\n}\n\nconst AvatarStack = ({\n className,\n orientation,\n avatars,\n maxAvatarsAmount = 3,\n ...props\n}: AvatarStackProps) => {\n const shownAvatars = avatars.slice(0, maxAvatarsAmount)\n const hiddenAvatars = avatars.slice(maxAvatarsAmount)\n\n return (\n <div\n className={cn(\n avatarStackVariants({ orientation }),\n className,\n orientation === 'horizontal' ? '-space-x-0' : '-space-y-0'\n )}\n {...props}\n >\n {shownAvatars.map(({ name, image }, index) => (\n <Tooltip key={`${name}-${image}-${index}`}>\n <TooltipTrigger asChild>\n <Avatar className={'hover:z-10'}>\n <AvatarImage src={image} />\n <AvatarFallback>\n {name\n ?.split(' ')\n ?.map((word) => word[0])\n ?.join('')\n ?.toUpperCase()}\n </AvatarFallback>\n </Avatar>\n </TooltipTrigger>\n <TooltipContent>\n <p>{name}</p>\n </TooltipContent>\n </Tooltip>\n ))}\n\n {hiddenAvatars.length ? (\n <Tooltip key=\"hidden-avatars\">\n <TooltipTrigger asChild>\n <Avatar>\n <AvatarFallback>+{avatars.length - shownAvatars.length}</AvatarFallback>\n </Avatar>\n </TooltipTrigger>\n <TooltipContent className=\"flex flex-col gap-2 bg-gray-100 p-2 rounded border\">\n {hiddenAvatars.map(({ name }, index) => (\n <p key={`${name}-${index}`}>{name}</p>\n ))}\n </TooltipContent>\n </Tooltip>\n ) : null}\n </div>\n )\n}\n\nexport { AvatarStack, avatarStackVariants }\n",
+ "content": "import { cn } from '@/lib/utils'\nimport { Avatar, AvatarFallback, AvatarImage } from '@/registry/default/components/ui/avatar'\nimport { Tooltip, TooltipContent, TooltipTrigger } from '@/registry/default/components/ui/tooltip'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nconst avatarStackVariants = cva('flex -space-x-4 -space-y-4', {\n variants: {\n orientation: {\n vertical: 'flex-row',\n horizontal: 'flex-col',\n },\n },\n defaultVariants: {\n orientation: 'vertical',\n },\n})\n\nexport interface AvatarStackProps\n extends React.HTMLAttributes<HTMLDivElement>,\n VariantProps<typeof avatarStackVariants> {\n avatars: { name: string; image: string }[]\n maxAvatarsAmount?: number\n}\n\nconst AvatarStack = ({\n className,\n orientation,\n avatars,\n maxAvatarsAmount = 3,\n ...props\n}: AvatarStackProps) => {\n const shownAvatars = avatars.slice(0, maxAvatarsAmount)\n const hiddenAvatars = avatars.slice(maxAvatarsAmount)\n\n return (\n <div\n className={cn(\n avatarStackVariants({ orientation }),\n className,\n orientation === 'horizontal' ? '-space-x-0' : '-space-y-0'\n )}\n {...props}\n >\n {shownAvatars.map(({ name, image }, index) => (\n <Tooltip key={`${name}-${image}-${index}`}>\n <TooltipTrigger asChild>\n <Avatar className=\"hover:z-10\">\n <AvatarImage src={image} />\n <AvatarFallback>\n {name\n ?.split(' ')\n ?.map((word) => word[0])\n ?.join('')\n ?.toUpperCase()}\n </AvatarFallback>\n </Avatar>\n </TooltipTrigger>\n <TooltipContent>\n <p>{name}</p>\n </TooltipContent>\n </Tooltip>\n ))}\n\n {hiddenAvatars.length ? (\n <Tooltip key=\"hidden-avatars\">\n <TooltipTrigger asChild>\n <Avatar>\n <AvatarFallback>+{avatars.length - shownAvatars.length}</AvatarFallback>\n </Avatar>\n </TooltipTrigger>\n <TooltipContent>\n {hiddenAvatars.map(({ name }, index) => (\n <p key={`${name}-${index}`}>{name}</p>\n ))}\n </TooltipContent>\n </Tooltip>\n ) : null}\n </div>\n )\n}\n\nexport { AvatarStack, avatarStackVariants }\n",
"type": "registry:component"
},
{
diff --git a/apps/ui-library/public/r/realtime-avatar-stack-tanstack.json b/apps/ui-library/public/r/realtime-avatar-stack-tanstack.json
index 61dce22414b..3b8d2fc7ecd 100644
--- a/apps/ui-library/public/r/realtime-avatar-stack-tanstack.json
+++ b/apps/ui-library/public/r/realtime-avatar-stack-tanstack.json
@@ -15,7 +15,7 @@
"files": [
{
"path": "registry/default/blocks/realtime-avatar-stack/components/avatar-stack.tsx",
- "content": "import { cn } from '@/lib/utils'\nimport { Avatar, AvatarFallback, AvatarImage } from '@/registry/default/components/ui/avatar'\nimport { Tooltip, TooltipContent, TooltipTrigger } from '@/registry/default/components/ui/tooltip'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nconst avatarStackVariants = cva('flex -space-x-4 -space-y-4', {\n variants: {\n orientation: {\n vertical: 'flex-row',\n horizontal: 'flex-col',\n },\n },\n defaultVariants: {\n orientation: 'vertical',\n },\n})\n\nexport interface AvatarStackProps\n extends React.HTMLAttributes<HTMLDivElement>,\n VariantProps<typeof avatarStackVariants> {\n avatars: { name: string; image: string }[]\n maxAvatarsAmount?: number\n}\n\nconst AvatarStack = ({\n className,\n orientation,\n avatars,\n maxAvatarsAmount = 3,\n ...props\n}: AvatarStackProps) => {\n const shownAvatars = avatars.slice(0, maxAvatarsAmount)\n const hiddenAvatars = avatars.slice(maxAvatarsAmount)\n\n return (\n <div\n className={cn(\n avatarStackVariants({ orientation }),\n className,\n orientation === 'horizontal' ? '-space-x-0' : '-space-y-0'\n )}\n {...props}\n >\n {shownAvatars.map(({ name, image }, index) => (\n <Tooltip key={`${name}-${image}-${index}`}>\n <TooltipTrigger asChild>\n <Avatar className={'hover:z-10'}>\n <AvatarImage src={image} />\n <AvatarFallback>\n {name\n ?.split(' ')\n ?.map((word) => word[0])\n ?.join('')\n ?.toUpperCase()}\n </AvatarFallback>\n </Avatar>\n </TooltipTrigger>\n <TooltipContent>\n <p>{name}</p>\n </TooltipContent>\n </Tooltip>\n ))}\n\n {hiddenAvatars.length ? (\n <Tooltip key=\"hidden-avatars\">\n <TooltipTrigger asChild>\n <Avatar>\n <AvatarFallback>+{avatars.length - shownAvatars.length}</AvatarFallback>\n </Avatar>\n </TooltipTrigger>\n <TooltipContent className=\"flex flex-col gap-2 bg-gray-100 p-2 rounded border\">\n {hiddenAvatars.map(({ name }, index) => (\n <p key={`${name}-${index}`}>{name}</p>\n ))}\n </TooltipContent>\n </Tooltip>\n ) : null}\n </div>\n )\n}\n\nexport { AvatarStack, avatarStackVariants }\n",
+ "content": "import { cn } from '@/lib/utils'\nimport { Avatar, AvatarFallback, AvatarImage } from '@/registry/default/components/ui/avatar'\nimport { Tooltip, TooltipContent, TooltipTrigger } from '@/registry/default/components/ui/tooltip'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nconst avatarStackVariants = cva('flex -space-x-4 -space-y-4', {\n variants: {\n orientation: {\n vertical: 'flex-row',\n horizontal: 'flex-col',\n },\n },\n defaultVariants: {\n orientation: 'vertical',\n },\n})\n\nexport interface AvatarStackProps\n extends React.HTMLAttributes<HTMLDivElement>,\n VariantProps<typeof avatarStackVariants> {\n avatars: { name: string; image: string }[]\n maxAvatarsAmount?: number\n}\n\nconst AvatarStack = ({\n className,\n orientation,\n avatars,\n maxAvatarsAmount = 3,\n ...props\n}: AvatarStackProps) => {\n const shownAvatars = avatars.slice(0, maxAvatarsAmount)\n const hiddenAvatars = avatars.slice(maxAvatarsAmount)\n\n return (\n <div\n className={cn(\n avatarStackVariants({ orientation }),\n className,\n orientation === 'horizontal' ? '-space-x-0' : '-space-y-0'\n )}\n {...props}\n >\n {shownAvatars.map(({ name, image }, index) => (\n <Tooltip key={`${name}-${image}-${index}`}>\n <TooltipTrigger asChild>\n <Avatar className=\"hover:z-10\">\n <AvatarImage src={image} />\n <AvatarFallback>\n {name\n ?.split(' ')\n ?.map((word) => word[0])\n ?.join('')\n ?.toUpperCase()}\n </AvatarFallback>\n </Avatar>\n </TooltipTrigger>\n <TooltipContent>\n <p>{name}</p>\n </TooltipContent>\n </Tooltip>\n ))}\n\n {hiddenAvatars.length ? (\n <Tooltip key=\"hidden-avatars\">\n <TooltipTrigger asChild>\n <Avatar>\n <AvatarFallback>+{avatars.length - shownAvatars.length}</AvatarFallback>\n </Avatar>\n </TooltipTrigger>\n <TooltipContent>\n {hiddenAvatars.map(({ name }, index) => (\n <p key={`${name}-${index}`}>{name}</p>\n ))}\n </TooltipContent>\n </Tooltip>\n ) : null}\n </div>\n )\n}\n\nexport { AvatarStack, avatarStackVariants }\n",
"type": "registry:component"
},
{
diff --git a/apps/ui-library/public/r/realtime-chat-nextjs.json b/apps/ui-library/public/r/realtime-chat-nextjs.json
index 8955c4bfee0..01116d924ff 100644
--- a/apps/ui-library/public/r/realtime-chat-nextjs.json
+++ b/apps/ui-library/public/r/realtime-chat-nextjs.json
@@ -20,7 +20,7 @@
},
{
"path": "registry/default/blocks/realtime-chat/components/realtime-chat.tsx",
- "content": "'use client'\n\nimport { cn } from '@/lib/utils'\nimport { ChatMessageItem } from '@/registry/default/blocks/realtime-chat/components/chat-message'\nimport { useChatScroll } from '@/registry/default/blocks/realtime-chat/hooks/use-chat-scroll'\nimport {\n ChatMessage,\n useRealtimeChat,\n} from '@/registry/default/blocks/realtime-chat/hooks/use-realtime-chat'\nimport { Button } from '@/registry/default/components/ui/button'\nimport { Input } from '@/registry/default/components/ui/input'\nimport { Send } from 'lucide-react'\nimport { useCallback, useEffect, useState } from 'react'\n\ninterface RealtimeChatProps {\n roomName: string\n username: string\n onMessage?: (messages: ChatMessage[]) => void\n messages?: ChatMessage[]\n}\n\n/**\n * Realtime chat component\n * @param roomName - The name of the room to join. Each room is a unique chat.\n * @param username - The username of the user\n * @param onMessage - The callback function to handle the messages. Useful if you want to store the messages in a database.\n * @param messages - The messages to display in the chat. Useful if you want to display messages from a database.\n * @returns The chat component\n */\nexport const RealtimeChat = ({\n roomName,\n username,\n onMessage,\n messages: initialMessages = [],\n}: RealtimeChatProps) => {\n const { containerRef, scrollToBottom } = useChatScroll()\n const [allMessages, setAllMessages] = useState<ChatMessage[]>(initialMessages)\n\n const {\n messages: realtimeMessages,\n sendMessage,\n isConnected,\n } = useRealtimeChat({\n roomName,\n username,\n })\n const [newMessage, setNewMessage] = useState('')\n\n // Merge realtime messages with initial messages\n useEffect(() => {\n const mergedMessages = [...initialMessages, ...realtimeMessages]\n // Remove duplicates based on message id\n const uniqueMessages = mergedMessages.filter(\n (message, index, self) => index === self.findIndex((m) => m.id === message.id)\n )\n // Sort by creation date\n const sortedMessages = uniqueMessages.sort(\n (a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime()\n )\n setAllMessages(sortedMessages)\n }, [initialMessages, realtimeMessages])\n\n useEffect(() => {\n if (onMessage) {\n onMessage(allMessages)\n }\n }, [allMessages, onMessage])\n\n useEffect(() => {\n // Scroll to bottom whenever messages change\n scrollToBottom()\n }, [allMessages, scrollToBottom])\n\n const handleSendMessage = useCallback(\n (e: React.FormEvent) => {\n e.preventDefault()\n if (!newMessage.trim() || !isConnected) return\n\n sendMessage(newMessage)\n setNewMessage('')\n },\n [newMessage, isConnected, sendMessage]\n )\n\n return (\n <div className=\"flex flex-col h-full w-full bg-background text-foreground antialiased\">\n {/* Messages */}\n <div ref={containerRef} className=\"flex-1 overflow-y-auto p-4 space-y-4\">\n {allMessages.length === 0 ? (\n <div className=\"text-center text-sm text-muted-foreground\">\n No messages yet. Start the conversation!\n </div>\n ) : null}\n <div className=\"space-y-1\">\n {allMessages.map((message, index) => {\n const prevMessage = index > 0 ? allMessages[index - 1] : null\n const showHeader = !prevMessage || prevMessage.user.name !== message.user.name\n\n return (\n <div\n key={message.id}\n className=\"animate-in fade-in slide-in-from-bottom-4 duration-300\"\n >\n <ChatMessageItem\n message={message}\n isOwnMessage={message.user.name === username}\n showHeader={showHeader}\n />\n </div>\n )\n })}\n </div>\n </div>\n\n <form onSubmit={handleSendMessage} className=\"flex w-full gap-2 border-t border-border p-4\">\n <Input\n className={cn(\n 'rounded-full bg-background text-sm transition-all duration-300',\n isConnected && newMessage.trim() ? 'w-[calc(100%-36px)]' : 'w-full'\n )}\n type=\"text\"\n value={newMessage}\n onChange={(e) => setNewMessage(e.target.value)}\n placeholder=\"Type a message...\"\n disabled={!isConnected}\n />\n {isConnected && newMessage.trim() && (\n <Button\n className=\"aspect-square rounded-full animate-in fade-in slide-in-from-right-4 duration-300\"\n type=\"submit\"\n disabled={!isConnected}\n >\n <Send className=\"size-4\" />\n </Button>\n )}\n </form>\n </div>\n )\n}\n",
+ "content": "'use client'\n\nimport { cn } from '@/lib/utils'\nimport { ChatMessageItem } from '@/registry/default/blocks/realtime-chat/components/chat-message'\nimport { useChatScroll } from '@/registry/default/blocks/realtime-chat/hooks/use-chat-scroll'\nimport {\n ChatMessage,\n useRealtimeChat,\n} from '@/registry/default/blocks/realtime-chat/hooks/use-realtime-chat'\nimport { Button } from '@/registry/default/components/ui/button'\nimport { Input } from '@/registry/default/components/ui/input'\nimport { Send } from 'lucide-react'\nimport { useCallback, useEffect, useMemo, useState } from 'react'\n\ninterface RealtimeChatProps {\n roomName: string\n username: string\n onMessage?: (messages: ChatMessage[]) => void\n messages?: ChatMessage[]\n}\n\n/**\n * Realtime chat component\n * @param roomName - The name of the room to join. Each room is a unique chat.\n * @param username - The username of the user\n * @param onMessage - The callback function to handle the messages. Useful if you want to store the messages in a database.\n * @param messages - The messages to display in the chat. Useful if you want to display messages from a database.\n * @returns The chat component\n */\nexport const RealtimeChat = ({\n roomName,\n username,\n onMessage,\n messages: initialMessages = [],\n}: RealtimeChatProps) => {\n const { containerRef, scrollToBottom } = useChatScroll()\n\n const {\n messages: realtimeMessages,\n sendMessage,\n isConnected,\n } = useRealtimeChat({\n roomName,\n username,\n })\n const [newMessage, setNewMessage] = useState('')\n\n // Merge realtime messages with initial messages\n const allMessages = useMemo(() => {\n const mergedMessages = [...initialMessages, ...realtimeMessages]\n // Remove duplicates based on message id\n const uniqueMessages = mergedMessages.filter(\n (message, index, self) => index === self.findIndex((m) => m.id === message.id)\n )\n // Sort by creation date\n const sortedMessages = uniqueMessages.sort((a, b) => a.createdAt.localeCompare(b.createdAt))\n\n return sortedMessages\n }, [initialMessages, realtimeMessages])\n\n useEffect(() => {\n if (onMessage) {\n onMessage(allMessages)\n }\n }, [allMessages, onMessage])\n\n useEffect(() => {\n // Scroll to bottom whenever messages change\n scrollToBottom()\n }, [allMessages, scrollToBottom])\n\n const handleSendMessage = useCallback(\n (e: React.FormEvent) => {\n e.preventDefault()\n if (!newMessage.trim() || !isConnected) return\n\n sendMessage(newMessage)\n setNewMessage('')\n },\n [newMessage, isConnected, sendMessage]\n )\n\n return (\n <div className=\"flex flex-col h-full w-full bg-background text-foreground antialiased\">\n {/* Messages */}\n <div ref={containerRef} className=\"flex-1 overflow-y-auto p-4 space-y-4\">\n {allMessages.length === 0 ? (\n <div className=\"text-center text-sm text-muted-foreground\">\n No messages yet. Start the conversation!\n </div>\n ) : null}\n <div className=\"space-y-1\">\n {allMessages.map((message, index) => {\n const prevMessage = index > 0 ? allMessages[index - 1] : null\n const showHeader = !prevMessage || prevMessage.user.name !== message.user.name\n\n return (\n <div\n key={message.id}\n className=\"animate-in fade-in slide-in-from-bottom-4 duration-300\"\n >\n <ChatMessageItem\n message={message}\n isOwnMessage={message.user.name === username}\n showHeader={showHeader}\n />\n </div>\n )\n })}\n </div>\n </div>\n\n <form onSubmit={handleSendMessage} className=\"flex w-full gap-2 border-t border-border p-4\">\n <Input\n className={cn(\n 'rounded-full bg-background text-sm transition-all duration-300',\n isConnected && newMessage.trim() ? 'w-[calc(100%-36px)]' : 'w-full'\n )}\n type=\"text\"\n value={newMessage}\n onChange={(e) => setNewMessage(e.target.value)}\n placeholder=\"Type a message...\"\n disabled={!isConnected}\n />\n {isConnected && newMessage.trim() && (\n <Button\n className=\"aspect-square rounded-full animate-in fade-in slide-in-from-right-4 duration-300\"\n type=\"submit\"\n disabled={!isConnected}\n >\n <Send className=\"size-4\" />\n </Button>\n )}\n </form>\n </div>\n )\n}\n",
"type": "registry:component"
},
{
@@ -40,7 +40,7 @@
},
{
"path": "registry/default/clients/nextjs/lib/supabase/middleware.ts",
- "content": "import { createServerClient } from '@supabase/ssr'\nimport { NextResponse, type NextRequest } from 'next/server'\n\nexport async function updateSession(request: NextRequest) {\n let supabaseResponse = NextResponse.next({\n request,\n })\n\n const supabase = createServerClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,\n {\n cookies: {\n getAll() {\n return request.cookies.getAll()\n },\n setAll(cookiesToSet) {\n cookiesToSet.forEach(({ name, value }) => request.cookies.set(name, value))\n supabaseResponse = NextResponse.next({\n request,\n })\n cookiesToSet.forEach(({ name, value, options }) =>\n supabaseResponse.cookies.set(name, value, options)\n )\n },\n },\n }\n )\n\n // Do not run code between createServerClient and\n // supabase.auth.getUser(). A simple mistake could make it very hard to debug\n // issues with users being randomly logged out.\n\n // IMPORTANT: DO NOT REMOVE auth.getUser()\n\n const {\n data: { user },\n } = await supabase.auth.getUser()\n\n if (\n !user &&\n !request.nextUrl.pathname.startsWith('/login') &&\n !request.nextUrl.pathname.startsWith('/auth')\n ) {\n // no user, potentially respond by redirecting the user to the login page\n const url = request.nextUrl.clone()\n url.pathname = '/login'\n return NextResponse.redirect(url)\n }\n\n // IMPORTANT: You *must* return the supabaseResponse object as it is.\n // If you're creating a new response object with NextResponse.next() make sure to:\n // 1. Pass the request in it, like so:\n // const myNewResponse = NextResponse.next({ request })\n // 2. Copy over the cookies, like so:\n // myNewResponse.cookies.setAll(supabaseResponse.cookies.getAll())\n // 3. Change the myNewResponse object to fit your needs, but avoid changing\n // the cookies!\n // 4. Finally:\n // return myNewResponse\n // If this is not done, you may be causing the browser and server to go out\n // of sync and terminate the user's session prematurely!\n\n return supabaseResponse\n}\n",
+ "content": "import { createServerClient } from '@supabase/ssr'\nimport { NextResponse, type NextRequest } from 'next/server'\n\nexport async function updateSession(request: NextRequest) {\n let supabaseResponse = NextResponse.next({\n request,\n })\n\n const supabase = createServerClient(\n process.env.NEXT_PUBLIC_SUPABASE_URL!,\n process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,\n {\n cookies: {\n getAll() {\n return request.cookies.getAll()\n },\n setAll(cookiesToSet) {\n cookiesToSet.forEach(({ name, value }) => request.cookies.set(name, value))\n supabaseResponse = NextResponse.next({\n request,\n })\n cookiesToSet.forEach(({ name, value, options }) =>\n supabaseResponse.cookies.set(name, value, options)\n )\n },\n },\n }\n )\n\n // Do not run code between createServerClient and\n // supabase.auth.getUser(). A simple mistake could make it very hard to debug\n // issues with users being randomly logged out.\n\n // IMPORTANT: DO NOT REMOVE auth.getUser()\n\n const {\n data: { user },\n } = await supabase.auth.getUser()\n\n if (\n !user &&\n !request.nextUrl.pathname.startsWith('/login') &&\n !request.nextUrl.pathname.startsWith('/auth')\n ) {\n // no user, potentially respond by redirecting the user to the login page\n const url = request.nextUrl.clone()\n url.pathname = '/auth/login'\n return NextResponse.redirect(url)\n }\n\n // IMPORTANT: You *must* return the supabaseResponse object as it is.\n // If you're creating a new response object with NextResponse.next() make sure to:\n // 1. Pass the request in it, like so:\n // const myNewResponse = NextResponse.next({ request })\n // 2. Copy over the cookies, like so:\n // myNewResponse.cookies.setAll(supabaseResponse.cookies.getAll())\n // 3. Change the myNewResponse object to fit your needs, but avoid changing\n // the cookies!\n // 4. Finally:\n // return myNewResponse\n // If this is not done, you may be causing the browser and server to go out\n // of sync and terminate the user's session prematurely!\n\n return supabaseResponse\n}\n",
"type": "registry:lib"
},
{
diff --git a/apps/ui-library/public/r/realtime-chat-react-router.json b/apps/ui-library/public/r/realtime-chat-react-router.json
index e78474c33d3..bf378f01d66 100644
--- a/apps/ui-library/public/r/realtime-chat-react-router.json
+++ b/apps/ui-library/public/r/realtime-chat-react-router.json
@@ -21,7 +21,7 @@
},
{
"path": "registry/default/blocks/realtime-chat/components/realtime-chat.tsx",
- "content": "'use client'\n\nimport { cn } from '@/lib/utils'\nimport { ChatMessageItem } from '@/registry/default/blocks/realtime-chat/components/chat-message'\nimport { useChatScroll } from '@/registry/default/blocks/realtime-chat/hooks/use-chat-scroll'\nimport {\n ChatMessage,\n useRealtimeChat,\n} from '@/registry/default/blocks/realtime-chat/hooks/use-realtime-chat'\nimport { Button } from '@/registry/default/components/ui/button'\nimport { Input } from '@/registry/default/components/ui/input'\nimport { Send } from 'lucide-react'\nimport { useCallback, useEffect, useState } from 'react'\n\ninterface RealtimeChatProps {\n roomName: string\n username: string\n onMessage?: (messages: ChatMessage[]) => void\n messages?: ChatMessage[]\n}\n\n/**\n * Realtime chat component\n * @param roomName - The name of the room to join. Each room is a unique chat.\n * @param username - The username of the user\n * @param onMessage - The callback function to handle the messages. Useful if you want to store the messages in a database.\n * @param messages - The messages to display in the chat. Useful if you want to display messages from a database.\n * @returns The chat component\n */\nexport const RealtimeChat = ({\n roomName,\n username,\n onMessage,\n messages: initialMessages = [],\n}: RealtimeChatProps) => {\n const { containerRef, scrollToBottom } = useChatScroll()\n const [allMessages, setAllMessages] = useState<ChatMessage[]>(initialMessages)\n\n const {\n messages: realtimeMessages,\n sendMessage,\n isConnected,\n } = useRealtimeChat({\n roomName,\n username,\n })\n const [newMessage, setNewMessage] = useState('')\n\n // Merge realtime messages with initial messages\n useEffect(() => {\n const mergedMessages = [...initialMessages, ...realtimeMessages]\n // Remove duplicates based on message id\n const uniqueMessages = mergedMessages.filter(\n (message, index, self) => index === self.findIndex((m) => m.id === message.id)\n )\n // Sort by creation date\n const sortedMessages = uniqueMessages.sort(\n (a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime()\n )\n setAllMessages(sortedMessages)\n }, [initialMessages, realtimeMessages])\n\n useEffect(() => {\n if (onMessage) {\n onMessage(allMessages)\n }\n }, [allMessages, onMessage])\n\n useEffect(() => {\n // Scroll to bottom whenever messages change\n scrollToBottom()\n }, [allMessages, scrollToBottom])\n\n const handleSendMessage = useCallback(\n (e: React.FormEvent) => {\n e.preventDefault()\n if (!newMessage.trim() || !isConnected) return\n\n sendMessage(newMessage)\n setNewMessage('')\n },\n [newMessage, isConnected, sendMessage]\n )\n\n return (\n <div className=\"flex flex-col h-full w-full bg-background text-foreground antialiased\">\n {/* Messages */}\n <div ref={containerRef} className=\"flex-1 overflow-y-auto p-4 space-y-4\">\n {allMessages.length === 0 ? (\n <div className=\"text-center text-sm text-muted-foreground\">\n No messages yet. Start the conversation!\n </div>\n ) : null}\n <div className=\"space-y-1\">\n {allMessages.map((message, index) => {\n const prevMessage = index > 0 ? allMessages[index - 1] : null\n const showHeader = !prevMessage || prevMessage.user.name !== message.user.name\n\n return (\n <div\n key={message.id}\n className=\"animate-in fade-in slide-in-from-bottom-4 duration-300\"\n >\n <ChatMessageItem\n message={message}\n isOwnMessage={message.user.name === username}\n showHeader={showHeader}\n />\n </div>\n )\n })}\n </div>\n </div>\n\n <form onSubmit={handleSendMessage} className=\"flex w-full gap-2 border-t border-border p-4\">\n <Input\n className={cn(\n 'rounded-full bg-background text-sm transition-all duration-300',\n isConnected && newMessage.trim() ? 'w-[calc(100%-36px)]' : 'w-full'\n )}\n type=\"text\"\n value={newMessage}\n onChange={(e) => setNewMessage(e.target.value)}\n placeholder=\"Type a message...\"\n disabled={!isConnected}\n />\n {isConnected && newMessage.trim() && (\n <Button\n className=\"aspect-square rounded-full animate-in fade-in slide-in-from-right-4 duration-300\"\n type=\"submit\"\n disabled={!isConnected}\n >\n <Send className=\"size-4\" />\n </Button>\n )}\n </form>\n </div>\n )\n}\n",
+ "content": "'use client'\n\nimport { cn } from '@/lib/utils'\nimport { ChatMessageItem } from '@/registry/default/blocks/realtime-chat/components/chat-message'\nimport { useChatScroll } from '@/registry/default/blocks/realtime-chat/hooks/use-chat-scroll'\nimport {\n ChatMessage,\n useRealtimeChat,\n} from '@/registry/default/blocks/realtime-chat/hooks/use-realtime-chat'\nimport { Button } from '@/registry/default/components/ui/button'\nimport { Input } from '@/registry/default/components/ui/input'\nimport { Send } from 'lucide-react'\nimport { useCallback, useEffect, useMemo, useState } from 'react'\n\ninterface RealtimeChatProps {\n roomName: string\n username: string\n onMessage?: (messages: ChatMessage[]) => void\n messages?: ChatMessage[]\n}\n\n/**\n * Realtime chat component\n * @param roomName - The name of the room to join. Each room is a unique chat.\n * @param username - The username of the user\n * @param onMessage - The callback function to handle the messages. Useful if you want to store the messages in a database.\n * @param messages - The messages to display in the chat. Useful if you want to display messages from a database.\n * @returns The chat component\n */\nexport const RealtimeChat = ({\n roomName,\n username,\n onMessage,\n messages: initialMessages = [],\n}: RealtimeChatProps) => {\n const { containerRef, scrollToBottom } = useChatScroll()\n\n const {\n messages: realtimeMessages,\n sendMessage,\n isConnected,\n } = useRealtimeChat({\n roomName,\n username,\n })\n const [newMessage, setNewMessage] = useState('')\n\n // Merge realtime messages with initial messages\n const allMessages = useMemo(() => {\n const mergedMessages = [...initialMessages, ...realtimeMessages]\n // Remove duplicates based on message id\n const uniqueMessages = mergedMessages.filter(\n (message, index, self) => index === self.findIndex((m) => m.id === message.id)\n )\n // Sort by creation date\n const sortedMessages = uniqueMessages.sort((a, b) => a.createdAt.localeCompare(b.createdAt))\n\n return sortedMessages\n }, [initialMessages, realtimeMessages])\n\n useEffect(() => {\n if (onMessage) {\n onMessage(allMessages)\n }\n }, [allMessages, onMessage])\n\n useEffect(() => {\n // Scroll to bottom whenever messages change\n scrollToBottom()\n }, [allMessages, scrollToBottom])\n\n const handleSendMessage = useCallback(\n (e: React.FormEvent) => {\n e.preventDefault()\n if (!newMessage.trim() || !isConnected) return\n\n sendMessage(newMessage)\n setNewMessage('')\n },\n [newMessage, isConnected, sendMessage]\n )\n\n return (\n <div className=\"flex flex-col h-full w-full bg-background text-foreground antialiased\">\n {/* Messages */}\n <div ref={containerRef} className=\"flex-1 overflow-y-auto p-4 space-y-4\">\n {allMessages.length === 0 ? (\n <div className=\"text-center text-sm text-muted-foreground\">\n No messages yet. Start the conversation!\n </div>\n ) : null}\n <div className=\"space-y-1\">\n {allMessages.map((message, index) => {\n const prevMessage = index > 0 ? allMessages[index - 1] : null\n const showHeader = !prevMessage || prevMessage.user.name !== message.user.name\n\n return (\n <div\n key={message.id}\n className=\"animate-in fade-in slide-in-from-bottom-4 duration-300\"\n >\n <ChatMessageItem\n message={message}\n isOwnMessage={message.user.name === username}\n showHeader={showHeader}\n />\n </div>\n )\n })}\n </div>\n </div>\n\n <form onSubmit={handleSendMessage} className=\"flex w-full gap-2 border-t border-border p-4\">\n <Input\n className={cn(\n 'rounded-full bg-background text-sm transition-all duration-300',\n isConnected && newMessage.trim() ? 'w-[calc(100%-36px)]' : 'w-full'\n )}\n type=\"text\"\n value={newMessage}\n onChange={(e) => setNewMessage(e.target.value)}\n placeholder=\"Type a message...\"\n disabled={!isConnected}\n />\n {isConnected && newMessage.trim() && (\n <Button\n className=\"aspect-square rounded-full animate-in fade-in slide-in-from-right-4 duration-300\"\n type=\"submit\"\n disabled={!isConnected}\n >\n <Send className=\"size-4\" />\n </Button>\n )}\n </form>\n </div>\n )\n}\n",
"type": "registry:component"
},
{
diff --git a/apps/ui-library/public/r/realtime-chat-react.json b/apps/ui-library/public/r/realtime-chat-react.json
index 4498c3dfb65..f3095406be0 100644
--- a/apps/ui-library/public/r/realtime-chat-react.json
+++ b/apps/ui-library/public/r/realtime-chat-react.json
@@ -20,7 +20,7 @@
},
{
"path": "registry/default/blocks/realtime-chat/components/realtime-chat.tsx",
- "content": "'use client'\n\nimport { cn } from '@/lib/utils'\nimport { ChatMessageItem } from '@/registry/default/blocks/realtime-chat/components/chat-message'\nimport { useChatScroll } from '@/registry/default/blocks/realtime-chat/hooks/use-chat-scroll'\nimport {\n ChatMessage,\n useRealtimeChat,\n} from '@/registry/default/blocks/realtime-chat/hooks/use-realtime-chat'\nimport { Button } from '@/registry/default/components/ui/button'\nimport { Input } from '@/registry/default/components/ui/input'\nimport { Send } from 'lucide-react'\nimport { useCallback, useEffect, useState } from 'react'\n\ninterface RealtimeChatProps {\n roomName: string\n username: string\n onMessage?: (messages: ChatMessage[]) => void\n messages?: ChatMessage[]\n}\n\n/**\n * Realtime chat component\n * @param roomName - The name of the room to join. Each room is a unique chat.\n * @param username - The username of the user\n * @param onMessage - The callback function to handle the messages. Useful if you want to store the messages in a database.\n * @param messages - The messages to display in the chat. Useful if you want to display messages from a database.\n * @returns The chat component\n */\nexport const RealtimeChat = ({\n roomName,\n username,\n onMessage,\n messages: initialMessages = [],\n}: RealtimeChatProps) => {\n const { containerRef, scrollToBottom } = useChatScroll()\n const [allMessages, setAllMessages] = useState<ChatMessage[]>(initialMessages)\n\n const {\n messages: realtimeMessages,\n sendMessage,\n isConnected,\n } = useRealtimeChat({\n roomName,\n username,\n })\n const [newMessage, setNewMessage] = useState('')\n\n // Merge realtime messages with initial messages\n useEffect(() => {\n const mergedMessages = [...initialMessages, ...realtimeMessages]\n // Remove duplicates based on message id\n const uniqueMessages = mergedMessages.filter(\n (message, index, self) => index === self.findIndex((m) => m.id === message.id)\n )\n // Sort by creation date\n const sortedMessages = uniqueMessages.sort(\n (a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime()\n )\n setAllMessages(sortedMessages)\n }, [initialMessages, realtimeMessages])\n\n useEffect(() => {\n if (onMessage) {\n onMessage(allMessages)\n }\n }, [allMessages, onMessage])\n\n useEffect(() => {\n // Scroll to bottom whenever messages change\n scrollToBottom()\n }, [allMessages, scrollToBottom])\n\n const handleSendMessage = useCallback(\n (e: React.FormEvent) => {\n e.preventDefault()\n if (!newMessage.trim() || !isConnected) return\n\n sendMessage(newMessage)\n setNewMessage('')\n },\n [newMessage, isConnected, sendMessage]\n )\n\n return (\n <div className=\"flex flex-col h-full w-full bg-background text-foreground antialiased\">\n {/* Messages */}\n <div ref={containerRef} className=\"flex-1 overflow-y-auto p-4 space-y-4\">\n {allMessages.length === 0 ? (\n <div className=\"text-center text-sm text-muted-foreground\">\n No messages yet. Start the conversation!\n </div>\n ) : null}\n <div className=\"space-y-1\">\n {allMessages.map((message, index) => {\n const prevMessage = index > 0 ? allMessages[index - 1] : null\n const showHeader = !prevMessage || prevMessage.user.name !== message.user.name\n\n return (\n <div\n key={message.id}\n className=\"animate-in fade-in slide-in-from-bottom-4 duration-300\"\n >\n <ChatMessageItem\n message={message}\n isOwnMessage={message.user.name === username}\n showHeader={showHeader}\n />\n </div>\n )\n })}\n </div>\n </div>\n\n <form onSubmit={handleSendMessage} className=\"flex w-full gap-2 border-t border-border p-4\">\n <Input\n className={cn(\n 'rounded-full bg-background text-sm transition-all duration-300',\n isConnected && newMessage.trim() ? 'w-[calc(100%-36px)]' : 'w-full'\n )}\n type=\"text\"\n value={newMessage}\n onChange={(e) => setNewMessage(e.target.value)}\n placeholder=\"Type a message...\"\n disabled={!isConnected}\n />\n {isConnected && newMessage.trim() && (\n <Button\n className=\"aspect-square rounded-full animate-in fade-in slide-in-from-right-4 duration-300\"\n type=\"submit\"\n disabled={!isConnected}\n >\n <Send className=\"size-4\" />\n </Button>\n )}\n </form>\n </div>\n )\n}\n",
+ "content": "'use client'\n\nimport { cn } from '@/lib/utils'\nimport { ChatMessageItem } from '@/registry/default/blocks/realtime-chat/components/chat-message'\nimport { useChatScroll } from '@/registry/default/blocks/realtime-chat/hooks/use-chat-scroll'\nimport {\n ChatMessage,\n useRealtimeChat,\n} from '@/registry/default/blocks/realtime-chat/hooks/use-realtime-chat'\nimport { Button } from '@/registry/default/components/ui/button'\nimport { Input } from '@/registry/default/components/ui/input'\nimport { Send } from 'lucide-react'\nimport { useCallback, useEffect, useMemo, useState } from 'react'\n\ninterface RealtimeChatProps {\n roomName: string\n username: string\n onMessage?: (messages: ChatMessage[]) => void\n messages?: ChatMessage[]\n}\n\n/**\n * Realtime chat component\n * @param roomName - The name of the room to join. Each room is a unique chat.\n * @param username - The username of the user\n * @param onMessage - The callback function to handle the messages. Useful if you want to store the messages in a database.\n * @param messages - The messages to display in the chat. Useful if you want to display messages from a database.\n * @returns The chat component\n */\nexport const RealtimeChat = ({\n roomName,\n username,\n onMessage,\n messages: initialMessages = [],\n}: RealtimeChatProps) => {\n const { containerRef, scrollToBottom } = useChatScroll()\n\n const {\n messages: realtimeMessages,\n sendMessage,\n isConnected,\n } = useRealtimeChat({\n roomName,\n username,\n })\n const [newMessage, setNewMessage] = useState('')\n\n // Merge realtime messages with initial messages\n const allMessages = useMemo(() => {\n const mergedMessages = [...initialMessages, ...realtimeMessages]\n // Remove duplicates based on message id\n const uniqueMessages = mergedMessages.filter(\n (message, index, self) => index === self.findIndex((m) => m.id === message.id)\n )\n // Sort by creation date\n const sortedMessages = uniqueMessages.sort((a, b) => a.createdAt.localeCompare(b.createdAt))\n\n return sortedMessages\n }, [initialMessages, realtimeMessages])\n\n useEffect(() => {\n if (onMessage) {\n onMessage(allMessages)\n }\n }, [allMessages, onMessage])\n\n useEffect(() => {\n // Scroll to bottom whenever messages change\n scrollToBottom()\n }, [allMessages, scrollToBottom])\n\n const handleSendMessage = useCallback(\n (e: React.FormEvent) => {\n e.preventDefault()\n if (!newMessage.trim() || !isConnected) return\n\n sendMessage(newMessage)\n setNewMessage('')\n },\n [newMessage, isConnected, sendMessage]\n )\n\n return (\n <div className=\"flex flex-col h-full w-full bg-background text-foreground antialiased\">\n {/* Messages */}\n <div ref={containerRef} className=\"flex-1 overflow-y-auto p-4 space-y-4\">\n {allMessages.length === 0 ? (\n <div className=\"text-center text-sm text-muted-foreground\">\n No messages yet. Start the conversation!\n </div>\n ) : null}\n <div className=\"space-y-1\">\n {allMessages.map((message, index) => {\n const prevMessage = index > 0 ? allMessages[index - 1] : null\n const showHeader = !prevMessage || prevMessage.user.name !== message.user.name\n\n return (\n <div\n key={message.id}\n className=\"animate-in fade-in slide-in-from-bottom-4 duration-300\"\n >\n <ChatMessageItem\n message={message}\n isOwnMessage={message.user.name === username}\n showHeader={showHeader}\n />\n </div>\n )\n })}\n </div>\n </div>\n\n <form onSubmit={handleSendMessage} className=\"flex w-full gap-2 border-t border-border p-4\">\n <Input\n className={cn(\n 'rounded-full bg-background text-sm transition-all duration-300',\n isConnected && newMessage.trim() ? 'w-[calc(100%-36px)]' : 'w-full'\n )}\n type=\"text\"\n value={newMessage}\n onChange={(e) => setNewMessage(e.target.value)}\n placeholder=\"Type a message...\"\n disabled={!isConnected}\n />\n {isConnected && newMessage.trim() && (\n <Button\n className=\"aspect-square rounded-full animate-in fade-in slide-in-from-right-4 duration-300\"\n type=\"submit\"\n disabled={!isConnected}\n >\n <Send className=\"size-4\" />\n </Button>\n )}\n </form>\n </div>\n )\n}\n",
"type": "registry:component"
},
{
diff --git a/apps/ui-library/public/r/realtime-chat-tanstack.json b/apps/ui-library/public/r/realtime-chat-tanstack.json
index 60434de3acd..269745ca283 100644
--- a/apps/ui-library/public/r/realtime-chat-tanstack.json
+++ b/apps/ui-library/public/r/realtime-chat-tanstack.json
@@ -21,7 +21,7 @@
},
{
"path": "registry/default/blocks/realtime-chat/components/realtime-chat.tsx",
- "content": "'use client'\n\nimport { cn } from '@/lib/utils'\nimport { ChatMessageItem } from '@/registry/default/blocks/realtime-chat/components/chat-message'\nimport { useChatScroll } from '@/registry/default/blocks/realtime-chat/hooks/use-chat-scroll'\nimport {\n ChatMessage,\n useRealtimeChat,\n} from '@/registry/default/blocks/realtime-chat/hooks/use-realtime-chat'\nimport { Button } from '@/registry/default/components/ui/button'\nimport { Input } from '@/registry/default/components/ui/input'\nimport { Send } from 'lucide-react'\nimport { useCallback, useEffect, useState } from 'react'\n\ninterface RealtimeChatProps {\n roomName: string\n username: string\n onMessage?: (messages: ChatMessage[]) => void\n messages?: ChatMessage[]\n}\n\n/**\n * Realtime chat component\n * @param roomName - The name of the room to join. Each room is a unique chat.\n * @param username - The username of the user\n * @param onMessage - The callback function to handle the messages. Useful if you want to store the messages in a database.\n * @param messages - The messages to display in the chat. Useful if you want to display messages from a database.\n * @returns The chat component\n */\nexport const RealtimeChat = ({\n roomName,\n username,\n onMessage,\n messages: initialMessages = [],\n}: RealtimeChatProps) => {\n const { containerRef, scrollToBottom } = useChatScroll()\n const [allMessages, setAllMessages] = useState<ChatMessage[]>(initialMessages)\n\n const {\n messages: realtimeMessages,\n sendMessage,\n isConnected,\n } = useRealtimeChat({\n roomName,\n username,\n })\n const [newMessage, setNewMessage] = useState('')\n\n // Merge realtime messages with initial messages\n useEffect(() => {\n const mergedMessages = [...initialMessages, ...realtimeMessages]\n // Remove duplicates based on message id\n const uniqueMessages = mergedMessages.filter(\n (message, index, self) => index === self.findIndex((m) => m.id === message.id)\n )\n // Sort by creation date\n const sortedMessages = uniqueMessages.sort(\n (a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime()\n )\n setAllMessages(sortedMessages)\n }, [initialMessages, realtimeMessages])\n\n useEffect(() => {\n if (onMessage) {\n onMessage(allMessages)\n }\n }, [allMessages, onMessage])\n\n useEffect(() => {\n // Scroll to bottom whenever messages change\n scrollToBottom()\n }, [allMessages, scrollToBottom])\n\n const handleSendMessage = useCallback(\n (e: React.FormEvent) => {\n e.preventDefault()\n if (!newMessage.trim() || !isConnected) return\n\n sendMessage(newMessage)\n setNewMessage('')\n },\n [newMessage, isConnected, sendMessage]\n )\n\n return (\n <div className=\"flex flex-col h-full w-full bg-background text-foreground antialiased\">\n {/* Messages */}\n <div ref={containerRef} className=\"flex-1 overflow-y-auto p-4 space-y-4\">\n {allMessages.length === 0 ? (\n <div className=\"text-center text-sm text-muted-foreground\">\n No messages yet. Start the conversation!\n </div>\n ) : null}\n <div className=\"space-y-1\">\n {allMessages.map((message, index) => {\n const prevMessage = index > 0 ? allMessages[index - 1] : null\n const showHeader = !prevMessage || prevMessage.user.name !== message.user.name\n\n return (\n <div\n key={message.id}\n className=\"animate-in fade-in slide-in-from-bottom-4 duration-300\"\n >\n <ChatMessageItem\n message={message}\n isOwnMessage={message.user.name === username}\n showHeader={showHeader}\n />\n </div>\n )\n })}\n </div>\n </div>\n\n <form onSubmit={handleSendMessage} className=\"flex w-full gap-2 border-t border-border p-4\">\n <Input\n className={cn(\n 'rounded-full bg-background text-sm transition-all duration-300',\n isConnected && newMessage.trim() ? 'w-[calc(100%-36px)]' : 'w-full'\n )}\n type=\"text\"\n value={newMessage}\n onChange={(e) => setNewMessage(e.target.value)}\n placeholder=\"Type a message...\"\n disabled={!isConnected}\n />\n {isConnected && newMessage.trim() && (\n <Button\n className=\"aspect-square rounded-full animate-in fade-in slide-in-from-right-4 duration-300\"\n type=\"submit\"\n disabled={!isConnected}\n >\n <Send className=\"size-4\" />\n </Button>\n )}\n </form>\n </div>\n )\n}\n",
+ "content": "'use client'\n\nimport { cn } from '@/lib/utils'\nimport { ChatMessageItem } from '@/registry/default/blocks/realtime-chat/components/chat-message'\nimport { useChatScroll } from '@/registry/default/blocks/realtime-chat/hooks/use-chat-scroll'\nimport {\n ChatMessage,\n useRealtimeChat,\n} from '@/registry/default/blocks/realtime-chat/hooks/use-realtime-chat'\nimport { Button } from '@/registry/default/components/ui/button'\nimport { Input } from '@/registry/default/components/ui/input'\nimport { Send } from 'lucide-react'\nimport { useCallback, useEffect, useMemo, useState } from 'react'\n\ninterface RealtimeChatProps {\n roomName: string\n username: string\n onMessage?: (messages: ChatMessage[]) => void\n messages?: ChatMessage[]\n}\n\n/**\n * Realtime chat component\n * @param roomName - The name of the room to join. Each room is a unique chat.\n * @param username - The username of the user\n * @param onMessage - The callback function to handle the messages. Useful if you want to store the messages in a database.\n * @param messages - The messages to display in the chat. Useful if you want to display messages from a database.\n * @returns The chat component\n */\nexport const RealtimeChat = ({\n roomName,\n username,\n onMessage,\n messages: initialMessages = [],\n}: RealtimeChatProps) => {\n const { containerRef, scrollToBottom } = useChatScroll()\n\n const {\n messages: realtimeMessages,\n sendMessage,\n isConnected,\n } = useRealtimeChat({\n roomName,\n username,\n })\n const [newMessage, setNewMessage] = useState('')\n\n // Merge realtime messages with initial messages\n const allMessages = useMemo(() => {\n const mergedMessages = [...initialMessages, ...realtimeMessages]\n // Remove duplicates based on message id\n const uniqueMessages = mergedMessages.filter(\n (message, index, self) => index === self.findIndex((m) => m.id === message.id)\n )\n // Sort by creation date\n const sortedMessages = uniqueMessages.sort((a, b) => a.createdAt.localeCompare(b.createdAt))\n\n return sortedMessages\n }, [initialMessages, realtimeMessages])\n\n useEffect(() => {\n if (onMessage) {\n onMessage(allMessages)\n }\n }, [allMessages, onMessage])\n\n useEffect(() => {\n // Scroll to bottom whenever messages change\n scrollToBottom()\n }, [allMessages, scrollToBottom])\n\n const handleSendMessage = useCallback(\n (e: React.FormEvent) => {\n e.preventDefault()\n if (!newMessage.trim() || !isConnected) return\n\n sendMessage(newMessage)\n setNewMessage('')\n },\n [newMessage, isConnected, sendMessage]\n )\n\n return (\n <div className=\"flex flex-col h-full w-full bg-background text-foreground antialiased\">\n {/* Messages */}\n <div ref={containerRef} className=\"flex-1 overflow-y-auto p-4 space-y-4\">\n {allMessages.length === 0 ? (\n <div className=\"text-center text-sm text-muted-foreground\">\n No messages yet. Start the conversation!\n </div>\n ) : null}\n <div className=\"space-y-1\">\n {allMessages.map((message, index) => {\n const prevMessage = index > 0 ? allMessages[index - 1] : null\n const showHeader = !prevMessage || prevMessage.user.name !== message.user.name\n\n return (\n <div\n key={message.id}\n className=\"animate-in fade-in slide-in-from-bottom-4 duration-300\"\n >\n <ChatMessageItem\n message={message}\n isOwnMessage={message.user.name === username}\n showHeader={showHeader}\n />\n </div>\n )\n })}\n </div>\n </div>\n\n <form onSubmit={handleSendMessage} className=\"flex w-full gap-2 border-t border-border p-4\">\n <Input\n className={cn(\n 'rounded-full bg-background text-sm transition-all duration-300',\n isConnected && newMessage.trim() ? 'w-[calc(100%-36px)]' : 'w-full'\n )}\n type=\"text\"\n value={newMessage}\n onChange={(e) => setNewMessage(e.target.value)}\n placeholder=\"Type a message...\"\n disabled={!isConnected}\n />\n {isConnected && newMessage.trim() && (\n <Button\n className=\"aspect-square rounded-full animate-in fade-in slide-in-from-right-4 duration-300\"\n type=\"submit\"\n disabled={!isConnected}\n >\n <Send className=\"size-4\" />\n </Button>\n )}\n </form>\n </div>\n )\n}\n",
"type": "registry:component"
},
{
diff --git a/apps/ui-library/public/r/supabase-client-tanstack.json b/apps/ui-library/public/r/supabase-client-tanstack.json
index 116e5c7243c..26047e045e9 100644
--- a/apps/ui-library/public/r/supabase-client-tanstack.json
+++ b/apps/ui-library/public/r/supabase-client-tanstack.json
@@ -2,7 +2,7 @@
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
"name": "supabase-client-tanstack",
"type": "registry:lib",
- "title": "Supabase Client for Tanstack Start",
+ "title": "Supabase Client for TanStack Start",
"description": "",
"dependencies": [
"@supabase/ssr@latest",
diff --git a/apps/ui-library/registry.json b/apps/ui-library/registry.json
index 921e075f6fc..93347e46a9d 100644
--- a/apps/ui-library/registry.json
+++ b/apps/ui-library/registry.json
@@ -277,7 +277,7 @@
"type": "registry:component",
"title": "Dropzone (File Upload)",
"description": "Displays a control for easier uploading of files directly to Supabase Storage.",
- "registryDependencies": ["button", "tooltip", "progress"],
+ "registryDependencies": ["button"],
"dependencies": ["react-dropzone", "lucide-react", "@supabase/ssr@latest"],
"files": [
{
@@ -308,7 +308,7 @@
"type": "registry:component",
"title": "Dropzone (File Upload)",
"description": "Displays a control for easier uploading of files directly to Supabase Storage.",
- "registryDependencies": ["button", "tooltip", "progress"],
+ "registryDependencies": ["button"],
"dependencies": ["react-dropzone", "lucide-react", "@supabase/supabase-js@latest"],
"files": [
{
@@ -331,7 +331,7 @@
"type": "registry:component",
"title": "Dropzone (File Upload)",
"description": "Displays a control for easier uploading of files directly to Supabase Storage.",
- "registryDependencies": ["button", "tooltip", "progress"],
+ "registryDependencies": ["button"],
"dependencies": [
"react-dropzone",
"lucide-react",
@@ -363,7 +363,7 @@
"type": "registry:component",
"title": "Dropzone (File Upload)",
"description": "Displays a control for easier uploading of files directly to Supabase Storage.",
- "registryDependencies": ["button", "tooltip", "progress"],
+ "registryDependencies": ["button"],
"dependencies": [
"react-dropzone",
"lucide-react",
@@ -1021,27 +1021,27 @@
{
"path": "registry/default/ai-editor-rules/create-db-functions.md",
"type": "registry:file",
- "target": ".rules/create-db-functions.md"
+ "target": ".cursor/rules/create-db-functions.md"
},
{
"path": "registry/default/ai-editor-rules/create-migration.md",
"type": "registry:file",
- "target": ".rules/create-migration.md"
+ "target": ".cursor/rules/create-migration.md"
},
{
"path": "registry/default/ai-editor-rules/create-rls-policies.md",
"type": "registry:file",
- "target": ".rules/create-rls-policies.md"
+ "target": ".cursor/rules/create-rls-policies.md"
},
{
"path": "registry/default/ai-editor-rules/postgres-sql-style-guide.md",
"type": "registry:file",
- "target": ".rules/postgres-sql-style-guide.md"
+ "target": ".cursor/rules/postgres-sql-style-guide.md"
},
{
"path": "registry/default/ai-editor-rules/writing-supabase-edge-functions.md",
"type": "registry:file",
- "target": ".rules/writing-supabase-edge-functions.md"
+ "target": ".cursor/rules/writing-supabase-edge-functions.md"
}
]
}
diff --git a/apps/ui-library/registry/default/ai-editor-rules/registry-item.json b/apps/ui-library/registry/default/ai-editor-rules/registry-item.json
index 0f5ad947596..9568526a86a 100644
--- a/apps/ui-library/registry/default/ai-editor-rules/registry-item.json
+++ b/apps/ui-library/registry/default/ai-editor-rules/registry-item.json
@@ -10,27 +10,27 @@
{
"path": "registry/default/ai-editor-rules/create-db-functions.md",
"type": "registry:file",
- "target": ".rules/create-db-functions.md"
+ "target": ".cursor/rules/create-db-functions.md"
},
{
"path": "registry/default/ai-editor-rules/create-migration.md",
"type": "registry:file",
- "target": ".rules/create-migration.md"
+ "target": ".cursor/rules/create-migration.md"
},
{
"path": "registry/default/ai-editor-rules/create-rls-policies.md",
"type": "registry:file",
- "target": ".rules/create-rls-policies.md"
+ "target": ".cursor/rules/create-rls-policies.md"
},
{
"path": "registry/default/ai-editor-rules/postgres-sql-style-guide.md",
"type": "registry:file",
- "target": ".rules/postgres-sql-style-guide.md"
+ "target": ".cursor/rules/postgres-sql-style-guide.md"
},
{
"path": "registry/default/ai-editor-rules/writing-supabase-edge-functions.md",
"type": "registry:file",
- "target": ".rules/writing-supabase-edge-functions.md"
+ "target": ".cursor/rules/writing-supabase-edge-functions.md"
}
]
}
diff --git a/apps/ui-library/registry/default/examples/current-user-avatar-demo.tsx b/apps/ui-library/registry/default/examples/current-user-avatar-demo.tsx
index ed847e94be2..fcf6059c9f6 100644
--- a/apps/ui-library/registry/default/examples/current-user-avatar-demo.tsx
+++ b/apps/ui-library/registry/default/examples/current-user-avatar-demo.tsx
@@ -26,6 +26,8 @@ const CurrentUserAvatarDemo = () => {
<span className="text-sm text-foreground-light">
It seems like you&apos;re not logged in. Login via the{' '}
<a
+ target="_blank"
+ rel="noopener noreferrer"
href="https://supabase.com/dashboard/sign-in"
className="text-foreground underline decoration-1 decoration-foreground-muted underline-offset-4 transition-colors hover:decoration-brand hover:decoration-2"
>
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 5cc01b15176..312ccaa4473 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -88,10 +88,10 @@ importers:
version: 1.2.0
next:
specifier: 'catalog:'
next-contentlayer2:
specifier: 0.4.6
next-themes:
specifier: ^0.3.0
@@ -1010,6 +1010,9 @@ importers:
'@react-router/fs-routes':
specifier: ^7.4.0
+ '@supabase/supa-mdx-lint':
+ specifier: 0.2.6-alpha
+ version: 0.2.6-alpha
class-variance-authority:
specifier: ^0.6.0
version: 0.6.1
@@ -1036,10 +1039,10 @@ importers:
version: 0.436.0([email protected])
next:
specifier: 'catalog:'
next-contentlayer2:
specifier: 0.4.6
next-themes:
specifier: ^0.3.0
@@ -1525,7 +1528,7 @@ importers:
version: 0.7.12
'@vercel/flags':
specifier: ^2.6.0
api-types:
specifier: workspace:*
version: link:../api-types
@@ -1867,7 +1870,7 @@ importers:
version: 3.6.1
'@testing-library/jest-dom':
specifier: ^6.1.3
'@testing-library/react':
specifier: ^14.0.0
@@ -2042,7 +2045,7 @@ importers:
version: 10.1.0
'@testing-library/jest-dom':
specifier: ^6.4.6
'@testing-library/react':
specifier: ^16.0.0
@@ -8750,7 +8753,6 @@ packages:
resolution: {integrity: sha512-t0q23FIpvHDTtnORW+bDJziGsal5uh9RJTJ1fyH8drd4lICOoXhJ5pLMUZ5C0VQei6dNmwTzzoTRgMkO9JgHEQ==}
peerDependencies:
eslint: '>= 5'
- bundledDependencies: []
resolution: {integrity: sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==}
@@ -20539,22 +20541,6 @@ snapshots:
pretty-format: 27.5.1
- dependencies:
- '@adobe/css-tools': 4.4.0
- '@babel/runtime': 7.24.7
- aria-query: 5.3.0
- chalk: 3.0.0
- css.escape: 1.5.1
- dom-accessibility-api: 0.6.3
- lodash: 4.17.21
- redent: 3.0.0
- optionalDependencies:
- '@jest/globals': 29.7.0([email protected])
- '@types/jest': 29.5.5
-
dependencies:
'@adobe/css-tools': 4.4.0
'@babel/runtime': 7.24.7
@@ -21206,6 +21192,14 @@ snapshots:
react: 18.2.0
react-dom: 18.2.0([email protected])
+ dependencies:
+ jose: 5.2.1
+ optionalDependencies:
+ react: 18.2.0
+ react-dom: 18.2.0([email protected])
+
dependencies:
'@mapbox/node-pre-gyp': 2.0.0([email protected])([email protected])
@@ -27384,12 +27378,12 @@ snapshots:
- markdown-wasm
- supports-color
dependencies:
'@contentlayer2/utils': 0.4.3
react: 18.2.0
react-dom: 18.2.0([email protected])
transitivePeerDependencies:
@@ -27403,7 +27397,7 @@ snapshots:
'@contentlayer2/utils': 0.5.3
react: 18.2.0
react-dom: 18.2.0([email protected])
transitivePeerDependencies:
@@ -27434,7 +27428,7 @@ snapshots:
dependencies:
react: 18.2.0
react-dom: 18.2.0([email protected])
@@ -27499,6 +27493,34 @@ snapshots:
- '@babel/core'
- babel-plugin-macros
+ dependencies:
+ '@next/env': 14.2.26
+ '@swc/helpers': 0.5.5
+ busboy: 1.6.0
+ caniuse-lite: 1.0.30001695
+ graceful-fs: 4.2.11
+ postcss: 8.4.31
+ react: 18.2.0
+ react-dom: 18.2.0([email protected])
+ optionalDependencies:
+ '@next/swc-darwin-arm64': 14.2.26
+ '@next/swc-darwin-x64': 14.2.26
+ '@next/swc-linux-arm64-gnu': 14.2.26
+ '@next/swc-linux-arm64-musl': 14.2.26
+ '@next/swc-linux-x64-gnu': 14.2.26
+ '@next/swc-linux-x64-musl': 14.2.26
+ '@next/swc-win32-arm64-msvc': 14.2.26
+ '@next/swc-win32-ia32-msvc': 14.2.26
+ '@next/swc-win32-x64-msvc': 14.2.26
+ '@opentelemetry/api': 1.9.0
+ '@playwright/test': 1.49.1
+ sass: 1.72.0
+ transitivePeerDependencies:
+ - '@babel/core'
+ - babel-plugin-macros
+
@@ -27789,7 +27811,7 @@ snapshots:
dependencies:
mitt: 3.0.1
dependencies:
diff --git a/supa-mdx-lint/Rule003Spelling.toml b/supa-mdx-lint/Rule003Spelling.toml
index 014cd63aa15..581282b3135 100644
--- a/supa-mdx-lint/Rule003Spelling.toml
+++ b/supa-mdx-lint/Rule003Spelling.toml
@@ -328,6 +328,7 @@ allow_list = [
"supabase-rb",
"supabase-swift",
"supautils",
+ "TanStack",
"tokio",
"tsvector",
"tvOS",