From f7d8d64d7bafe5cdca008f6e286d2657d14b025e Mon Sep 17 00:00:00 2001 From: KarimAldeen Date: Thu, 4 Apr 2024 18:13:54 +0300 Subject: [PATCH] Done --- src/Pages/Developer/Page.tsx | 11 +++++ src/Pages/Developer/useTableColumns.tsx | 2 +- src/Pages/Home/HomePage.tsx | 62 +++++++++++++++++++++++++ src/Pages/Key/Page.tsx | 12 +++++ src/Pages/Key/useTableColumns.tsx | 2 +- src/Pages/Service/Page.tsx | 11 +++++ src/Pages/Service/useTableColumns.tsx | 2 +- src/Routes.tsx | 3 +- src/api/home.ts | 10 ++++ 9 files changed, 111 insertions(+), 4 deletions(-) create mode 100644 src/Pages/Home/HomePage.tsx create mode 100644 src/api/home.ts diff --git a/src/Pages/Developer/Page.tsx b/src/Pages/Developer/Page.tsx index f77a091..b04ab44 100644 --- a/src/Pages/Developer/Page.tsx +++ b/src/Pages/Developer/Page.tsx @@ -15,6 +15,15 @@ function Page() { const {data ,status } = useGetDeveloper() const navigate = useNavigate() + const ExpandedComponent = ({ data }:any) => { + console.log(data,"data"); + + return ( +
+

description : {data?.description}

+
+ ); + }; return ( // Pass Status to Layout @@ -32,6 +41,8 @@ function Page() { isLoading={false} columns={column} is_pagination={false} + expandableRows + expandableRowsComponent={ExpandedComponent} /> diff --git a/src/Pages/Developer/useTableColumns.tsx b/src/Pages/Developer/useTableColumns.tsx index 5c74511..6dc1291 100644 --- a/src/Pages/Developer/useTableColumns.tsx +++ b/src/Pages/Developer/useTableColumns.tsx @@ -41,7 +41,7 @@ const useTableColumns :any = () => { name: t("description"), sortable: false, center: "true", - cell: (row:any) => row?.description + cell: (row:any) =>
{row?.description}
}, { name: "#", diff --git a/src/Pages/Home/HomePage.tsx b/src/Pages/Home/HomePage.tsx new file mode 100644 index 0000000..61df56d --- /dev/null +++ b/src/Pages/Home/HomePage.tsx @@ -0,0 +1,62 @@ +import React from "react"; +import StatisticsCard from "../../Components/Ui/StaticsCard/StaticCard"; +import { FaFirstOrder, FaProductHunt, FaUser } from "react-icons/fa"; +import { useTranslation } from "react-i18next"; +import { Col, Row } from "reactstrap"; +import { useGetHome } from "../../api/home"; +import { Spin } from "antd"; + +export default function HomePage() { + const { t } = useTranslation(); + + const {data,isLoading} = useGetHome() + console.log(data); + + + const cardsData = [ + { + icon: , + count: data?.developer_count, // Example count + pathWhenClick: '/', + titleKey: "developer_count", + contentKey: "developer_in_your_Application" + }, + { + icon: , + count: data?.contact_us_count, // Example count + pathWhenClick: "/", + titleKey: "contact_us_count", + contentKey: "contact_us__Count_in_your_Application" + }, + { + icon: , + count: data?.quotation_count, // Example count + pathWhenClick: "/", + titleKey: "quotation_count", + contentKey: "quotation_count_in_your_Application" + } + ]; + + if(isLoading){ + return + } + return ( + <> + + {cardsData.map((card, index) => ( + +
+ +
+ + ))} +
+ + ); +} diff --git a/src/Pages/Key/Page.tsx b/src/Pages/Key/Page.tsx index f50aaab..3ca2de9 100644 --- a/src/Pages/Key/Page.tsx +++ b/src/Pages/Key/Page.tsx @@ -23,6 +23,16 @@ function Page() { ] + + const ExpandedComponent = ({ data }:any) => { + console.log(data,"data"); + + return ( +
+

value : {data?.value}

+
+ ); + }; return ( // Pass Status to Layout @@ -43,6 +53,8 @@ function Page() { isLoading={false} columns={column} is_pagination={false} + expandableRows + expandableRowsComponent={ExpandedComponent} /> diff --git a/src/Pages/Key/useTableColumns.tsx b/src/Pages/Key/useTableColumns.tsx index e39f999..024fd88 100644 --- a/src/Pages/Key/useTableColumns.tsx +++ b/src/Pages/Key/useTableColumns.tsx @@ -43,7 +43,7 @@ const useTableColumns :any = () => { let src = row?.value; return } else { - return row?.value; + return
{row?.value}
; } } }, diff --git a/src/Pages/Service/Page.tsx b/src/Pages/Service/Page.tsx index 5e08b8b..08318da 100644 --- a/src/Pages/Service/Page.tsx +++ b/src/Pages/Service/Page.tsx @@ -15,6 +15,15 @@ function Page() { const {data ,status } = useGetService() const navigate = useNavigate() + const ExpandedComponent = ({ data }:any) => { + console.log(data,"data"); + + return ( +
+

description : {data?.description}

+
+ ); + }; return ( // Pass Status to Layout @@ -32,6 +41,8 @@ function Page() { isLoading={false} columns={column} is_pagination={false} + expandableRows + expandableRowsComponent={ExpandedComponent} /> diff --git a/src/Pages/Service/useTableColumns.tsx b/src/Pages/Service/useTableColumns.tsx index 333b570..f9123a8 100644 --- a/src/Pages/Service/useTableColumns.tsx +++ b/src/Pages/Service/useTableColumns.tsx @@ -41,7 +41,7 @@ const useTableColumns :any = () => { name: t("description"), sortable: false, center: "true", - cell: (row:any) => row?.description + cell: (row:any) =>
{row?.description}
}, { name: "#", diff --git a/src/Routes.tsx b/src/Routes.tsx index e101e93..ff96f3c 100644 --- a/src/Routes.tsx +++ b/src/Routes.tsx @@ -48,6 +48,7 @@ import { FaServicestack } from "react-icons/fa"; import { ContactsOutlined, HomeFilled, ProjectFilled } from "@ant-design/icons"; import { MdDeveloperBoard } from "react-icons/md"; import { BsKey } from "react-icons/bs"; +import HomePage from "./Pages/Home/HomePage"; interface RoutesLinksType { @@ -66,7 +67,7 @@ export const RoutesLinks: RoutesLinksType[] = [ { name: "Home", - element:

Home Page

, + element:, icon: , href: "/", }, diff --git a/src/api/home.ts b/src/api/home.ts new file mode 100644 index 0000000..34e342f --- /dev/null +++ b/src/api/home.ts @@ -0,0 +1,10 @@ + +import useGetQueryPagination from "./helper/ueGetPagination"; + +const API = { + GET_ALL: `home`, +}; +const KEY = "home" + + +export const useGetHome = (params?:any) => useGetQueryPagination(KEY, API.GET_ALL,params);