diff --git a/src/app/blogs/components/BigBlogItem.tsx b/src/app/blogs/components/BigBlogItem.tsx index c068644..9d97148 100644 --- a/src/app/blogs/components/BigBlogItem.tsx +++ b/src/app/blogs/components/BigBlogItem.tsx @@ -12,11 +12,15 @@ interface BigBlogItemProps { const BigBlogItem: FC = ({ item }) => { return (
- blog + + blog +
-

- {item.title} -

+ +

+ {item.title} +

+
diff --git a/src/app/blogs/components/BlogList.tsx b/src/app/blogs/components/BlogList.tsx index c9ee015..d993431 100644 --- a/src/app/blogs/components/BlogList.tsx +++ b/src/app/blogs/components/BlogList.tsx @@ -6,9 +6,11 @@ import BigBlogItem from './BigBlogItem' import MostVisited from './MostVisited' import ContactUs from './ContactUs' import { useGetBlogs } from '../hooks/useBlogsData' +import { useBlogStore } from '../store/BlogStore' const BlogList: FC = () => { - const { data } = useGetBlogs() + const { selectedCategory } = useBlogStore() + const { data } = useGetBlogs(selectedCategory) return (
diff --git a/src/app/blogs/components/Category.tsx b/src/app/blogs/components/Category.tsx index 7f4677a..822327f 100644 --- a/src/app/blogs/components/Category.tsx +++ b/src/app/blogs/components/Category.tsx @@ -4,11 +4,10 @@ import { useGetBlogCategories } from '../hooks/useBlogsData' import Image from 'next/image' import { useBlogStore } from '../store/BlogStore' const Category: FC = () => { + const { data } = useGetBlogCategories() const { selectedCategory, setSelectedCategory } = useBlogStore() - console.log(data); - return (

diff --git a/src/app/blogs/components/HeroSection.tsx b/src/app/blogs/components/HeroSection.tsx index 55b2867..55a8a92 100644 --- a/src/app/blogs/components/HeroSection.tsx +++ b/src/app/blogs/components/HeroSection.tsx @@ -41,7 +41,7 @@ const HeroSection: FC = () => {
{ data?.data?.mostVisitedBlogs?.map((item, index: number) => { - if (index !== 0) { + if (index !== 0 && index < 4) { return ( ) diff --git a/src/app/blogs/components/MiniBlogItem.tsx b/src/app/blogs/components/MiniBlogItem.tsx index 681b8df..c3e3504 100644 --- a/src/app/blogs/components/MiniBlogItem.tsx +++ b/src/app/blogs/components/MiniBlogItem.tsx @@ -1,19 +1,25 @@ import Image from 'next/image' import { FC } from 'react' import { Blog } from '../types/BlogTypes' +import Link from 'next/link' const MiniBlogItem: FC<{ item: Blog }> = ({ item }) => { return (
- {item.title} -
- {item.title} -
+ + {item.title} + + + +
+ {item.title} +
+
) } diff --git a/src/app/blogs/hooks/useBlogsData.ts b/src/app/blogs/hooks/useBlogsData.ts index dbd29e0..874f9e4 100644 --- a/src/app/blogs/hooks/useBlogsData.ts +++ b/src/app/blogs/hooks/useBlogsData.ts @@ -2,10 +2,10 @@ import { useQuery } from "@tanstack/react-query"; import * as api from "../service/BlogService"; // برای client -export const useGetBlogs = () => +export const useGetBlogs = (categoryId: string) => useQuery({ - queryKey: ["blogs"], - queryFn: api.getBlogs, + queryKey: ["blogs", categoryId], + queryFn: () => api.getBlogs(categoryId), }); export const useGetMostVisitedBlogs = () => @@ -40,8 +40,8 @@ export const useGetBlogSingle = (id: string) => // برای server prefetch export const blogsQueryOptions = { - queryKey: ["blogs"], - queryFn: api.getBlogs, + queryKey: ["blogs", ""], + queryFn: () => api.getBlogs(""), }; export const blogSingleQueryOptions = (id: string) => ({ diff --git a/src/app/blogs/service/BlogService.ts b/src/app/blogs/service/BlogService.ts index 4aec9de..4a3a8de 100644 --- a/src/app/blogs/service/BlogService.ts +++ b/src/app/blogs/service/BlogService.ts @@ -6,8 +6,12 @@ import { BlogSingleResponse, } from "../types/BlogTypes"; -export const getBlogs = async () => { - const { data } = await axios.get(`/blogs`); +export const getBlogs = async (categoryId: string) => { + let query = ""; + if (categoryId) { + query = `?categoryId=${categoryId}`; + } + const { data } = await axios.get(`/blogs${query}`); return data; }; diff --git a/src/app/globals.css b/src/app/globals.css index ddc726b..7756141 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -103,3 +103,7 @@ tbody tr { .rc-rate-star { margin-right: 3px !important; /* فاصله بین ستاره‌ها */ } + +#blog-preview-content * { + color: white !important; +} diff --git a/src/app/home/Blog.tsx b/src/app/home/Blog.tsx index a87eb69..f588380 100644 --- a/src/app/home/Blog.tsx +++ b/src/app/home/Blog.tsx @@ -14,10 +14,11 @@ const Blog: FC = () => {
{ - data?.data?.pinnedBlogs?.map((item) => { - return ( - - ) + data?.data?.pinnedBlogs?.map((item, index: number) => { + if (index < 3) + return ( + + ) }) } diff --git a/src/components/BlogItem.tsx b/src/components/BlogItem.tsx index da8766c..e90750f 100644 --- a/src/components/BlogItem.tsx +++ b/src/components/BlogItem.tsx @@ -1,5 +1,6 @@ import { Blog } from '@/app/blogs/types/BlogTypes' import Image from 'next/image' +import Link from 'next/link' import { FC } from 'react' interface Props { @@ -8,7 +9,7 @@ interface Props { const BlogItem: FC = ({ item }) => { return ( -
+ = ({ item }) => { {item.title}

-

+

-
+ ) } diff --git a/src/components/ServiceItem.tsx b/src/components/ServiceItem.tsx index 04c6dcf..44c8204 100644 --- a/src/components/ServiceItem.tsx +++ b/src/components/ServiceItem.tsx @@ -11,7 +11,7 @@ type Props = { const ServiceItem: FC = (props) => { return ( - +
{props.item.name} diff --git a/src/config/axios.ts b/src/config/axios.ts index e302827..6b4fb22 100644 --- a/src/config/axios.ts +++ b/src/config/axios.ts @@ -4,7 +4,7 @@ import { getToken } from "./func"; const axiosInstance = axios.create({ // baseURL: process.env.NEXT_PUBLIC_BASE_URL, - baseURL: "http://192.168.1.108:4000", + baseURL: "https://api.danakcorp.com", }); axiosInstance.interceptors.response.use( diff --git a/src/shared/Footer.tsx b/src/shared/Footer.tsx index 4ad9ba7..8b3a320 100644 --- a/src/shared/Footer.tsx +++ b/src/shared/Footer.tsx @@ -11,7 +11,7 @@ const Footer: FC = () => {
-
+
{ alt='لوگو داناک' /> -

+

ما در داناک هم تولیدکننده نرم‌افزارهای پیشرفته هستیم و هم بستری برای فروش محصولات نرم‌افزاری دیگران فراهم کرده‌ایم. با ما هوشمندانه بسازید و حرفه‌ای بفروشید.

@@ -29,7 +29,7 @@ const Footer: FC = () => {
داناک
-
    +
    • محصولات
    • @@ -46,7 +46,7 @@ const Footer: FC = () => {
      سرویس ها محبوب
      -
        +
        • دی منو
        • @@ -63,7 +63,7 @@ const Footer: FC = () => {
          همکاری با داناک
          -
            +
            • توسعه دهندگان
            • diff --git a/src/shared/Header.tsx b/src/shared/Header.tsx index 4e8406b..12a3600 100644 --- a/src/shared/Header.tsx +++ b/src/shared/Header.tsx @@ -27,7 +27,7 @@ const Header: FC = () => { - +
            • خدمات
            • @@ -62,10 +62,12 @@ const Header: FC = () => {
              ورود | ثبت نام
              -