diff --git a/src/app/marketing/edit/[id]/page.tsx b/src/app/marketing/edit/[id]/page.tsx
new file mode 100644
index 0000000..676faae
--- /dev/null
+++ b/src/app/marketing/edit/[id]/page.tsx
@@ -0,0 +1,33 @@
+import Loading from "@/app/loading";
+import Breadcrumb from "@/components/Breadcrumbs/Breadcrumb";
+import { useGetCmsDetails } from "@/hooks/queries/useCmsQueries";
+import { BreadcrumbItem } from "@/types/shared";
+import { use } from "react";
+
+interface IProps {
+ params: Promise<{ id: string }>;
+}
+const EditMarketingPage = async ({ params }: IProps) => {
+ const { id } = use(params);
+ const { data, isPending } = useGetCmsDetails(id);
+ const breadcrumbItems: BreadcrumbItem[] = [
+ {
+ href: "/",
+ name: "Dashboard",
+ },
+ {
+ href: "/marketing",
+ name: "Marketing",
+ },
+ {
+ href: `/marketing/${id}`,
+ name: "Edit Marketing",
+ },
+ ];
+ if (isPending) return ;
+ return (
+ <>
+
+ >
+ );
+};
diff --git a/src/components/Tables/cms/index.tsx b/src/components/Tables/cms/index.tsx
index f8d64ed..956a230 100644
--- a/src/components/Tables/cms/index.tsx
+++ b/src/components/Tables/cms/index.tsx
@@ -28,7 +28,7 @@ const CmsTable = () => {
columns={columns}
emptyMessage="No Cms were found"
>
- Hollo
+ Cms list will be added
diff --git a/src/components/Tables/contact-us/index.tsx b/src/components/Tables/contact-us/index.tsx
index 1e6cd14..00f8505 100644
--- a/src/components/Tables/contact-us/index.tsx
+++ b/src/components/Tables/contact-us/index.tsx
@@ -1,16 +1,12 @@
"use client";
-import {
- Table,
- TableBody,
- TableHead,
- TableHeader,
- TableRow,
-} from "@/components/ui/table";
+import EmptyListWrapper from "@/components/HOC/EmptyListWrapper";
+import { Table, TableHead, TableHeader, TableRow } from "@/components/ui/table";
import TableSkeleton from "@/components/ui/TableSkeleton";
import { useContactUsListPresenter } from "./useContactUsListPresenter";
const ContactUsTable = () => {
- const { columns, pathname, router, isPending } = useContactUsListPresenter();
+ const { columns, pathname, router, isPending, data } =
+ useContactUsListPresenter();
return (
@@ -28,7 +24,13 @@ const ContactUsTable = () => {
{isPending && }
-
+
+ Contact us table will be initialized here
+
);
diff --git a/src/components/Tables/contact-us/useContactUsListPresenter.ts b/src/components/Tables/contact-us/useContactUsListPresenter.ts
index 5185618..afc6940 100644
--- a/src/components/Tables/contact-us/useContactUsListPresenter.ts
+++ b/src/components/Tables/contact-us/useContactUsListPresenter.ts
@@ -2,7 +2,7 @@
import { useReadAllContactUs } from "@/hooks/queries/useContactUsQuery";
import { usePathname, useRouter } from "next/navigation";
export const useContactUsListPresenter = () => {
- const columns: string[] = [];
+ const columns: string[] = ["row", "actions"];
const pathname = usePathname();
const router = useRouter();
const { data, isPending } = useReadAllContactUs();
diff --git a/src/hooks/queries/useCmsQueries.ts b/src/hooks/queries/useCmsQueries.ts
index c9fcb6c..fc26074 100644
--- a/src/hooks/queries/useCmsQueries.ts
+++ b/src/hooks/queries/useCmsQueries.ts
@@ -10,6 +10,13 @@ export const useGetCmsList = () => {
queryFn: cmsService.getCms,
});
};
+export const useGetCmsDetails = (id: string) => {
+ const queryKey = useMemo(() => [API_ENDPOINTS.CMS.BASE(id)], [id]);
+ return useQuery({
+ queryKey,
+ queryFn: () => cmsService.getCmsDetails(id),
+ });
+};
export const useCreateCms = () => {
const mutationKey = useMemo(
() => [API_ENDPOINTS.CMS.BASE(), "Create cms"],
diff --git a/src/lib/api/services/cms-service.ts b/src/lib/api/services/cms-service.ts
index 233074b..3dcfaa8 100644
--- a/src/lib/api/services/cms-service.ts
+++ b/src/lib/api/services/cms-service.ts
@@ -1,10 +1,10 @@
import api from "../axios";
import { API_ENDPOINTS } from "../endpoints";
import { ApiResponse } from "../types";
-import { TCmsResponse } from "../types/TCms";
+import { TCmsListResponse } from "../types/TCms";
export const cmsService = {
- getCms: async (): Promise> => {
+ getCms: async (): Promise> => {
try {
return (await api.get(API_ENDPOINTS.CMS.BASE())).data;
} catch (error) {
@@ -20,4 +20,12 @@ export const cmsService = {
throw error;
}
},
+ getCmsDetails: async (id: string) => {
+ try {
+ return (await api.get(API_ENDPOINTS.CMS.BASE(id))).data;
+ } catch (error) {
+ console.error("Error Caught In CMS Service => getCmsDetails: ", error);
+ throw error;
+ }
+ },
};
diff --git a/src/lib/api/types/TCms.ts b/src/lib/api/types/TCms.ts
index 3842c69..4b4c0da 100644
--- a/src/lib/api/types/TCms.ts
+++ b/src/lib/api/types/TCms.ts
@@ -1,155 +1,160 @@
import { z } from "zod";
-export const CmsCredentials = z.object({ advantages: z.object({
- cards: z.array(
- z.object({
- description: z.string(),
- icon: z.string(),
- title: z.string(),
- }),
- ),
+export const CmsCredentials = z.object({
+ advantages: z.object({
+ cards: z.array(
+ z.object({
description: z.string(),
+ icon: z.string(),
title: z.string(),
}),
- challenges: z.object({
- cards: z.array(
- z.object({
- description: z.string(),
- icon: z.string(),
- title: z.string(),
- }),
- ),
+ ),
+ description: z.string(),
+ title: z.string(),
+ }),
+ challenges: z.object({
+ cards: z.array(
+ z.object({
description: z.string(),
+ icon: z.string(),
title: z.string(),
}),
- chart: z.object({
- data: z.array(
- z.object({
- key: z.string(),
- value: z.number(),
- }),
- ),
- missedAmount: z.string(),
- title: z.string(),
+ ),
+ description: z.string(),
+ title: z.string(),
+ }),
+ chart: z.object({
+ data: z.array(
+ z.object({
+ key: z.string(),
+ value: z.number(),
}),
- contact: z.object({
+ ),
+ missedAmount: z.string(),
+ title: z.string(),
+ }),
+ contact: z.object({
+ description: z.string(),
+ fields: z.array(
+ z.object({
+ label: z.string(),
+ name: z.string(),
+ placeholder: z.string(),
+ required: z.boolean(),
+ }),
+ ),
+ submitButtonText: z.string(),
+ title: z.string(),
+ }),
+ features: z.object({
+ cards: z.array(
+ z.object({
description: z.string(),
- fields: z.array(
- z.object({
- label: z.string(),
- name: z.string(),
- placeholder: z.string(),
- required: z.boolean(),
- }),
- ),
- submitButtonText: z.string(),
+ icon: z.string(),
title: z.string(),
}),
- features: z.object({
- cards: z.array(
- z.object({
- description: z.string(),
- icon: z.string(),
- title: z.string(),
- }),
- ),
- description: z.string(),
- title: z.string(),
- }),
- footer: z.object({
- copyright: z.string(),
- email: z.string(),
- location: z.string(),
- phone: z.string(),
- tagline: z.string(),
- }),
- hero: z.object({
- buttonLink: z.string(),
- buttonText: z.string(),
- description: z.string(),
- gifFile: z.string(),
- title: z.string(),
- })})
-const CmsSchema = z.object({
- cms: z.array(
- z.object({
- advantages: z.object({
- cards: z.array(
- z.object({
- description: z.string(),
- icon: z.string(),
- title: z.string(),
- }),
- ),
- description: z.string(),
- title: z.string(),
- }),
- challenges: z.object({
- cards: z.array(
- z.object({
- description: z.string(),
- icon: z.string(),
- title: z.string(),
- }),
- ),
- description: z.string(),
- title: z.string(),
- }),
- chart: z.object({
- data: z.array(
- z.object({
- key: z.string(),
- value: z.number(),
- }),
- ),
- missedAmount: z.string(),
- title: z.string(),
- }),
- contact: z.object({
- description: z.string(),
- fields: z.array(
- z.object({
- label: z.string(),
- name: z.string(),
- placeholder: z.string(),
- required: z.boolean(),
- }),
- ),
- submitButtonText: z.string(),
- title: z.string(),
- }),
- features: z.object({
- cards: z.array(
- z.object({
- description: z.string(),
- icon: z.string(),
- title: z.string(),
- }),
- ),
- description: z.string(),
- title: z.string(),
- }),
- footer: z.object({
- copyright: z.string(),
- email: z.string(),
- location: z.string(),
- phone: z.string(),
- tagline: z.string(),
- }),
- hero: z.object({
- buttonLink: z.string(),
- buttonText: z.string(),
- description: z.string(),
- gifFile: z.string(),
- title: z.string(),
- }),
- created_at: z.number(),
- updated_at: z.number(),
- id: z.string(),
- key: z.string(),
- type: z.string(),
- }),
- ),
+ ),
+ description: z.string(),
+ title: z.string(),
+ }),
+ footer: z.object({
+ copyright: z.string(),
+ email: z.string(),
+ location: z.string(),
+ phone: z.string(),
+ tagline: z.string(),
+ }),
+ hero: z.object({
+ buttonLink: z.string(),
+ buttonText: z.string(),
+ description: z.string(),
+ gifFile: z.string(),
+ title: z.string(),
+ }),
});
-export type TCmsResponse = z.infer;
-export type TCmsCredentials = z.infer
\ No newline at end of file
+const CmsSchema = z.object({
+ advantages: z.object({
+ cards: z.array(
+ z.object({
+ description: z.string(),
+ icon: z.string(),
+ title: z.string(),
+ }),
+ ),
+ description: z.string(),
+ title: z.string(),
+ }),
+ challenges: z.object({
+ cards: z.array(
+ z.object({
+ description: z.string(),
+ icon: z.string(),
+ title: z.string(),
+ }),
+ ),
+ description: z.string(),
+ title: z.string(),
+ }),
+ chart: z.object({
+ data: z.array(
+ z.object({
+ key: z.string(),
+ value: z.number(),
+ }),
+ ),
+ missedAmount: z.string(),
+ title: z.string(),
+ }),
+ contact: z.object({
+ description: z.string(),
+ fields: z.array(
+ z.object({
+ label: z.string(),
+ name: z.string(),
+ placeholder: z.string(),
+ required: z.boolean(),
+ }),
+ ),
+ submitButtonText: z.string(),
+ title: z.string(),
+ }),
+ features: z.object({
+ cards: z.array(
+ z.object({
+ description: z.string(),
+ icon: z.string(),
+ title: z.string(),
+ }),
+ ),
+ description: z.string(),
+ title: z.string(),
+ }),
+ footer: z.object({
+ copyright: z.string(),
+ email: z.string(),
+ location: z.string(),
+ phone: z.string(),
+ tagline: z.string(),
+ }),
+ hero: z.object({
+ buttonLink: z.string(),
+ buttonText: z.string(),
+ description: z.string(),
+ gifFile: z.string(),
+ title: z.string(),
+ }),
+ created_at: z.number(),
+ updated_at: z.number(),
+ id: z.string(),
+ key: z.string(),
+ type: z.string(),
+});
+export const cmsListResponseSchema = z.object({
+ cms: z.array(CmsSchema),
+});
+export const cmsDetailsResponse = z.object({
+ cms: CmsSchema,
+});
+export type TCmsListResponse = z.infer;
+export type TCmsDetailsResponse = z.infer
+export type TCmsCredentials = z.infer;