Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.
feat(sidebar): highlight currently selected thread
Akarshan Biswas73a4d26286c9
diff --git a/web-app/src/containers/ThreadList.tsx b/web-app/src/containers/ThreadList.tsxindex 7c501c657..90633fb4d 100644--- a/web-app/src/containers/ThreadList.tsx+++ b/web-app/src/containers/ThreadList.tsx@@ -25,7 +25,7 @@ import {} from '@/components/ui/sidebar'import { useTranslation } from '@/i18n/react-i18next-compat'import { memo, useMemo, useState } from 'react'-import { Link } from '@tanstack/react-router'+import { Link, useParams } from '@tanstack/react-router'import { RenameThreadDialog, DeleteThreadDialog } from '@/containers/dialogs'import { toast } from 'sonner'import { cn } from '@/lib/utils'@@ -145,15 +145,21 @@ const ThreadItem = memo()const isActive = isAppStateActive || isSessionStreaming+ const currentThreadId = useParams({+ strict: false,+ select: (params) => params.threadId,+ })+ const isSelected = currentThreadId === thread.id+return (<SidebarMenuItem>{currentProjectId ?- <Link to="/threads/$threadId" params={{ threadId: thread.id }} className="bg-card dark:bg-secondary/20 mb-2 px-4 py-4 border hover:dark:bg-secondary/30 rounded-lg block max-w-full overflow-hidden">+ <Link to="/threads/$threadId" params={{ threadId: thread.id }} className={cn("bg-card dark:bg-secondary/20 mb-2 px-4 py-4 border hover:dark:bg-secondary/30 rounded-lg block max-w-full overflow-hidden", isSelected && "border-primary")}><div className="flex items-center gap-1.5 min-w-0">{isActive && (<Loader2 className="size-3 shrink-0 animate-spin text-muted-foreground" />)}- <span className="block truncate" title={thread.title || t('common:newThread')}>{thread.title || t('common:newThread')}</span>+ <span className={cn("block truncate", isSelected && "font-medium text-primary")} title={thread.title || t('common:newThread')}>{thread.title || t('common:newThread')}</span></div>{currentProjectId && lastUserMessageText && (<div className="text-muted-foreground text-xs mt-1 line-clamp-1 pr-10">@@ -162,12 +168,12 @@ const ThreadItem = memo()}</Link>:- <SidebarMenuButton asChild>+ <SidebarMenuButton asChild isActive={isSelected}><Link to="/threads/$threadId" params={{ threadId: thread.id }}>{isActive && (<Loader2 className="size-3 shrink-0 animate-spin text-muted-foreground" />)}- <span className="block truncate" title={thread.title || t('common:newThread')}>{thread.title || t('common:newThread')}</span>+ <span className={cn("block truncate", isSelected && "font-medium")} title={thread.title || t('common:newThread')}>{thread.title || t('common:newThread')}</span></Link></SidebarMenuButton>}