From b3c2f3a3fcf55671c13cd9bfb1a4d587d95d014c Mon Sep 17 00:00:00 2001 From: Pablo Lara Date: Tue, 8 Oct 2024 12:05:29 +0200 Subject: [PATCH] chore: tsx tweaks --- app/(prowler)/providers/page.tsx | 4 +- app/(prowler)/scan/page.tsx | 61 +++++++++++++++++++++++ components/filters/data-filters.ts | 11 +++- components/icons/prowler/ProwlerIcons.tsx | 2 +- components/ui/sidebar/sidebar-items.tsx | 21 +------- components/ui/sidebar/sidebar-wrap.tsx | 54 ++++++++++++++------ 6 files changed, 115 insertions(+), 38 deletions(-) create mode 100644 app/(prowler)/scan/page.tsx diff --git a/app/(prowler)/providers/page.tsx b/app/(prowler)/providers/page.tsx index 7ff10fbb5e..a2553da2ba 100644 --- a/app/(prowler)/providers/page.tsx +++ b/app/(prowler)/providers/page.tsx @@ -2,7 +2,7 @@ import { Spacer } from "@nextui-org/react"; import { Suspense } from "react"; import { getProviders } from "@/actions/providers"; -import { FilterControls, filtersProviders } from "@/components/filters"; +import { FilterControls, filterProviders } from "@/components/filters"; import { AddProvider } from "@/components/providers"; import { ColumnsProvider, @@ -24,7 +24,7 @@ export default async function Providers({
- + diff --git a/app/(prowler)/scan/page.tsx b/app/(prowler)/scan/page.tsx new file mode 100644 index 0000000000..e87b094ec5 --- /dev/null +++ b/app/(prowler)/scan/page.tsx @@ -0,0 +1,61 @@ +import { Spacer } from "@nextui-org/react"; +import { Suspense } from "react"; + +// import { getProviders } from "@/actions/providers"; +import { FilterControls, filterScans } from "@/components/filters"; +import { + // ColumnsProvider, + // DataTableProvider, + SkeletonTableProvider, +} from "@/components/providers/table"; +import { Header } from "@/components/ui"; +import { SearchParamsProps } from "@/types"; + +export default async function Scan({ + searchParams, +}: { + searchParams: SearchParamsProps; +}) { + const searchParamsKey = JSON.stringify(searchParams || {}); + + return ( + <> +
+ + + + + + }> + {/* */} + + + ); +} + +// const SSRDataTable = async ({ +// searchParams, +// }: { +// searchParams: SearchParamsProps; +// }) => { +// const page = parseInt(searchParams.page?.toString() || "1", 10); +// const sort = searchParams.sort?.toString(); + +// // Extract all filter parameters +// const filters = Object.fromEntries( +// Object.entries(searchParams).filter(([key]) => key.startsWith("filter[")), +// ); + +// // Extract query from filters +// const query = (filters["filter[search]"] as string) || ""; + +// const providersData = await getProviders({ query, page, sort, filters }); + +// return ( +// +// ); +// }; diff --git a/components/filters/data-filters.ts b/components/filters/data-filters.ts index df1e01cea0..ca01c9b509 100644 --- a/components/filters/data-filters.ts +++ b/components/filters/data-filters.ts @@ -1,4 +1,13 @@ -export const filtersProviders = [ +export const filterProviders = [ + { + key: "connected", + labelCheckboxGroup: "Connection", + values: ["false", "true"], + }, + // Add more filter categories as needed +]; + +export const filterScans = [ { key: "connected", labelCheckboxGroup: "Connection", diff --git a/components/icons/prowler/ProwlerIcons.tsx b/components/icons/prowler/ProwlerIcons.tsx index 425788e88b..ae0b989e6b 100644 --- a/components/icons/prowler/ProwlerIcons.tsx +++ b/components/icons/prowler/ProwlerIcons.tsx @@ -4,7 +4,7 @@ import { IconSvgProps } from "../../../types/index"; export const ProwlerExtended: React.FC = ({ size, - width = 164, + width = 216, height, ...props }) => { diff --git a/components/ui/sidebar/sidebar-items.tsx b/components/ui/sidebar/sidebar-items.tsx index 3888e0e82a..7aa97ace94 100644 --- a/components/ui/sidebar/sidebar-items.tsx +++ b/components/ui/sidebar/sidebar-items.tsx @@ -120,8 +120,8 @@ export const sectionItems: SidebarItem[] = [ title: "Scan", items: [ { - key: "scanners", - href: "#", + key: "scan", + href: "/scan", icon: "lucide:scan-search", title: "Scanners", }, @@ -130,23 +130,6 @@ export const sectionItems: SidebarItem[] = [ href: "/findings", title: "Findings", icon: "ph:list-checks-duotone", - items: [ - { - key: "shareholders", - href: "#", - title: "Shareholders", - }, - { - key: "note_holders", - href: "#", - title: "Note Holders", - }, - { - key: "transactions_log", - href: "#", - title: "Transactions Log", - }, - ], }, ], }, diff --git a/components/ui/sidebar/sidebar-wrap.tsx b/components/ui/sidebar/sidebar-wrap.tsx index f458929815..52434a6e1b 100644 --- a/components/ui/sidebar/sidebar-wrap.tsx +++ b/components/ui/sidebar/sidebar-wrap.tsx @@ -10,6 +10,7 @@ import React, { Suspense, useCallback } from "react"; import { useMediaQuery } from "usehooks-ts"; import { logOut } from "@/actions/auth"; +import { AddIcon } from "@/components/icons"; import { useUIStore } from "@/store"; import { @@ -17,6 +18,7 @@ import { ProwlerShort, } from "../../icons/prowler/ProwlerIcons"; import { ThemeSwitch } from "../../ThemeSwitch"; +import { CustomButton } from "../custom"; import Sidebar from "./sidebar"; import { sectionItemsWithTeams } from "./sidebar-items"; import { UserAvatar } from "./user-avatar"; @@ -50,9 +52,12 @@ export const SidebarWrap = () => { )} >
{
+ + Loading...

}> + +
+ + +
+ + } + > + Launch Scan + + +
- - - Loading...

}> - -
- - - +