From 3738be20db94d4a089bd8cb8e621f69404b36be9 Mon Sep 17 00:00:00 2001 From: rockyeverlast Date: Tue, 4 Jun 2024 17:19:09 +0530 Subject: [PATCH] New updates to admin panel --- package-lock.json | 95 ++++++ package.json | 1 + src/App.css | 128 ++++---- src/Components/Header.jsx | 56 +++- src/Components/TabularView/TabularView.jsx | 16 +- src/Layout/DefaultLayout.jsx | 78 +++-- src/Pages/Faq/AddFaq.jsx | 331 +++++++++++++++++++ src/Pages/Faq/EditFaq.jsx | 168 ++++++++++ src/Pages/Faq/Faq.jsx | 257 +++++++++++++++ src/Pages/Faq/ViewFaq.jsx | 96 ++++++ src/Pages/NewLetter/NewsLetter.jsx | 217 +++++++++++++ src/Pages/Partners/AddPartners.jsx | 349 ++++++++++++++++++++ src/Pages/Partners/EditPartners.jsx | 353 +++++++++++++++++++++ src/Pages/Partners/Partner.jsx | 306 ++++++++++++++++++ src/Pages/Partners/ViewPartner.jsx | 100 ++++++ src/Routes/Nav.js | 18 ++ src/Routes/Routes.js | 25 ++ src/Services/api.service.js | 118 +++++++ src/Validations/Validations.js | 95 ++++++ yarn.lock | 58 ++++ 20 files changed, 2749 insertions(+), 116 deletions(-) create mode 100644 src/Pages/Faq/AddFaq.jsx create mode 100644 src/Pages/Faq/EditFaq.jsx create mode 100644 src/Pages/Faq/Faq.jsx create mode 100644 src/Pages/Faq/ViewFaq.jsx create mode 100644 src/Pages/NewLetter/NewsLetter.jsx create mode 100644 src/Pages/Partners/AddPartners.jsx create mode 100644 src/Pages/Partners/EditPartners.jsx create mode 100644 src/Pages/Partners/Partner.jsx create mode 100644 src/Pages/Partners/ViewPartner.jsx diff --git a/package-lock.json b/package-lock.json index fe30c54..605fe4d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,6 +28,7 @@ "redux-persist": "^6.0.0", "redux-persist-transform-encrypt": "^5.1.1", "uuid": "^9.0.1", + "xlsx": "^0.18.5", "yup": "^1.4.0" }, "devDependencies": { @@ -2576,6 +2577,14 @@ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, + "node_modules/adler-32": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/adler-32/-/adler-32-1.3.1.tgz", + "integrity": "sha512-ynZ4w/nUUv5rrsR8UUGoe1VC9hZj6V5hU9Qw1HlMDJGEJw5S7TfTErWTjMys6M7vr0YWcPqs3qAr4ss0nDfP+A==", + "engines": { + "node": ">=0.8" + } + }, "node_modules/ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -2861,6 +2870,18 @@ "node": ">=6" } }, + "node_modules/cfb": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/cfb/-/cfb-1.2.2.tgz", + "integrity": "sha512-KfdUZsSOw19/ObEWasvBP/Ac4reZvAGauZhs6S/gqNhXhI7cKwvlH7ulj+dOEYnca4bm4SGo8C1bTAQvnTjgQA==", + "dependencies": { + "adler-32": "~1.3.0", + "crc-32": "~1.2.0" + }, + "engines": { + "node": ">=0.8" + } + }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -2885,6 +2906,14 @@ "node": ">=0.8" } }, + "node_modules/codepage": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/codepage/-/codepage-1.15.0.tgz", + "integrity": "sha512-3g6NUTPd/YtuuGrhMnOMRjFc+LJw/bnMp3+0r/Wcz3IXUuCosKRJvMphm5+Q+bvTVGcJJuRvVLuYba+WojaFaA==", + "engines": { + "node": ">=0.8" + } + }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -2947,6 +2976,17 @@ "node": ">=10" } }, + "node_modules/crc-32": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz", + "integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==", + "bin": { + "crc32": "bin/crc32.njs" + }, + "engines": { + "node": ">=0.8" + } + }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -3684,6 +3724,14 @@ "is-callable": "^1.1.3" } }, + "node_modules/frac": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/frac/-/frac-1.1.2.tgz", + "integrity": "sha512-w/XBfkibaTl3YDqASwfDUqkna4Z2p9cFSr1aHDt0WoMTECnRfBOv2WArlZILlqgWlmdIlALXGpM2AOhEk5W3IA==", + "engines": { + "node": ">=0.8" + } + }, "node_modules/framer-motion": { "version": "11.1.5", "resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-11.1.5.tgz", @@ -5547,6 +5595,17 @@ "node": ">=0.10.0" } }, + "node_modules/ssf": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/ssf/-/ssf-0.11.2.tgz", + "integrity": "sha512-+idbmIXoYET47hH+d7dfm2epdOMUDjqcB4648sTZ+t2JwoyBFL/insLfB/racrDmsKB3diwsDA696pZMieAC5g==", + "dependencies": { + "frac": "~1.1.2" + }, + "engines": { + "node": ">=0.8" + } + }, "node_modules/string.prototype.matchall": { "version": "4.0.11", "resolved": "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.11.tgz", @@ -6044,12 +6103,48 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/wmf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wmf/-/wmf-1.0.2.tgz", + "integrity": "sha512-/p9K7bEh0Dj6WbXg4JG0xvLQmIadrner1bi45VMJTfnbVHsc7yIajZyoSoK60/dtVBs12Fm6WkUI5/3WAVsNMw==", + "engines": { + "node": ">=0.8" + } + }, + "node_modules/word": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/word/-/word-0.3.0.tgz", + "integrity": "sha512-OELeY0Q61OXpdUfTp+oweA/vtLVg5VDOXh+3he3PNzLGG/y0oylSOC1xRVj0+l4vQ3tj/bB1HVHv1ocXkQceFA==", + "engines": { + "node": ">=0.8" + } + }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", "dev": true }, + "node_modules/xlsx": { + "version": "0.18.5", + "resolved": "https://registry.npmjs.org/xlsx/-/xlsx-0.18.5.tgz", + "integrity": "sha512-dmg3LCjBPHZnQp5/F/+nnTa+miPJxUXB6vtk42YjBBKayDNagxGEeIdWApkYPOf3Z3pm3k62Knjzp7lMeTEtFQ==", + "dependencies": { + "adler-32": "~1.3.0", + "cfb": "~1.2.1", + "codepage": "~1.15.0", + "crc-32": "~1.2.1", + "ssf": "~0.11.2", + "wmf": "~1.0.1", + "word": "~0.3.0" + }, + "bin": { + "xlsx": "bin/xlsx.njs" + }, + "engines": { + "node": ">=0.8" + } + }, "node_modules/yaml": { "version": "1.10.2", "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", diff --git a/package.json b/package.json index 6618cd0..dd82cde 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "redux-persist": "^6.0.0", "redux-persist-transform-encrypt": "^5.1.1", "uuid": "^9.0.1", + "xlsx": "^0.18.5", "yup": "^1.4.0" }, "devDependencies": { diff --git a/src/App.css b/src/App.css index 04fb12d..9cbc7e9 100644 --- a/src/App.css +++ b/src/App.css @@ -1,5 +1,5 @@ @import url("https://fonts.googleapis.com/css2?family=League+Spartan:wght@100..900&display=swap"); -@import url('https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap'); +@import url("https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap"); * { box-sizing: border-box; @@ -13,22 +13,26 @@ cursor: pointer !important; } -.activee{ +.activee { text-decoration: none; /* Remove underline */ font-weight: bold; /* Optionally change font weight for active link */ - background: linear-gradient(to right, #7A45FB, #DE41B5); /* Gradient background */ + background: linear-gradient( + to right, + #7a45fb, + #de41b5 + ); /* Gradient background */ -webkit-background-clip: text; /* Clip text to the background area */ -webkit-text-fill-color: transparent; /* Fill text with the background color */ transition: all 0.3s ease-in-out; } -.active{ +.active { /* background-color: #e2e8f086; */ background-color: #e2e8f01c; } .link { - text-decoration: none ; + text-decoration: none; transition: all 0.2s ease-in-out; font-weight: 400; } @@ -43,58 +47,59 @@ background-color: #e2e8f01c !important; } -.web-text-small{ +.web-text-small { font-size: 12px !important; } -.web-text-xxsmall{ +.web-text-xxsmall { font-size: 9px !important; } -.web-text-xsmall{ +.web-text-xsmall { font-size: 11px !important; } -.web-text-medium{ +.web-text-medium { font-size: 13px !important; } -.web-text-large{ +.web-text-large { font-size: 15px !important; } -.rubix-text-dark{ - color:#3b3e3f +.rubix-text-dark { + color: #3b3e3f; } - - -.arrow-button{ +.arrow-button { transition: all 0.5s; } - -.arrow-button:active{ +.arrow-button:active { background: #fff; } -.arrow-button:focus{ +.arrow-button:focus { background: #fff; } -.arrow-button:hover{ - background: linear-gradient(90deg, #DE41B5 0%, #7A45FB 100%); +.arrow-button:hover { + background: linear-gradient(90deg, #de41b5 0%, #7a45fb 100%); } -.greeting{ +.greeting { text-decoration: none; /* Remove underline */ font-weight: bold; /* Optionally change font weight for active link */ - background: linear-gradient(to right, #7A45FB, #DE41B5); /* Gradient background */ + background: linear-gradient( + to right, + #7a45fb, + #de41b5 + ); /* Gradient background */ -webkit-background-clip: text; /* Clip text to the background area */ -webkit-text-fill-color: transparent; /* Fill text with the background color */ transition: all 0.3s ease-in-out; } -.primary-btn{ - background-color: #38187C !important; +.primary-btn { + background-color: #38187c !important; } .team-slider .swiper-button-next:after { @@ -142,16 +147,39 @@ ); } -.text-animate{ - +.text-animate { animation-name: text; animation-duration: 5s; animation-iteration-count: 1; } +/* Total scrollbar width */ +::-webkit-scrollbar { + width: 4px; + height: 12px; +} + +/* The track (background) of the scrollbar */ +::-webkit-scrollbar-track { + background: transparent; + border-radius: 10px; +} + +/* The draggable scrollbar handle */ +::-webkit-scrollbar-thumb { + background: #de858e; + border-radius: 10px; + cursor: grabbing; +} + +/* On hover */ +::-webkit-scrollbar-thumb:hover { + background: #e97d88; +} + @keyframes text { 0% { - color: #0B0B27; + color: #0b0b27; /* margin-bottom: -40px; */ } 30% { @@ -167,23 +195,19 @@ } } - -.rotate{ - +.rotate { animation: animName 10s linear infinite; } @keyframes animName { - 0%{ - transform: rotate(0deg); - } - 100%{ - transform: rotate(360deg); - } - } - + 0% { + transform: rotate(0deg); + } + 100% { + transform: rotate(360deg); + } +} - .lds-ellipsis { display: inline-block; position: relative; @@ -239,37 +263,11 @@ } } - - - - - - - - - - - - - - - - - - - - - - - - /* Extra small devices (phones, 600px and down) */ @media only screen and (max-width: 600px) { body { font-size: 14px !important; } - - } /* Small devices (portrait tablets and large phones, 600px and up) */ diff --git a/src/Components/Header.jsx b/src/Components/Header.jsx index 44fa9a1..1f7e795 100644 --- a/src/Components/Header.jsx +++ b/src/Components/Header.jsx @@ -2,11 +2,30 @@ import { AddIcon } from "@chakra-ui/icons"; import { Box, Button, Text } from "@chakra-ui/react"; import React from "react"; import { Link } from "react-router-dom"; +import { IoMdDownload } from "react-icons/io"; +import * as XLSX from "xlsx"; +import { useGetNewsLetterEmailQuery } from "../Services/api.service"; const Header = ({ link, btnTitle, title }) => { + const { data, error, isLoading } = useGetNewsLetterEmailQuery(); + console.log(data); + + const handleDownload = () => { + if (Array.isArray(data?.data?.rows)) { + const worksheet = XLSX.utils.json_to_sheet(data?.data?.rows); + const workbook = XLSX.utils.book_new(); + XLSX.utils.book_append_sheet(workbook, worksheet, "Sheet1"); + XLSX.writeFile(workbook, "newsletter_emails.xlsx"); + } else { + console.error( + "Expected data to be an array but received:", + data?.data?.rows + ); + } + }; return ( { > {/* Community */} - + {title} - - {/* {title} */} - {btnTitle && link && ( - + {btnTitle && + link && + (link === "" ? ( + + + + ) : ( - - )} + ))} ); }; diff --git a/src/Components/TabularView/TabularView.jsx b/src/Components/TabularView/TabularView.jsx index 548a9c3..00541ee 100644 --- a/src/Components/TabularView/TabularView.jsx +++ b/src/Components/TabularView/TabularView.jsx @@ -23,12 +23,12 @@ const TabularView = ({ pageSize, setPageSize, totalPages, - noDataTitle + noDataTitle, }) => { - const [displayRange, setDisplayRange] = useState({ - start: TABLE_PAGINATION?.page, - end: pageSize, - }); + const [displayRange, setDisplayRange] = useState({ + start: TABLE_PAGINATION?.page, + end: pageSize, + }); // ====================================================[Pagination Setup]================================================================ const paginationPrev = () => { if (currentPage > 1) { @@ -37,7 +37,6 @@ const TabularView = ({ } }; - const paginationNext = () => { const totalPage = Math.ceil(totalPages / pageSize); if (currentPage < totalPage) { @@ -51,8 +50,6 @@ const TabularView = ({ setDisplayRange({ start, end }); }; - - return ( - {displayRange.start} - {displayRange.end} of{" "} - {totalPages} + {displayRange.start} - {displayRange.end} of {totalPages} { const [openDrawerClick, setOpenDrawerClick] = useState(true); const { setIsAuthenticate } = useContext(GlobalStateContext); - const openDrawerOnClick = () => { setOpenDrawerClick(!openDrawerClick); }; @@ -81,12 +80,14 @@ const DashboardLayout = () => { case "/community/view/": return "Community"; case "/community/add-comunity": - return - - - - Community - ; + return ( + + + + + Community + + ); default: if (path.startsWith("/community/view/")) { return ( @@ -124,7 +125,7 @@ const DashboardLayout = () => { className="d-flex" >