фикс билда

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 = {
id: post.id,
title: post.title.rendered,
preview: image?.src || null,
preview: image?.src || "",
};
result.push(newPost);
+3 -2
View File
@@ -36,7 +36,7 @@ export const fetchPosts = async (): Promise<App.PostsResult> => {
if (postCategories.includes("projects")) {
const newProject: App.Card = {
...newPost,
preview: image?.src || null,
preview: image?.src || "",
};
result.projects[post.id] = newProject;
} else if (postCategories.includes("labs")) {
@@ -44,7 +44,7 @@ export const fetchPosts = async (): Promise<App.PostsResult> => {
const excerptElement = Parse(post.excerpt.rendered)[0];
const newLab: App.LabCard = {
...newPost,
preview: image?.src || undefined,
preview: image?.src || "",
previewText: (excerptElement as any)?.props?.children || "",
};
result.labs[post.id] = newLab;
@@ -53,6 +53,7 @@ export const fetchPosts = async (): Promise<App.PostsResult> => {
...newPost,
content: parseContent(post.content.rendered),
tag: post.tags[0],
categories: postCategories,
};
result.other.push(newWpPostPage);
}
+2 -1
View File
@@ -16,7 +16,8 @@ type FieldType =
| "file"
| "textarea"
| "textarea"
| "password";
| "password"
| "tel";
interface FieldProps {
type: FieldType;
File renamed without changes.
+3 -2
View File
@@ -301,14 +301,15 @@ declare namespace App {
export interface WpPostPage extends WpPost {
content: ParsedContent[];
tag: number;
categories?: string[];
}
export interface Card extends WpPost {
preview?: string | null;
preview: string;
}
export interface LabCard extends Card {
previewText?: string | null;
previewText: string;
}
export interface PostsResult {
+8 -2
View File
@@ -1,19 +1,25 @@
import { CardData } from "@/shared/Components/Card/types";
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 = (
posts: App.WpPost[]
posts: App.Card[] | App.LabCard[]
): Record<string, CardData> => {
return posts.reduce((acc, post) => {
acc[post.id] = {
id: post.id.toString(),
name: post.title,
previewText: post.previewText || "",
previewText: hasPreviewText(post) ? post.previewText : "",
link: `/post/${post.id}`,
preview: post.preview || "",
};
return acc;
}, {} as Record<string, CardData>);
};
export const transformNewsToCardData = (
news: SKBKit.News[]
): 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 FooterLink from "./FooterLink";
import FooterContacts from "./FooterContacts";
@@ -73,7 +73,8 @@ const mockContacts: ContactsType = {
};
function Footer({ links = mockLinks, contacts = mockContacts }: FooterProps) {
const [mediaList, setMediaList] = useState(links);
// TODO: добавить setMediaList
const [mediaList] = useState(links);
return (
<footer id="footer">
+1 -1
View File
@@ -1,5 +1,5 @@
import "./Numbers.styles.scss";
import { Illustration } from '../../shared/assets/images/numbers';
import { Illustration } from '@/shared/assets/images/numbers';
const Numbers = () => {
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 "./PhotoGallery.style.scss"
@@ -8,9 +8,9 @@ interface PhotoGalleryProps {
category?: string;
}
const PhotoGallery = ({ images, category = "галерея" }: PhotoGalleryProps) => {
const PhotoGallery = ({ images }: PhotoGalleryProps) => {
const { data: mediaData, isLoading, isError } = useMedia();
const [visibleCount, setVisibleCount] = useState(10);
const [visibleCount] = useState(10);
const filteredMedia = images
? images.map((src, id) => ({ id, src }))