The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Faqs updates (#19208)
Terry Sutton385d9a9e6126
diff --git a/apps/database-new/app/[threadId]/Chat.tsx b/apps/database-new/app/[threadId]/Chat.tsxindex 8560f77ec1b..e06bce236e1 100644--- a/apps/database-new/app/[threadId]/Chat.tsx+++ b/apps/database-new/app/[threadId]/Chat.tsx@@ -10,7 +10,7 @@ import { useMessagesQuery } from '@/data/messages-query'import { AssistantMessage, UserMessage } from '@/lib/types'import BottomMarker from './BottomMarker'import UserChat from './UserChat'-import { ChatInputAtom } from '../../components/Chat/ChatInput'+import { ChatInputAtom } from '@/components/Chat/ChatInput'export const Chat = () => {const router = useRouter()diff --git a/apps/database-new/app/faq/page.tsx b/apps/database-new/app/faq/page.tsxindex 2f46f1fb645..ae38bd7cba9 100644--- a/apps/database-new/app/faq/page.tsx+++ b/apps/database-new/app/faq/page.tsx@@ -1,46 +1,11 @@+import { FAQS, faq } from '@/data/faqs'+import { slugify } from '@/lib/utils'import type { Metadata } from 'next'-type faq = {- question: string- answer: string-}-export const metadata: Metadata = {title: 'database.design | Faq',}-const FAQS = [- {- question: 'What is database.design?',- answer:- 'Lorem ipsum dolor sit, amet consectetur adipisicing elit. Doloremque molestias dicta nobis explicabo maiores officia blanditiis cupiditate, quibusdam debitis! Dignissimos ducimus aut temporibus ea, repellat consectetur quisquam molestiae recusandae rem.',- },- {- question: 'How does it work?',- answer:- 'Lorem ipsum dolor sit, amet consectetur adipisicing elit. Doloremque molestias dicta nobis explicabo maiores officia blanditiis cupiditate, quibusdam debitis! Dignissimos ducimus aut temporibus ea, repellat consectetur quisquam molestiae recusandae rem.',- },- {- question: 'Can I see the code?',- answer:- 'Lorem ipsum dolor sit, amet consectetur adipisicing elit. Doloremque molestias dicta nobis explicabo maiores officia blanditiis cupiditate, quibusdam debitis! Dignissimos ducimus aut temporibus ea, repellat consectetur quisquam molestiae recusandae rem.',- },- {- question: 'Can I use this for non-Postgres databases?',- answer:- 'Lorem ipsum dolor sit, amet consectetur adipisicing elit. Doloremque molestias dicta nobis explicabo maiores officia blanditiis cupiditate, quibusdam debitis! Dignissimos ducimus aut temporibus ea, repellat consectetur quisquam molestiae recusandae rem.',- },-]--function slugify(str: string) {- return str- .toLowerCase() // Convert to lowercase- .replace(/\s+/g, '-') // Replace spaces with hyphens- .replace(/[^\w-]+/g, '') // Remove non-word characters except hyphens- .replace(/--+/g, '-') // Replace multiple consecutive hyphens with a single hyphen- .replace(/^-+|-+$/g, '') // Remove leading and trailing hyphens-}-const FAQ = async () => {return (<div className="bg-background">@@ -58,7 +23,7 @@ const FAQ = async () => {{FAQS.map((faq: faq, index) => (<articlekey={index}- className="prose prose-headings:scroll-mt-20 prose-headings:font-display prose-headings:font-semibold"+ className="prose prose-headings:scroll-mt-20 prose-headings:font-display prose-headings:font-semibold w-full"><a href={`#${slugify(faq.question)}`} className="no-underline hover:underline"><h2 id={slugify(faq.question)}>{faq.question}</h2>diff --git a/apps/database-new/app/profile/ConfirmDeleteThreadModal.tsx b/apps/database-new/app/profile/ConfirmDeleteThreadModal.tsxindex 9b759e03c17..05e7900d275 100644--- a/apps/database-new/app/profile/ConfirmDeleteThreadModal.tsx+++ b/apps/database-new/app/profile/ConfirmDeleteThreadModal.tsx@@ -1,8 +1,8 @@'use client'import { Button, Modal } from 'ui'-import { deleteThread } from './../../app/actions'import { ThreadType } from './Threads'+import { deleteThread } from '../actions'const ConfirmDeleteThreadModal = ({thread,diff --git a/apps/database-new/app/profile/EditThreadModal.tsx b/apps/database-new/app/profile/EditThreadModal.tsxindex 4eeea121611..0fd3ed84ebd 100644--- a/apps/database-new/app/profile/EditThreadModal.tsx+++ b/apps/database-new/app/profile/EditThreadModal.tsx@@ -1,9 +1,10 @@'use client'import { Button, Input, Modal } from 'ui'-import { updateThreadName } from './../../app/actions'+import { ThreadType } from './Threads'import { useState } from 'react'+import { updateThreadName } from '../actions'const EditThreadModal = ({thread,diff --git a/apps/database-new/app/profile/page.tsx b/apps/database-new/app/profile/page.tsxindex 8b98328bd6a..701b37a6b16 100644--- a/apps/database-new/app/profile/page.tsx+++ b/apps/database-new/app/profile/page.tsx@@ -4,8 +4,12 @@ import { cookies } from 'next/headers'import { redirect } from 'next/navigation'import Threads from './Threads'import { Suspense } from 'react'+import type { Metadata } from 'next'dayjs.extend(relativeTime)+export const metadata: Metadata = {+ title: 'database.design | Profile',+}// revalidatePath not working in the create route handler// force-dynamic to refetch every time if neededdiff --git a/apps/database-new/components/Header/AvatarDropdown.tsx b/apps/database-new/components/Header/AvatarDropdown.tsxindex ac412174a02..93ac5737b52 100644--- a/apps/database-new/components/Header/AvatarDropdown.tsx+++ b/apps/database-new/components/Header/AvatarDropdown.tsx@@ -1,11 +1,11 @@'use client'+import { logout } from '@/app/actions'import { User } from '@supabase/supabase-js'-import { HelpCircle, LogIn, LogOut } from 'lucide-react'+import { HelpCircle, LogOut } from 'lucide-react'import Image from 'next/image'import Link from 'next/link'-import { Button, DropdownMenuGroup, DropdownMenuItem, DropdownMenuSeparator, IconUser } from 'ui'-import { logout } from './../../app/actions'+import { DropdownMenuGroup, DropdownMenuItem, DropdownMenuSeparator, IconUser } from 'ui'interface AvatarDropdownProps {user: Userdiff --git a/apps/database-new/data/faqs.ts b/apps/database-new/data/faqs.tsnew file mode 100644index 00000000000..1628a0e326a--- /dev/null+++ b/apps/database-new/data/faqs.ts@@ -0,0 +1,32 @@+export type faq = {+ question: string+ answer: string+}++export const FAQS = [+ {+ question: 'What is database.design?',+ answer:+ 'database.design is a new way to get ideas out of your head and into code as fast as possible. Supabase provides you tools to making building incredibly fast. This tool focuses on the very first step: turning your idea into a database schema.',+ },+ {+ question: 'How does it work?',+ answer: `We use OpenAI under the hood to provide responses to your prompts. Just like ChatGPT, you can fine-tune your responses until you're happy with the schema. We're using React Flow to visualize the schemas.`,+ },+ {+ question: 'Can I see the code?',+ answer: 'You sure can. All of the source code is open source and available on Github. ',+ },+ {+ question: 'Can I contribute to this project?',+ answer: 'You sure can. All of the source code is open source and available on Github. ',+ },+ {+ question: `What's the license? Can we fork this project and build our own?`,+ answer: 'Yes. We release software under the Apache License 2.0.',+ },+ {+ question: 'Can I use this for non-Postgres databases?',+ answer: `Not at the moment. We've tailored the responses to try and do a great job returning Postgres-flavored SQL`,+ },+]diff --git a/apps/database-new/lib/utils.ts b/apps/database-new/lib/utils.tsindex 6de712e0084..91acb6cc139 100644--- a/apps/database-new/lib/utils.ts+++ b/apps/database-new/lib/utils.ts@@ -245,3 +245,12 @@ export function timeAgo(date: string) {return createdAt.format('MMM DD, YYYY')}}++export function slugify(str: string) {+ return str+ .toLowerCase() // Convert to lowercase+ .replace(/\s+/g, '-') // Replace spaces with hyphens+ .replace(/[^\w-]+/g, '') // Remove non-word characters except hyphens+ .replace(/--+/g, '-') // Replace multiple consecutive hyphens with a single hyphen+ .replace(/^-+|-+$/g, '') // Remove leading and trailing hyphens+}