From bc81c1cf2adc83b3477cfea91d0f0b485054a164 Mon Sep 17 00:00:00 2001 From: yasaman Date: Wed, 24 Jan 2024 14:33:51 +0330 Subject: [PATCH] New & AboutUs Added , CullUs & Landing Page Modified --- app/AboutUs/page.tsx | 6 ++ app/News/page.tsx | 8 ++ app/components/Landing.tsx | 15 ++-- components/AboutUs.tsx | 41 ++++++++++ components/CallUs.tsx | 2 +- components/News.tsx | 151 +++++++++++++++++++++++++++++++++++++ constants/index.tsx | 18 ++--- utils/commonApi.ts | 11 ++- 8 files changed, 235 insertions(+), 17 deletions(-) create mode 100644 app/AboutUs/page.tsx create mode 100644 app/News/page.tsx create mode 100644 components/AboutUs.tsx create mode 100644 components/News.tsx diff --git a/app/AboutUs/page.tsx b/app/AboutUs/page.tsx new file mode 100644 index 0000000..02cbc35 --- /dev/null +++ b/app/AboutUs/page.tsx @@ -0,0 +1,6 @@ +import AboutUs from "@/components/AboutUs"; +import React from "react"; + +export default function page() { + return ; +} diff --git a/app/News/page.tsx b/app/News/page.tsx new file mode 100644 index 0000000..588329e --- /dev/null +++ b/app/News/page.tsx @@ -0,0 +1,8 @@ +import News from '@/components/News' +import React from 'react' + +export default function page() { + return ( + + ) +} diff --git a/app/components/Landing.tsx b/app/components/Landing.tsx index 89c66bd..1076756 100644 --- a/app/components/Landing.tsx +++ b/app/components/Landing.tsx @@ -19,7 +19,7 @@ import "swiper/css/pagination"; import { Autoplay, Pagination, Navigation } from "swiper/modules"; import { sliderItems } from "@/constants"; import { useQuery } from "@tanstack/react-query"; -import { getSliders } from "@/utils/commonApi"; +import { getSliders , getNews} from "@/utils/commonApi"; export default function Landing() { const { data, isLoading, refetch } = useQuery({ @@ -27,9 +27,15 @@ export default function Landing() { queryFn: () => getSliders(), refetchOnWindowFocus: false, }); - console.log(data); + const { data:NewsData, isLoading:NewsisLoading, isError:NewsisError, refetch:Newsrefetch } = useQuery({ + queryKey: ["News"], + queryFn: () => getNews(), + refetchOnWindowFocus: false, + }); + console.log("NewsData"+ NewsData); + return (
@@ -160,10 +166,7 @@ export default function Landing() { آخرین اخبار
+ className=" w-full mt-6 flex flex-row gap-8 mb-14 max-lg:flex-col max-lg:gap-4 "> {/* Right News */}
getSingleWebContents(title), + refetchOnWindowFocus: false, + }); + console.log(data); + + useEffect(() => { + refetch(); + }, [title, refetch]); + + if (isLoading) { + return

Loading...

; + } + if (isError) { + return

Error fetching content.

; + } + + const fetchedContent = data?.content || ""; // Assuming your API response has a 'content' property + + return ( +
+
+ {/* Display fetched content */} +
+
+
+ ); +} diff --git a/components/CallUs.tsx b/components/CallUs.tsx index 7cf32ef..1d6d867 100644 --- a/components/CallUs.tsx +++ b/components/CallUs.tsx @@ -50,7 +50,7 @@ export default function CallUs(props: any) { {/*
*/}
-
+
{callUsItems.map((item) => { return (
getNews(), + refetchOnWindowFocus: false, + }); + console.log(data); + + if (isLoading) { + return

Loading...

; + } + if (isError) { + return

Error fetching content.

; + } + + return ( +
+
+ + {/* {data.map((item: any, index: number) => { + return

News

; + })} */} + +
+
+ picture +
+ +
+

+ اخبار +

+

+ 24 آذر ماه 1402 +

+

+ شروع به کار سامانه عیون +

+

+ این سامانه با هدف نظارت بر عملکرد پرسنل و نهادهای مرتبط با امور + مردمی در شهرداری استان یزد در زمستان 1402 شروع به فعالیت نموده است + ... +

+ + بیشتر بخوانید{" "} + +
+
+ +
+
+ picture +
+ +
+

+ اخبار +

+

+ 24 آذر ماه 1402 +

+

+ شروع به کار سامانه عیون +

+

+ این سامانه با هدف نظارت بر عملکرد پرسنل و نهادهای مرتبط با امور + مردمی در شهرداری استان یزد در زمستان 1402 شروع به فعالیت نموده است + ... +

+ + بیشتر بخوانید{" "} + +
+
+ +
+
+ picture +
+ +
+

+ اخبار +

+

+ 24 آذر ماه 1402 +

+

+ شروع به کار سامانه عیون +

+

+ این سامانه با هدف نظارت بر عملکرد پرسنل و نهادهای مرتبط با امور + مردمی در شهرداری استان یزد در زمستان 1402 شروع به فعالیت نموده است + ... +

+ + بیشتر بخوانید{" "} + +
+
+
+
+ ); +} diff --git a/constants/index.tsx b/constants/index.tsx index 4acd701..c53468a 100644 --- a/constants/index.tsx +++ b/constants/index.tsx @@ -5,8 +5,8 @@ import bgimg from "../public/img/bg.png"; export const menuItems = [ { id: 1, name: "صفحه اصلی", href: "/" }, - { id: 2, name: "اخبار", href: "/" }, - { id: 3, name: "درباره ما", href: "/" }, + { id: 2, name: "اخبار", href: "/News" }, + { id: 3, name: "درباره ما", href: "/AboutUs" }, { id: 4, name: "تماس با ما", href: "/CallUs" }, { id: 5, name: "پیگیری", href: "/FollowUp" }, { id: 6, name: "ورود به پنل کاربری", href: "/Login" }, @@ -106,13 +106,13 @@ export const footerItems = [ ]; export const callUsItems = [ - { - id: 1, - title: "نشانی", - icon: , - description: " نشانی ما جهت ارتباط ", - description2: "google map", - }, + // { + // id: 1, + // title: "نشانی", + // icon: , + // description: " نشانی ما جهت ارتباط ", + // description2: "google map", + // }, { id: 2, title: "نشانی الکترونیک", diff --git a/utils/commonApi.ts b/utils/commonApi.ts index 30f6ffd..33c1d0d 100644 --- a/utils/commonApi.ts +++ b/utils/commonApi.ts @@ -35,4 +35,13 @@ export async function getSingleWebContents( title: string ) { const data = await axios.get(`api/Common/Contents/${title}`); console.log(data); return data.data; -} \ No newline at end of file +} + + +// News +export async function getNews() { + const data = await axios.get("api/Common/News"); + console.log(data); + return data.data; +} +