-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* install dialog for sharing * Add share chat component * Add chat context to root layout * add copy to clipboard for share component * Share CRUD * Fix max chat readers limit * Fixes * Fix share dialog auto grow * Fix lint and react warning * Text link copied button * Last touches to the share form
- Loading branch information
1 parent
6639d2c
commit d7f71d3
Showing
14 changed files
with
1,202 additions
and
399 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
"use client"; | ||
|
||
import React, { createContext, ReactNode, useContext, useState } from "react"; | ||
|
||
interface ChatContextProps { | ||
chatId?: string; | ||
setChatId: (id?: string) => void; | ||
} | ||
|
||
const ChatContext = createContext<ChatContextProps | undefined>(undefined); | ||
|
||
export const ChatProvider = ({ | ||
chatId: initialChatId, | ||
children, | ||
}: { | ||
chatId?: string; | ||
children: ReactNode; | ||
}) => { | ||
const [chatId, setChatId] = useState(initialChatId); | ||
|
||
return ( | ||
<ChatContext.Provider value={{ chatId, setChatId }}> | ||
{children} | ||
</ChatContext.Provider> | ||
); | ||
}; | ||
|
||
export const useChat = () => { | ||
const context = useContext(ChatContext); | ||
if (!context) { | ||
throw new Error("useChat must be used within a ChatProvider"); | ||
} | ||
return context; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import Link from "next/link"; | ||
|
||
import { ArrowRightIcon, GHIcon, IconAuth0 } from "@/components/icons"; | ||
import { getSession } from "@auth0/nextjs-auth0"; | ||
|
||
import UserButton from "../auth0/user-button"; | ||
import { DropdownMenu, DropdownMenuGroup, DropdownMenuItem, DropdownMenuShortcut } from "../ui/dropdown-menu"; | ||
import { ShareConversation } from "./share"; | ||
|
||
export async function Header() { | ||
const session = await getSession(); | ||
const user = session?.user!; | ||
|
||
return ( | ||
<header className="sticky top-0 z-50 flex items-center justify-between w-full px-6 py-3 h-14 shrink-0 bg-background backdrop-blur-xl"> | ||
<div className="flex items-center gap-6"> | ||
<span className="inline-flex items-center home-links whitespace-nowrap"> | ||
<Link href="https://lab.auth0.com" rel="noopener" target="_blank"> | ||
<IconAuth0 className="w-5 h-5 sm:h-6 sm:w-6" /> | ||
</Link> | ||
</span> | ||
<Link | ||
href="#" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
className="hover:text-black transition-all duration-300 text-sm font-light text-slate-500 flex items-center gap-1" | ||
> | ||
Learn about Auth for GenAI <ArrowRightIcon /> | ||
</Link> | ||
</div> | ||
<div className="flex items-center justify-end gap-6"> | ||
<div className="flex items-center justify-end gap-6"> | ||
<ShareConversation user={user} /> | ||
|
||
<Link | ||
href="https://github.com/auth0-lab/market0" | ||
rel="noopener noreferrer" | ||
target="_blank" | ||
className="bg-white text-slate-500 border border-slate-500 flex gap-2 items-center px-3 py-2 rounded-md text-sm hover:bg-gray-100 hover:text-black transition-colors duration-300" | ||
> | ||
<GHIcon /> GitHub | ||
</Link> | ||
<UserButton user={user}> | ||
<DropdownMenu> | ||
<DropdownMenuGroup> | ||
<DropdownMenuItem> | ||
<Link href="/profile" className="flex gap-2 items-center"> | ||
Profile | ||
</Link> | ||
<DropdownMenuShortcut>⌘P</DropdownMenuShortcut> | ||
</DropdownMenuItem> | ||
</DropdownMenuGroup> | ||
</DropdownMenu> | ||
</UserButton> | ||
</div> | ||
</div> | ||
</header> | ||
); | ||
} |
Oops, something went wrong.