+
} />
} />
} />
} />
+ } />
diff --git a/frontend/src/components/app-sidebar.tsx b/frontend/src/components/app-sidebar.tsx
index d6c1a8c..ee7436f 100644
--- a/frontend/src/components/app-sidebar.tsx
+++ b/frontend/src/components/app-sidebar.tsx
@@ -27,30 +27,30 @@ import {
// This is sample data.
const data = {
user: {
- name: "shadcn",
- email: "m@example.com",
+ name: "Andra Police",
+ email: "designed by Cyberark",
avatar: "/avatars/shadcn.jpg",
},
teams: [
{
- name: "Acme Inc",
+ name: "News Analyzer",
logo: GalleryVerticalEnd,
plan: "Enterprise",
},
{
- name: "Acme Corp.",
+ name: "News AI",
logo: AudioWaveform,
plan: "Startup",
},
- {
- name: "Evil Corp.",
- logo: Command,
- plan: "Free",
- },
+ // {
+ // name: "Evil Corp.",
+ // logo: Command,
+ // plan: "Free",
+ // },
],
navMain: [
{
- title: "Playground",
+ title: "Available Links",
url: "#",
icon: SquareTerminal,
isActive: true,
@@ -71,90 +71,94 @@ const data = {
title: "About",
url: "/about",
},
- ],
- },
- {
- title: "Models",
- url: "#",
- icon: Bot,
- items: [
- {
- title: "Genesis",
- url: "#",
- },
- {
- title: "Explorer",
- url: "#",
- },
- {
- title: "Quantum",
- url: "#",
- },
- ],
- },
- {
- title: "Documentation",
- url: "#",
- icon: BookOpen,
- items: [
- {
- title: "Introduction",
- url: "#",
- },
- {
- title: "Get Started",
- url: "#",
- },
- {
- title: "Tutorials",
- url: "#",
- },
{
- title: "Changelog",
- url: "#",
- },
- ],
- },
- {
- title: "Settings",
- url: "#",
- icon: Settings2,
- items: [
- {
- title: "General",
- url: "#",
- },
- {
- title: "Team",
- url: "#",
- },
- {
- title: "Billing",
- url: "#",
- },
- {
- title: "Limits",
- url: "#",
+ title: "Uploads",
+ url: "/upload",
},
],
},
+ // {
+ // title: "Models",
+ // url: "#",
+ // icon: Bot,
+ // items: [
+ // {
+ // title: "Genesis",
+ // url: "#",
+ // },
+ // {
+ // title: "Explorer",
+ // url: "#",
+ // },
+ // {
+ // title: "Quantum",
+ // url: "#",
+ // },
+ // ],
+ // },
+ // {
+ // title: "Documentation",
+ // url: "#",
+ // icon: BookOpen,
+ // items: [
+ // {
+ // title: "Introduction",
+ // url: "#",
+ // },
+ // {
+ // title: "Get Started",
+ // url: "#",
+ // },
+ // {
+ // title: "Tutorials",
+ // url: "#",
+ // },
+ // {
+ // title: "Changelog",
+ // url: "#",
+ // },
+ // ],
+ // },
+ // {
+ // title: "Settings",
+ // url: "#",
+ // icon: Settings2,
+ // items: [
+ // {
+ // title: "General",
+ // url: "#",
+ // },
+ // {
+ // title: "Team",
+ // url: "#",
+ // },
+ // {
+ // title: "Billing",
+ // url: "#",
+ // },
+ // {
+ // title: "Limits",
+ // url: "#",
+ // },
+ // ],
+ // },
],
projects: [
- {
- name: "Design Engineering",
- url: "#",
- icon: Frame,
- },
- {
- name: "Sales & Marketing",
- url: "#",
- icon: PieChart,
- },
- {
- name: "Travel",
- url: "#",
- icon: Map,
- },
+ // {
+ // name: "Design Engineering",
+ // url: "#",
+ // icon: Frame,
+ // },
+ // {
+ // name: "Sales & Marketing",
+ // url: "#",
+ // icon: PieChart,
+ // },
+ // {
+ // name: "Travel",
+ // url: "#",
+ // icon: Map,
+ // },
],
}
diff --git a/frontend/src/modules/search/Search.tsx b/frontend/src/modules/search/Search.tsx
index 3300f4b..9cb279e 100644
--- a/frontend/src/modules/search/Search.tsx
+++ b/frontend/src/modules/search/Search.tsx
@@ -2,14 +2,12 @@
import { Button } from "@/components/ui/button";
import { Textarea } from "@/components/ui/textarea";
import { DataTable } from "./table/data-table";
-import { columns, type GroupedCategory } from "./table/columns";
+import { columns, type Article } from "./table/columns";
import { useEffect, useRef, useState } from "react";
-import { GetArticles } from "./GetArticles";
import { Pagination, PaginationContent, PaginationItem, PaginationPrevious, PaginationLink, PaginationNext } from "@/components/ui/pagination";
import { Skeleton } from "@/components/ui/skeleton";
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
import { useReactToPrint } from "react-to-print";
-import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
function renderSkeletonTable() {
return (
@@ -41,27 +39,59 @@ function renderSkeletonTable() {
}
export default function Search() {
- const [data, setData] = useState
([]);
+ const [dataState, setDataState] = useState([]);
const [loading, setLoading] = useState(false);
const [page, setPage] = useState(1);
const [pageSize, setPageSize] = useState(10);
const [total, setTotal] = useState(0);
- const [rowSelection, setRowSelection] = useState>({});
+ const [, setRowSelection] = useState>({});
+ const API_BASE_URL = import.meta.env.VITE_API_UPLOAD_URL || "";
let componentRef = useRef(null);
const handlePrint = useReactToPrint({
contentRef: componentRef,
- documentTitle: `${'test'}-Print`,
+ documentTitle: `${new Date()}-Search Results`,
onPrintError: () => alert("there is an error when printing"),
});
- const fetchData = async (pageNum = page, size = pageSize) => {
+ const fetchFeedList = async () => {
+ const response = await fetch(`http://localhost:3001/GetFeed`);
+ // const response = await fetch(`${API_BASE_URL}/getfeed`);
+ const data = await response.json();
+ console.log(data);
+ return data as Article[];
+ }
+
+ // const { isFetching, isError, data, error } = useQuery({
+ // queryKey: ['feed'],
+ // queryFn: fetchFeedList,
+ // refetchOnWindowFocus: false,
+ // refetchOnReconnect: false,
+ // refetchOnMount: false, // or 'always'/'false' as needed
+ // staleTime: 1000 * 60 * 5, // 5 minutes, adjust as needed
+ // })
+
+
+ const fetchData = async (page: any, pageSize: any) => {
+ // setLoading(true);
+ // const result = await GetArticles({ page: pageNum, pageSize: size });
+ // setDataState(result.data);
+ // setTotal(result.total);
+ // setLoading(false);
setLoading(true);
- const result = await GetArticles({ page: pageNum, pageSize: size });
- setData(result.data);
- setTotal(result.total);
+ const data = await fetchFeedList();
+ const start = (page - 1) * pageSize;
+ const end = start + pageSize;
+ const result = data?.slice(start, end) ?? [];
+
setLoading(false);
+ setDataState(result);
+ setTotal(data?.length ?? 0);
+ return {
+ data: result,
+ total: data?.length ?? 0
+ };
};
useEffect(() => {
@@ -73,16 +103,11 @@ export default function Search() {
return (
-
-
-
-
-
+
+
+
+
+
@@ -92,12 +117,12 @@ export default function Search() {
renderSkeletonTable()
:
-
+
{/* You can use rowSelection here as needed, e.g., for debugging: */}
-
+