diff --git a/surfsense_desktop/src/modules/active-workspace.ts b/surfsense_desktop/src/modules/active-workspace.ts index 059ff5aa4..82adb4de2 100644 --- a/surfsense_desktop/src/modules/active-workspace.ts +++ b/surfsense_desktop/src/modules/active-workspace.ts @@ -1,5 +1,4 @@ const STORE_KEY = 'activeWorkspaceId'; -// eslint-disable-next-line @typescript-eslint/no-explicit-any let store: any = null; async function getStore() { @@ -12,7 +11,6 @@ async function getStore() { // One-time migration from the legacy `active-search-space` store so the // user's last-selected workspace survives the rename. if (store.get(STORE_KEY) == null) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any const legacy: any = new Store({ name: 'active-search-space', defaults: { activeSearchSpaceId: null as string | null }, diff --git a/surfsense_web/atoms/documents/ui.atoms.ts b/surfsense_web/atoms/documents/ui.atoms.ts index 37096a3d1..a2499a8f9 100644 --- a/surfsense_web/atoms/documents/ui.atoms.ts +++ b/surfsense_web/atoms/documents/ui.atoms.ts @@ -6,8 +6,6 @@ export const globalDocumentsQueryParamsAtom = atom void; onPreview: (doc: DocumentNodeDoc) => void; - onEdit: (doc: DocumentNodeDoc) => void; onDelete: (doc: DocumentNodeDoc) => void; onMove: (doc: DocumentNodeDoc) => void; onReset?: (doc: DocumentNodeDoc) => void; @@ -69,7 +64,6 @@ interface DocumentNodeProps { canDelete?: boolean; canMove?: boolean; canMention?: boolean; - canEdit?: boolean; contextMenuOpen?: boolean; onContextMenuOpenChange?: (open: boolean) => void; } @@ -80,7 +74,6 @@ export const DocumentNode = React.memo(function DocumentNode({ isMentioned, onToggleChatMention, onPreview, - onEdit, onDelete, onMove, onReset, @@ -89,7 +82,6 @@ export const DocumentNode = React.memo(function DocumentNode({ canDelete = true, canMove = true, canMention = true, - canEdit = true, contextMenuOpen, onContextMenuOpenChange, }: DocumentNodeProps) { @@ -100,10 +92,6 @@ export const DocumentNode = React.memo(function DocumentNode({ const isMemoryDocument = doc.document_type === "USER_MEMORY" || doc.document_type === "TEAM_MEMORY"; const isSelectable = canMention && !isUnavailable; - const isEditable = - canEdit && - (isMemoryDocument || EDITABLE_DOCUMENT_TYPES.has(doc.document_type)) && - !isUnavailable; const handleCheckChange = useCallback(() => { if (isSelectable) { @@ -112,12 +100,20 @@ export const DocumentNode = React.memo(function DocumentNode({ }, [doc, isMentioned, isSelectable, onToggleChatMention]); const handlePrimaryClick = useCallback(() => { - if (canMention) { - handleCheckChange(); - return; - } + if (isUnavailable) return; onPreview(doc); - }, [canMention, doc, handleCheckChange, onPreview]); + }, [doc, isUnavailable, onPreview]); + + const handlePrimaryKeyDown = useCallback( + (event: React.KeyboardEvent) => { + if (event.currentTarget !== event.target) return; + if (event.key !== "Enter" && event.key !== " ") return; + + event.preventDefault(); + handlePrimaryClick(); + }, + [handlePrimaryClick] + ); const [{ isDragging }, drag] = useDrag( () => ({ @@ -172,6 +168,11 @@ export const DocumentNode = React.memo(function DocumentNode({ dragging={isDragging} className="gap-2.5 px-1" style={{ paddingLeft: `${depth * 16 + 4}px` }} + role="button" + tabIndex={isUnavailable ? -1 : 0} + aria-disabled={isUnavailable} + onClick={handlePrimaryClick} + onKeyDown={handlePrimaryKeyDown} > {(() => { if (statusState === "pending") { @@ -248,17 +249,11 @@ export const DocumentNode = React.memo(function DocumentNode({ onOpenChange={handleTitleTooltipOpenChange} > - + {doc.title} @@ -304,16 +299,6 @@ export const DocumentNode = React.memo(function DocumentNode({ className="w-40" onClick={(e) => e.stopPropagation()} > - onPreview(doc)} disabled={isUnavailable}> - - Open - - {isEditable && ( - onEdit(doc)}> - - Edit - - )} {canMove && ( onMove(doc)}> @@ -362,16 +347,6 @@ export const DocumentNode = React.memo(function DocumentNode({ {contextMenuOpen && ( e.stopPropagation()}> - onPreview(doc)} disabled={isUnavailable}> - - Open - - {isEditable && ( - onEdit(doc)}> - - Edit - - )} {canMove && ( onMove(doc)}> diff --git a/surfsense_web/components/documents/FolderTreeView.tsx b/surfsense_web/components/documents/FolderTreeView.tsx index 78a8afa43..27098c587 100644 --- a/surfsense_web/components/documents/FolderTreeView.tsx +++ b/surfsense_web/components/documents/FolderTreeView.tsx @@ -29,7 +29,6 @@ interface FolderTreeViewProps { onMoveFolder: (folder: FolderDisplay) => void; onCreateFolder: (parentId: number | null) => void; onPreviewDocument: (doc: DocumentNodeDoc) => void; - onEditDocument: (doc: DocumentNodeDoc) => void; onDeleteDocument: (doc: DocumentNodeDoc) => void; onMoveDocument: (doc: DocumentNodeDoc) => void; onResetDocument?: (doc: DocumentNodeDoc) => void; @@ -72,7 +71,6 @@ export function FolderTreeView({ onMoveFolder, onCreateFolder, onPreviewDocument, - onEditDocument, onDeleteDocument, onMoveDocument, onResetDocument, @@ -215,7 +213,6 @@ export function FolderTreeView({ isMentioned={!isMemoryDocument && mentionedDocKeys.has(getMentionDocKey(d))} onToggleChatMention={onToggleChatMention} onPreview={onPreviewDocument} - onEdit={onEditDocument} onDelete={onDeleteDocument} onMove={onMoveDocument} onReset={onResetDocument} @@ -224,7 +221,6 @@ export function FolderTreeView({ canDelete={!isMemoryDocument} canMove={!isMemoryDocument} canMention={!isMemoryDocument} - canEdit contextMenuOpen={openContextMenuId === `doc-${d.id}`} onContextMenuOpenChange={(open) => setOpenContextMenuId(open ? `doc-${d.id}` : null)} /> @@ -233,7 +229,6 @@ export function FolderTreeView({ [ mentionedDocKeys, onDeleteDocument, - onEditDocument, onExportDocument, onMoveDocument, onPreviewDocument, diff --git a/surfsense_web/components/layout/ui/sidebar/AllChatsSidebar.tsx b/surfsense_web/components/layout/ui/sidebar/AllChatsSidebar.tsx index 1cdabc990..c02fd31ef 100644 --- a/surfsense_web/components/layout/ui/sidebar/AllChatsSidebar.tsx +++ b/surfsense_web/components/layout/ui/sidebar/AllChatsSidebar.tsx @@ -11,7 +11,6 @@ import { RotateCcwIcon, Search, Trash2, - Users, X, } from "lucide-react"; import { useParams, useRouter } from "next/navigation"; @@ -19,6 +18,7 @@ import { useTranslations } from "next-intl"; import { useCallback, useMemo, useRef, useState } from "react"; import { toast } from "sonner"; import { removeChatTabAtom } from "@/atoms/tabs/tabs.atom"; +import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { Dialog, @@ -301,7 +301,7 @@ function AllChatsContent({ workspaceId, className }: AllChatsContentProps) { -
+
{isLoading ? (
{[75, 90, 55, 80, 65, 85].map((titleWidth) => ( @@ -319,15 +319,21 @@ function AllChatsContent({ workspaceId, className }: AllChatsContentProps) { {t("error_loading_chats") || "Error loading chats"}
) : threads.length > 0 ? ( -
- {threads.map((thread) => { +
+ {threads.map((thread, index) => { const isDeleting = deletingThreadId === thread.id; const isArchiving = archivingThreadId === thread.id; const isBusy = isDeleting || isArchiving; const isActive = currentChatId === thread.id; return ( -
+
0 && "border-t border-border/60" + )} + > {isMobile ? (
+ { + onOpenChange(false); + onUserSettings(); + } + : undefined + } + onAnnouncements={ + onAnnouncements + ? () => { + onOpenChange(false); + onAnnouncements(); + } + : undefined + } + announcementUnreadCount={announcementUnreadCount} + onLogout={onLogout} + isCollapsed + theme={theme} + setTheme={setTheme} + />
{/* Sidebar Content - right side */} @@ -209,6 +234,7 @@ export function MobileSidebar({ className="w-full border-none" isLoadingChats={isLoadingChats} disableTooltips + renderUserProfile={false} />