forked from pingdotgg/t3code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNoActiveThreadState.tsx
More file actions
65 lines (61 loc) · 2.39 KB
/
Copy pathNoActiveThreadState.tsx
File metadata and controls
65 lines (61 loc) · 2.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import { Empty, EmptyDescription, EmptyHeader, EmptyTitle } from "./ui/empty";
import { SidebarInset, SidebarTrigger, useSidebar } from "./ui/sidebar";
import { isElectron } from "../env";
import { cn } from "~/lib/utils";
export function shouldShowNoActiveThreadSidebarTrigger({
isMobile,
open,
openMobile,
}: {
isMobile: boolean;
open: boolean;
openMobile: boolean;
}): boolean {
return isMobile ? !openMobile : !open;
}
export function NoActiveThreadState() {
const { isMobile, open, openMobile } = useSidebar();
const showSidebarTrigger = shouldShowNoActiveThreadSidebarTrigger({
isMobile,
open,
openMobile,
});
return (
<SidebarInset className="h-dvh min-h-0 overflow-hidden overscroll-y-none bg-background text-foreground">
<div className="flex min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden bg-background">
<header
className={cn(
"border-b border-border px-3 sm:px-5",
isElectron
? "drag-region flex h-[52px] items-center wco:h-[env(titlebar-area-height)]"
: "py-2 sm:py-3",
)}
>
{isElectron ? (
<div className="flex min-w-0 items-center gap-2 wco:pr-[calc(100vw-env(titlebar-area-width)-env(titlebar-area-x)+1em)]">
{showSidebarTrigger ? <SidebarTrigger className="size-7 shrink-0" /> : null}
<span className="truncate text-xs text-muted-foreground/50">No active thread</span>
</div>
) : (
<div className="flex items-center gap-2">
{showSidebarTrigger ? <SidebarTrigger className="size-7 shrink-0" /> : null}
<span className="text-sm font-medium text-foreground md:text-muted-foreground/60">
No active thread
</span>
</div>
)}
</header>
<Empty className="flex-1">
<div className="w-full max-w-lg rounded-3xl border border-border/55 bg-card/20 px-8 py-12 shadow-sm/5">
<EmptyHeader className="max-w-none">
<EmptyTitle className="text-foreground text-xl">Pick a thread to continue</EmptyTitle>
<EmptyDescription className="mt-2 text-sm text-muted-foreground/78">
Select an existing thread or create a new one to get started.
</EmptyDescription>
</EmptyHeader>
</div>
</Empty>
</div>
</SidebarInset>
);
}