From 5ccbd4cf8d528280e569e099ff13640bc4ae63ee Mon Sep 17 00:00:00 2001 From: felixNyalenda Date: Thu, 25 Jan 2024 11:16:09 +0300 Subject: [PATCH 01/17] add error boundary --- src/APP/index.js | 2 ++ src/APP/pages/errorPages/Error500.jsx | 21 +++++++------- src/APP/pages/errorPages/ErrorBoundary.jsx | 33 ++++++++++++++++++++++ src/main.jsx | 19 +++++++------ 4 files changed, 56 insertions(+), 19 deletions(-) create mode 100644 src/APP/pages/errorPages/ErrorBoundary.jsx diff --git a/src/APP/index.js b/src/APP/index.js index b51edd7e..1c572f69 100644 --- a/src/APP/index.js +++ b/src/APP/index.js @@ -20,6 +20,7 @@ import Error400 from "./pages/errorPages/Error400"; import Error403 from "./pages/errorPages/Error403"; import Error404 from "./pages/errorPages/Error404"; import Error500 from "./pages/errorPages/Error500"; +import ErrorBoundary from "./pages/errorPages/ErrorBoundary"; import ProductDisplay from "./pages/shop/pages/ProductDisplay"; import GalleryPage from "./pages/gallery/GalleryPage"; @@ -46,6 +47,7 @@ export { Error403, Error404, Error500, + ErrorBoundary, ProductDisplay, GalleryPage, }; diff --git a/src/APP/pages/errorPages/Error500.jsx b/src/APP/pages/errorPages/Error500.jsx index 2c879d4e..914fe875 100644 --- a/src/APP/pages/errorPages/Error500.jsx +++ b/src/APP/pages/errorPages/Error500.jsx @@ -1,5 +1,4 @@ import React from "react"; -import { Link } from "react-router-dom"; import { bgError500, error500svg } from "../../../assets/images/errorPages"; @@ -30,17 +29,17 @@ function Error500() {

We’re experiencing an internal server problem. Please try again after a few minutes or{" "} - + contact us. - +

- Go Home - + @@ -60,17 +59,17 @@ function Error500() {

We’re experiencing an internal server problem. Please try again after a few minutes or{" "} - + contact us. - +

- Go Home - + ); diff --git a/src/APP/pages/errorPages/ErrorBoundary.jsx b/src/APP/pages/errorPages/ErrorBoundary.jsx new file mode 100644 index 00000000..34e1d5bf --- /dev/null +++ b/src/APP/pages/errorPages/ErrorBoundary.jsx @@ -0,0 +1,33 @@ +import React, { useState, useEffect } from "react"; + +import Error500 from "./Error500"; + +function ErrorBoundary({ children }) { + const [hasError, setHasError] = useState(false); + + useEffect(() => { + const errorHandler = (error) => { + console.error( + "Error: ", + error.message, + "ErrorFileName: ", + error.filename + ); + setHasError(true); + }; + + window.addEventListener("error", errorHandler); + + return () => { + window.removeEventListener("error", errorHandler); + }; + }, []); + + if (hasError) { + return ; + } + + return <>{children}; +} + +export default ErrorBoundary; diff --git a/src/main.jsx b/src/main.jsx index 01e98260..50c73fc7 100644 --- a/src/main.jsx +++ b/src/main.jsx @@ -8,6 +8,7 @@ import "./index.css"; import router from "./router"; import { SearchBlogProvider } from "./context/searchBlog"; import { AuthContextProvider } from "./utils/AuthContext"; +import { ErrorBoundary } from "./APP"; const queryClient = new QueryClient({ defaultOptions: { @@ -19,13 +20,15 @@ const queryClient = new QueryClient({ ReactDOM.createRoot(document.getElementById("root")).render( - - - - - - - - + + + + + + + + + + ); From 3d81c63be6e68c19a0f20db04717ba414392d2c2 Mon Sep 17 00:00:00 2001 From: SpaceYaTech <139357796+spaceyatech-org@users.noreply.github.com> Date: Thu, 25 Jan 2024 16:53:49 +0300 Subject: [PATCH 02/17] Refetch blog (#120) * init blog formatting * format blogs page * add line-clamp to podCard title&desc * return categories * add blog search functionality * prevent blogWrapper.css styles affecting other components * add text-primary & bg in global.css * style code on blog body * wrap no result in a p tag * init pageNotFound * import 404 image * complete page not found page * import formatDistanceToNow (#100) * refactor service section * change param to title_slug * filter blogs by categories * make blog categories scrollable * span components on the landing page * add download attribute internship document * fix route * fetch related blogs on blog page * refetch on page change * add error img * add condition filtering to cat * add loader to blog page * build error500 mobile page * build error500 web page * remove img border * error 400 page build * error 400 page build * error 403 page build * reinsert 404 page * remove 403 route * removed unbuilt routes * Filter out recurring current blog on related blogs fetched. * Add error500 svg img * Dev resolve conflict (#106) * Update Dev (#96) * - * remove and refactor code * import useQuery * make navlinks active * delete NavLink component * set max-width on pages --------- Co-authored-by: felixNyalenda Co-authored-by: Jimmy Oty * Update 05-01-24 (#99) * init blog formatting * format blogs page * add line-clamp to podCard title&desc * return categories * add blog search functionality * prevent blogWrapper.css styles affecting other components * add text-primary & bg in global.css * style code on blog body * wrap no result in a p tag --------- Co-authored-by: felixNyalenda * Update 05-01-24 Beta (#101) * init blog formatting * format blogs page * add line-clamp to podCard title&desc * return categories * add blog search functionality * prevent blogWrapper.css styles affecting other components * add text-primary & bg in global.css * style code on blog body * wrap no result in a p tag * import formatDistanceToNow (#100) --------- Co-authored-by: felixNyalenda --------- Co-authored-by: SpaceYaTech <139357796+spaceyatech-org@users.noreply.github.com> Co-authored-by: Jimmy Oty * remove duplicate * create error routes * re-route to error-pages * Add related blogs header * conditionally render related blogs * conditionally render related blogs * resize subscription form on small screens * style: fixed styles on landing page * refactor: added temp API statements * refactor: added single order endpoint * rename related blogs header to related articles * gallery init * add dummy photos * reformat event dates * format date on the events page * remove console logs * add Loader * remove parse * Add blog liking functionality * add hover effect * Hotfix 0.1 broken events page (#113) * Update date attribute name * Uncomment blocked single events page * use grid to render images * add overflow to events container * add wrap on Events cities filter for mobile * add more photos * change id number * data syt photos * refactor: add gallery footer link * add fetch-blog * set p tags font sizes --------- Co-authored-by: felixNyalenda Co-authored-by: Jimmy Oty Co-authored-by: Collins Kasyoki Co-authored-by: sonylomo --- package.json | 2 + src/APP/components/Footer2.jsx | 102 +++++--- src/APP/index.js | 15 +- src/APP/pages/blog/Blog.jsx | 19 +- src/APP/pages/blog/sections/BlogWrapper.jsx | 2 +- src/APP/pages/blog/sections/RelatedBlogs.jsx | 41 +-- src/APP/pages/blog/sections/blogWrapper.css | 1 + src/APP/pages/blogs/sections/Banner.jsx | 6 +- src/APP/pages/blogs/sections/BlogStats.jsx | 41 ++- src/APP/pages/blogs/sections/BlogsWrapper.jsx | 13 +- .../SingleEvents/SingleEvent.jsx | 54 ++-- .../gallerySection/GallerySection.jsx | 40 +-- .../events/sections/eventsSection/Events.jsx | 43 +++- .../sections/eventsSection/EventsSection.jsx | 14 +- .../eventsSection/EventsUpdateSection.jsx | 43 ++-- src/APP/pages/gallery/GalleryPage.jsx | 85 +++++++ src/APP/pages/gallery/data.js | 239 ++++++++++++++++++ src/APP/pages/gallery/sections/ImageCard.jsx | 58 +++++ .../pages/gallery/sections/ImageCardss.jsx | 28 ++ src/APP/pages/shop/Homepage.jsx | 15 ++ src/APP/pages/shop/Shop.jsx | 17 -- src/APP/pages/shop/pages/Homepage.jsx | 15 -- .../pages/{Checkout.jsx => OrderSummary.jsx} | 35 +-- src/APP/pages/shop/pages/ProductDisplay.jsx | 14 + src/APP/pages/shop/pages/SingleItemPage.jsx | 144 ++++++----- src/APP/pages/shop/sections/Banner.jsx | 21 +- .../shop/sections/CategoriesProducts.jsx | 234 +++++++++-------- .../pages/shop/sections/CategoriesSection.jsx | 32 ++- .../shop/sections/PopularItemsSection.jsx | 78 +++--- src/assets/images/shop-page/shop-banner.jpg | Bin 0 -> 480165 bytes src/hooks/Queries/blog/usePostLikeBlog.jsx | 58 +++++ src/hooks/Queries/shop/useCartProducts.jsx | 25 ++ src/hooks/Queries/shop/useOrdersList.jsx | 48 ++++ src/hooks/Queries/shop/useSwagList.jsx | 25 ++ src/main.jsx | 1 - src/router/index.jsx | 77 ++++-- src/utilities/formatEventDate.jsx | 30 +++ src/utilities/processPhotos.jsx | 32 +++ 38 files changed, 1285 insertions(+), 462 deletions(-) create mode 100644 src/APP/pages/gallery/GalleryPage.jsx create mode 100644 src/APP/pages/gallery/data.js create mode 100644 src/APP/pages/gallery/sections/ImageCard.jsx create mode 100644 src/APP/pages/gallery/sections/ImageCardss.jsx create mode 100644 src/APP/pages/shop/Homepage.jsx delete mode 100644 src/APP/pages/shop/Shop.jsx delete mode 100644 src/APP/pages/shop/pages/Homepage.jsx rename src/APP/pages/shop/pages/{Checkout.jsx => OrderSummary.jsx} (94%) create mode 100644 src/APP/pages/shop/pages/ProductDisplay.jsx create mode 100644 src/assets/images/shop-page/shop-banner.jpg create mode 100644 src/hooks/Queries/blog/usePostLikeBlog.jsx create mode 100644 src/hooks/Queries/shop/useCartProducts.jsx create mode 100644 src/hooks/Queries/shop/useOrdersList.jsx create mode 100644 src/hooks/Queries/shop/useSwagList.jsx create mode 100644 src/utilities/formatEventDate.jsx create mode 100644 src/utilities/processPhotos.jsx diff --git a/package.json b/package.json index d47bdb45..d383175b 100644 --- a/package.json +++ b/package.json @@ -31,10 +31,12 @@ "react-dom": "^18.2.0", "react-fast-marquee": "^1.6.2", "react-hook-form": "^7.48.2", + "react-photo-album": "^2.3.0", "react-query": "^3.39.3", "react-router-dom": "^6.11.2", "react-simple-wysiwyg": "^2.2.5", "tailwind-scrollbar-hide": "^1.1.7", + "yet-another-react-lightbox": "^3.15.6", "yup": "^1.3.2" }, "devDependencies": { diff --git a/src/APP/components/Footer2.jsx b/src/APP/components/Footer2.jsx index e90b1452..68f75255 100644 --- a/src/APP/components/Footer2.jsx +++ b/src/APP/components/Footer2.jsx @@ -7,6 +7,8 @@ import { twitter, spotify, youtube, + instagram, + facebook, } from "../../assets/images/socials"; function Footer2() { @@ -16,8 +18,8 @@ function Footer2() { return (