feat: streamline workspace controls

This commit is contained in:
2026-07-08 23:18:08 +08:00
parent c1d4c1e4ce
commit 683e4d6c07
2 changed files with 51 additions and 68 deletions

View File

@@ -1,15 +1,7 @@
import { useAuth } from "@/_core/hooks/useAuth"; import { useAuth } from "@/_core/hooks/useAuth";
import { Avatar, AvatarFallback } from "@/components/ui/avatar";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import { import {
Sidebar, Sidebar,
SidebarContent, SidebarContent,
SidebarFooter,
SidebarHeader, SidebarHeader,
SidebarInset, SidebarInset,
SidebarMenu, SidebarMenu,
@@ -21,7 +13,7 @@ import {
} from "@/components/ui/sidebar"; } from "@/components/ui/sidebar";
import { getLoginUrl } from "@/const"; import { getLoginUrl } from "@/const";
import { useIsMobile } from "@/hooks/useMobile"; import { useIsMobile } from "@/hooks/useMobile";
import { LayoutDashboard, LogOut, PanelLeft, Users } from "lucide-react"; import { LayoutDashboard, PanelLeft, Users } from "lucide-react";
import { CSSProperties, useEffect, useRef, useState } from "react"; import { CSSProperties, useEffect, useRef, useState } from "react";
import { useLocation } from "wouter"; import { useLocation } from "wouter";
import { DashboardLayoutSkeleton } from './DashboardLayoutSkeleton'; import { DashboardLayoutSkeleton } from './DashboardLayoutSkeleton';
@@ -106,7 +98,6 @@ function DashboardLayoutContent({
children, children,
setSidebarWidth, setSidebarWidth,
}: DashboardLayoutContentProps) { }: DashboardLayoutContentProps) {
const { user, logout } = useAuth();
const [location, setLocation] = useLocation(); const [location, setLocation] = useLocation();
const { state, toggleSidebar } = useSidebar(); const { state, toggleSidebar } = useSidebar();
const isCollapsed = state === "collapsed"; const isCollapsed = state === "collapsed";
@@ -201,36 +192,6 @@ function DashboardLayoutContent({
</SidebarMenu> </SidebarMenu>
</SidebarContent> </SidebarContent>
<SidebarFooter className="p-3">
<DropdownMenu>
<DropdownMenuTrigger asChild>
<button className="flex items-center gap-3 rounded-lg px-1 py-1 hover:bg-accent/50 transition-colors w-full text-left group-data-[collapsible=icon]:justify-center focus:outline-none focus-visible:ring-2 focus-visible:ring-ring">
<Avatar className="h-9 w-9 border shrink-0">
<AvatarFallback className="text-xs font-medium">
{user?.name?.charAt(0).toUpperCase()}
</AvatarFallback>
</Avatar>
<div className="flex-1 min-w-0 group-data-[collapsible=icon]:hidden">
<p className="text-sm font-medium truncate leading-none">
{user?.name || "-"}
</p>
<p className="text-xs text-muted-foreground truncate mt-1.5">
{user?.email || "-"}
</p>
</div>
</button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end" className="w-48">
<DropdownMenuItem
onClick={logout}
className="cursor-pointer text-destructive focus:text-destructive"
>
<LogOut className="mr-2 h-4 w-4" />
<span>Sign out</span>
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
</SidebarFooter>
</Sidebar> </Sidebar>
<div <div
className={`absolute top-0 right-0 w-1 h-full cursor-col-resize hover:bg-primary/20 transition-colors ${isCollapsed ? "hidden" : ""}`} className={`absolute top-0 right-0 w-1 h-full cursor-col-resize hover:bg-primary/20 transition-colors ${isCollapsed ? "hidden" : ""}`}

View File

@@ -616,8 +616,9 @@ export default function TaskManager({
)} )}
</div> </div>
<div className="flex items-center gap-1">
<button <button
className="industrial-btn industrial-btn-primary w-full py-1 text-[10px] flex items-center justify-center gap-1" className="industrial-btn industrial-btn-primary flex-1 min-w-0 py-1 text-[10px] flex items-center justify-center gap-1"
disabled={activeTaskId == null || selectedModelPcFileIds.size === 0 || linkPcFilesFromModel.isPending} disabled={activeTaskId == null || selectedModelPcFileIds.size === 0 || linkPcFilesFromModel.isPending}
onClick={() => { onClick={() => {
if (activeTaskId == null || selectedModelPcFileIds.size === 0) return; if (activeTaskId == null || selectedModelPcFileIds.size === 0) return;
@@ -630,6 +631,16 @@ export default function TaskManager({
<Plus className="w-3 h-3" /> <Plus className="w-3 h-3" />
添加到当前任务{selectedModelPcFileIds.size > 0 ? ` (${selectedModelPcFileIds.size})` : ''} 添加到当前任务{selectedModelPcFileIds.size > 0 ? ` (${selectedModelPcFileIds.size})` : ''}
</button> </button>
<button
type="button"
className="industrial-btn w-7 flex-shrink-0 px-0 py-1 text-[10px] flex items-center justify-center bg-red-900/55 border-red-500/60 text-red-100 hover:bg-red-800/70 hover:border-red-400"
title="关闭车型点云库"
aria-label="关闭车型点云库"
onClick={() => setPcLibraryOpen(false)}
>
<X className="w-3 h-3 flex-shrink-0" />
</button>
</div>
</div> </div>
)} )}
@@ -848,8 +859,9 @@ export default function TaskManager({
)} )}
</div> </div>
<div className="flex items-center gap-1">
<button <button
className="industrial-btn industrial-btn-primary w-full py-1 text-[10px] flex items-center justify-center gap-1" className="industrial-btn industrial-btn-primary flex-1 min-w-0 py-1 text-[10px] flex items-center justify-center gap-1"
disabled={activeTaskId == null || selectedModelCadFileIds.size === 0 || linkCadFilesFromModel.isPending} disabled={activeTaskId == null || selectedModelCadFileIds.size === 0 || linkCadFilesFromModel.isPending}
onClick={() => { onClick={() => {
if (activeTaskId == null || selectedModelCadFileIds.size === 0) return; if (activeTaskId == null || selectedModelCadFileIds.size === 0) return;
@@ -862,6 +874,16 @@ export default function TaskManager({
<Plus className="w-3 h-3" /> <Plus className="w-3 h-3" />
添加到当前任务{selectedModelCadFileIds.size > 0 ? ` (${selectedModelCadFileIds.size})` : ''} 添加到当前任务{selectedModelCadFileIds.size > 0 ? ` (${selectedModelCadFileIds.size})` : ''}
</button> </button>
<button
type="button"
className="industrial-btn w-7 flex-shrink-0 px-0 py-1 text-[10px] flex items-center justify-center bg-red-900/55 border-red-500/60 text-red-100 hover:bg-red-800/70 hover:border-red-400"
title="关闭车型 CAD 库"
aria-label="关闭车型 CAD 库"
onClick={() => setCadLibraryOpen(false)}
>
<X className="w-3 h-3 flex-shrink-0" />
</button>
</div>
</div> </div>
)} )}