UI minor tweaks
This commit is contained in:
parent
4de9a0d085
commit
1fdb251a47
3 changed files with 316 additions and 315 deletions
|
|
@ -44,7 +44,7 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
className={cn(
|
className={cn(
|
||||||
"primary-input",
|
"primary-input",
|
||||||
icon && "pl-9",
|
icon && "!pl-9",
|
||||||
type === "password" && "!pr-8",
|
type === "password" && "!pr-8",
|
||||||
icon ? inputClassName : className
|
icon ? inputClassName : className
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,13 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { ArrowLeft, Check, Copy, Loader2, Search } from "lucide-react";
|
import { ArrowLeft, Check, Copy, Loader2, Search } from "lucide-react";
|
||||||
import { Suspense, useCallback, useEffect, useMemo, useState } from "react";
|
|
||||||
import { useRouter, useSearchParams } from "next/navigation";
|
import { useRouter, useSearchParams } from "next/navigation";
|
||||||
|
import { Suspense, useCallback, useEffect, useMemo, useState } from "react";
|
||||||
import { ProtectedRoute } from "@/components/protected-route";
|
import { ProtectedRoute } from "@/components/protected-route";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
|
import { Checkbox } from "@/components/ui/checkbox";
|
||||||
|
import { Input } from "@/components/ui/input";
|
||||||
|
import { Label } from "@/components/ui/label";
|
||||||
import { useKnowledgeFilter } from "@/contexts/knowledge-filter-context";
|
import { useKnowledgeFilter } from "@/contexts/knowledge-filter-context";
|
||||||
import { useTask } from "@/contexts/task-context";
|
import { useTask } from "@/contexts/task-context";
|
||||||
import {
|
import {
|
||||||
|
|
@ -12,9 +15,6 @@ import {
|
||||||
type File,
|
type File,
|
||||||
useGetSearchQuery,
|
useGetSearchQuery,
|
||||||
} from "../../api/queries/useGetSearchQuery";
|
} from "../../api/queries/useGetSearchQuery";
|
||||||
import { Label } from "@/components/ui/label";
|
|
||||||
import { Checkbox } from "@/components/ui/checkbox";
|
|
||||||
import { Input } from "@/components/ui/input";
|
|
||||||
|
|
||||||
const getFileTypeLabel = (mimetype: string) => {
|
const getFileTypeLabel = (mimetype: string) => {
|
||||||
if (mimetype === "application/pdf") return "PDF";
|
if (mimetype === "application/pdf") return "PDF";
|
||||||
|
|
@ -44,12 +44,12 @@ function ChunksPageContent() {
|
||||||
() =>
|
() =>
|
||||||
chunks.reduce((acc, chunk) => acc + chunk.text.length, 0) /
|
chunks.reduce((acc, chunk) => acc + chunk.text.length, 0) /
|
||||||
chunks.length || 0,
|
chunks.length || 0,
|
||||||
[chunks]
|
[chunks],
|
||||||
);
|
);
|
||||||
|
|
||||||
const [selectAll, setSelectAll] = useState(false);
|
const [selectAll, setSelectAll] = useState(false);
|
||||||
const [queryInputText, setQueryInputText] = useState(
|
const [queryInputText, setQueryInputText] = useState(
|
||||||
parsedFilterData?.query ?? ""
|
parsedFilterData?.query ?? "",
|
||||||
);
|
);
|
||||||
|
|
||||||
// Use the same search query as the knowledge page, but we'll filter for the specific file
|
// Use the same search query as the knowledge page, but we'll filter for the specific file
|
||||||
|
|
@ -61,8 +61,8 @@ function ChunksPageContent() {
|
||||||
} else {
|
} else {
|
||||||
setChunksFilteredByQuery(
|
setChunksFilteredByQuery(
|
||||||
chunks.filter((chunk) =>
|
chunks.filter((chunk) =>
|
||||||
chunk.text.toLowerCase().includes(queryInputText.toLowerCase())
|
chunk.text.toLowerCase().includes(queryInputText.toLowerCase()),
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}, [queryInputText, chunks]);
|
}, [queryInputText, chunks]);
|
||||||
|
|
@ -75,7 +75,7 @@ function ChunksPageContent() {
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const fileData = (data as File[]).find(
|
const fileData = (data as File[]).find(
|
||||||
(file: File) => file.filename === filename
|
(file: File) => file.filename === filename,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Extract chunks for the specific file
|
// Extract chunks for the specific file
|
||||||
|
|
@ -113,7 +113,7 @@ function ChunksPageContent() {
|
||||||
return newSelected;
|
return newSelected;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
[setSelectedChunks]
|
[setSelectedChunks],
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!filename) {
|
if (!filename) {
|
||||||
|
|
@ -161,7 +161,9 @@ function ChunksPageContent() {
|
||||||
<div className="flex-1 flex items-center gap-2 w-full max-w-[616px] mb-8">
|
<div className="flex-1 flex items-center gap-2 w-full max-w-[616px] mb-8">
|
||||||
<Input
|
<Input
|
||||||
name="search-query"
|
name="search-query"
|
||||||
icon={!queryInputText.length ? <Search size={18} /> : null}
|
icon={
|
||||||
|
!queryInputText.length ? <Search className="h-4 w-4" /> : null
|
||||||
|
}
|
||||||
id="search-query"
|
id="search-query"
|
||||||
type="text"
|
type="text"
|
||||||
defaultValue={parsedFilterData?.query}
|
defaultValue={parsedFilterData?.query}
|
||||||
|
|
|
||||||
|
|
@ -310,14 +310,13 @@ function SearchPage() {
|
||||||
)}
|
)}
|
||||||
<Search
|
<Search
|
||||||
className="h-4 w-4 ml-1 flex-shrink-0 text-placeholder-foreground"
|
className="h-4 w-4 ml-1 flex-shrink-0 text-placeholder-foreground"
|
||||||
strokeWidth={1.5}
|
|
||||||
/>
|
/>
|
||||||
<input
|
<input
|
||||||
className="bg-transparent w-full h-full ml-2 focus:outline-none focus-visible:outline-none font-mono placeholder:font-mono"
|
className="bg-transparent w-full h-full ml-2 focus:outline-none focus-visible:outline-none font-mono placeholder:font-mono"
|
||||||
name="search-query"
|
name="search-query"
|
||||||
id="search-query"
|
id="search-query"
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Search your documents..."
|
placeholder="Enter your search query..."
|
||||||
onChange={handleTableSearch}
|
onChange={handleTableSearch}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue