From fe114433ffcf644257919ac6c1297de5dfb8b730 Mon Sep 17 00:00:00 2001 From: victorAnumudu Date: Sun, 15 Dec 2024 07:34:38 +0100 Subject: [PATCH] product url added --- src/component/home/HomeSections.jsx | 118 +--------------------------- src/component/home/ProductsURL.jsx | 86 ++++++++++++++++++++ src/services/queryKeys.js | 3 +- src/services/services.js | 5 ++ 4 files changed, 95 insertions(+), 117 deletions(-) create mode 100644 src/component/home/ProductsURL.jsx diff --git a/src/component/home/HomeSections.jsx b/src/component/home/HomeSections.jsx index 67f7f34..411288b 100644 --- a/src/component/home/HomeSections.jsx +++ b/src/component/home/HomeSections.jsx @@ -3,42 +3,10 @@ import BreadcrumbComBS from "../breadcrumb/BreadcrumbComBS"; import RecentActions from "./RecentActions"; import Products from "./Products"; import TopBar from "./TopBar"; -// import { useQuery } from "@tanstack/react-query"; -// import { accountDashboard } from "../../services/services"; -// import queryKeys from "../../services/queryKeys"; -// import MainLoaderBS from "../loaders/MainLoaderBS"; - +import ProductsURL from "./ProductsURL"; export default function HomeSections(){ - // const {data:dashData, isFetching, isError} = useQuery({ - // queryKey: queryKeys.dashboard, - // queryFn: async () => await accountDashboard() - // }) - - // if(isFetching){ - // return( - // <> - // {/* */} - //
- //
- //

Loading...

- //
- //
- // - // ) - // } - - // if(isError){ - // return ( - //
- //
- //

Error occured! Please refresh to continue

- //
- //
- // ) - // } - return <> {/*
@@ -75,90 +43,8 @@ export default function HomeSections(){
-
-
-
-
-

My Product URLs

-
-
- {/*Export */} -
-
-
-
- - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#DescriptionStatusAction
1Description - URL(Clickable) Active
2Main Website - https://starterweb.0ach30996.mermsemr.com Updating
3Blog Site - https://starterblog.0ach30996.mermsemr.com Refreshing
4Long Sleeve Bow TopActive
5Shine Stripe Long Sleeve RuffleActive
6Long Sleeve Micro Thermal Shirtinfo
#NamePriceIn stockStatusAction
-
-
-
-
diff --git a/src/component/home/ProductsURL.jsx b/src/component/home/ProductsURL.jsx new file mode 100644 index 0000000..baafc4e --- /dev/null +++ b/src/component/home/ProductsURL.jsx @@ -0,0 +1,86 @@ +import React from 'react' +import { productsURL } from '../../services/services' +import { useQuery } from '@tanstack/react-query' +import queryKeys from '../../services/queryKeys' + +export default function ProductsURL() { + + const {data:data, isFetching, isError, error} = useQuery({ + queryKey: queryKeys.product_url, + queryFn: () => productsURL() + }) + + const urlData = data?.data?.url_data?.url + + return ( + <> +
+
+
+
+

My Product URLs

+
+
+ {/*Export */} +
+
+
+
+ {isFetching ? + <> +
+
+

Loading...

+
+
+ + : isError ? +
+
+

{error.message}

+
+
+ : + + + + + + + + + + + + {urlData && urlData.map((item, index) => { + let statusColor = item?.status == 'Active' ? 'badge-success-inverse' : item?.status == 'Updating' ? 'badge-success-inverse' : item?.status == 'Refreshing' ? 'badge-danger-inverse' : 'badge-info-inverse' + return ( + + + + + + + + ) + })} + + + + + + + + + + + +
#DescriptionStatusAction
{Number(item?.no) + Number(index)}{item?.description} - {item?.url}{item?.status}
#NamePriceIn stockStatusAction
+ } +
+
+
+
+ + ) +} diff --git a/src/services/queryKeys.js b/src/services/queryKeys.js index e184ee4..f263e8a 100644 --- a/src/services/queryKeys.js +++ b/src/services/queryKeys.js @@ -1,7 +1,8 @@ const queryKeys = { dashboard: ['dashboard'], recentAction: ['recent-action'], - product: ['product-data'] + product: ['product-data'], + product_url: ['product_url'] } export default queryKeys \ No newline at end of file diff --git a/src/services/services.js b/src/services/services.js index aa0caea..2566d20 100644 --- a/src/services/services.js +++ b/src/services/services.js @@ -66,6 +66,11 @@ export const productData = () => { return getAuxEnd(`/panel/account/products`) } +// FUNCTION TO GET DASHBOARD PRODUCT URL DATA SECTION +export const productsURL = () => { + return getAuxEnd(`/panel/account/products/url`) +} + export const MyProductData = () => { return getAuxEnd(`/panel/myproduct/dash`) } \ No newline at end of file