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,289 +1,291 @@
|
||||||
"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 {
|
||||||
type ChunkResult,
|
type ChunkResult,
|
||||||
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";
|
||||||
if (mimetype === "text/plain") return "Text";
|
if (mimetype === "text/plain") return "Text";
|
||||||
if (mimetype === "application/msword") return "Word Document";
|
if (mimetype === "application/msword") return "Word Document";
|
||||||
return "Unknown";
|
return "Unknown";
|
||||||
};
|
};
|
||||||
|
|
||||||
function ChunksPageContent() {
|
function ChunksPageContent() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const searchParams = useSearchParams();
|
const searchParams = useSearchParams();
|
||||||
const { isMenuOpen } = useTask();
|
const { isMenuOpen } = useTask();
|
||||||
const { parsedFilterData, isPanelOpen } = useKnowledgeFilter();
|
const { parsedFilterData, isPanelOpen } = useKnowledgeFilter();
|
||||||
|
|
||||||
const filename = searchParams.get("filename");
|
const filename = searchParams.get("filename");
|
||||||
const [chunks, setChunks] = useState<ChunkResult[]>([]);
|
const [chunks, setChunks] = useState<ChunkResult[]>([]);
|
||||||
const [chunksFilteredByQuery, setChunksFilteredByQuery] = useState<
|
const [chunksFilteredByQuery, setChunksFilteredByQuery] = useState<
|
||||||
ChunkResult[]
|
ChunkResult[]
|
||||||
>([]);
|
>([]);
|
||||||
const [selectedChunks, setSelectedChunks] = useState<Set<number>>(new Set());
|
const [selectedChunks, setSelectedChunks] = useState<Set<number>>(new Set());
|
||||||
const [activeCopiedChunkIndex, setActiveCopiedChunkIndex] = useState<
|
const [activeCopiedChunkIndex, setActiveCopiedChunkIndex] = useState<
|
||||||
number | null
|
number | null
|
||||||
>(null);
|
>(null);
|
||||||
|
|
||||||
// Calculate average chunk length
|
// Calculate average chunk length
|
||||||
const averageChunkLength = useMemo(
|
const averageChunkLength = useMemo(
|
||||||
() =>
|
() =>
|
||||||
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
|
||||||
const { data = [], isFetching } = useGetSearchQuery("*", parsedFilterData);
|
const { data = [], isFetching } = useGetSearchQuery("*", parsedFilterData);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (queryInputText === "") {
|
if (queryInputText === "") {
|
||||||
setChunksFilteredByQuery(chunks);
|
setChunksFilteredByQuery(chunks);
|
||||||
} 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]);
|
||||||
|
|
||||||
const handleCopy = useCallback((text: string, index: number) => {
|
const handleCopy = useCallback((text: string, index: number) => {
|
||||||
// Trim whitespace and remove new lines/tabs for cleaner copy
|
// Trim whitespace and remove new lines/tabs for cleaner copy
|
||||||
navigator.clipboard.writeText(text.trim().replace(/[\n\r\t]/gm, ""));
|
navigator.clipboard.writeText(text.trim().replace(/[\n\r\t]/gm, ""));
|
||||||
setActiveCopiedChunkIndex(index);
|
setActiveCopiedChunkIndex(index);
|
||||||
setTimeout(() => setActiveCopiedChunkIndex(null), 10 * 1000); // 10 seconds
|
setTimeout(() => setActiveCopiedChunkIndex(null), 10 * 1000); // 10 seconds
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
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
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!filename || !(data as File[]).length) {
|
if (!filename || !(data as File[]).length) {
|
||||||
setChunks([]);
|
setChunks([]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setChunks(fileData?.chunks || []);
|
setChunks(fileData?.chunks || []);
|
||||||
}, [data, filename]);
|
}, [data, filename]);
|
||||||
|
|
||||||
// Set selected state for all checkboxes when selectAll changes
|
// Set selected state for all checkboxes when selectAll changes
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (selectAll) {
|
if (selectAll) {
|
||||||
setSelectedChunks(new Set(chunks.map((_, index) => index)));
|
setSelectedChunks(new Set(chunks.map((_, index) => index)));
|
||||||
} else {
|
} else {
|
||||||
setSelectedChunks(new Set());
|
setSelectedChunks(new Set());
|
||||||
}
|
}
|
||||||
}, [selectAll, setSelectedChunks, chunks]);
|
}, [selectAll, setSelectedChunks, chunks]);
|
||||||
|
|
||||||
const handleBack = useCallback(() => {
|
const handleBack = useCallback(() => {
|
||||||
router.push("/knowledge");
|
router.push("/knowledge");
|
||||||
}, [router]);
|
}, [router]);
|
||||||
|
|
||||||
const handleChunkCardCheckboxChange = useCallback(
|
const handleChunkCardCheckboxChange = useCallback(
|
||||||
(index: number) => {
|
(index: number) => {
|
||||||
setSelectedChunks((prevSelected) => {
|
setSelectedChunks((prevSelected) => {
|
||||||
const newSelected = new Set(prevSelected);
|
const newSelected = new Set(prevSelected);
|
||||||
if (newSelected.has(index)) {
|
if (newSelected.has(index)) {
|
||||||
newSelected.delete(index);
|
newSelected.delete(index);
|
||||||
} else {
|
} else {
|
||||||
newSelected.add(index);
|
newSelected.add(index);
|
||||||
}
|
}
|
||||||
return newSelected;
|
return newSelected;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
[setSelectedChunks]
|
[setSelectedChunks],
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!filename) {
|
if (!filename) {
|
||||||
return (
|
return (
|
||||||
<div className="flex items-center justify-center h-64">
|
<div className="flex items-center justify-center h-64">
|
||||||
<div className="text-center">
|
<div className="text-center">
|
||||||
<Search className="h-12 w-12 mx-auto mb-4 text-muted-foreground/50" />
|
<Search className="h-12 w-12 mx-auto mb-4 text-muted-foreground/50" />
|
||||||
<p className="text-lg text-muted-foreground">No file specified</p>
|
<p className="text-lg text-muted-foreground">No file specified</p>
|
||||||
<p className="text-sm text-muted-foreground/70 mt-2">
|
<p className="text-sm text-muted-foreground/70 mt-2">
|
||||||
Please select a file from the knowledge page
|
Please select a file from the knowledge page
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={`fixed inset-0 md:left-72 top-[53px] flex flex-row transition-all duration-300 ${
|
className={`fixed inset-0 md:left-72 top-[53px] flex flex-row transition-all duration-300 ${
|
||||||
isMenuOpen && isPanelOpen
|
isMenuOpen && isPanelOpen
|
||||||
? "md:right-[704px]"
|
? "md:right-[704px]"
|
||||||
: // Both open: 384px (menu) + 320px (KF panel)
|
: // Both open: 384px (menu) + 320px (KF panel)
|
||||||
isMenuOpen
|
isMenuOpen
|
||||||
? "md:right-96"
|
? "md:right-96"
|
||||||
: // Only menu open: 384px
|
: // Only menu open: 384px
|
||||||
isPanelOpen
|
isPanelOpen
|
||||||
? "md:right-80"
|
? "md:right-80"
|
||||||
: // Only KF panel open: 320px
|
: // Only KF panel open: 320px
|
||||||
"md:right-6" // Neither open: 24px
|
"md:right-6" // Neither open: 24px
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<div className="flex-1 flex flex-col min-h-0 px-6 py-6">
|
<div className="flex-1 flex flex-col min-h-0 px-6 py-6">
|
||||||
{/* Header */}
|
{/* Header */}
|
||||||
<div className="flex flex-col mb-6">
|
<div className="flex flex-col mb-6">
|
||||||
<div className="flex flex-row items-center gap-3 mb-6">
|
<div className="flex flex-row items-center gap-3 mb-6">
|
||||||
<Button variant="ghost" onClick={handleBack} size="sm">
|
<Button variant="ghost" onClick={handleBack} size="sm">
|
||||||
<ArrowLeft size={24} />
|
<ArrowLeft size={24} />
|
||||||
</Button>
|
</Button>
|
||||||
<h1 className="text-lg font-semibold">
|
<h1 className="text-lg font-semibold">
|
||||||
{/* Removes file extension from filename */}
|
{/* Removes file extension from filename */}
|
||||||
{filename.replace(/\.[^/.]+$/, "")}
|
{filename.replace(/\.[^/.]+$/, "")}
|
||||||
</h1>
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-col items-start mt-2">
|
<div className="flex flex-col items-start mt-2">
|
||||||
<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={
|
||||||
id="search-query"
|
!queryInputText.length ? <Search className="h-4 w-4" /> : null
|
||||||
type="text"
|
}
|
||||||
defaultValue={parsedFilterData?.query}
|
id="search-query"
|
||||||
value={queryInputText}
|
type="text"
|
||||||
onChange={(e) => setQueryInputText(e.target.value)}
|
defaultValue={parsedFilterData?.query}
|
||||||
placeholder="Search chunks..."
|
value={queryInputText}
|
||||||
/>
|
onChange={(e) => setQueryInputText(e.target.value)}
|
||||||
</div>
|
placeholder="Search chunks..."
|
||||||
<div className="flex items-center pl-4 gap-2">
|
/>
|
||||||
<Checkbox
|
</div>
|
||||||
id="selectAllChunks"
|
<div className="flex items-center pl-4 gap-2">
|
||||||
checked={selectAll}
|
<Checkbox
|
||||||
onCheckedChange={(handleSelectAll) =>
|
id="selectAllChunks"
|
||||||
setSelectAll(!!handleSelectAll)
|
checked={selectAll}
|
||||||
}
|
onCheckedChange={(handleSelectAll) =>
|
||||||
/>
|
setSelectAll(!!handleSelectAll)
|
||||||
<Label
|
}
|
||||||
htmlFor="selectAllChunks"
|
/>
|
||||||
className="font-medium text-muted-foreground whitespace-nowrap cursor-pointer"
|
<Label
|
||||||
>
|
htmlFor="selectAllChunks"
|
||||||
Select all
|
className="font-medium text-muted-foreground whitespace-nowrap cursor-pointer"
|
||||||
</Label>
|
>
|
||||||
</div>
|
Select all
|
||||||
</div>
|
</Label>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{/* Content Area - matches knowledge page structure */}
|
{/* Content Area - matches knowledge page structure */}
|
||||||
<div className="flex-1 overflow-scroll pr-6">
|
<div className="flex-1 overflow-scroll pr-6">
|
||||||
{isFetching ? (
|
{isFetching ? (
|
||||||
<div className="flex items-center justify-center h-64">
|
<div className="flex items-center justify-center h-64">
|
||||||
<div className="text-center">
|
<div className="text-center">
|
||||||
<Loader2 className="h-12 w-12 mx-auto mb-4 text-muted-foreground/50 animate-spin" />
|
<Loader2 className="h-12 w-12 mx-auto mb-4 text-muted-foreground/50 animate-spin" />
|
||||||
<p className="text-lg text-muted-foreground">
|
<p className="text-lg text-muted-foreground">
|
||||||
Loading chunks...
|
Loading chunks...
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
) : chunks.length === 0 ? (
|
) : chunks.length === 0 ? (
|
||||||
<div className="flex items-center justify-center h-64">
|
<div className="flex items-center justify-center h-64">
|
||||||
<div className="text-center">
|
<div className="text-center">
|
||||||
<Search className="h-12 w-12 mx-auto mb-4 text-muted-foreground/50" />
|
<Search className="h-12 w-12 mx-auto mb-4 text-muted-foreground/50" />
|
||||||
<p className="text-lg text-muted-foreground">No chunks found</p>
|
<p className="text-lg text-muted-foreground">No chunks found</p>
|
||||||
<p className="text-sm text-muted-foreground/70 mt-2">
|
<p className="text-sm text-muted-foreground/70 mt-2">
|
||||||
This file may not have been indexed yet
|
This file may not have been indexed yet
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="space-y-4 pb-6">
|
<div className="space-y-4 pb-6">
|
||||||
{chunksFilteredByQuery.map((chunk, index) => (
|
{chunksFilteredByQuery.map((chunk, index) => (
|
||||||
<div
|
<div
|
||||||
key={chunk.filename + index}
|
key={chunk.filename + index}
|
||||||
className="bg-muted rounded-lg p-4 border border-border/50"
|
className="bg-muted rounded-lg p-4 border border-border/50"
|
||||||
>
|
>
|
||||||
<div className="flex items-center justify-between mb-2">
|
<div className="flex items-center justify-between mb-2">
|
||||||
<div className="flex items-center gap-3">
|
<div className="flex items-center gap-3">
|
||||||
<div>
|
<div>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
checked={selectedChunks.has(index)}
|
checked={selectedChunks.has(index)}
|
||||||
onCheckedChange={() =>
|
onCheckedChange={() =>
|
||||||
handleChunkCardCheckboxChange(index)
|
handleChunkCardCheckboxChange(index)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<span className="text-sm font-bold">
|
<span className="text-sm font-bold">
|
||||||
Chunk {chunk.page}
|
Chunk {chunk.page}
|
||||||
</span>
|
</span>
|
||||||
<span className="bg-background p-1 rounded text-xs text-muted-foreground/70">
|
<span className="bg-background p-1 rounded text-xs text-muted-foreground/70">
|
||||||
{chunk.text.length} chars
|
{chunk.text.length} chars
|
||||||
</span>
|
</span>
|
||||||
<div className="py-1">
|
<div className="py-1">
|
||||||
<Button
|
<Button
|
||||||
onClick={() => handleCopy(chunk.text, index)}
|
onClick={() => handleCopy(chunk.text, index)}
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
size="sm"
|
size="sm"
|
||||||
>
|
>
|
||||||
{activeCopiedChunkIndex === index ? (
|
{activeCopiedChunkIndex === index ? (
|
||||||
<Check className="text-muted-foreground" />
|
<Check className="text-muted-foreground" />
|
||||||
) : (
|
) : (
|
||||||
<Copy className="text-muted-foreground" />
|
<Copy className="text-muted-foreground" />
|
||||||
)}
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* TODO: Update to use active toggle */}
|
{/* TODO: Update to use active toggle */}
|
||||||
{/* <span className="px-2 py-1 text-green-500">
|
{/* <span className="px-2 py-1 text-green-500">
|
||||||
<Switch
|
<Switch
|
||||||
className="ml-2 bg-green-500"
|
className="ml-2 bg-green-500"
|
||||||
checked={true}
|
checked={true}
|
||||||
/>
|
/>
|
||||||
Active
|
Active
|
||||||
</span> */}
|
</span> */}
|
||||||
</div>
|
</div>
|
||||||
<blockquote className="text-sm text-muted-foreground leading-relaxed border-l-2 border-input ml-1.5 pl-4">
|
<blockquote className="text-sm text-muted-foreground leading-relaxed border-l-2 border-input ml-1.5 pl-4">
|
||||||
{chunk.text}
|
{chunk.text}
|
||||||
</blockquote>
|
</blockquote>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/* Right panel - Summary (TODO), Technical details, */}
|
{/* Right panel - Summary (TODO), Technical details, */}
|
||||||
<div className="w-[320px] py-20 px-2">
|
<div className="w-[320px] py-20 px-2">
|
||||||
<div className="mb-8">
|
<div className="mb-8">
|
||||||
<h2 className="text-xl font-semibold mt-3 mb-4">Technical details</h2>
|
<h2 className="text-xl font-semibold mt-3 mb-4">Technical details</h2>
|
||||||
<dl>
|
<dl>
|
||||||
<div className="sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 mb-2.5">
|
<div className="sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 mb-2.5">
|
||||||
<dt className="text-sm/6 text-muted-foreground">Total chunks</dt>
|
<dt className="text-sm/6 text-muted-foreground">Total chunks</dt>
|
||||||
<dd className="mt-1 text-sm/6 text-gray-100 sm:col-span-2 sm:mt-0">
|
<dd className="mt-1 text-sm/6 text-gray-100 sm:col-span-2 sm:mt-0">
|
||||||
{chunks.length}
|
{chunks.length}
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<div className="sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 mb-2.5">
|
<div className="sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 mb-2.5">
|
||||||
<dt className="text-sm/6 text-muted-foreground">Avg length</dt>
|
<dt className="text-sm/6 text-muted-foreground">Avg length</dt>
|
||||||
<dd className="mt-1 text-sm/6 text-gray-100 sm:col-span-2 sm:mt-0">
|
<dd className="mt-1 text-sm/6 text-gray-100 sm:col-span-2 sm:mt-0">
|
||||||
{averageChunkLength.toFixed(0)} chars
|
{averageChunkLength.toFixed(0)} chars
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
{/* TODO: Uncomment after data is available */}
|
{/* TODO: Uncomment after data is available */}
|
||||||
{/* <div className="sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 mb-2.5">
|
{/* <div className="sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 mb-2.5">
|
||||||
<dt className="text-sm/6 text-muted-foreground">Process time</dt>
|
<dt className="text-sm/6 text-muted-foreground">Process time</dt>
|
||||||
<dd className="mt-1 text-sm/6 text-gray-100 sm:col-span-2 sm:mt-0">
|
<dd className="mt-1 text-sm/6 text-gray-100 sm:col-span-2 sm:mt-0">
|
||||||
</dd>
|
</dd>
|
||||||
|
|
@ -293,76 +295,76 @@ function ChunksPageContent() {
|
||||||
<dd className="mt-1 text-sm/6 text-gray-100 sm:col-span-2 sm:mt-0">
|
<dd className="mt-1 text-sm/6 text-gray-100 sm:col-span-2 sm:mt-0">
|
||||||
</dd>
|
</dd>
|
||||||
</div> */}
|
</div> */}
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div className="mb-8">
|
<div className="mb-8">
|
||||||
<h2 className="text-xl font-semibold mt-2 mb-3">Original document</h2>
|
<h2 className="text-xl font-semibold mt-2 mb-3">Original document</h2>
|
||||||
<dl>
|
<dl>
|
||||||
<div className="sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 mb-2.5">
|
<div className="sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 mb-2.5">
|
||||||
<dt className="text-sm/6 text-muted-foreground">Name</dt>
|
<dt className="text-sm/6 text-muted-foreground">Name</dt>
|
||||||
<dd className="mt-1 text-sm/6 text-gray-100 sm:col-span-2 sm:mt-0">
|
<dd className="mt-1 text-sm/6 text-gray-100 sm:col-span-2 sm:mt-0">
|
||||||
{fileData?.filename}
|
{fileData?.filename}
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<div className="sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 mb-2.5">
|
<div className="sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 mb-2.5">
|
||||||
<dt className="text-sm/6 text-muted-foreground">Type</dt>
|
<dt className="text-sm/6 text-muted-foreground">Type</dt>
|
||||||
<dd className="mt-1 text-sm/6 text-gray-100 sm:col-span-2 sm:mt-0">
|
<dd className="mt-1 text-sm/6 text-gray-100 sm:col-span-2 sm:mt-0">
|
||||||
{fileData ? getFileTypeLabel(fileData.mimetype) : "Unknown"}
|
{fileData ? getFileTypeLabel(fileData.mimetype) : "Unknown"}
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<div className="sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 mb-2.5">
|
<div className="sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 mb-2.5">
|
||||||
<dt className="text-sm/6 text-muted-foreground">Size</dt>
|
<dt className="text-sm/6 text-muted-foreground">Size</dt>
|
||||||
<dd className="mt-1 text-sm/6 text-gray-100 sm:col-span-2 sm:mt-0">
|
<dd className="mt-1 text-sm/6 text-gray-100 sm:col-span-2 sm:mt-0">
|
||||||
{fileData?.size
|
{fileData?.size
|
||||||
? `${Math.round(fileData.size / 1024)} KB`
|
? `${Math.round(fileData.size / 1024)} KB`
|
||||||
: "Unknown"}
|
: "Unknown"}
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<div className="sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 mb-2.5">
|
<div className="sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 mb-2.5">
|
||||||
<dt className="text-sm/6 text-muted-foreground">Uploaded</dt>
|
<dt className="text-sm/6 text-muted-foreground">Uploaded</dt>
|
||||||
<dd className="mt-1 text-sm/6 text-gray-100 sm:col-span-2 sm:mt-0">
|
<dd className="mt-1 text-sm/6 text-gray-100 sm:col-span-2 sm:mt-0">
|
||||||
N/A
|
N/A
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
{/* TODO: Uncomment after data is available */}
|
{/* TODO: Uncomment after data is available */}
|
||||||
{/* <div className="sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 mb-2.5">
|
{/* <div className="sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 mb-2.5">
|
||||||
<dt className="text-sm/6 text-muted-foreground">Source</dt>
|
<dt className="text-sm/6 text-muted-foreground">Source</dt>
|
||||||
<dd className="mt-1 text-sm/6 text-gray-100 sm:col-span-2 sm:mt-0"></dd>
|
<dd className="mt-1 text-sm/6 text-gray-100 sm:col-span-2 sm:mt-0"></dd>
|
||||||
</div> */}
|
</div> */}
|
||||||
<div className="sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 mb-2.5">
|
<div className="sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0 mb-2.5">
|
||||||
<dt className="text-sm/6 text-muted-foreground">Updated</dt>
|
<dt className="text-sm/6 text-muted-foreground">Updated</dt>
|
||||||
<dd className="mt-1 text-sm/6 text-gray-100 sm:col-span-2 sm:mt-0">
|
<dd className="mt-1 text-sm/6 text-gray-100 sm:col-span-2 sm:mt-0">
|
||||||
N/A
|
N/A
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function ChunksPage() {
|
function ChunksPage() {
|
||||||
return (
|
return (
|
||||||
<Suspense
|
<Suspense
|
||||||
fallback={
|
fallback={
|
||||||
<div className="flex items-center justify-center h-64">
|
<div className="flex items-center justify-center h-64">
|
||||||
<div className="text-center">
|
<div className="text-center">
|
||||||
<Loader2 className="h-12 w-12 mx-auto mb-4 text-muted-foreground/50 animate-spin" />
|
<Loader2 className="h-12 w-12 mx-auto mb-4 text-muted-foreground/50 animate-spin" />
|
||||||
<p className="text-lg text-muted-foreground">Loading...</p>
|
<p className="text-lg text-muted-foreground">Loading...</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<ChunksPageContent />
|
<ChunksPageContent />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function ProtectedChunksPage() {
|
export default function ProtectedChunksPage() {
|
||||||
return (
|
return (
|
||||||
<ProtectedRoute>
|
<ProtectedRoute>
|
||||||
<ChunksPage />
|
<ChunksPage />
|
||||||
</ProtectedRoute>
|
</ProtectedRoute>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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