diff --git a/frontend/src/assets/caret-sort.svg b/frontend/src/assets/caret-sort.svg new file mode 100644 index 000000000..9380120df --- /dev/null +++ b/frontend/src/assets/caret-sort.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/src/index.css b/frontend/src/index.css index 5bcc76832..1eca983c6 100644 --- a/frontend/src/index.css +++ b/frontend/src/index.css @@ -53,22 +53,24 @@ body.dark { } .table-default th { - @apply border-r border-silver dark:border-silver/40 p-4 w-[244px]; + @apply p-4 w-[244px] font-normal text-gray-400; /* Remove border-r */ } .table-default th:last-child { - @apply w-[auto] border-r-0; + @apply w-[auto]; } .table-default td { - @apply border-r border-t border-silver dark:border-silver/40 px-4 py-2; + @apply border-t border-silver dark:border-silver/40 px-4 py-2; /* Remove border-r */ } .table-default td:last-child { - @apply border-r-0; + @apply border-r-0; /* Ensure no right border on the last column */ } + } + /*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */ /* Document diff --git a/frontend/src/settings/Documents.tsx b/frontend/src/settings/Documents.tsx index 867fc9de9..004b6f487 100644 --- a/frontend/src/settings/Documents.tsx +++ b/frontend/src/settings/Documents.tsx @@ -6,11 +6,14 @@ import { useDispatch } from 'react-redux'; import userService from '../api/services/userService'; import SyncIcon from '../assets/sync.svg'; import Trash from '../assets/trash.svg'; +import caretSort from '../assets/caret-sort.svg'; import DropdownMenu from '../components/DropdownMenu'; +import { Doc, DocumentsProps, ActiveState } from '../models/misc'; // Ensure ActiveState type is imported import SkeletonLoader from '../components/SkeletonLoader'; -import { Doc, DocumentsProps } from '../models/misc'; import { getDocs } from '../preferences/preferenceApi'; import { setSourceDocs } from '../preferences/preferenceSlice'; +import Input from '../components/Input'; +import Upload from '../upload/Upload'; // Import the Upload component // Utility function to format numbers const formatTokens = (tokens: number): string => { @@ -35,7 +38,14 @@ const Documents: React.FC = ({ }) => { const { t } = useTranslation(); const dispatch = useDispatch(); + + // State for search input + const [searchTerm, setSearchTerm] = useState(''); + // State for modal: active/inactive + const [modalState, setModalState] = useState('INACTIVE'); // Initialize with inactive state + const [isOnboarding, setIsOnboarding] = useState(false); // State for onboarding flag const [loading, setLoading] = useState(false); + const syncOptions = [ { label: 'Never', value: 'never' }, { label: 'Daily', value: 'daily' }, @@ -59,10 +69,37 @@ const Documents: React.FC = ({ }); }; + // Filter documents based on the search term + const filteredDocuments = documents?.filter((document) => + document.name.toLowerCase().includes(searchTerm.toLowerCase()), + ); + return (
+
+
+ setSearchTerm(e.target.value)} // Handle search input change + /> +
+ +
{loading ? ( ) : ( @@ -70,22 +107,37 @@ const Documents: React.FC = ({ {t('settings.documents.name')} - {t('settings.documents.date')} - {t('settings.documents.tokenUsage')} - {t('settings.documents.type')} + +
+ {t('settings.documents.date')} + +
+ + +
+ {t('settings.documents.tokenUsage')} + +
+ + +
+ {t('settings.documents.type')} + +
+ - {!documents?.length && ( + {!filteredDocuments?.length && ( {t('settings.documents.noData')} )} - {documents && - documents.map((document, index) => ( + {filteredDocuments && + filteredDocuments.map((document, index) => ( {document.name} {document.date} @@ -101,7 +153,7 @@ const Documents: React.FC = ({ Delete { event.stopPropagation(); @@ -130,6 +182,19 @@ const Documents: React.FC = ({ )}
+ {/* Conditionally render the Upload modal based on modalState */} + {modalState === 'ACTIVE' && ( +
+
+ {/* Your Upload component */} + +
+
+ )}
);