mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-01 11:56:25 +02:00
refactor: clean up DocumentsFilters component by removing unused imports and buttons, and streamline type toggle functionality
This commit is contained in:
parent
5813b90e78
commit
f3e5b19a99
1 changed files with 3 additions and 24 deletions
|
|
@ -1,12 +1,10 @@
|
|||
"use client";
|
||||
|
||||
import { useSetAtom } from "jotai";
|
||||
import {
|
||||
CircleAlert,
|
||||
FileType,
|
||||
ListFilter,
|
||||
Search,
|
||||
SlidersHorizontal,
|
||||
Trash,
|
||||
Upload,
|
||||
X,
|
||||
|
|
@ -14,7 +12,6 @@ import {
|
|||
import { motion } from "motion/react";
|
||||
import { useTranslations } from "next-intl";
|
||||
import React, { useMemo, useRef, useState } from "react";
|
||||
import { connectorDialogOpenAtom } from "@/atoms/connector-dialog/connector-dialog.atoms";
|
||||
import { useDocumentUploadDialog } from "@/components/assistant-ui/document-upload-popup";
|
||||
import {
|
||||
AlertDialog,
|
||||
|
|
@ -55,9 +52,7 @@ export function DocumentsFilters({
|
|||
const id = React.useId();
|
||||
const inputRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
// Dialog hooks for action buttons
|
||||
const { openDialog: openUploadDialog } = useDocumentUploadDialog();
|
||||
const setConnectorDialogOpen = useSetAtom(connectorDialogOpenAtom);
|
||||
|
||||
const [typeSearchQuery, setTypeSearchQuery] = useState("");
|
||||
|
||||
|
|
@ -99,15 +94,6 @@ export function DocumentsFilters({
|
|||
<Upload size={16} />
|
||||
<span>Upload documents</span>
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => setConnectorDialogOpen(true)}
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="h-9 gap-2 bg-white text-gray-700 border-white hover:bg-gray-50 dark:bg-white dark:text-gray-800 dark:hover:bg-gray-100"
|
||||
>
|
||||
<SlidersHorizontal size={16} />
|
||||
<span>Manage connectors</span>
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
{/* Spacer */}
|
||||
|
|
@ -193,18 +179,11 @@ export function DocumentsFilters({
|
|||
</div>
|
||||
) : (
|
||||
filteredTypes.map((value: DocumentTypeEnum, i) => (
|
||||
<div
|
||||
<button
|
||||
type="button"
|
||||
key={value}
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
className="flex w-full items-center gap-2.5 py-2 px-3 rounded-md hover:bg-muted/50 transition-colors cursor-pointer text-left"
|
||||
onClick={() => onToggleType(value, !activeTypes.includes(value))}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter" || e.key === " ") {
|
||||
e.preventDefault();
|
||||
onToggleType(value, !activeTypes.includes(value));
|
||||
}
|
||||
}}
|
||||
>
|
||||
{/* Icon */}
|
||||
<div className="flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-muted/50 text-foreground/80">
|
||||
|
|
@ -227,7 +206,7 @@ export function DocumentsFilters({
|
|||
onCheckedChange={(checked: boolean) => onToggleType(value, !!checked)}
|
||||
className="h-4 w-4 shrink-0 rounded border-muted-foreground/30 data-[state=checked]:bg-primary data-[state=checked]:border-primary"
|
||||
/>
|
||||
</div>
|
||||
</button>
|
||||
))
|
||||
)}
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue