⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.
TypeScript honoissue-managementissue-trackerjira-alternativekanbanlinear-alternativemcpproject-managementreactself-hostedtypescript
feat(settings): refresh settings sidebars and project/workspace UX
Andrej3424436ad3d1
diff --git a/apps/web/src/components/nav-projects.tsx b/apps/web/src/components/nav-projects.tsxindex d294ff0c2..6a2c99fdf 100644--- a/apps/web/src/components/nav-projects.tsx+++ b/apps/web/src/components/nav-projects.tsx@@ -44,6 +44,7 @@ import {AlertDialogHeader,AlertDialogTitle,} from "./ui/alert-dialog";+import { Button } from "./ui/button";export function NavProjects() {const { isMobile } = useSidebar();@@ -199,7 +200,11 @@ export function NavProjects() {</AlertDialogDescription></AlertDialogHeader><AlertDialogFooter>- <AlertDialogClose>Cancel</AlertDialogClose>+ <AlertDialogClose>+ <Button variant="outline" size="sm">+ Cancel+ </Button>+ </AlertDialogClose><AlertDialogCloseonClick={async () => {await deleteProject({@@ -216,9 +221,10 @@ export function NavProjects() {},});}}- className="bg-destructive text-destructive-foreground hover:bg-destructive/90">- Delete Project+ <Button variant="destructive" size="sm">+ Delete Project+ </Button></AlertDialogClose></AlertDialogFooter></AlertDialogContent>diff --git a/apps/web/src/components/notification/notification-dropdown.tsx b/apps/web/src/components/notification/notification-dropdown.tsxindex b3b53f069..a9aa663a1 100644--- a/apps/web/src/components/notification/notification-dropdown.tsx+++ b/apps/web/src/components/notification/notification-dropdown.tsx@@ -187,12 +187,15 @@ const NotificationDropdown = forwardRef<NotificationDropdownRef>(</AlertDialogDescription></AlertDialogHeader><AlertDialogFooter>- <AlertDialogClose>Cancel</AlertDialogClose>- <AlertDialogClose- onClick={handleClearAll}- className="bg-destructive text-destructive-foreground hover:bg-destructive/90"- >- Clear all+ <AlertDialogClose>+ <Button variant="outline" size="sm">+ Cancel+ </Button>+ </AlertDialogClose>+ <AlertDialogClose onClick={handleClearAll}>+ <Button variant="destructive" size="sm">+ Clear all+ </Button></AlertDialogClose></AlertDialogFooter></AlertDialogContent>diff --git a/apps/web/src/components/shared/modals/create-project-modal.tsx b/apps/web/src/components/shared/modals/create-project-modal.tsxindex b7023f19f..72023ffab 100644--- a/apps/web/src/components/shared/modals/create-project-modal.tsx+++ b/apps/web/src/components/shared/modals/create-project-modal.tsx@@ -39,6 +39,7 @@ function CreateProjectModal({ open, onClose }: CreateProjectModalProps) {const [slug, setSlug] = useState("");const [selectedIcon, setSelectedIcon] = useState("Layout");const [iconPopoverOpen, setIconPopoverOpen] = useState(false);+ const [iconSearch, setIconSearch] = useState("");const queryClient = useQueryClient();const { data: workspace } = useActiveWorkspace();const { mutateAsync } = useCreateProject({@@ -47,7 +48,11 @@ function CreateProjectModal({ open, onClose }: CreateProjectModalProps) {workspaceId: workspace?.id ?? "",icon: selectedIcon,});- const IconComponent = icons[selectedIcon as keyof typeof icons];+ const SelectedIcon =+ icons[selectedIcon as keyof typeof icons] || icons.Layout;+ const filteredIcons = Object.entries(icons).filter(([iconName]) =>+ iconName.toLowerCase().includes(iconSearch.trim().toLowerCase()),+ );const navigate = useNavigate();const handleClose = () => {@@ -55,6 +60,7 @@ function CreateProjectModal({ open, onClose }: CreateProjectModalProps) {setSlug("");setSelectedIcon("Layout");setIconPopoverOpen(false);+ setIconSearch("");onClose();};@@ -92,79 +98,98 @@ function CreateProjectModal({ open, onClose }: CreateProjectModalProps) {return (<Dialog open={open} onOpenChange={handleClose}><DialogContent className="max-w-md" showCloseButton={false}>- <DialogHeader className="pb-6">- <DialogTitle asChild>- <Breadcrumb>- <BreadcrumbList>- <BreadcrumbItem className="text-muted-foreground font-semibold tracking-wider text-sm">- {workspace?.name?.toUpperCase() || "WORKSPACE"}- </BreadcrumbItem>- <BreadcrumbSeparator />- <BreadcrumbItem className="text-foreground font-medium text-sm">- Create a new project- </BreadcrumbItem>- </BreadcrumbList>- </Breadcrumb>- </DialogTitle>+ <DialogHeader className="px-3 pt-4 pb-1 gap-1.5">+ <DialogTitle className="sr-only">Create a new project</DialogTitle>+ <Breadcrumb>+ <BreadcrumbList className="gap-1 text-xs">+ <BreadcrumbItem className="text-muted-foreground font-medium tracking-wide">+ {workspace?.name?.toUpperCase() || "WORKSPACE"}+ </BreadcrumbItem>+ <BreadcrumbSeparator className="[&>svg]:size-3.5" />+ <BreadcrumbItem className="text-foreground font-medium">+ Create a new project+ </BreadcrumbItem>+ </BreadcrumbList>+ </Breadcrumb><DialogDescription className="sr-only">Create a new project in your workspace by providing a name, key, andselecting an icon.</DialogDescription></DialogHeader>- <form onSubmit={handleSubmit} className="space-y-6">- <div className="space-y-4 px-6">+ <form onSubmit={handleSubmit} className="space-y-4">+ <div className="space-y-6 px-3 pt-2"><Popoveropen={iconPopoverOpen}- onOpenChange={setIconPopoverOpen}+ onOpenChange={(open) => {+ setIconPopoverOpen(open);+ if (!open) setIconSearch("");+ }}modal={true}><PopoverTrigger asChild>- <button+ <Buttontype="button"- className="flex items-center justify-center p-2 rounded border border-border hover:bg-accent transition-colors"+ variant="outline"+ size="icon-sm"+ className="h-8 w-8 p-0"+ title="Pick icon">- <IconComponent className="w-4 h-4 text-muted-foreground" />- </button>+ <SelectedIcon className="h-4 w-4" />+ </Button></PopoverTrigger>- <PopoverContent className="w-80 p-2" align="start">- <div className="max-h-[300px] overflow-y-auto">- <div className="grid grid-cols-8 gap-2">- {Object.entries(icons).map(([iconName, Icon]) => (- <button- key={iconName}- type="button"- onClick={() => {- setSelectedIcon(iconName);- setIconPopoverOpen(false);- }}- className={cn(- "p-2 rounded-lg transition-all duration-200 flex items-center justify-center group hover:scale-105",- selectedIcon === iconName- ? "bg-accent text-foreground"- : "text-muted-foreground hover:bg-accent",- )}- title={iconName}- >- <Icon className="w-4 h-4" />- </button>- ))}+ <PopoverContent className="w-64 p-2" align="start">+ <div className="space-y-2">+ <Input+ value={iconSearch}+ onChange={(e) => setIconSearch(e.target.value)}+ placeholder="Search icons..."+ className="h-8 text-xs"+ />+ <div className="max-h-[280px] overflow-y-auto pr-1">+ <div className="grid grid-cols-6 gap-1.5">+ {filteredIcons.map(([iconName, Icon]) => {+ const isSelected = selectedIcon === iconName;+ return (+ <Button+ key={iconName}+ type="button"+ variant="ghost"+ size="sm"+ onClick={() => {+ setSelectedIcon(iconName);+ setIconPopoverOpen(false);+ setIconSearch("");+ }}+ className={cn(+ "h-10 items-center justify-center rounded-md p-0",+ isSelected &&+ "bg-sidebar-accent text-sidebar-accent-foreground",+ )}+ title={iconName}+ >+ <Icon className="h-4 w-4" />+ </Button>+ );+ })}+ </div></div></div></PopoverContent></Popover><Input+ unstyledvalue={name}onChange={handleNameChange}autoFocusplaceholder="Project name"- className="!text-2xl font-semibold !border-0 px-0 py-3 !shadow-none focus-visible:!ring-0 !bg-transparent text-foreground placeholder:text-muted-foreground tracking-tight focus:!outline-none focus-visible:!outline-none"+ className="w-full [&_[data-slot=input]]:h-auto [&_[data-slot=input]]:px-0 [&_[data-slot=input]]:py-2 [&_[data-slot=input]]:text-2xl [&_[data-slot=input]]:leading-tight [&_[data-slot=input]]:font-semibold [&_[data-slot=input]]:tracking-tight [&_[data-slot=input]]:text-foreground [&_[data-slot=input]]:placeholder:text-muted-foreground [&_[data-slot=input]]:outline-none"required/></div>- <div className="space-y-4 px-6">+ <div className="space-y-3 px-3"><div className="flex items-center gap-3 p-3 rounded-xl bg-muted/50 border border-border"><div className="flex items-center gap-2"><span className="text-sm font-medium text-muted-foreground">diff --git a/apps/web/src/components/shared/modals/create-workspace-modal.tsx b/apps/web/src/components/shared/modals/create-workspace-modal.tsxindex aba4fea9a..3fc36b445 100644--- a/apps/web/src/components/shared/modals/create-workspace-modal.tsx+++ b/apps/web/src/components/shared/modals/create-workspace-modal.tsx@@ -102,18 +102,20 @@ function CreateWorkspaceModal({ open, onClose }: CreateWorkspaceModalProps) {<div className="space-y-4 px-6"><Inputref={inputRef}+ unstyledvalue={name}onChange={(e) => setName(e.target.value)}placeholder="Workspace name"- className="!text-2xl font-semibold !border-0 px-0 py-3 !shadow-none focus-visible:!ring-0 !bg-transparent text-foreground placeholder:text-muted-foreground tracking-tight focus:!outline-none focus-visible:!outline-none"+ className="w-full [&_[data-slot=input]]:h-auto [&_[data-slot=input]]:px-0 [&_[data-slot=input]]:py-2 [&_[data-slot=input]]:text-2xl [&_[data-slot=input]]:leading-tight [&_[data-slot=input]]:font-semibold [&_[data-slot=input]]:tracking-tight [&_[data-slot=input]]:text-foreground [&_[data-slot=input]]:placeholder:text-muted-foreground [&_[data-slot=input]]:outline-none"required/><Input+ unstyledvalue={description}onChange={(e) => setDescription(e.target.value)}placeholder="Add description..."- className="!border-0 px-0 py-2 !shadow-none focus-visible:!ring-0 !bg-transparent text-foreground placeholder:text-muted-foreground focus:!outline-none focus-visible:!outline-none"+ className="w-full [&_[data-slot=input]]:h-auto [&_[data-slot=input]]:px-0 [&_[data-slot=input]]:py-2 [&_[data-slot=input]]:text-base [&_[data-slot=input]]:leading-relaxed [&_[data-slot=input]]:text-foreground [&_[data-slot=input]]:placeholder:text-muted-foreground [&_[data-slot=input]]:outline-none"/></div>diff --git a/apps/web/src/components/team/members-table.tsx b/apps/web/src/components/team/members-table.tsxindex a6988c7e0..e479612c8 100644--- a/apps/web/src/components/team/members-table.tsx+++ b/apps/web/src/components/team/members-table.tsx@@ -247,14 +247,16 @@ function MembersTable({</AlertDialogDescription></AlertDialogHeader><AlertDialogFooter>- <AlertDialogClose disabled={isPending}>Cancel</AlertDialogClose>- <AlertDialogClose- onClick={handleDeleteMember}- disabled={isPending}- className="bg-destructive text-destructive-foreground hover:bg-destructive/90"- >- <Trash2 className="w-4 h-4 mr-2" />- Remove Member+ <AlertDialogClose disabled={isPending}>+ <Button variant="outline" size="sm" disabled={isPending}>+ Cancel+ </Button>+ </AlertDialogClose>+ <AlertDialogClose onClick={handleDeleteMember} disabled={isPending}>+ <Button variant="destructive" size="sm" disabled={isPending}>+ <Trash2 className="w-4 h-4 mr-2" />+ Remove Member+ </Button></AlertDialogClose></AlertDialogFooter></AlertDialogContent>@@ -276,14 +278,19 @@ function MembersTable({</AlertDialogDescription></AlertDialogHeader><AlertDialogFooter>- <AlertDialogClose disabled={isCancelling}>Cancel</AlertDialogClose>+ <AlertDialogClose disabled={isCancelling}>+ <Button variant="outline" size="sm" disabled={isCancelling}>+ Cancel+ </Button>+ </AlertDialogClose><AlertDialogCloseonClick={handleCancelInvitation}disabled={isCancelling}- className="bg-destructive text-destructive-foreground hover:bg-destructive/90">- <Trash2 className="w-4 h-4 mr-2" />- Cancel Invitation+ <Button variant="destructive" size="sm" disabled={isCancelling}>+ <Trash2 className="w-4 h-4 mr-2" />+ Cancel Invitation+ </Button></AlertDialogClose></AlertDialogFooter></AlertDialogContent>diff --git a/apps/web/src/components/ui/select.tsx b/apps/web/src/components/ui/select.tsxindex a1b3a4b11..6778df6b8 100644--- a/apps/web/src/components/ui/select.tsx+++ b/apps/web/src/components/ui/select.tsx@@ -16,7 +16,7 @@ import { cn } from "@/lib/cn";const Select = SelectPrimitive.Root;const selectTriggerVariants = cva(- "relative inline-flex min-h-9 w-full min-w-36 select-none items-center justify-between gap-2 rounded-lg border border-input bg-background not-dark:bg-clip-padding px-[calc(--spacing(3)-1px)] text-left text-base text-foreground shadow-xs/5 outline-none ring-ring/24 transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-data-disabled:not-focus-visible:not-aria-invalid:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 focus-visible:border-ring focus-visible:ring-[3px] aria-invalid:border-destructive/36 focus-visible:aria-invalid:border-destructive/64 focus-visible:aria-invalid:ring-destructive/16 data-disabled:pointer-events-none data-disabled:opacity-64 sm:min-h-8 sm:text-sm dark:bg-input/32 dark:aria-invalid:ring-destructive/24 dark:not-data-disabled:not-focus-visible:not-aria-invalid:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0 [[data-disabled],:focus-visible,[aria-invalid],[data-pressed]]:shadow-none",+ "relative inline-flex min-h-9 w-full min-w-36 cursor-pointer select-none items-center justify-between gap-2 rounded-lg border border-input bg-background not-dark:bg-clip-padding px-[calc(--spacing(3)-1px)] text-left text-base text-foreground shadow-xs/5 outline-none ring-ring/24 transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-data-disabled:not-focus-visible:not-aria-invalid:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 focus-visible:border-ring focus-visible:ring-[3px] aria-invalid:border-destructive/36 focus-visible:aria-invalid:border-destructive/64 focus-visible:aria-invalid:ring-destructive/16 data-disabled:pointer-events-none data-disabled:opacity-64 sm:min-h-8 sm:text-sm dark:bg-input/32 dark:aria-invalid:ring-destructive/24 dark:not-data-disabled:not-focus-visible:not-aria-invalid:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0 [[data-disabled],:focus-visible,[aria-invalid],[data-pressed]]:shadow-none",{defaultVariants: {size: "default",diff --git a/apps/web/src/components/ui/sidebar.tsx b/apps/web/src/components/ui/sidebar.tsxindex 3342c6329..4a6cfb93c 100644--- a/apps/web/src/components/ui/sidebar.tsx+++ b/apps/web/src/components/ui/sidebar.tsx@@ -480,7 +480,7 @@ function SidebarMenuItem({ className, ...props }: React.ComponentProps<"li">) {}const sidebarMenuButtonVariants = cva(- "peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-lg p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pe-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg:not([class*='size-'])]:size-4 [&>svg]:shrink-0",+ "peer/menu-button flex w-full cursor-pointer items-center gap-2 overflow-hidden rounded-lg p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pe-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg:not([class*='size-'])]:size-4 [&>svg]:shrink-0",{defaultVariants: {size: "default",diff --git a/apps/web/src/hooks/mutations/workspace/use-update-workspace.ts b/apps/web/src/hooks/mutations/workspace/use-update-workspace.tsindex 9248524ba..fbbf59527 100644--- a/apps/web/src/hooks/mutations/workspace/use-update-workspace.ts+++ b/apps/web/src/hooks/mutations/workspace/use-update-workspace.ts@@ -5,6 +5,7 @@ import { createSlug } from "@/lib/utils/create-slug";type UpdateWorkspaceRequest = {workspaceId: string;name?: string;+ description?: string;slug?: string;logo?: string;metadata?: Record<string, unknown>;@@ -15,12 +16,14 @@ function useUpdateWorkspace() {mutationFn: async ({workspaceId,name,+ description,slug,logo,metadata,}: UpdateWorkspaceRequest) => {const updateData: {name?: string;+ description?: string;slug?: string;logo?: string;metadata?: Record<string, unknown>;@@ -37,6 +40,10 @@ function useUpdateWorkspace() {updateData.slug = slug;}+ if (description !== undefined) {+ updateData.description = description;+ }+if (logo !== undefined) {updateData.logo = logo;}diff --git a/apps/web/src/routes/_layout/_authenticated/dashboard/settings/account.tsx b/apps/web/src/routes/_layout/_authenticated/dashboard/settings/account.tsxindex eb1d223d4..080dfb796 100644--- a/apps/web/src/routes/_layout/_authenticated/dashboard/settings/account.tsx+++ b/apps/web/src/routes/_layout/_authenticated/dashboard/settings/account.tsx@@ -7,6 +7,14 @@ import {import { Code, Settings, User } from "lucide-react";import useAuth from "@/components/providers/auth-provider/hooks/use-auth";import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";+import { Button } from "@/components/ui/button";+import {+ SidebarGroup,+ SidebarGroupContent,+ SidebarGroupLabel,+ SidebarMenu,+ SidebarMenuItem,+} from "@/components/ui/sidebar";import { cn } from "@/lib/cn";export const Route = createFileRoute(@@ -31,73 +39,80 @@ const menuItems = [function RouteComponent() {const { user } = useAuth();const location = useLocation();+ const isActivePath = (path: string) => location.pathname === path;return (<div className="flex gap-6 h-full">- <div className="w-64 flex-shrink-0">- <div className="p-4 h-fit">- <div className="flex items-center gap-3 mb-6">- <Avatar className="h-10 w-10">+ <aside className="w-64 flex-shrink-0">+ <div className="p-2">+ <div className="mb-1 flex items-center gap-3 rounded-md px-2 py-2">+ <Avatar className="h-9 w-9"><AvatarImage src={user?.image ?? ""} alt={user?.name || ""} /><AvatarFallback className="text-xs font-medium border border-border/30">{user?.name?.charAt(0).toUpperCase()}</AvatarFallback></Avatar><div className="flex flex-col">- <p className="text-sm font-medium">{user?.name}</p>- <p className="text-xs text-muted-foreground">{user?.email}</p>+ <p className="text-sm">{user?.name}</p>+ <p className="text-xs text-sidebar-foreground/70">+ {user?.email}+ </p></div></div>- <div className="space-y-4">- <div>- <h3 className="text-xs font-medium text-muted-foreground uppercase tracking-wider mb-2">- Account- </h3>- <nav className="space-y-0.5">+ <SidebarGroup className="gap-1 p-1">+ <SidebarGroupLabel className="h-7 px-2 text-[11px] uppercase tracking-wide text-sidebar-foreground/70">+ Account+ </SidebarGroupLabel>+ <SidebarGroupContent>+ <SidebarMenu className="gap-0.5">{menuItems.map((item) => (- <Link- key={item.title}- to={item.url}+ <SidebarMenuItem key={item.title}>+ <Button+ render={<Link to={item.url} />}+ variant="ghost"+ size="sm"+ className={cn(+ "h-8 w-full justify-start gap-2 rounded-lg px-2 text-[11px] font-normal text-sidebar-foreground/80",+ isActivePath(item.url) &&+ "bg-sidebar-accent text-sidebar-accent-foreground",+ )}+ >+ <item.icon className="h-4 w-4" />+ <span>{item.title}</span>+ </Button>+ </SidebarMenuItem>+ ))}+ </SidebarMenu>+ </SidebarGroupContent>+ </SidebarGroup>++ <SidebarGroup className="gap-1 p-1">+ <SidebarGroupLabel className="h-7 px-2 text-[11px] uppercase tracking-wide text-sidebar-foreground/70">+ Developer+ </SidebarGroupLabel>+ <SidebarGroupContent>+ <SidebarMenu className="gap-0.5">+ <SidebarMenuItem>+ <Button+ render={<Link to="/dashboard/settings/account/developer" />}+ variant="ghost"+ size="sm"className={cn(- "flex items-center gap-2 px-2 py-1.5 text-xs rounded-sm transition-colors",- "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",- location.pathname === item.url- ? "bg-sidebar-accent text-sidebar-accent-foreground font-medium"- : "text-muted-foreground",+ "h-8 w-full justify-start gap-2 rounded-lg px-2 text-[11px] font-normal text-sidebar-foreground/80",+ isActivePath("/dashboard/settings/account/developer") &&+ "bg-sidebar-accent text-sidebar-accent-foreground",)}>- <item.icon className="h-3.5 w-3.5" />- <span>{item.title}</span>- </Link>- ))}- </nav>- </div>-- <div>- <h3 className="text-xs font-medium text-muted-foreground uppercase tracking-wider mb-2">- Developer- </h3>- <nav className="space-y-0.5">- <Link- to="/dashboard/settings/account/developer"- className={cn(- "flex items-center gap-2 px-2 py-1.5 text-xs rounded-sm transition-colors",- "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",- location.pathname ===- "/dashboard/settings/account/developer"- ? "bg-sidebar-accent text-sidebar-accent-foreground font-medium"- : "text-muted-foreground",- )}- >- <Code className="h-3.5 w-3.5" />- <span>API Keys</span>- </Link>- </nav>- </div>- </div>+ <Code className="h-4 w-4" />+ <span>API Keys</span>+ </Button>+ </SidebarMenuItem>+ </SidebarMenu>+ </SidebarGroupContent>+ </SidebarGroup></div>- </div>+ </aside><div className="flex-1 min-w-0 overflow-y-auto"><Outlet />diff --git a/apps/web/src/routes/_layout/_authenticated/dashboard/settings/account/information.tsx b/apps/web/src/routes/_layout/_authenticated/dashboard/settings/account/information.tsxindex 1171bd4ed..52173b05b 100644--- a/apps/web/src/routes/_layout/_authenticated/dashboard/settings/account/information.tsx+++ b/apps/web/src/routes/_layout/_authenticated/dashboard/settings/account/information.tsx@@ -31,6 +31,11 @@ type ProfileFormValues = {email: string;};+type NormalizedProfileValues = {+ name: string;+ email: string;+};+const profileSchema = z.object({name: z.string()@@ -39,15 +44,27 @@ const profileSchema = z.object({email: z.string().email("Invalid email address"),});+function normalizeProfileValues(+ data: ProfileFormValues,+): NormalizedProfileValues {+ return {+ name: data.name.trim(),+ email: data.email,+ };+}+function RouteComponent() {const { user } = useAuth();const queryClient = useQueryClient();const { mutateAsync: updateProfile } = useUpdateUserProfile();const debounceTimeoutRef = useRef<NodeJS.Timeout | null>(null);- const debouncedSaveRef = useRef<(data: ProfileFormValues) => void>(() => {});+ const isSavingRef = useRef(false);+ const queuedSaveRef = useRef<ProfileFormValues | null>(null);+ const lastSavedRef = useRef<NormalizedProfileValues | null>(null);const profileForm = useForm<ProfileFormValues>({resolver: standardSchemaResolver(profileSchema),+ mode: "onChange",defaultValues: {name: user?.name || "",email: user?.email || "",@@ -55,22 +72,42 @@ function RouteComponent() {});useEffect(() => {- if (user && !profileForm.formState.isDirty) {- profileForm.reset({- name: user.name || "",- email: user.email || "",- });+ if (!user) return;++ const nextValues = {+ name: user.name || "",+ email: user.email || "",+ };+ lastSavedRef.current = normalizeProfileValues(nextValues);++ if (!profileForm.formState.isDirty) {+ profileForm.reset(nextValues);}}, [user, profileForm]);const saveProfile = useCallback(async (data: ProfileFormValues) => {+ const normalizedData = normalizeProfileValues(data);++ if (lastSavedRef.current?.name === normalizedData.name) {+ return;+ }++ if (isSavingRef.current) {+ queuedSaveRef.current = data;+ return;+ }++ isSavingRef.current = true;+try {await updateProfile({- name: data.name.trim(),+ name: normalizedData.name,});- profileForm.reset(data, { keepDirty: false });+ profileForm.reset(normalizedData, { keepDirty: false });+ lastSavedRef.current = normalizedData;+ queuedSaveRef.current = null;await queryClient.invalidateQueries({ queryKey: ["session"] });toast.success("Profile updated successfully");@@ -78,6 +115,14 @@ function RouteComponent() {toast.error(error instanceof Error ? error.message : "Failed to update profile",);+ } finally {+ isSavingRef.current = false;++ if (queuedSaveRef.current) {+ const queuedData = queuedSaveRef.current;+ queuedSaveRef.current = null;+ await saveProfile(queuedData);+ }}},[updateProfile, queryClient, profileForm],@@ -96,17 +141,15 @@ function RouteComponent() {[saveProfile],);- debouncedSaveRef.current = debouncedSave;-useEffect(() => {- const subscription = profileForm.watch((data) => {+ const subscription = profileForm.watch(() => {if (profileForm.formState.isDirty && profileForm.formState.isValid) {- debouncedSaveRef.current?.(data as ProfileFormValues);+ debouncedSave(profileForm.getValues());}});return () => subscription.unsubscribe();- }, [profileForm]);+ }, [profileForm, debouncedSave]);useEffect(() => {return () => {diff --git a/apps/web/src/routes/_layout/_authenticated/dashboard/settings/projects.tsx b/apps/web/src/routes/_layout/_authenticated/dashboard/settings/projects.tsxindex 0172a7a17..ad4ce8eee 100644--- a/apps/web/src/routes/_layout/_authenticated/dashboard/settings/projects.tsx+++ b/apps/web/src/routes/_layout/_authenticated/dashboard/settings/projects.tsx@@ -5,15 +5,23 @@ import {useLocation,useNavigate,} from "@tanstack/react-router";-import { ChevronRight, Eye, GitBranch, Plug, Settings } from "lucide-react";+import { Eye, GitBranch, Plug, Settings } from "lucide-react";import { useEffect } from "react";import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";+import { Button } from "@/components/ui/button";import {- Collapsible,- CollapsibleContent,- CollapsibleTrigger,-} from "@/components/ui/collapsible";-import icons from "@/constants/project-icons";+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+} from "@/components/ui/select";+import {+ SidebarGroup,+ SidebarGroupContent,+ SidebarGroupLabel,+ SidebarMenu,+ SidebarMenuItem,+} from "@/components/ui/sidebar";import useGetProjects from "@/hooks/queries/project/use-get-projects";import { useWorkspacePermission } from "@/hooks/use-workspace-permission";import { cn } from "@/lib/cn";@@ -28,18 +36,22 @@ const menuItems = [{title: "General",icon: Settings,+ segment: "general",},{title: "Visibility",icon: Eye,+ segment: "visibility",},{title: "Integrations",icon: Plug,+ segment: "integrations",},{title: "Workflow",icon: GitBranch,+ segment: "workflow",},];@@ -51,6 +63,23 @@ function RouteComponent() {workspaceId: workspace?.id || "",});+ const workspaceInitials =+ workspace?.name+ ?.split(" ")+ .filter(Boolean)+ .slice(0, 2)+ .map((part) => part[0]?.toUpperCase())+ .join("") || "WS";++ const selectedProjectMatch = location.pathname.match(+ /^\/dashboard\/settings\/projects\/([^/]+)\//,+ );+ const selectedProjectId = selectedProjectMatch?.[1] || "";+ const selectedSegment =+ location.pathname.match(+ /^\/dashboard\/settings\/projects\/[^/]+\/([^/]+)/,+ )?.[1] || "general";+useEffect(() => {const isProjectsRoot =location.pathname === "/dashboard/settings/projects" ||@@ -67,93 +96,115 @@ function RouteComponent() {});}, [location.pathname, navigate, projects]);+ const selectedProject = projects?.find(+ (project) => project.id === selectedProjectId,+ );+return (<div className="flex gap-6 h-full">- <div className="w-64 flex-shrink-0">- <div className="p-4 h-fit">- <div className="flex items-center gap-3 mb-6">- <Avatar className="h-10 w-10">+ <aside className="w-64 flex-shrink-0">+ <div className="p-2">+ <div className="mb-1 flex items-center gap-3 rounded-md px-2 py-2">+ <Avatar className="h-8 w-8"><AvatarImagesrc={workspace?.logo ?? ""}alt={workspace?.name || ""}/>- <AvatarFallback className="text-md bg-primary font-medium border border-border/30">- {workspace?.name?.charAt(0).toUpperCase()}+ <AvatarFallback className="border border-sidebar-border/70 bg-sidebar-accent/70 text-[11px] font-medium text-sidebar-accent-foreground">+ {workspaceInitials}</AvatarFallback></Avatar><div className="flex flex-col">- <p className="text-sm font-medium">{workspace?.name}</p>- <p className="text-xs text-muted-foreground capitalize">{role}</p>+ <p className="text-sm">{workspace?.name}</p>+ <p className="text-[11px] text-sidebar-foreground/60 capitalize">+ {role}+ </p></div></div>- <div className="space-y-4">- <Collapsible defaultOpen={true} className="group/collapsible">- <h3 className="text-xs font-medium text-muted-foreground uppercase tracking-wider mb-2">- Projects- </h3>- <CollapsibleContent className="data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:slide-out-to-bottom-2 data-[state=open]:slide-in-from-bottom-2 duration-200">- <nav className="space-y-0.5">- {projects?.map((project) => {- const IconComponent =- icons[project.icon as keyof typeof icons] || icons.Layout;+ <SidebarGroup className="gap-1 p-1">+ <SidebarGroupLabel className="h-7 px-2 text-[11px] uppercase tracking-wide text-sidebar-foreground/70">+ Project+ </SidebarGroupLabel>+ <SidebarGroupContent>+ <Select+ value={selectedProjectId}+ onValueChange={(projectId) => {+ const nextSegment = menuItems.some(+ (item) => item.segment === selectedSegment,+ )+ ? selectedSegment+ : "general";- return (- <Collapsible- key={project.id}- defaultOpen={true}- className="group/project-collapsible"- >- <CollapsibleTrigger asChild>- <div className="flex items-center gap-2.5 px-3 py-2 text-xs rounded-md transition-all duration-200 cursor-pointer hover:bg-sidebar-accent hover:text-sidebar-accent-foreground group text-muted-foreground">- <IconComponent className="w-3.5 h-3.5" />- <span>{project.name}</span>- <ChevronRight className="w-4 h-4 ml-auto transition-transform duration-200 group-data-[state=open]/project-collapsible:rotate-90" />- </div>- </CollapsibleTrigger>- <CollapsibleContent className="data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:slide-out-to-bottom-2 data-[state=open]:slide-in-from-bottom-2 duration-200">- <div className="flex flex-col gap-1 ml-6 mt-1">- {menuItems.map((item) => {- const urlMap = {- General: `/dashboard/settings/projects/${project.id}/general`,- Visibility: `/dashboard/settings/projects/${project.id}/visibility`,- Integrations: `/dashboard/settings/projects/${project.id}/integrations`,- Workflow: `/dashboard/settings/projects/${project.id}/workflow`,- };-- const toUrl =- urlMap[item.title as keyof typeof urlMap];+ void navigate({+ to: `/dashboard/settings/projects/${projectId}/${nextSegment}`,+ });+ }}+ >+ <SelectTrigger+ className="h-8 text-[11px] font-normal text-foreground"+ size="sm"+ >+ <span className="truncate font-normal text-foreground">+ {selectedProject?.name ||+ (projects?.length ? "Select project" : "No projects")}+ </span>+ </SelectTrigger>+ <SelectContent+ side="bottom"+ align="start"+ sideOffset={6}+ alignItemWithTrigger={false}+ className="w-(--anchor-width)"+ >+ {projects?.map((project) => (+ <SelectItem key={project.id} value={project.id}>+ <span className="font-normal text-foreground">+ {project.name}+ </span>+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ </SidebarGroupContent>+ </SidebarGroup>- const isActive = location.pathname === toUrl;+ <SidebarGroup className="gap-1 p-1">+ <SidebarGroupLabel className="h-7 px-2 text-[11px] uppercase tracking-wide text-sidebar-foreground/70">+ Settings+ </SidebarGroupLabel>+ <SidebarGroupContent>+ <SidebarMenu className="gap-0.5">+ {menuItems.map((item) => {+ const toUrl = selectedProject+ ? `/dashboard/settings/projects/${selectedProject.id}/${item.segment}`+ : "/dashboard/settings/projects";+ const isActive = selectedSegment === item.segment;- return (- <Link- key={item.title}- to={toUrl}- className={cn(- "flex items-center gap-2.5 px-3 py-2 text-xs rounded-md transition-all duration-200",- "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",- isActive- ? "bg-sidebar-accent text-sidebar-accent-foreground font-medium"- : "text-muted-foreground hover:text-foreground",- )}- >- <item.icon className="h-3.5 w-3.5" />- <span>{item.title}</span>- </Link>- );- })}- </div>- </CollapsibleContent>- </Collapsible>- );- })}- </nav>- </CollapsibleContent>- </Collapsible>- </div>+ return (+ <SidebarMenuItem key={item.title}>+ <Button+ render={<Link to={toUrl} />}+ variant="ghost"+ size="sm"+ disabled={!selectedProject}+ className={cn(+ "h-8 w-full justify-start gap-2 rounded-lg px-2 text-[11px] font-normal text-sidebar-foreground/80",+ isActive &&+ "bg-sidebar-accent text-sidebar-accent-foreground",+ )}+ >+ <item.icon className="h-3.5 w-3.5" />+ <span>{item.title}</span>+ </Button>+ </SidebarMenuItem>+ );+ })}+ </SidebarMenu>+ </SidebarGroupContent>+ </SidebarGroup></div>- </div>+ </aside><div className="flex-1 min-w-0 overflow-y-auto"><Outlet />diff --git a/apps/web/src/routes/_layout/_authenticated/dashboard/settings/projects/$projectId/general.tsx b/apps/web/src/routes/_layout/_authenticated/dashboard/settings/projects/$projectId/general.tsxindex bcfebe753..a2a21ebf9 100644--- a/apps/web/src/routes/_layout/_authenticated/dashboard/settings/projects/$projectId/general.tsx+++ b/apps/web/src/routes/_layout/_authenticated/dashboard/settings/projects/$projectId/general.tsx@@ -55,6 +55,13 @@ type ProjectFormValues = {icon: string;};+type NormalizedProjectValues = {+ name: string;+ slug: string;+ description: string;+ icon: string;+};+const projectSchema = z.object({name: z.string()@@ -69,12 +76,27 @@ const projectSchema = z.object({icon: z.string().min(1, "Icon is required"),});+function normalizeProjectValues(+ data: ProjectFormValues,+): NormalizedProjectValues {+ return {+ name: data.name.trim(),+ slug: data.slug.trim(),+ description: (data.description ?? "").trim(),+ icon: data.icon || "Layout",+ };+}+function RouteComponent() {const queryClient = useQueryClient();const navigate = useNavigate();const debounceTimeoutRef = useRef<NodeJS.Timeout | null>(null);+ const isSavingRef = useRef(false);+ const queuedSaveRef = useRef<ProjectFormValues | null>(null);+ const lastSavedRef = useRef<NormalizedProjectValues | null>(null);const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);const [iconPopoverOpen, setIconPopoverOpen] = useState(false);+ const [iconSearch, setIconSearch] = useState("");const { data: workspace } = useActiveWorkspace();const { projectId: rawProjectId } = useParams({ strict: false });@@ -101,31 +123,63 @@ function RouteComponent() {useEffect(() => {if (!project) return;- // Reset form values when project changes without marking as dirty- projectForm.reset(- {- name: project.name || "",- slug: project.slug || "",- description: project.description || "",- icon: project.icon || "Layout",- },- { keepDirty: false, keepTouched: false, keepIsValid: true },- );++ const nextValues = {+ name: project.name || "",+ slug: project.slug || "",+ description: project.description || "",+ icon: project.icon || "Layout",+ };+ lastSavedRef.current = normalizeProjectValues(nextValues);++ if (projectForm.formState.isDirty) return;++ projectForm.reset(nextValues, {+ keepDirty: false,+ keepTouched: false,+ keepIsValid: true,+ });}, [project, projectForm]);const saveProject = useCallback(async (data: ProjectFormValues) => {if (!project?.id) return;+ const normalizedData = normalizeProjectValues(data);+ const nameChanged = lastSavedRef.current?.name !== normalizedData.name;+ const slugChanged = lastSavedRef.current?.slug !== normalizedData.slug;+ const descriptionChanged =+ lastSavedRef.current?.description !== normalizedData.description;+ const iconChanged = lastSavedRef.current?.icon !== normalizedData.icon;+ const hasChanges =+ nameChanged || slugChanged || descriptionChanged || iconChanged;++ if (!hasChanges) return;++ if (isSavingRef.current) {+ queuedSaveRef.current = data;+ return;+ }++ isSavingRef.current = true;+try {- await updateProject({+ const updatePayload = {id: project.id,- name: data.name.trim(),- slug: data.slug.trim(),- description: (data.description ?? "").trim(),- icon: data.icon || project?.icon || "Layout",+ name: nameChanged ? normalizedData.name : project.name,+ slug: slugChanged ? normalizedData.slug : project.slug,+ description: descriptionChanged+ ? normalizedData.description+ : (project.description ?? ""),+ icon: iconChanged ? normalizedData.icon : (project.icon ?? "Layout"),isPublic: !!project.isPublic,- });+ };++ await updateProject(updatePayload);++ projectForm.reset(normalizedData, { keepDirty: false });+ lastSavedRef.current = normalizedData;+ queuedSaveRef.current = null;await Promise.all([queryClient.invalidateQueries({ queryKey: ["projects"] }),@@ -141,15 +195,27 @@ function RouteComponent() {toast.error(error instanceof Error ? error.message : "Failed to update project",);+ } finally {+ isSavingRef.current = false;++ if (queuedSaveRef.current) {+ const queuedData = queuedSaveRef.current;+ queuedSaveRef.current = null;+ await saveProject(queuedData);+ }}},[project?.id,project?.isPublic,+ project?.name,+ project?.slug,+ project?.description,project?.icon,updateProject,queryClient,workspace?.id,+ projectForm,],);@@ -170,6 +236,7 @@ function RouteComponent() {useEffect(() => {const subscription = projectForm.watch(() => {+ if (!projectForm.formState.isDirty) return;debouncedSave();});@@ -234,57 +301,77 @@ function RouteComponent() {<div className="flex items-center gap-3"><Popoveropen={iconPopoverOpen}- onOpenChange={setIconPopoverOpen}+ onOpenChange={(open) => {+ setIconPopoverOpen(open);+ if (!open) setIconSearch("");+ }}modal={true}>- <PopoverTrigger asChild>- <button+ <PopoverTrigger>+ <Buttontype="button"- className="flex items-center justify-center p-2 rounded border border-border hover:bg-accent transition-colors"+ variant="outline"+ size="sm"+ className="h-8 w-auto justify-start gap-2 font-normal"title="Pick icon">{(() => {- const key =+ const selectedKey =(projectForm.watch("icon") as keyof typeof icons) ||"Layout";- const Icon = icons[key] || icons.Layout;- return (- <Icon className="w-4 h-4 text-muted-foreground" />- );+ const SelectedIcon = icons[selectedKey] || icons.Layout;+ return <SelectedIcon className="h-4 w-4" />;})()}- </button>+ <span className="truncate text-xs">+ {projectForm.watch("icon") || "Layout"}+ </span>+ </Button></PopoverTrigger>- <PopoverContent className="w-80 p-2" align="end">- <div className="max-h-[300px] overflow-y-auto">- <div className="grid grid-cols-8 gap-2">- {Object.entries(icons).map(([iconName, Icon]) => (- <button- key={iconName}- type="button"- onClick={() => {- projectForm.setValue("icon", iconName, {- shouldDirty: true,- shouldValidate: true,- });- // Save immediately on icon change- const values = projectForm.getValues();- void saveProject({- ...values,- icon: iconName,- } as ProjectFormValues);- setIconPopoverOpen(false);- }}- className={cn(- "p-2 rounded-lg transition-all duration-200 flex items-center justify-center group hover:scale-105",- projectForm.getValues("icon") === iconName- ? "bg-accent text-foreground"- : "text-muted-foreground hover:bg-accent",- )}- title={iconName}- >- <Icon className="w-4 h-4" />- </button>- ))}+ <PopoverContent className="w-80" align="end">+ <div className="space-y-2">+ <Input+ value={iconSearch}+ onChange={(e) => setIconSearch(e.target.value)}+ placeholder="Search icons..."+ className="h-8 text-xs"+ />+ <div className="max-h-[280px] overflow-y-auto pr-1">+ <div className="grid grid-cols-6 gap-1.5">+ {Object.entries(icons)+ .filter(([iconName]) =>+ iconName+ .toLowerCase()+ .includes(iconSearch.trim().toLowerCase()),+ )+ .map(([iconName, Icon]) => {+ const isSelected =+ projectForm.getValues("icon") === iconName;+ return (+ <Button+ key={iconName}+ type="button"+ variant="ghost"+ size="sm"+ onClick={() => {+ projectForm.setValue("icon", iconName, {+ shouldDirty: true,+ shouldValidate: true,+ });+ setIconPopoverOpen(false);+ setIconSearch("");+ }}+ className={cn(+ "h-10 items-center justify-center rounded-md p-0",+ isSelected &&+ "bg-sidebar-accent text-sidebar-accent-foreground",+ )}+ title={iconName}+ >+ <Icon className="h-4 w-4" />+ </Button>+ );+ })}+ </div></div></div></PopoverContent>@@ -429,13 +516,18 @@ function RouteComponent() {</AlertDialogDescription></AlertDialogHeader><AlertDialogFooter>- <AlertDialogClose>Cancel</AlertDialogClose>+ <AlertDialogClose>+ <Button variant="outline" size="sm">+ Cancel+ </Button>+ </AlertDialogClose><AlertDialogCloseonClick={handleDeleteProject}disabled={isDeleting}- className="bg-destructive text-destructive-foreground hover:bg-destructive/90">- {isDeleting ? "Deleting..." : "Delete Project"}+ <Button variant="destructive" size="sm" disabled={isDeleting}>+ {isDeleting ? "Deleting..." : "Delete Project"}+ </Button></AlertDialogClose></AlertDialogFooter></AlertDialogContent>diff --git a/apps/web/src/routes/_layout/_authenticated/dashboard/settings/workspace.tsx b/apps/web/src/routes/_layout/_authenticated/dashboard/settings/workspace.tsxindex 15e566131..c11bed1c1 100644--- a/apps/web/src/routes/_layout/_authenticated/dashboard/settings/workspace.tsx+++ b/apps/web/src/routes/_layout/_authenticated/dashboard/settings/workspace.tsx@@ -6,6 +6,14 @@ import {} from "@tanstack/react-router";import { Settings } from "lucide-react";import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";+import { Button } from "@/components/ui/button";+import {+ SidebarGroup,+ SidebarGroupContent,+ SidebarGroupLabel,+ SidebarMenu,+ SidebarMenuItem,+} from "@/components/ui/sidebar";import { useWorkspacePermission } from "@/hooks/use-workspace-permission";import { cn } from "@/lib/cn";@@ -26,54 +34,65 @@ const menuItems = [function RouteComponent() {const { workspace, role } = useWorkspacePermission();const location = useLocation();+ const isActivePath = (path: string) => location.pathname === path;+ const workspaceInitials =+ workspace?.name+ ?.split(" ")+ .filter(Boolean)+ .slice(0, 2)+ .map((part) => part[0]?.toUpperCase())+ .join("") || "WS";return (<div className="flex gap-6 h-full">- <div className="w-64 flex-shrink-0">- <div className="p-4 h-fit">- <div className="flex items-center gap-3 mb-6">- <Avatar className="h-10 w-10">+ <aside className="w-64 flex-shrink-0">+ <div className="p-2">+ <div className="mb-1 flex items-center gap-3 rounded-md px-2 py-2">+ <Avatar className="h-8 w-8"><AvatarImagesrc={workspace?.logo ?? ""}alt={workspace?.name || ""}/>- <AvatarFallback className="text-md bg-primary font-medium border border-border/30">- {workspace?.name?.charAt(0).toUpperCase()}+ <AvatarFallback className="border border-sidebar-border/70 bg-sidebar-accent/70 text-[11px] font-medium text-sidebar-accent-foreground">+ {workspaceInitials}</AvatarFallback></Avatar><div className="flex flex-col">- <p className="text-sm font-medium">{workspace?.name}</p>- <p className="text-xs text-muted-foreground capitalize">{role}</p>+ <p className="text-sm">{workspace?.name}</p>+ <p className="text-[11px] text-sidebar-foreground/60 capitalize">+ {role}+ </p></div></div>- <div className="space-y-4">- <div>- <h3 className="text-xs font-medium text-muted-foreground uppercase tracking-wider mb-2">- Workspace- </h3>- <nav className="space-y-0.5">+ <SidebarGroup className="gap-1 p-1">+ <SidebarGroupLabel className="h-7 px-2 text-[11px] uppercase tracking-wide text-sidebar-foreground/70">+ Workspace+ </SidebarGroupLabel>+ <SidebarGroupContent>+ <SidebarMenu className="gap-0.5">{menuItems.map((item) => (- <Link- key={item.title}- to={item.url}- className={cn(- "flex items-center gap-2 px-2 py-1.5 text-xs rounded-sm transition-colors",- "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",- location.pathname === item.url- ? "bg-sidebar-accent text-sidebar-accent-foreground font-medium"- : "text-muted-foreground",- )}- >- <item.icon className="h-3.5 w-3.5" />- <span>{item.title}</span>- </Link>+ <SidebarMenuItem key={item.title}>+ <Button+ render={<Link to={item.url} />}+ variant="ghost"+ size="sm"+ className={cn(+ "h-8 w-full justify-start gap-2 rounded-lg px-2 text-[11px] font-normal text-sidebar-foreground/80",+ isActivePath(item.url) &&+ "bg-sidebar-accent text-sidebar-accent-foreground",+ )}+ >+ <item.icon className="h-4 w-4" />+ <span>{item.title}</span>+ </Button>+ </SidebarMenuItem>))}- </nav>- </div>- </div>+ </SidebarMenu>+ </SidebarGroupContent>+ </SidebarGroup></div>- </div>+ </aside><div className="flex-1 min-w-0 overflow-y-auto"><Outlet />diff --git a/apps/web/src/routes/_layout/_authenticated/dashboard/settings/workspace/general.tsx b/apps/web/src/routes/_layout/_authenticated/dashboard/settings/workspace/general.tsxindex a849f5efd..ab1935a64 100644--- a/apps/web/src/routes/_layout/_authenticated/dashboard/settings/workspace/general.tsx+++ b/apps/web/src/routes/_layout/_authenticated/dashboard/settings/workspace/general.tsx@@ -41,6 +41,11 @@ type WorkspaceFormValues = {description?: string;};+type NormalizedWorkspaceValues = {+ name: string;+ description: string;+};+const workspaceSchema = z.object({name: z.string()@@ -49,46 +54,99 @@ const workspaceSchema = z.object({description: z.string().optional(),});+function normalizeWorkspaceValues(+ data: WorkspaceFormValues,+): NormalizedWorkspaceValues {+ return {+ name: data.name.trim(),+ description: (data.description ?? "").trim(),+ };+}+function RouteComponent() {const queryClient = useQueryClient();const navigate = useNavigate();const debounceTimeoutRef = useRef<NodeJS.Timeout | null>(null);+ const isSavingRef = useRef(false);+ const queuedSaveRef = useRef<WorkspaceFormValues | null>(null);+ const lastSavedRef = useRef<NormalizedWorkspaceValues | null>(null);const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);const { data: workspace } = useActiveWorkspace();const { mutateAsync: updateWorkspace } = useUpdateWorkspace();const { mutateAsync: deleteWorkspace, isPending: isDeleting } =useDeleteWorkspace();+ const workspaceDescription =+ typeof workspace?.metadata === "object" &&+ workspace?.metadata &&+ "description" in workspace.metadata+ ? String(workspace.metadata.description ?? "")+ : "";const workspaceForm = useForm<WorkspaceFormValues>({resolver: standardSchemaResolver(workspaceSchema),+ mode: "onChange",defaultValues: {name: workspace?.name || "",- description: workspace?.metadata?.description || "",+ description: workspaceDescription,},});useEffect(() => {- if (workspace) {- workspaceForm.reset({- name: workspace.name || "",- description: workspace.metadata?.description || "",- });+ if (!workspace) return;++ const nextValues = {+ name: workspace.name || "",+ description: workspaceDescription,+ };+ lastSavedRef.current = normalizeWorkspaceValues(nextValues);++ if (!workspaceForm.formState.isDirty) {+ workspaceForm.reset(nextValues);}- }, [workspace, workspaceForm]);+ }, [workspace, workspaceDescription, workspaceForm]);const saveWorkspace = useCallback(async (data: WorkspaceFormValues) => {if (!workspace?.id) return;+ const normalizedData = normalizeWorkspaceValues(data);+ const nameChanged = lastSavedRef.current?.name !== normalizedData.name;+ const descriptionChanged =+ lastSavedRef.current?.description !== normalizedData.description;+ const hasChanges = nameChanged || descriptionChanged;++ if (!hasChanges) return;++ if (isSavingRef.current) {+ queuedSaveRef.current = data;+ return;+ }++ isSavingRef.current = true;+try {- await updateWorkspace({+ const updatePayload: {+ workspaceId: string;+ name?: string;+ description?: string;+ } = {workspaceId: workspace.id,- name: data.name.trim(),- metadata: {- description: data.description?.trim() || undefined,- },- });+ };++ if (nameChanged) {+ updatePayload.name = normalizedData.name;+ }++ if (descriptionChanged) {+ updatePayload.description = normalizedData.description;+ }++ await updateWorkspace(updatePayload);++ workspaceForm.reset(normalizedData, { keepDirty: false });+ lastSavedRef.current = normalizedData;+ queuedSaveRef.current = null;await queryClient.invalidateQueries({queryKey: ["active-organization"],@@ -98,9 +156,17 @@ function RouteComponent() {toast.error(error instanceof Error ? error.message : "Failed to update workspace",);+ } finally {+ isSavingRef.current = false;++ if (queuedSaveRef.current) {+ const queuedData = queuedSaveRef.current;+ queuedSaveRef.current = null;+ await saveWorkspace(queuedData);+ }}},- [workspace?.id, updateWorkspace, queryClient],+ [workspace, updateWorkspace, queryClient, workspaceForm],);const handleDeleteWorkspace = useCallback(async () => {@@ -138,9 +204,9 @@ function RouteComponent() {);useEffect(() => {- const subscription = workspaceForm.watch((data) => {+ const subscription = workspaceForm.watch(() => {if (workspaceForm.formState.isDirty && workspaceForm.formState.isValid) {- debouncedSave(data as WorkspaceFormValues);+ debouncedSave(workspaceForm.getValues());}});@@ -279,13 +345,18 @@ function RouteComponent() {</AlertDialogDescription></AlertDialogHeader><AlertDialogFooter>- <AlertDialogClose>Cancel</AlertDialogClose>+ <AlertDialogClose>+ <Button variant="outline" size="sm">+ Cancel+ </Button>+ </AlertDialogClose><AlertDialogCloseonClick={handleDeleteWorkspace}disabled={isDeleting}- className="bg-destructive text-destructive-foreground hover:bg-destructive/90">- {isDeleting ? "Deleting..." : "Delete Workspace"}+ <Button variant="destructive" size="sm" disabled={isDeleting}>+ {isDeleting ? "Deleting..." : "Delete Workspace"}+ </Button></AlertDialogClose></AlertDialogFooter></AlertDialogContent>