refactor(tabs): drop sidebar count and terminal-tab folder badge, show folder in tab tooltip
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
"use client"
|
||||
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react"
|
||||
import { useCallback, useEffect, useRef, useState } from "react"
|
||||
import {
|
||||
ChevronsDownUp,
|
||||
ChevronsUpDown,
|
||||
@@ -9,7 +9,6 @@ import {
|
||||
} from "lucide-react"
|
||||
import { useTranslations } from "next-intl"
|
||||
import { useSidebarContext } from "@/contexts/sidebar-context"
|
||||
import { useAppWorkspace } from "@/contexts/app-workspace-context"
|
||||
import {
|
||||
SidebarConversationList,
|
||||
type SidebarConversationListHandle,
|
||||
@@ -36,20 +35,12 @@ import {
|
||||
export function Sidebar() {
|
||||
const t = useTranslations("Folder.sidebar")
|
||||
const { isOpen, toggle } = useSidebarContext()
|
||||
const { conversations } = useAppWorkspace()
|
||||
const isMobile = useIsMobile()
|
||||
const listRef = useRef<SidebarConversationListHandle>(null)
|
||||
|
||||
const [showCompleted, setShowCompleted] = useState(false)
|
||||
const [allExpanded, setAllExpanded] = useState(true)
|
||||
|
||||
const visibleCount = useMemo(() => {
|
||||
if (showCompleted) return conversations.length
|
||||
return conversations.filter(
|
||||
(c) => c.status !== "completed" && c.status !== "cancelled"
|
||||
).length
|
||||
}, [conversations, showCompleted])
|
||||
|
||||
useEffect(() => {
|
||||
// Hydrate from localStorage after mount to keep SSR/CSR markup consistent.
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect
|
||||
@@ -81,9 +72,6 @@ export function Sidebar() {
|
||||
<h2 className="truncate text-[0.875rem] font-bold tracking-[-0.00625rem] text-sidebar-foreground">
|
||||
{t("title")}
|
||||
</h2>
|
||||
<span className="shrink-0 text-[0.75rem] tabular-nums text-muted-foreground/70">
|
||||
{t("conversationCountUnit", { count: visibleCount })}
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex items-center gap-0.5">
|
||||
<Button
|
||||
|
||||
@@ -17,7 +17,6 @@ import {
|
||||
ContextMenuSeparator,
|
||||
ContextMenuTrigger,
|
||||
} from "@/components/ui/context-menu"
|
||||
import { FolderBadge } from "@/components/ui/folder-badge"
|
||||
import {
|
||||
Tooltip,
|
||||
TooltipContent,
|
||||
@@ -80,14 +79,8 @@ export function TerminalTabBar() {
|
||||
: "text-muted-foreground hover:text-foreground hover:bg-muted"
|
||||
}`}
|
||||
onClick={() => switchTerminal(tab.id)}
|
||||
title={`${folderIndex.get(tab.folderId) ?? String(tab.folderId)} — ${tab.title}`}
|
||||
>
|
||||
<FolderBadge
|
||||
folderId={tab.folderId}
|
||||
folderName={
|
||||
folderIndex.get(tab.folderId) ?? String(tab.folderId)
|
||||
}
|
||||
size="sm"
|
||||
/>
|
||||
{editingId === tab.id ? (
|
||||
<input
|
||||
ref={inputRef}
|
||||
|
||||
Reference in New Issue
Block a user