diff --git a/src/Redux/slice/blogsSlice.js b/src/Redux/slice/blogsSlice.js new file mode 100644 index 0000000..407adc9 --- /dev/null +++ b/src/Redux/slice/blogsSlice.js @@ -0,0 +1,14 @@ +// apiSlice.js +import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'; + +export const blogApi = createApi({ + reducerPath: 'blog', + baseQuery: fetchBaseQuery({ baseUrl: 'https://rubix.betadelivery.com/api/' }), + endpoints: (builder) => ({ + getBlog: builder.query({ + query: () => 'blog/active', + }), + }), +}); + +export const { useGetBlogQuery } = blogApi; \ No newline at end of file diff --git a/src/Redux/slice/communityBannerSlice.js b/src/Redux/slice/communityBannerSlice.js new file mode 100644 index 0000000..b35e922 --- /dev/null +++ b/src/Redux/slice/communityBannerSlice.js @@ -0,0 +1,14 @@ +// apiSlice.js +import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'; + +export const communitiesBanner = createApi({ + reducerPath: 'communitiesBanner', + baseQuery: fetchBaseQuery({ baseUrl: 'https://rubix.betadelivery.com/api/' }), + endpoints: (builder) => ({ + getCommunitiesBanner: builder.query({ + query: () => 'admin/main-community', + }), + }), +}); + +export const { useGetCommunitiesBannerQuery } = communitiesBanner; \ No newline at end of file diff --git a/src/Redux/slice/communitySlice.js b/src/Redux/slice/communitySlice.js index 3c85420..e8a22f2 100644 --- a/src/Redux/slice/communitySlice.js +++ b/src/Redux/slice/communitySlice.js @@ -3,10 +3,10 @@ import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'; export const api = createApi({ reducerPath: 'communities', - baseQuery: fetchBaseQuery({ baseUrl: 'https://rubix.betadelivery.com/api/admin/' }), + baseQuery: fetchBaseQuery({ baseUrl: 'https://rubix.betadelivery.com/api/' }), endpoints: (builder) => ({ getCommunities: builder.query({ - query: () => 'community', + query: () => 'community/active', }), }), }); diff --git a/src/Redux/slice/newsSlice.js b/src/Redux/slice/newsSlice.js new file mode 100644 index 0000000..b813cd7 --- /dev/null +++ b/src/Redux/slice/newsSlice.js @@ -0,0 +1,13 @@ +import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'; + +export const newsApi = createApi({ + reducerPath: 'news', + baseQuery: fetchBaseQuery({ baseUrl: 'https://rubix.betadelivery.com/api/' }), + endpoints: (builder) => ({ + getNews: builder.query({ + query: () => 'admin/news', + }), + }), +}); + +export const { useGetNewsQuery } = newsApi; \ No newline at end of file diff --git a/src/Redux/store/store.js b/src/Redux/store/store.js index 3a9dfa1..1ca517c 100644 --- a/src/Redux/store/store.js +++ b/src/Redux/store/store.js @@ -1,12 +1,23 @@ import { configureStore } from '@reduxjs/toolkit'; import { api } from '../slice/communitySlice'; +import { blogApi } from '../slice/blogsSlice'; +import { communitiesBanner } from '../slice/communityBannerSlice'; +import { newsApi } from '../slice/newsSlice'; const store = configureStore({ reducer: { [api.reducerPath]: api.reducer, + [blogApi.reducerPath]: blogApi.reducer, + [communitiesBanner.reducerPath]: communitiesBanner.reducer, + [newsApi.reducerPath]: newsApi.reducer, }, middleware: (getDefaultMiddleware) => - getDefaultMiddleware().concat(api.middleware), + getDefaultMiddleware().concat( + api.middleware, + blogApi.middleware, + communitiesBanner.middleware, + newsApi.middleware + ), // Add blogApi.middleware here }); export default store; diff --git a/src/components/BlogPost/BlogPost.jsx b/src/components/BlogPost/BlogPost.jsx new file mode 100644 index 0000000..5a10785 --- /dev/null +++ b/src/components/BlogPost/BlogPost.jsx @@ -0,0 +1,296 @@ +/* eslint-disable react/jsx-key */ +/* eslint-disable no-unused-vars */ +import React, { useEffect } from "react"; +import { Box, Text, Image } from "@chakra-ui/react"; +import { Avatar, AvatarBadge, AvatarGroup } from "@chakra-ui/react"; +import Chip from "../Chip/Chip"; +import Footer from "../Footer/Footer"; +import { ChevronRightIcon } from "@chakra-ui/icons"; +import profile from "../../assets/images/profile.png"; +import x from "../../assets/images/x.png"; +import linked from "../../assets/images/linked.png"; +import github from "../../assets/images/github.png"; +import tele from "../../assets/images/tele.png"; +import reddit from "../../assets/images/reddit.png"; +import fb from "../../assets/images/fb.png"; +import { useGetBlogQuery } from "../../Redux/slice/blogsSlice"; +import { Link, useParams } from "react-router-dom"; +import NotFound from "../../pages/NotFound"; + +const BlogPost = () => { + const { title_slug } = useParams(); + const { data, error, isLoading } = useGetBlogQuery(); + const blogPosts = data?.data; + console.log(blogPosts); + + useEffect(() => { + window.scrollTo(0, 0); + }, []); + + if (isLoading) { + return
Loading...
; + } + + const matchingBlogPost = blogPosts + ? blogPosts.find((item) => item.title_slug === title_slug) + : null; + + console.log(matchingBlogPost); + + return ( + <> + {matchingBlogPost ? ( + + + + {matchingBlogPost.title} + + + + {matchingBlogPost.category.blog_category} + {(function () { + const createdAtDate = new Date(matchingBlogPost.createdAt); + const formattedDate = createdAtDate.toLocaleDateString( + "en-GB", + { + day: "2-digit", + month: "2-digit", + year: "2-digit", + } + ); + return ( + + {formattedDate} + + ); + })()} + + + + + + + {matchingBlogPost.author_name} + {matchingBlogPost.author_designation} + + + + {/* ========[ Banner ]======= */} + + + + + + + + Share + + + + + + + + + + + + + + + + + + + + {matchingBlogPost.tags.map((tag, index) => ( + + ))} + + + + + {/* {matchingBlogPost.content} + */} + + + + + ) : ( + + )} + + ); +}; + +export default BlogPost; diff --git a/src/components/Card/CommCard.jsx b/src/components/Card/CommCard.jsx index aa2d615..81f7415 100644 --- a/src/components/Card/CommCard.jsx +++ b/src/components/Card/CommCard.jsx @@ -14,7 +14,8 @@ import linkedin from "../../assets/images/linkedin.png"; import games from "../../assets/images/discot.png"; import { Link } from "react-router-dom"; -const CommCard = ({ id, imageUrl, name, jobTitle, description, link }) => { +const CommCard = ({ id, img, name, designation, description, link }) => { + console.log(img); const imgHeight = { minWidth: `214px`, height: "240px", @@ -46,7 +47,7 @@ const CommCard = ({ id, imageUrl, name, jobTitle, description, link }) => { }, }} > - + { {name} - {jobTitle} + {designation} {description} diff --git a/src/components/Card/HomeCard.jsx b/src/components/Card/HomeCard.jsx index 275edf3..48600d8 100644 --- a/src/components/Card/HomeCard.jsx +++ b/src/components/Card/HomeCard.jsx @@ -1,101 +1,142 @@ +/* eslint-disable react/jsx-key */ /* eslint-disable react/prop-types */ /* eslint-disable no-unused-vars */ import { Box, Container, Text, Image, Button } from "@chakra-ui/react"; import cardimg from "../../assets/images/CardImg.png"; import { Badge } from "@chakra-ui/react"; -import { Link } from "react-router-dom"; +import { Link, useParams } from "react-router-dom"; +import { useGetBlogQuery } from "../../Redux/slice/blogsSlice"; -const HomeCard = ({ key, date, text, link }) => { - return ( - - - - - - INSIGHT - +const HomeCard = ({ cardkey, date, text, link }) => { + const { title_slug } = useParams(); + const { data } = useGetBlogQuery(); + const blogCards = data?.data; - - {date} - - - {text} - + const matchingBlogPost = blogCards + ? blogCards.find((item) => item.title_slug === title_slug) + : null; + + return ( + <> + {blogCards?.map((card) => ( + - - - - + {card.meta_description} + + + + + + + + - - + ))} + ); }; diff --git a/src/components/Community/CommunityBanner.jsx b/src/components/Community/CommunityBanner.jsx index 58afc9b..631b7b0 100644 --- a/src/components/Community/CommunityBanner.jsx +++ b/src/components/Community/CommunityBanner.jsx @@ -1,7 +1,9 @@ +/* eslint-disable no-unused-vars */ /* eslint-disable react/prop-types */ /* eslint-disable react/no-unknown-property */ import { Box, Button, Container, Text } from "@chakra-ui/react"; import banner from "../../assets/images/communityBanner.webp"; +import { useGetCommunitiesBannerQuery } from "../../Redux/slice/communityBannerSlice"; const BannerContent = [ { @@ -19,10 +21,20 @@ const BannerContent = [ ]; const CommunityBanner = ({ onClick }) => { + const { data } = useGetCommunitiesBannerQuery(); + const content = data?.data.rows; + // const loop = () => { + // blogPosts.map((item) => { + // console.log(item); + // }); + // }; + // loop(); + console.log(content); + return ( { }} > { color: "#fff", }} > - {BannerContent[0].heading1} + {content?.[1]?.Heading}
{ }, }} /> - {BannerContent[0].heading2} + {/* {BannerContent[0].heading2} */} { }, }} > - {BannerContent[1].subheading} + {content?.[1]?.sub_heading}
diff --git a/src/components/Community/CommunityCard.jsx b/src/components/Community/CommunityCard.jsx index 5d40101..9c51adc 100644 --- a/src/components/Community/CommunityCard.jsx +++ b/src/components/Community/CommunityCard.jsx @@ -11,7 +11,7 @@ import { SimpleGrid, Text, } from "@chakra-ui/react"; -import React from "react"; +import React, { useState } from "react"; import CommCard from "../Card/CommCard"; import imgOne from "../../assets/images/Component115.png"; import imgtwo from "../../assets/images/Component116.png"; @@ -28,6 +28,7 @@ import imgtweleve from "../../assets/images/kiran.jpg"; import { useEffect } from "react"; import axios from "axios"; import { useGetCommunitiesQuery } from "../../Redux/slice/communitySlice"; +import Loader from "../Loader/Loader"; const individuals = [ { @@ -129,78 +130,81 @@ const individuals = [ ]; const CommunityCard = () => { - // const { data, error, isLoading } = useGetCommunitiesQuery(); - - useEffect(() => { - // async function fetchData() { - // try { - // const response = await axios.get( - // "https://rubix.betadelivery.com/api/admin/community" - // ); - // console.log(response.data.data.rows); - // } catch (error) { - // // Handle errors - // console.error("Error fetching data:", error.message); - // } - // } - // // Call the fetchData function to initiate the request - // fetchData(); - }, []); + const { data, error, isLoading } = useGetCommunitiesQuery(); + const [state, setState] = useState(); + const profile = data?.data?.data; + console.log(data?.data?.data); + useEffect(() => {}, []); return ( <> - - - + ) : ( + + - Rubix Community - - - {individuals.map((item) => ( - - ))} - - - + + Rubix Community + + + {/* {individuals.map((item) => ( + + ))} */} + {profile.map((item) => ( + + ))} + + +
+ )} ); }; diff --git a/src/components/EventsInternal/EventDates/EventDates.jsx b/src/components/EventsInternal/EventDates/EventDates.jsx index b87e4d3..5a4eed2 100644 --- a/src/components/EventsInternal/EventDates/EventDates.jsx +++ b/src/components/EventsInternal/EventDates/EventDates.jsx @@ -7,7 +7,7 @@ const EventDates = () => { { fontFamily={"Poppins"} marginBottom={"2rem"} minW={"300px"} + sx={{ + "@media (max-width: 1024px)": { + minWidth: "270px", + }, + "@media (max-width: 768px)": { + width: "100%", + }, + }} > - Details - + + Details + + Friday, May 18 - 8.00 PM - + Friday, May 18 - 8.00 PM - + Friday, May 18 - 8.00 PM @@ -41,9 +86,36 @@ const EventDates = () => { fontFamily={"Poppins"} marginBottom={"2rem"} minW={"300px"} + sx={{ + "@media (max-width: 1024px)": { + minWidth: "270px", + }, + "@media (max-width: 768px)": { + width: "100%", + }, + }} > - Location - + + Location + + Anywhere 123, anycity @@ -55,15 +127,59 @@ const EventDates = () => { borderRadius={"5px"} fontFamily={"Poppins"} minW={"300px"} + sx={{ + "@media (max-width: 1024px)": { + minWidth: "270px", + }, + "@media (max-width: 600px)": { + width: "100%", + }, + }} > - Organizer - + + Organizer + + Rubix Team - + +91 4578451245 - + rubix@gmail.com diff --git a/src/components/EventsInternal/EventsInternal.jsx b/src/components/EventsInternal/EventsInternal.jsx index 046377f..5c66234 100644 --- a/src/components/EventsInternal/EventsInternal.jsx +++ b/src/components/EventsInternal/EventsInternal.jsx @@ -45,7 +45,10 @@ const EventsInternal = () => { flexDirection={"column"} color="white" sx={{ - "@media (max-width: 600px)": { + "@media (max-width: 1024px)": { + minHeight: "30vh", + }, + "@media (max-width: 820px)": { minHeight: "inherit", width: "100vw", marginTop: "6rem", @@ -60,7 +63,7 @@ const EventsInternal = () => { fontFamily={"Mona Sans"} color={"#fff"} sx={{ - "@media (max-width: 600px)": { + "@media (max-width: 768px)": { fontSize: "28px", lineHeight: "45px", padding: "0px 1rem", @@ -71,7 +74,7 @@ const EventsInternal = () => { { alignItems={"flex-start"} justifyContent={"center"} sx={{ - "@media (max-width: 600px)": { + "@media (max-width: 820px)": { flexDirection: "column", }, }} @@ -95,7 +98,10 @@ const EventsInternal = () => { { pb={"2rem"} width={"815px"} sx={{ - "@media (max-width: 600px)": { - height: "215px", + "@media (max-width: 1024px)": { + height: "auto", + width: "555px", + }, + "@media (max-width: 768px)": { + height: "auto", width: "100%", }, }} @@ -119,7 +129,7 @@ const EventsInternal = () => { color="white" width={"94%"} sx={{ - "@media (max-width: 600px)": { + "@media (max-width: 768px)": { display: "block", top: "inherit", width: "100%", diff --git a/src/components/Footer/Footer.jsx b/src/components/Footer/Footer.jsx index 0a6c2eb..f0ca630 100644 --- a/src/components/Footer/Footer.jsx +++ b/src/components/Footer/Footer.jsx @@ -271,7 +271,7 @@ const Footer = () => { }} > { }, }} > - {content.map((item) => ( + {/* {content.map((item) => ( - ))} + ))} */} + {/*