this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add sign in button to chat sidebar and render empty chat app when loading or signed out

+5 -12
+5 -1
apps/web/src/components/chat-sidebar.tsx
··· 1 - import { SignedIn } from "@clerk/clerk-react"; 1 + import { SignedIn, SignedOut, SignInButton } from "@clerk/clerk-react"; 2 2 import { useChats } from "#/hooks/use-chats"; 3 3 import { ChatSidebarHeader } from "./chat-sidebar-header"; 4 4 import { ChatSidebarItem } from "./chat-sidebar-item"; 5 5 import { SidebarUserButton } from "./sidebar-user-button"; 6 + import { Button } from "./ui/button"; 6 7 import { 7 8 Sidebar, 8 9 SidebarContent, ··· 29 30 </SidebarGroup> 30 31 </SidebarContent> 31 32 <SidebarFooter> 33 + <SignedOut> 34 + <Button render={<SignInButton />}>Sign In</Button> 35 + </SignedOut> 32 36 <SignedIn> 33 37 <SidebarUserButton /> 34 38 </SignedIn>
-11
apps/web/src/routes/chats.tsx
··· 1 - import { RedirectToSignIn, useAuth } from "@clerk/clerk-react"; 2 1 import { createFileRoute, Outlet } from "@tanstack/react-router"; 3 2 import { ChatSidebar } from "#/components/chat-sidebar"; 4 3 import { Container } from "#/components/container"; ··· 9 8 }); 10 9 11 10 function RouteComponent() { 12 - const { isLoaded, isSignedIn } = useAuth(); 13 - 14 - if (!isLoaded) { 15 - return null; 16 - } 17 - 18 - if (!isSignedIn) { 19 - return <RedirectToSignIn />; 20 - } 21 - 22 11 return ( 23 12 <SidebarProvider className="h-dvh"> 24 13 <ChatSidebar />