Skip to content

[TOOL-2816] Nebula - update sidebar + other minor UI adjustments #5823

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,13 @@ export function ChatHistoryPageUI(props: {

{filteredSessions.length > 0 && (
<ScrollShadow
className="container max-w-[800px] flex-1"
className="flex-1"
scrollableClassName="max-h-full py-6"
shadowColor="hsl(var(--background))"
shadowClassName="z-10"
>
{filteredSessions.length > 0 && (
<div className="flex flex-col gap-5">
<div className="container flex max-w-[800px] flex-col gap-5">
{filteredSessions.map((session) => (
<SessionCard
key={session.id + session.updated_at + session.created_at}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ export function Chatbar(props: {
<Button
aria-label="Send"
disabled={message.trim() === ""}
variant="primary"
className={cn(
"!h-auto w-auto border border-transparent p-2 disabled:opacity-100",
message === "" &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ import { ScrollShadow } from "@/components/ui/ScrollShadow/ScrollShadow";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import type { Account } from "@3rdweb-sdk/react/hooks/useApi";
import {
ChevronRightIcon,
FlaskConicalIcon,
MessageSquareDashedIcon,
} from "lucide-react";
import { MessagesSquareIcon, SquareDashedBottomCodeIcon } from "lucide-react";
import Link from "next/link";
import type { TruncatedSessionInfo } from "../api/types";
import { useNewChatPageLink } from "../hooks/useNewChatPageLink";
Expand All @@ -33,31 +29,45 @@ export function ChatSidebar(props: {
<NebulaIcon className="size-8 text-foreground" />
</Link>

<Badge variant="outline" className="gap-1">
<FlaskConicalIcon className="size-2.5" />
<Badge variant="secondary" className="gap-1 py-1">
Alpha
</Badge>
</div>

<div className="p-2">
<div className="h-3" />
<Button asChild variant="primary" className="w-full gap-2">
<Link href={newChatPage}>
<MessageSquareDashedIcon className="size-4" />
New Chat
</Link>
<div className="h-4" />

<div className="flex flex-col gap-2 px-2">
<Button asChild variant="outline" className="w-full gap-2 rounded-lg">
<Link href={newChatPage}>New Chat</Link>
</Button>
</div>

<div className="h-4" />

<div>
<SidebarIconLink
href="/chat/history"
icon={MessagesSquareIcon}
label="All Chats"
/>

<SidebarIconLink
href="https://portal.thirdweb.com/nebula"
icon={SquareDashedBottomCodeIcon}
label="Documentation"
target="_blank"
/>
</div>

{sessionsToShow.length > 0 && (
<ScrollShadow
className="my-5 flex-1 border-t border-dashed pt-2"
className="my-4 flex-1 border-t border-dashed pt-2"
scrollableClassName="max-h-full"
shadowColor="hsl(var(--muted))"
shadowColor="transparent"
shadowClassName="z-10"
>
<div className="flex flex-col gap-1">
<h3 className="px-2 py-3 text-muted-foreground text-sm">
<h3 className="px-2 py-3 text-muted-foreground text-xs">
Recent Chats
</h3>
{sessionsToShow.map((session) => {
Expand All @@ -70,13 +80,6 @@ export function ChatSidebar(props: {
/>
);
})}

<Link
href="/chat/history"
className="inline-flex items-center gap-1.5 px-2 py-3 text-muted-foreground text-sm underline-offset-4 hover:text-foreground hover:underline"
>
View All <ChevronRightIcon className="size-4 text-foreground" />
</Link>
</div>
</ScrollShadow>
)}
Expand All @@ -89,3 +92,23 @@ export function ChatSidebar(props: {
</div>
);
}

function SidebarIconLink(props: {
icon: React.FC<{ className?: string }>;
label: string;
target?: "_blank";
href: string;
}) {
return (
<Button asChild variant="ghost">
<Link
href={props.href}
target={props.target}
className="!justify-start !px-3 w-full gap-2.5 rounded-lg text-left"
>
<props.icon className="size-4" />
{props.label}
</Link>
</Button>
);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"use client";

import { MultiNetworkSelector } from "@/components/blocks/NetworkSelectors";
import { Spinner } from "@/components/ui/Spinner/Spinner";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
Expand Down Expand Up @@ -30,7 +31,6 @@ import { useForm } from "react-hook-form";
import { toast } from "sonner";
import { isAddress } from "thirdweb";
import { z } from "zod";
import { MultiNetworkSelector } from "../../../../@/components/blocks/NetworkSelectors";
import type { ContextFilters } from "../api/chat";

export default function ContextFiltersButton(props: {
Expand All @@ -55,14 +55,14 @@ export default function ContextFiltersButton(props: {
Context Filters
<div className="flex gap-1 overflow-hidden">
{chainIds && chainIds.length > 0 && (
<Badge className="gap-1 truncate">
<Badge className="gap-1 truncate" variant="secondary">
Chain
<span className="max-sm:hidden">{chainIds.join(", ")}</span>
</Badge>
)}

{contractAddresses && contractAddresses.length > 0 && (
<Badge className="gap-1 truncate">
<Badge className="gap-1 truncate" variant="secondary">
Contract
<span className="max-sm:hidden">
{contractAddresses
Expand All @@ -73,7 +73,7 @@ export default function ContextFiltersButton(props: {
)}

{walletAddresses && walletAddresses.length > 0 && (
<Badge className="gap-1 truncate">
<Badge className="gap-1 truncate" variant="secondary">
Wallet
<span className="max-sm:hidden">
{walletAddresses
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,7 @@ export function MobileNav(props: {
</Sheet>

<div className="flex items-center gap-5">
<Button
asChild
variant="primary"
className="h-auto w-auto rounded-lg px-2.5 py-1.5"
>
<Button asChild className="h-auto w-auto rounded-lg px-2.5 py-1.5">
<Link href={newChatPage}>New Chat</Link>
</Button>
</div>
Expand Down
Loading