refactor(tabs): drop sidebar count and terminal-tab folder badge, show folder in tab tooltip

This commit is contained in:
xintaofei
2026-04-21 22:23:23 +08:00
parent dd2b542df9
commit 1bf2c2afce
2 changed files with 2 additions and 21 deletions

View File

@@ -1,6 +1,6 @@
"use client" "use client"
import { useCallback, useEffect, useMemo, useRef, useState } from "react" import { useCallback, useEffect, useRef, useState } from "react"
import { import {
ChevronsDownUp, ChevronsDownUp,
ChevronsUpDown, ChevronsUpDown,
@@ -9,7 +9,6 @@ import {
} from "lucide-react" } from "lucide-react"
import { useTranslations } from "next-intl" import { useTranslations } from "next-intl"
import { useSidebarContext } from "@/contexts/sidebar-context" import { useSidebarContext } from "@/contexts/sidebar-context"
import { useAppWorkspace } from "@/contexts/app-workspace-context"
import { import {
SidebarConversationList, SidebarConversationList,
type SidebarConversationListHandle, type SidebarConversationListHandle,
@@ -36,20 +35,12 @@ import {
export function Sidebar() { export function Sidebar() {
const t = useTranslations("Folder.sidebar") const t = useTranslations("Folder.sidebar")
const { isOpen, toggle } = useSidebarContext() const { isOpen, toggle } = useSidebarContext()
const { conversations } = useAppWorkspace()
const isMobile = useIsMobile() const isMobile = useIsMobile()
const listRef = useRef<SidebarConversationListHandle>(null) const listRef = useRef<SidebarConversationListHandle>(null)
const [showCompleted, setShowCompleted] = useState(false) const [showCompleted, setShowCompleted] = useState(false)
const [allExpanded, setAllExpanded] = useState(true) 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(() => { useEffect(() => {
// Hydrate from localStorage after mount to keep SSR/CSR markup consistent. // Hydrate from localStorage after mount to keep SSR/CSR markup consistent.
// eslint-disable-next-line react-hooks/set-state-in-effect // 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"> <h2 className="truncate text-[0.875rem] font-bold tracking-[-0.00625rem] text-sidebar-foreground">
{t("title")} {t("title")}
</h2> </h2>
<span className="shrink-0 text-[0.75rem] tabular-nums text-muted-foreground/70">
{t("conversationCountUnit", { count: visibleCount })}
</span>
</div> </div>
<div className="flex items-center gap-0.5"> <div className="flex items-center gap-0.5">
<Button <Button

View File

@@ -17,7 +17,6 @@ import {
ContextMenuSeparator, ContextMenuSeparator,
ContextMenuTrigger, ContextMenuTrigger,
} from "@/components/ui/context-menu" } from "@/components/ui/context-menu"
import { FolderBadge } from "@/components/ui/folder-badge"
import { import {
Tooltip, Tooltip,
TooltipContent, TooltipContent,
@@ -80,14 +79,8 @@ export function TerminalTabBar() {
: "text-muted-foreground hover:text-foreground hover:bg-muted" : "text-muted-foreground hover:text-foreground hover:bg-muted"
}`} }`}
onClick={() => switchTerminal(tab.id)} 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 ? ( {editingId === tab.id ? (
<input <input
ref={inputRef} ref={inputRef}