diff --git a/components/sidebar.tsx b/components/sidebar.tsx
index c210dd1..87e4eff 100644
--- a/components/sidebar.tsx
+++ b/components/sidebar.tsx
@@ -10,18 +10,14 @@ import {
SheetTitle,
SheetTrigger
} from '@/components/ui/sheet'
-import { ThemeToggle } from '@/components/theme-toggle'
import { IconSidebar } from '@/components/ui/icons'
-import { useClerk } from '@clerk/nextjs'
export interface SidebarProps {
userId?: string
children?: React.ReactNode
}
-export function Sidebar({ userId, children }: SidebarProps) {
- const { signOut } = useClerk()
-
+export function Sidebar({ children }: SidebarProps) {
return (
@@ -35,18 +31,6 @@ export function Sidebar({ userId, children }: SidebarProps) {
Chat History
{children}
-
-
- {userId && (
-
- )}
-
)
diff --git a/components/toaster.tsx b/components/toaster.tsx
new file mode 100644
index 0000000..4d26934
--- /dev/null
+++ b/components/toaster.tsx
@@ -0,0 +1,3 @@
+'use client'
+
+export { Toaster } from 'react-hot-toast'
diff --git a/components/ui/icons.tsx b/components/ui/icons.tsx
index 60f1142..e27b0d0 100644
--- a/components/ui/icons.tsx
+++ b/components/ui/icons.tsx
@@ -414,6 +414,20 @@ function IconEdit({ className, ...props }: React.ComponentProps<'svg'>) {
)
}
+function IconShare({ className, ...props }: React.ComponentProps<'svg'>) {
+ return (
+
+ )
+}
+
export {
IconEdit,
IconNextChat,
@@ -437,5 +451,6 @@ export {
IconCopy,
IconCheck,
IconDownload,
- IconClose
+ IconClose,
+ IconShare
}
diff --git a/components/ui/label.tsx b/components/ui/label.tsx
new file mode 100644
index 0000000..5341821
--- /dev/null
+++ b/components/ui/label.tsx
@@ -0,0 +1,26 @@
+"use client"
+
+import * as React from "react"
+import * as LabelPrimitive from "@radix-ui/react-label"
+import { cva, type VariantProps } from "class-variance-authority"
+
+import { cn } from "@/lib/utils"
+
+const labelVariants = cva(
+ "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
+)
+
+const Label = React.forwardRef<
+ React.ElementRef
,
+ React.ComponentPropsWithoutRef &
+ VariantProps
+>(({ className, ...props }, ref) => (
+
+))
+Label.displayName = LabelPrimitive.Root.displayName
+
+export { Label }
diff --git a/components/ui/switch.tsx b/components/ui/switch.tsx
new file mode 100644
index 0000000..191ef52
--- /dev/null
+++ b/components/ui/switch.tsx
@@ -0,0 +1,29 @@
+"use client"
+
+import * as React from "react"
+import * as SwitchPrimitives from "@radix-ui/react-switch"
+
+import { cn } from "@/lib/utils"
+
+const Switch = React.forwardRef<
+ React.ElementRef,
+ React.ComponentPropsWithoutRef
+>(({ className, ...props }, ref) => (
+
+
+
+))
+Switch.displayName = SwitchPrimitives.Root.displayName
+
+export { Switch }
diff --git a/lib/types.ts b/lib/types.ts
index f7eb363..9cf9176 100644
--- a/lib/types.ts
+++ b/lib/types.ts
@@ -5,5 +5,17 @@ export interface Chat extends Record {
title: string
createdAt: Date
userId: string
+ path: string
messages: Message[]
}
+
+export interface Share {
+ id: string
+ title: string
+ createdAt: number
+ userId: string
+ path: string
+ chat: Chat
+}
+
+export type ServerActionResult = Promise
diff --git a/lib/utils.ts b/lib/utils.ts
index 533bc28..cea3d17 100644
--- a/lib/utils.ts
+++ b/lib/utils.ts
@@ -32,3 +32,12 @@ export async function fetcher(
return res.json()
}
+
+export function formatDate(input: string | number | Date): string {
+ const date = new Date(input)
+ return date.toLocaleDateString('en-US', {
+ month: 'long',
+ day: 'numeric',
+ year: 'numeric'
+ })
+}
diff --git a/package.json b/package.json
index 6da22d3..b0ab716 100644
--- a/package.json
+++ b/package.json
@@ -17,8 +17,10 @@
"@clerk/nextjs": "^4.21.1",
"@radix-ui/react-alert-dialog": "^1.0.4",
"@radix-ui/react-dialog": "^1.0.4",
+ "@radix-ui/react-label": "^2.0.2",
"@radix-ui/react-separator": "^1.0.3",
"@radix-ui/react-slot": "^1.0.2",
+ "@radix-ui/react-switch": "^1.0.3",
"@radix-ui/react-tooltip": "^1.0.6",
"@vercel/analytics": "^1.0.0",
"@vercel/kv": "^0.2.1",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 0fd8386..26858c5 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -17,12 +17,18 @@ dependencies:
'@radix-ui/react-dialog':
specifier: ^1.0.4
version: 1.0.4(@types/react-dom@18.2.4)(@types/react@18.2.6)(react-dom@18.2.0)(react@18.2.0)
+ '@radix-ui/react-label':
+ specifier: ^2.0.2
+ version: 2.0.2(@types/react-dom@18.2.4)(@types/react@18.2.6)(react-dom@18.2.0)(react@18.2.0)
'@radix-ui/react-separator':
specifier: ^1.0.3
version: 1.0.3(@types/react-dom@18.2.4)(@types/react@18.2.6)(react-dom@18.2.0)(react@18.2.0)
'@radix-ui/react-slot':
specifier: ^1.0.2
version: 1.0.2(@types/react@18.2.6)(react@18.2.0)
+ '@radix-ui/react-switch':
+ specifier: ^1.0.3
+ version: 1.0.3(@types/react-dom@18.2.4)(@types/react@18.2.6)(react-dom@18.2.0)(react@18.2.0)
'@radix-ui/react-tooltip':
specifier: ^1.0.6
version: 1.0.6(@types/react-dom@18.2.4)(@types/react@18.2.6)(react-dom@18.2.0)(react@18.2.0)
@@ -709,6 +715,27 @@ packages:
react: 18.2.0
dev: false
+ /@radix-ui/react-label@2.0.2(@types/react-dom@18.2.4)(@types/react@18.2.6)(react-dom@18.2.0)(react@18.2.0):
+ resolution: {integrity: sha512-N5ehvlM7qoTLx7nWPodsPYPgMzA5WM8zZChQg8nyFJKnDO5WHdba1vv5/H6IO5LtJMfD2Q3wh1qHFGNtK0w3bQ==}
+ peerDependencies:
+ '@types/react': '*'
+ '@types/react-dom': '*'
+ react: ^16.8 || ^17.0 || ^18.0
+ react-dom: ^16.8 || ^17.0 || ^18.0
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+ dependencies:
+ '@babel/runtime': 7.21.5
+ '@radix-ui/react-primitive': 1.0.3(@types/react-dom@18.2.4)(@types/react@18.2.6)(react-dom@18.2.0)(react@18.2.0)
+ '@types/react': 18.2.6
+ '@types/react-dom': 18.2.4
+ react: 18.2.0
+ react-dom: 18.2.0(react@18.2.0)
+ dev: false
+
/@radix-ui/react-popper@1.1.2(@types/react-dom@18.2.4)(@types/react@18.2.6)(react-dom@18.2.0)(react@18.2.0):
resolution: {integrity: sha512-1CnGGfFi/bbqtJZZ0P/NQY20xdG3E0LALJaLUEoKwPLwl6PPPfbeiCqMVQnhoFRAxjJj4RpBRJzDmUgsex2tSg==}
peerDependencies:
@@ -839,6 +866,33 @@ packages:
react: 18.2.0
dev: false
+ /@radix-ui/react-switch@1.0.3(@types/react-dom@18.2.4)(@types/react@18.2.6)(react-dom@18.2.0)(react@18.2.0):
+ resolution: {integrity: sha512-mxm87F88HyHztsI7N+ZUmEoARGkC22YVW5CaC+Byc+HRpuvCrOBPTAnXgf+tZ/7i0Sg/eOePGdMhUKhPaQEqow==}
+ peerDependencies:
+ '@types/react': '*'
+ '@types/react-dom': '*'
+ react: ^16.8 || ^17.0 || ^18.0
+ react-dom: ^16.8 || ^17.0 || ^18.0
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+ dependencies:
+ '@babel/runtime': 7.21.5
+ '@radix-ui/primitive': 1.0.1
+ '@radix-ui/react-compose-refs': 1.0.1(@types/react@18.2.6)(react@18.2.0)
+ '@radix-ui/react-context': 1.0.1(@types/react@18.2.6)(react@18.2.0)
+ '@radix-ui/react-primitive': 1.0.3(@types/react-dom@18.2.4)(@types/react@18.2.6)(react-dom@18.2.0)(react@18.2.0)
+ '@radix-ui/react-use-controllable-state': 1.0.1(@types/react@18.2.6)(react@18.2.0)
+ '@radix-ui/react-use-previous': 1.0.1(@types/react@18.2.6)(react@18.2.0)
+ '@radix-ui/react-use-size': 1.0.1(@types/react@18.2.6)(react@18.2.0)
+ '@types/react': 18.2.6
+ '@types/react-dom': 18.2.4
+ react: 18.2.0
+ react-dom: 18.2.0(react@18.2.0)
+ dev: false
+
/@radix-ui/react-tooltip@1.0.6(@types/react-dom@18.2.4)(@types/react@18.2.6)(react-dom@18.2.0)(react@18.2.0):
resolution: {integrity: sha512-DmNFOiwEc2UDigsYj6clJENma58OelxD24O4IODoZ+3sQc3Zb+L8w1EP+y9laTuKCLAysPw4fD6/v0j4KNV8rg==}
peerDependencies:
@@ -929,6 +983,20 @@ packages:
react: 18.2.0
dev: false
+ /@radix-ui/react-use-previous@1.0.1(@types/react@18.2.6)(react@18.2.0):
+ resolution: {integrity: sha512-cV5La9DPwiQ7S0gf/0qiD6YgNqM5Fk97Kdrlc5yBcrF3jyEZQwm7vYFqMo4IfeHgJXsRaMvLABFtd0OVEmZhDw==}
+ peerDependencies:
+ '@types/react': '*'
+ react: ^16.8 || ^17.0 || ^18.0
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ dependencies:
+ '@babel/runtime': 7.21.5
+ '@types/react': 18.2.6
+ react: 18.2.0
+ dev: false
+
/@radix-ui/react-use-rect@1.0.1(@types/react@18.2.6)(react@18.2.0):
resolution: {integrity: sha512-Cq5DLuSiuYVKNU8orzJMbl15TXilTnJKUCltMVQg53BQOF1/C5toAaGrowkgksdBQ9H+SRL23g0HDmg9tvmxXw==}
peerDependencies: