фикс билда

This commit is contained in:
ifraimka1 committed 2025-04-18 16:44:04 +03:00
1 parent 6f6e122a71
commit eb3236b7a4
11 files changed
+25 -15

No files matched your search

@@ -39,7 +39,7 @@ export const fetchPostProjects = async (tag: number): Promise<App.Card[]> => {
const newPost: App.Card = { const newPost: App.Card = {
id: post.id, id: post.id,
title: post.title.rendered, title: post.title.rendered,
preview: image?.src || null, preview: image?.src || "",
}; };
result.push(newPost); result.push(newPost);
+3 -2
View File
@@ -36,7 +36,7 @@ export const fetchPosts = async (): Promise<App.PostsResult> => {
if (postCategories.includes("projects")) { if (postCategories.includes("projects")) {
const newProject: App.Card = { const newProject: App.Card = {
...newPost, ...newPost,
preview: image?.src || null, preview: image?.src || "",
}; };
result.projects[post.id] = newProject; result.projects[post.id] = newProject;
} else if (postCategories.includes("labs")) { } else if (postCategories.includes("labs")) {
@@ -44,7 +44,7 @@ export const fetchPosts = async (): Promise<App.PostsResult> => {
const excerptElement = Parse(post.excerpt.rendered)[0]; const excerptElement = Parse(post.excerpt.rendered)[0];
const newLab: App.LabCard = { const newLab: App.LabCard = {
...newPost, ...newPost,
preview: image?.src || undefined, preview: image?.src || "",
previewText: (excerptElement as any)?.props?.children || "", previewText: (excerptElement as any)?.props?.children || "",
}; };
result.labs[post.id] = newLab; result.labs[post.id] = newLab;
@@ -53,6 +53,7 @@ export const fetchPosts = async (): Promise<App.PostsResult> => {
...newPost, ...newPost,
content: parseContent(post.content.rendered), content: parseContent(post.content.rendered),
tag: post.tags[0], tag: post.tags[0],
categories: postCategories,
}; };
result.other.push(newWpPostPage); result.other.push(newWpPostPage);
} }
+2 -1
View File
@@ -16,7 +16,8 @@ type FieldType =
| "file" | "file"
| "textarea" | "textarea"
| "textarea" | "textarea"
| "password"; | "password"
| "tel";
interface FieldProps { interface FieldProps {
type: FieldType; type: FieldType;
File renamed without changes.
+3 -2
View File
@@ -301,14 +301,15 @@ declare namespace App {
export interface WpPostPage extends WpPost { export interface WpPostPage extends WpPost {
content: ParsedContent[]; content: ParsedContent[];
tag: number; tag: number;
categories?: string[];
} }
export interface Card extends WpPost { export interface Card extends WpPost {
preview?: string | null; preview: string;
} }
export interface LabCard extends Card { export interface LabCard extends Card {
previewText?: string | null; previewText: string;
} }
export interface PostsResult { export interface PostsResult {
+8 -2
View File
@@ -1,19 +1,25 @@
import { CardData } from "@/shared/Components/Card/types"; import { CardData } from "@/shared/Components/Card/types";
import { App, SKBKit } from "@/shared/types/app"; import { App, SKBKit } from "@/shared/types/app";
function hasPreviewText(post: App.Card | App.LabCard): post is App.LabCard {
return 'previewText' in post;
}
export const transformPostsToCardData = ( export const transformPostsToCardData = (
posts: App.WpPost[] posts: App.Card[] | App.LabCard[]
): Record<string, CardData> => { ): Record<string, CardData> => {
return posts.reduce((acc, post) => { return posts.reduce((acc, post) => {
acc[post.id] = { acc[post.id] = {
id: post.id.toString(), id: post.id.toString(),
name: post.title, name: post.title,
previewText: post.previewText || "", previewText: hasPreviewText(post) ? post.previewText : "",
link: `/post/${post.id}`, link: `/post/${post.id}`,
preview: post.preview || "", preview: post.preview || "",
}; };
return acc; return acc;
}, {} as Record<string, CardData>); }, {} as Record<string, CardData>);
}; };
export const transformNewsToCardData = ( export const transformNewsToCardData = (
news: SKBKit.News[] news: SKBKit.News[]
): Record<string, CardData> => { ): Record<string, CardData> => {
+3 -2
View File
@@ -1,4 +1,4 @@
import { useState, useEffect } from "react"; import { useState } from "react";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import FooterLink from "./FooterLink"; import FooterLink from "./FooterLink";
import FooterContacts from "./FooterContacts"; import FooterContacts from "./FooterContacts";
@@ -73,7 +73,8 @@ const mockContacts: ContactsType = {
}; };
function Footer({ links = mockLinks, contacts = mockContacts }: FooterProps) { function Footer({ links = mockLinks, contacts = mockContacts }: FooterProps) {
const [mediaList, setMediaList] = useState(links); // TODO: добавить setMediaList
const [mediaList] = useState(links);
return ( return (
<footer id="footer"> <footer id="footer">
+1 -1
View File
@@ -1,5 +1,5 @@
import "./Numbers.styles.scss"; import "./Numbers.styles.scss";
import { Illustration } from '../../shared/assets/images/numbers'; import { Illustration } from '@/shared/assets/images/numbers';
const Numbers = () => { const Numbers = () => {
const currentYear = new Date().getFullYear(); const currentYear = new Date().getFullYear();
+3 -3
View File
@@ -1,4 +1,4 @@
import { useEffect, useState } from "react"; import { useState } from "react";
import { useMedia } from "@/modules/media/hooks/useMedia"; import { useMedia } from "@/modules/media/hooks/useMedia";
import "./PhotoGallery.style.scss" import "./PhotoGallery.style.scss"
@@ -8,9 +8,9 @@ interface PhotoGalleryProps {
category?: string; category?: string;
} }
const PhotoGallery = ({ images, category = "галерея" }: PhotoGalleryProps) => { const PhotoGallery = ({ images }: PhotoGalleryProps) => {
const { data: mediaData, isLoading, isError } = useMedia(); const { data: mediaData, isLoading, isError } = useMedia();
const [visibleCount, setVisibleCount] = useState(10); const [visibleCount] = useState(10);
const filteredMedia = images const filteredMedia = images
? images.map((src, id) => ({ id, src })) ? images.map((src, id) => ({ id, src }))
+1 -1
View File
@@ -1 +1 @@
{"root":["./src/main.tsx","./src/vite-env.d.ts","./src/app/app.tsx","./src/app/layout/root.tsx","./src/app/providers/router/index.ts","./src/app/providers/router/ui/approuter.tsx","./src/app/types/global.d.ts","./src/modules/index.ts","./src/modules/contact/api/post.ts","./src/modules/contact/hooks/usecontactform.ts","./src/modules/media/api/get.ts","./src/modules/media/hooks/usemedia.ts","./src/modules/news/api/get.ts","./src/modules/news/hooks/usenews.ts","./src/modules/news/hooks/usenewsbyid.ts","./src/modules/posts/api/get/fetchpostbyid.ts","./src/modules/posts/api/get/fetchpostprojects.ts","./src/modules/posts/api/get/fetchposts.ts","./src/modules/posts/hooks/usepostbyid.ts","./src/modules/posts/hooks/usepostprojects.ts","./src/modules/posts/hooks/useposts.ts","./src/pages/aboutus/aboutus.tsx","./src/pages/aboutus/index.ts","./src/pages/aboutus/types.ts","./src/pages/contact/contact.tsx","./src/pages/contact/index.ts","./src/pages/mainpage/index.tsx","./src/pages/mainpage/ui/mainpage/mainpage.async.tsx","./src/pages/mainpage/ui/mainpage/mainpage.tsx","./src/pages/mainpage/ui/mainpage/mockdata.ts","./src/pages/mainpage/ui/components/gallery/gallery.tsx","./src/pages/mainpage/ui/components/gallery/index.ts","./src/pages/newsitem/newsitem.tsx","./src/pages/notfound/notfoundpage.tsx","./src/pages/wppostpage/wppostpage.tsx","./src/shared/components/card/card.tsx","./src/shared/components/card/types.ts","./src/shared/components/field/field.tsx","./src/shared/components/field/index.ts","./src/shared/api/parsecontent.ts","./src/shared/api/wp-client.ts","./src/shared/config/routeconfig/routeconfig.tsx","./src/shared/lib/elementonscreen/elementonscreen.ts","./src/shared/lib/classnames/classnames.ts","./src/shared/types/app.d.ts","./src/widgets/button/ui/button.tsx","./src/widgets/cardlist/cardlist.tsx","./src/widgets/cardlist/cardlistfunctions.ts","./src/widgets/cardlist/cardlisttemplate.tsx","./src/widgets/cardlist/types.ts","./src/widgets/categorypage/categorypage.tsx","./src/widgets/contactform/contactform.tsx","./src/widgets/contactform/index.ts","./src/widgets/contactform/variables.ts","./src/widgets/contactus/contactus.tsx","./src/widgets/contactus/index.ts","./src/widgets/footer/footer.tsx","./src/widgets/footer/footercontacts.tsx","./src/widgets/footer/footerlink.tsx","./src/widgets/footer/index.ts","./src/widgets/mediablock/mediablock.tsx","./src/widgets/mediablock/index.ts","./src/widgets/mediablock/mediacontainer/mediacontainer.tsx","./src/widgets/mediablock/mediacontainer/index.ts","./src/widgets/navbar/navbar.tsx","./src/widgets/navbar/navbarlink.tsx","./src/widgets/navbar/index.ts","./src/widgets/partners/partners.tsx","./src/widgets/partners/partnerslogo.tsx","./src/widgets/partners/index.ts","./src/widgets/slider/slider.tsx","./src/widgets/slider/components/arrows.tsx","./src/widgets/slider/components/dot.tsx","./src/widgets/slider/components/dots.tsx","./src/widgets/slider/components/slide.tsx","./src/widgets/slider/components/slideslist.tsx","./src/widgets/wppost/pagecontent.tsx","./src/widgets/wppost/pageheader.tsx","./src/widgets/wppost/wppost.tsx","./src/widgets/wppost/index.ts"],"version":"5.8.2"} {"root":["./src/main.tsx","./src/vite-env.d.ts","./src/app/app.tsx","./src/app/layout/root.tsx","./src/app/providers/router/index.ts","./src/app/providers/router/ui/approuter.tsx","./src/app/types/global.d.ts","./src/modules/index.ts","./src/modules/contact/api/post.ts","./src/modules/contact/hooks/usecontactform.ts","./src/modules/media/api/get.ts","./src/modules/media/hooks/usemedia.ts","./src/modules/news/api/get.ts","./src/modules/news/hooks/usenews.ts","./src/modules/news/hooks/usenewsbyid.ts","./src/modules/posts/api/get/fetchpostbyid.ts","./src/modules/posts/api/get/fetchpostprojects.ts","./src/modules/posts/api/get/fetchposts.ts","./src/modules/posts/hooks/usepostbyid.ts","./src/modules/posts/hooks/usepostprojects.ts","./src/modules/posts/hooks/useposts.ts","./src/pages/aboutus/aboutus.tsx","./src/pages/aboutus/index.ts","./src/pages/aboutus/types.ts","./src/pages/contact/contact.tsx","./src/pages/contact/index.ts","./src/pages/mainpage/index.tsx","./src/pages/mainpage/ui/mainpage/mainpage.async.tsx","./src/pages/mainpage/ui/mainpage/mainpage.tsx","./src/pages/mainpage/ui/mainpage/mockdata.ts","./src/pages/mainpage/ui/components/gallery/gallery.tsx","./src/pages/mainpage/ui/components/gallery/index.ts","./src/pages/newsitem/newsitem.tsx","./src/pages/notfound/notfoundpage.tsx","./src/pages/wppostpage/wppostpage.tsx","./src/shared/components/card/card.tsx","./src/shared/components/card/types.ts","./src/shared/components/field/field.tsx","./src/shared/components/field/index.ts","./src/shared/api/parsecontent.ts","./src/shared/api/wp-client.ts","./src/shared/assets/images/index.ts","./src/shared/assets/images/numbers/index.ts","./src/shared/config/routeconfig/routeconfig.tsx","./src/shared/lib/elementonscreen/elementonscreen.ts","./src/shared/lib/classnames/classnames.ts","./src/shared/types/app.d.ts","./src/widgets/button/ui/button.tsx","./src/widgets/cardlist/cardlist.tsx","./src/widgets/cardlist/cardlistfunctions.ts","./src/widgets/cardlist/cardlisttemplate.tsx","./src/widgets/cardlist/types.ts","./src/widgets/categorypage/categorypage.tsx","./src/widgets/contactform/contactform.tsx","./src/widgets/contactform/index.ts","./src/widgets/contactform/variables.ts","./src/widgets/contactus/contactus.tsx","./src/widgets/contactus/index.ts","./src/widgets/footer/footer.tsx","./src/widgets/footer/footercontacts.tsx","./src/widgets/footer/footerlink.tsx","./src/widgets/footer/index.ts","./src/widgets/mediablock/mediablock.tsx","./src/widgets/mediablock/index.ts","./src/widgets/mediablock/mediacontainer/mediacontainer.tsx","./src/widgets/mediablock/mediacontainer/index.ts","./src/widgets/navbar/navbar.tsx","./src/widgets/navbar/navbarlink.tsx","./src/widgets/navbar/index.ts","./src/widgets/numbers/numbers.tsx","./src/widgets/numbers/index.ts","./src/widgets/partners/partners.tsx","./src/widgets/partners/partnerslogo.tsx","./src/widgets/partners/index.ts","./src/widgets/photogallery/photogallery.tsx","./src/widgets/photogallery/index.ts","./src/widgets/slider/slider.tsx","./src/widgets/slider/components/arrows.tsx","./src/widgets/slider/components/dot.tsx","./src/widgets/slider/components/dots.tsx","./src/widgets/slider/components/slide.tsx","./src/widgets/slider/components/slideslist.tsx","./src/widgets/team/team.tsx","./src/widgets/team/index.ts","./src/widgets/wppost/pagecontent.tsx","./src/widgets/wppost/pageheader.tsx","./src/widgets/wppost/wppost.tsx","./src/widgets/wppost/index.ts"],"version":"5.8.3"}