Skip to content

Commit 385d9a9

Browse files
saltcodMildTomato
andauthored
Faqs updates (supabase#19208)
* Faqs updates * Add file * Apply suggestions from code review --------- Co-authored-by: Jonathan Summers-Muir <MildTomato@users.noreply.github.com>
1 parent bdf6b69 commit 385d9a9

File tree

8 files changed

+55
-44
lines changed

8 files changed

+55
-44
lines changed

apps/database-new/app/[threadId]/Chat.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { useMessagesQuery } from '@/data/messages-query'
1010
import { AssistantMessage, UserMessage } from '@/lib/types'
1111
import BottomMarker from './BottomMarker'
1212
import UserChat from './UserChat'
13-
import { ChatInputAtom } from '../../components/Chat/ChatInput'
13+
import { ChatInputAtom } from '@/components/Chat/ChatInput'
1414

1515
export const Chat = () => {
1616
const router = useRouter()

apps/database-new/app/faq/page.tsx

Lines changed: 3 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,11 @@
1+
import { FAQS, faq } from '@/data/faqs'
2+
import { slugify } from '@/lib/utils'
13
import type { Metadata } from 'next'
24

3-
type faq = {
4-
question: string
5-
answer: string
6-
}
7-
85
export const metadata: Metadata = {
96
title: 'database.design | Faq',
107
}
118

12-
const FAQS = [
13-
{
14-
question: 'What is database.design?',
15-
answer:
16-
'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.',
17-
},
18-
{
19-
question: 'How does it work?',
20-
answer:
21-
'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.',
22-
},
23-
{
24-
question: 'Can I see the code?',
25-
answer:
26-
'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.',
27-
},
28-
{
29-
question: 'Can I use this for non-Postgres databases?',
30-
answer:
31-
'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.',
32-
},
33-
]
34-
35-
function slugify(str: string) {
36-
return str
37-
.toLowerCase() // Convert to lowercase
38-
.replace(/\s+/g, '-') // Replace spaces with hyphens
39-
.replace(/[^\w-]+/g, '') // Remove non-word characters except hyphens
40-
.replace(/--+/g, '-') // Replace multiple consecutive hyphens with a single hyphen
41-
.replace(/^-+|-+$/g, '') // Remove leading and trailing hyphens
42-
}
43-
449
const FAQ = async () => {
4510
return (
4611
<div className="bg-background">
@@ -58,7 +23,7 @@ const FAQ = async () => {
5823
{FAQS.map((faq: faq, index) => (
5924
<article
6025
key={index}
61-
className="prose prose-headings:scroll-mt-20 prose-headings:font-display prose-headings:font-semibold"
26+
className="prose prose-headings:scroll-mt-20 prose-headings:font-display prose-headings:font-semibold w-full"
6227
>
6328
<a href={`#${slugify(faq.question)}`} className="no-underline hover:underline">
6429
<h2 id={slugify(faq.question)}>{faq.question}</h2>

apps/database-new/app/profile/ConfirmDeleteThreadModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
'use client'
22

33
import { Button, Modal } from 'ui'
4-
import { deleteThread } from './../../app/actions'
54
import { ThreadType } from './Threads'
5+
import { deleteThread } from '../actions'
66

77
const ConfirmDeleteThreadModal = ({
88
thread,

apps/database-new/app/profile/EditThreadModal.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
'use client'
22

33
import { Button, Input, Modal } from 'ui'
4-
import { updateThreadName } from './../../app/actions'
4+
55
import { ThreadType } from './Threads'
66
import { useState } from 'react'
7+
import { updateThreadName } from '../actions'
78

89
const EditThreadModal = ({
910
thread,

apps/database-new/app/profile/page.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@ import { cookies } from 'next/headers'
44
import { redirect } from 'next/navigation'
55
import Threads from './Threads'
66
import { Suspense } from 'react'
7+
import type { Metadata } from 'next'
78

89
dayjs.extend(relativeTime)
10+
export const metadata: Metadata = {
11+
title: 'database.design | Profile',
12+
}
913

1014
// revalidatePath not working in the create route handler
1115
// force-dynamic to refetch every time if needed

apps/database-new/components/Header/AvatarDropdown.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
'use client'
22

3+
import { logout } from '@/app/actions'
34
import { User } from '@supabase/supabase-js'
4-
import { HelpCircle, LogIn, LogOut } from 'lucide-react'
5+
import { HelpCircle, LogOut } from 'lucide-react'
56
import Image from 'next/image'
67
import Link from 'next/link'
7-
import { Button, DropdownMenuGroup, DropdownMenuItem, DropdownMenuSeparator, IconUser } from 'ui'
8-
import { logout } from './../../app/actions'
8+
import { DropdownMenuGroup, DropdownMenuItem, DropdownMenuSeparator, IconUser } from 'ui'
99

1010
interface AvatarDropdownProps {
1111
user: User

apps/database-new/data/faqs.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
export type faq = {
2+
question: string
3+
answer: string
4+
}
5+
6+
export const FAQS = [
7+
{
8+
question: 'What is database.design?',
9+
answer:
10+
'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.',
11+
},
12+
{
13+
question: 'How does it work?',
14+
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.`,
15+
},
16+
{
17+
question: 'Can I see the code?',
18+
answer: 'You sure can. All of the source code is open source and available on Github. ',
19+
},
20+
{
21+
question: 'Can I contribute to this project?',
22+
answer: 'You sure can. All of the source code is open source and available on Github. ',
23+
},
24+
{
25+
question: `What's the license? Can we fork this project and build our own?`,
26+
answer: 'Yes. We release software under the Apache License 2.0.',
27+
},
28+
{
29+
question: 'Can I use this for non-Postgres databases?',
30+
answer: `Not at the moment. We've tailored the responses to try and do a great job returning Postgres-flavored SQL`,
31+
},
32+
]

apps/database-new/lib/utils.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,3 +245,12 @@ export function timeAgo(date: string) {
245245
return createdAt.format('MMM DD, YYYY')
246246
}
247247
}
248+
249+
export function slugify(str: string) {
250+
return str
251+
.toLowerCase() // Convert to lowercase
252+
.replace(/\s+/g, '-') // Replace spaces with hyphens
253+
.replace(/[^\w-]+/g, '') // Remove non-word characters except hyphens
254+
.replace(/--+/g, '-') // Replace multiple consecutive hyphens with a single hyphen
255+
.replace(/^-+|-+$/g, '') // Remove leading and trailing hyphens
256+
}

0 commit comments

Comments
 (0)