Skip to content

Commit c8441ac

Browse files
authored
Merge pull request #146 from supabase-community/feat/new-design
New design
2 parents f2396d3 + a099165 commit c8441ac

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+3231
-1618
lines changed

apps/web/app/deploy/[databaseId]/page.tsx

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@ import { useMutation } from '@tanstack/react-query'
44
import { useParams, useRouter, useSearchParams } from 'next/navigation'
55
import { useEffect } from 'react'
66
import { useApp } from '~/components/app-provider'
7-
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '~/components/ui/dialog'
87
import { createClient } from '~/utils/supabase/client'
9-
import { Loader2 } from 'lucide-react'
10-
import { ParticlesBackground } from '~/components/particles-background'
118
import { getOauthUrl } from '~/lib/util'
129
import { SupabaseIcon } from '~/components/supabase-icon'
10+
import LineAnimation from '~/components/lines'
1311

1412
class IntegrationRevokedError extends Error {
1513
constructor() {
@@ -24,7 +22,7 @@ export default function Page() {
2422
const { liveShare } = useApp()
2523
const searchParams = useSearchParams()
2624

27-
const { mutate: deploy, error } = useMutation({
25+
const { mutate: deploy } = useMutation({
2826
mutationFn: async () => {
2927
// make the database available to the deployment worker
3028
const localDatabaseUrl = await liveShare.start(params.databaseId)
@@ -108,31 +106,24 @@ export default function Page() {
108106
}, [deploy])
109107

110108
return (
111-
<ParticlesBackground>
112-
<Dialog open>
113-
<DialogContent
114-
className="max-w-3xl bg-background/70 backdrop-blur-sm"
115-
showCloseButton={false}
116-
overlay={false}
117-
>
118-
<DialogHeader>
119-
<DialogTitle className="flex gap-2 items-center">
120-
<SupabaseIcon />
121-
Deploying your database
122-
</DialogTitle>
123-
<div className="py-2 border-b" />
124-
</DialogHeader>
125-
<div className="flex flex-col gap-6">
109+
<div className="flex items-center justify-center h-full w-full bg-muted">
110+
<div className="w-full h-full max-h-[400px] border rounded-lg overflow-hidden relative flex justify-center items-center">
111+
<div className="bg-background border rounded-md relative z-10 max-w-full">
112+
<h1 className="flex gap-2 items-center border-b px-6 py-4 font-semibold">
113+
<SupabaseIcon />
114+
Deploying your database
115+
</h1>
116+
<div className="flex flex-col gap-6 p-6">
126117
<div className="flex items-center gap-4">
127-
<Loader2 className="animate-spin" />
128118
<div>
129119
<p>Your database is being deployed. This process typically takes a few minutes.</p>
130120
<p>Please keep this page open to ensure successful deployment.</p>
131121
</div>
132122
</div>
133123
</div>
134-
</DialogContent>
135-
</Dialog>
136-
</ParticlesBackground>
124+
</div>
125+
<LineAnimation />
126+
</div>
127+
</div>
137128
)
138129
}

apps/web/app/globals.css

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
--primary-foreground: 0 0% 98%;
1515
--secondary: 0 0% 96.1%;
1616
--secondary-foreground: 0 0% 9%;
17-
--muted: 0 0% 96.1%;
18-
--muted-foreground: 0 0% 45.1%;
19-
--accent: 0 0% 96.1%;
17+
--muted: 0 0% 97.1%;
18+
--muted-foreground: 0 0% 30.1%;
19+
--accent: 0 0% 91.1%;
2020
--accent-foreground: 0 0% 9%;
2121
--destructive: 0 84.2% 60.2%;
2222
--destructive-foreground: 0 0% 98%;
23-
--border: 0 0% 89.8%;
23+
--border: 0 0% 91.8%;
2424
--input: 0 0% 89.8%;
2525
--ring: 0 0% 3.9%;
2626
--radius: 0.5rem;
@@ -29,20 +29,28 @@
2929
--chart-3: 197 37% 24%;
3030
--chart-4: 43 74% 66%;
3131
--chart-5: 27 87% 67%;
32+
--sidebar-background: 0 0% 98%;
33+
--sidebar-foreground: 240 5.3% 26.1%;
34+
--sidebar-primary: 240 5.9% 10%;
35+
--sidebar-primary-foreground: 0 0% 98%;
36+
--sidebar-accent: 240 4.8% 95.9%;
37+
--sidebar-accent-foreground: 240 5.9% 10%;
38+
--sidebar-border: 220 13% 91%;
39+
--sidebar-ring: 217.2 91.2% 59.8%;
3240
}
3341

3442
.dark {
3543
--background: 0 0% 3.9%;
3644
--foreground: 0 0% 98%;
3745
--card: 0 0% 3.9%;
3846
--card-foreground: 0 0% 98%;
39-
--popover: 0 0% 3.9%;
47+
--popover: 0 0% 7%;
4048
--popover-foreground: 0 0% 98%;
4149
--primary: 0 0% 98%;
4250
--primary-foreground: 0 0% 9%;
4351
--secondary: 0 0% 14.9%;
4452
--secondary-foreground: 0 0% 98%;
45-
--muted: 0 0% 14.9%;
53+
--muted: 0 0% 10.9%;
4654
--muted-foreground: 0 0% 63.9%;
4755
--accent: 0 0% 14.9%;
4856
--accent-foreground: 0 0% 98%;
@@ -56,6 +64,14 @@
5664
--chart-3: 30 80% 55%;
5765
--chart-4: 280 65% 60%;
5866
--chart-5: 340 75% 55%;
67+
--sidebar-background: 240 5.9% 10%;
68+
--sidebar-foreground: 240 4.8% 95.9%;
69+
--sidebar-primary: 224.3 76.3% 48%;
70+
--sidebar-primary-foreground: 0 0% 100%;
71+
--sidebar-accent: 240 3.7% 15.9%;
72+
--sidebar-accent-foreground: 240 4.8% 95.9%;
73+
--sidebar-border: 240 3.7% 15.9%;
74+
--sidebar-ring: 217.2 91.2% 59.8%;
5975
}
6076
}
6177

@@ -89,6 +105,7 @@
89105
html,
90106
body,
91107
main {
108+
font-size: 15px;
92109
height: 100%;
93110
width: 100%;
94111
padding: 0;

apps/web/components/app-provider.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,15 @@ export default function AppProvider({ children }: AppProps) {
4545
const [isSignInDialogOpen, setIsSignInDialogOpen] = useState(false)
4646
const [isRenameDialogOpen, setIsRenameDialogOpen] = useState(false)
4747
const [isRateLimited, setIsRateLimited] = useState(false)
48+
const [showSidebar, setShowSidebar] = useState(false)
49+
50+
useEffect(() => {
51+
dbManager?.getDatabases().then((databases) => {
52+
if (databases.length > 0) {
53+
setShowSidebar(true)
54+
}
55+
})
56+
}, [])
4857

4958
const focusRef = useRef<FocusHandle>(null)
5059

@@ -294,6 +303,8 @@ export default function AppProvider({ children }: AppProps) {
294303
pgVersion,
295304
isLegacyDomain,
296305
isLegacyDomainRedirect,
306+
showSidebar,
307+
setShowSidebar,
297308
}}
298309
>
299310
{children}
@@ -334,6 +345,8 @@ export type AppContextValues = {
334345
setModelProviderError: (error: string | undefined) => void
335346
isLegacyDomain: boolean
336347
isLegacyDomainRedirect: boolean
348+
showSidebar: boolean
349+
setShowSidebar: (show: boolean) => void
337350
}
338351

339352
export const AppContext = createContext<AppContextValues | undefined>(undefined)
Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,50 @@
11
import { Brain } from 'lucide-react'
22
import { useApp } from '~/components/app-provider'
33
import { Button } from '~/components/ui/button'
4+
import { cn } from '~/lib/utils'
5+
import { Tooltip, TooltipContent, TooltipTrigger } from '~/components/ui/tooltip'
46

57
export type ByoLlmButtonProps = {
68
onClick?: () => void
9+
className?: string
10+
size?: 'default' | 'sm' | 'lg' | 'icon'
11+
iconOnly?: boolean
712
}
813

9-
export default function ByoLlmButton({ onClick }: ByoLlmButtonProps) {
10-
const { setIsModelProviderDialogOpen } = useApp()
14+
export default function ByoLlmButton({
15+
onClick,
16+
className,
17+
size = 'default',
18+
iconOnly = false,
19+
}: ByoLlmButtonProps) {
20+
const { setIsModelProviderDialogOpen, modelProvider } = useApp()
1121

12-
return (
22+
const button = (
1323
<Button
14-
className="gap-2 text-base"
24+
className={cn('gap-2 text-sm flex justify-center items-center relative', className)}
25+
variant="outline"
26+
size={iconOnly ? 'sm' : size}
1527
onClick={() => {
1628
onClick?.()
1729
setIsModelProviderDialogOpen(true)
1830
}}
1931
>
20-
<Brain size={18} strokeWidth={2} />
21-
Bring your own LLM
32+
{modelProvider?.state?.enabled && (
33+
<div className="absolute top-1 right-1 w-2 h-2 rounded-full bg-green-500" />
34+
)}
35+
<Brain size={16} strokeWidth={1.5} />
36+
{!iconOnly && 'Bring your own LLM'}
2237
</Button>
2338
)
39+
40+
if (iconOnly) {
41+
return (
42+
<Tooltip>
43+
<TooltipTrigger asChild>{button}</TooltipTrigger>
44+
<TooltipContent>Bring your own LLM</TooltipContent>
45+
</Tooltip>
46+
)
47+
}
48+
49+
return button
2450
}

apps/web/components/chat-message.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,20 @@ import { isAutomatedUserMessage } from '~/lib/util'
1212
import { cn } from '~/lib/utils'
1313
import { CodeBlock } from './code-block'
1414
import { ToolUi } from './tools'
15+
import { Avatar, AvatarFallback, AvatarImage } from '~/components/ui/avatar'
16+
import { useApp } from './app-provider'
17+
import { UserIcon } from 'lucide-react'
1518

1619
export type ChatMessageProps = {
1720
message: Message
1821
isLast: boolean
1922
}
2023

2124
function ChatMessage({ message, isLast }: ChatMessageProps) {
25+
const { user } = useApp()
26+
const avatarUrl = user?.user_metadata.avatar_url ?? null
27+
const username = user?.user_metadata.user_name ?? null
28+
2229
switch (message.role) {
2330
case 'user':
2431
if (isAutomatedUserMessage(message)) {
@@ -28,7 +35,6 @@ function ChatMessage({ message, isLast }: ChatMessageProps) {
2835
return (
2936
<m.div
3037
// Only track layout on the last message to improve performance
31-
layoutId={isLast ? message.id : undefined}
3238
variants={{
3339
hidden: {
3440
opacity: 0,
@@ -39,7 +45,7 @@ function ChatMessage({ message, isLast }: ChatMessageProps) {
3945
x: 0,
4046
},
4147
}}
42-
className="self-end px-5 py-2.5 text-base rounded-3xl bg-border text-foreground whitespace-pre-wrap"
48+
className="self-end px-5 py-2 flex rounded-3xl bg-muted text-foreground whitespace-pre-wrap"
4349
>
4450
{message.content}
4551
</m.div>
@@ -50,7 +56,7 @@ function ChatMessage({ message, isLast }: ChatMessageProps) {
5056
remarkPlugins={[remarkGfm, [remarkMath, { singleDollarTextMath: false }]]}
5157
rehypePlugins={[[rehypeKatex, { output: 'html' }]]}
5258
components={{ ...markdownComponents, img: () => null }}
53-
className="prose prose-xs text-base [&_.katex-display>.katex]:text-left"
59+
className="prose prose-xs prose-h3:text-md [&_.katex-display>.katex]:text-left prose-ol:my-4"
5460
>
5561
{message.content}
5662
</ReactMarkdown>
@@ -69,7 +75,7 @@ function ChatMessage({ message, isLast }: ChatMessageProps) {
6975

7076
return (
7177
<m.div
72-
className="lg:ml-4 self-stretch flex flex-col items-stretch gap-6"
78+
className="self-stretch flex flex-col items-stretch gap-6"
7379
variants={{
7480
hidden: {
7581
opacity: 0,
@@ -111,7 +117,7 @@ const NextImageHandler = (props: any) => {
111117
}
112118

113119
const markdownComponents = {
114-
mono: (props: any) => <code className="text-sm not-prose">{props.children}</code>,
120+
mono: (props: any) => <code className="not-prose">{props.children}</code>,
115121
code: (props: any) => <CodeBlock {...props} />,
116122
pre: (props: any) => (
117123
<pre className="not-prose">

0 commit comments

Comments
 (0)