diff --git a/src/app/providers/router/ui/AppRouter.tsx b/src/app/providers/router/ui/AppRouter.tsx index 13b5ee3..4ec36d2 100644 --- a/src/app/providers/router/ui/AppRouter.tsx +++ b/src/app/providers/router/ui/AppRouter.tsx @@ -1,8 +1,8 @@ import Root from "@/app/Layout/Root"; import { routeConfig } from "@/shared/config/routeConfig/routeConfig"; -import { createBrowserRouter } from "react-router-dom"; +import { createHashRouter } from "react-router-dom"; -export const appRouter = createBrowserRouter([ +export const appRouter = createHashRouter([ { element: , diff --git a/src/modules/posts/api/get/fetchPostById.ts b/src/modules/posts/api/get/fetchPostById.ts index dd373ad..c9781a4 100644 --- a/src/modules/posts/api/get/fetchPostById.ts +++ b/src/modules/posts/api/get/fetchPostById.ts @@ -4,13 +4,25 @@ import { parseContent } from "@/shared/api/parseContent"; import { App, WPv2 } from "@/shared/types/app"; export const fetchPostById = async (id: number): Promise => { - const post = await wp.posts().id(id).get() as WPv2.Post; + const [post, categories] = await Promise.all([ + wp.posts().id(id).get() as Promise, + wp.categories().get() as Promise, + ]); + + const categoryMap = new Map( + categories.map((c) => [c.id, c.name]) + ); + + const postCategories = post.categories.map( + (id) => categoryMap.get(id) || "" + ); const result: App.WpPostPage = { id: post.id, title: post.title.rendered, content: parseContent(post.content.rendered), tag: post.tags[0], + categories: postCategories, }; return result; diff --git a/src/modules/posts/api/get/fetchPosts.ts b/src/modules/posts/api/get/fetchPosts.ts index a624c8c..4367862 100644 --- a/src/modules/posts/api/get/fetchPosts.ts +++ b/src/modules/posts/api/get/fetchPosts.ts @@ -58,6 +58,6 @@ export const fetchPosts = async (): Promise => { result.other.push(newWpPostPage); } } - console.log('fetchPosts result', result); + return result; }; diff --git a/src/pages/MainPage/ui/MainPage/MainPage.tsx b/src/pages/MainPage/ui/MainPage/MainPage.tsx index 1f9daee..cb5b908 100644 --- a/src/pages/MainPage/ui/MainPage/MainPage.tsx +++ b/src/pages/MainPage/ui/MainPage/MainPage.tsx @@ -43,17 +43,17 @@ const MainPage = () => { - -
- -
-
+ +
+
+ +
diff --git a/src/widgets/CardList/CardList.tsx b/src/widgets/CardList/CardList.tsx index be7135c..809ee2a 100644 --- a/src/widgets/CardList/CardList.tsx +++ b/src/widgets/CardList/CardList.tsx @@ -66,7 +66,7 @@ const LabsList = ({ items={transformPostsToCardData(labs)} variant="lab" gridConfig={gridConfig} - title="Лаборатории" + title="Наши лаборатории" /> ); @@ -82,7 +82,7 @@ const ProjectsList = ({ if (isLoading) return (
-

Проекты

+

Наши проекты

); @@ -96,7 +96,7 @@ const ProjectsList = ({ items={transformPostsToCardData(projects)} variant="project" gridConfig={gridConfig} - title="Проекты" + title="Наши проекты" /> ); diff --git a/src/widgets/CardList/CardListTemplate.tsx b/src/widgets/CardList/CardListTemplate.tsx index 034892d..41355c8 100644 --- a/src/widgets/CardList/CardListTemplate.tsx +++ b/src/widgets/CardList/CardListTemplate.tsx @@ -8,7 +8,7 @@ export const CardListTemplate = ({ items, variant = "lab", // Значение по умолчанию gridConfig = { desktop: 3, tablet: 2, mobile: 1 }, - title = "Лаборатории", + title = "Наши лаборатории", }: CardListProps) => { const itemsArray = Object.values(items); diff --git a/vite.config.ts b/vite.config.ts index 3e9bd1e..4b3d5ee 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -3,7 +3,7 @@ import react from "@vitejs/plugin-react"; import path from "path"; export default defineConfig({ - base: '/wp-content/reactpress/apps/skb/dist/', + base: "/wp-content/reactpress/apps/skb/dist/index.html", plugins: [react()], resolve: { alias: {