Fixed presenters

This commit is contained in:
Umar Adilov 2025-07-08 13:49:01 +05:00
parent 86b116dd97
commit 6de16d017f
8 changed files with 62 additions and 37 deletions

View File

@ -46,7 +46,7 @@ export type Station = Root<{
imya: string;
opisanie: string;
adress: string;
chasyraboty: Select[];
chasyRaboty: Select[];
lat: number;
long: number;
avtomojka: boolean;
@ -54,29 +54,29 @@ export type Station = Root<{
ai95: boolean;
z100: boolean;
propan: boolean;
zaryadnayastanciya: boolean;
zaryadnayaStanciya: boolean;
dt: boolean;
minimarket: boolean;
miniMarket: boolean;
tualet: boolean;
region: Select[];
foto: Image[];
}>;
export type TextResponse = Root<{
klyuchneizmenyat: string;
klyuchNeIzmenyat: string;
znachenie: string | null;
}>;
export type MediaResponse = Root<{
mestopolozheniya: string;
foto: Image[];
klyuchneizmenyat: string;
klyuchNeIzmenyat: string;
}>;
export type Team = Root<{
foto: Image[];
zvanie: string;
polnoeimya: string;
polnoeImya: string;
}>;
export type History = Root<{
@ -87,7 +87,7 @@ export type History = Root<{
export type Review = Root<{
id: number;
polnoeimya: string;
polnoeImya: string;
otzyv: string;
rejting: number;
}>;
@ -103,7 +103,7 @@ export type Charity = Root<{
export type Certificate = Root<{
nazvanie: string;
opisanie: string;
datavydachi: string;
dataVydachi: string;
dejstvitelenDo: string;
foto: Image[];
}>;

View File

@ -40,7 +40,7 @@ export const presentJobs = (jobs: Job) =>
export const presentTeamMembers = (members: Team) =>
members.records.map((member) => ({
name: member.polnoeimya,
name: member.polnoeImya,
photo: presentImage(member.foto),
profession: member.zvanie,
}));
@ -67,7 +67,7 @@ export const presentStations = (stations: Station) =>
name: station.imya,
description: station.opisanie,
address: station.adress,
workingHours: presentSelect(station.chasyraboty),
workingHours: presentSelect(station.chasyRaboty),
latitude: station.lat,
longitude: station.long,
carWash: station.avtomojka || false,
@ -76,8 +76,8 @@ export const presentStations = (stations: Station) =>
dt: station.dt || false,
z100: station.z100 || false,
propan: station.propan || false,
electricCharge: station.zaryadnayastanciya || false,
miniMarket: station.minimarket || false,
electricCharge: station.zaryadnayaStanciya || false,
miniMarket: station.miniMarket || false,
toilet: station.tualet || false,
region: presentSelect(station.region),
image: presentImage(station.foto),
@ -85,13 +85,13 @@ export const presentStations = (stations: Station) =>
export const presentTexts = (texts: TextResponse) =>
texts.records.map((item) => ({
key: item.klyuchneizmenyat,
key: item.klyuchNeIzmenyat,
value: item.znachenie,
}));
export const presentMedia = (media: MediaResponse) => {
return media.records.map((record) => ({
key: record.klyuchneizmenyat,
key: record.klyuchNeIzmenyat,
name: record.mestopolozheniya,
photo: presentImage(record.foto),
}));
@ -100,7 +100,7 @@ export const presentMedia = (media: MediaResponse) => {
export const presentReviews = (reviews: Review) =>
reviews.records.map((review) => ({
id: review.id,
fullname: review.polnoeimya,
fullname: review.polnoeImya,
review: review.otzyv,
rating: review.rejting,
}));
@ -120,7 +120,7 @@ export const presentCertificates = (certificates: Certificate) =>
id: index + 1,
name: certificate.nazvanie,
description: certificate.opisanie,
issuedAt: certificate.datavydachi,
issuedAt: certificate.dataVydachi,
validUntil: certificate.dejstvitelenDo,
image: presentImage(certificate.foto),
}));

View File

@ -6,7 +6,7 @@ export const stationsRequest = {
imya: true,
opisanie: true,
adress: true,
chasyraboty: {
chasyRaboty: {
name: true,
},
lat: true,
@ -16,9 +16,9 @@ export const stationsRequest = {
ai95: true,
z100: true,
propan: true,
zaryadnayastanciya: true,
zaryadnayaStanciya: true,
dt: true,
minimarket: true,
miniMarket: true,
tualet: true,
region: {
name: true,
@ -49,7 +49,7 @@ export const stationsWithImageRequest = {
imya: true,
opisanie: true,
adress: true,
chasyraboty: {
chasyRaboty: {
name: true,
},
lat: true,
@ -59,9 +59,9 @@ export const stationsWithImageRequest = {
ai95: true,
z100: true,
propan: true,
zaryadnayastanciya: true,
zaryadnayaStanciya: true,
dt: true,
minimarket: true,
miniMarket: true,
tualet: true,
region: {
name: true,
@ -115,23 +115,23 @@ export const discountsRequest = {
};
export const textsRequest = {
tekstovyjkontentsajta: {
tekstovyjKontentSajta: {
records: {
znachenie: true,
klyuchneizmenyat: true,
klyuchNeIzmenyat: true,
},
},
};
export const mediaRequest = {
mediakontentsajta: {
mediaKontentSajta: {
records: {
mestopolozheniya: true,
foto: {
id: true,
url: true,
},
klyuchneizmenyat: true,
klyuchNeIzmenyat: true,
},
},
};
@ -143,13 +143,13 @@ export const teamRequest = {
url: true,
},
zvanie: true,
polnoeimya: true,
polnoeImya: true,
},
},
};
export const historyRequest = {
istoriyakompanii: {
istoriyaKompanii: {
records: {
zagolovok: true,
god: true,
@ -174,7 +174,7 @@ export const reviewsRequest = {
},
records: {
id: true,
polnoeimya: true,
polnoeImya: true,
otzyv: true,
rejting: true,
},
@ -182,7 +182,7 @@ export const reviewsRequest = {
};
export const charityRequest = {
blagotvoritelnyjfond: {
blagotvoritelnyjFond: {
records: {
zagolovok: true,
opisanie: true,
@ -200,8 +200,8 @@ export const certificatesRequest = {
records: {
nazvanie: true,
opisanie: true,
datavydachi: true,
dejstvitelendo: true,
dataVydachi: true,
dejstvitelenDo: true,
foto: {
url: true,
},

View File

@ -14,7 +14,7 @@ export const POST = async (req: NextRequest) => {
{ mutation: createReviewMutation },
{
review: {
polnoeimya: validatedRequest.name,
polnoeImya: validatedRequest.name,
otzyv: validatedRequest.reviewMessage,
rejting: validatedRequest.rating,
},

View File

@ -57,7 +57,7 @@ export const mainPageApi = taylorAPI.injectEndpoints({
transformResponse: (response: any) => {
return {
team: presentTeamMembers(response.data.komanda),
history: presentHistoryItems(response.data.istoriyakompanii),
history: presentHistoryItems(response.data.istoriyaKompanii),
stations: presentStations(response.data.azs),
reviews: presentReviews(response.data.otzyvy),
};
@ -75,7 +75,7 @@ export const mainPageApi = taylorAPI.injectEndpoints({
transformResponse: (response: any) => {
return {
charities: presentCharities(response.data.blagotvoritelnyjfond),
charities: presentCharities(response.data.blagotvoritelnyjFond),
};
},
}),

View File

@ -18,7 +18,7 @@ export const textControlApi = taylorAPI.injectEndpoints({
}),
transformResponse: (response: any) => {
return presentTexts(response.data.tekstovyjkontentsajta);
return presentTexts(response.data.tekstovyjKontentSajta);
},
}),
}),

View File

@ -17,7 +17,7 @@ export const mediaControlApi = taylorAPI.injectEndpoints({
},
}),
transformResponse: (response: any) => {
return presentMedia(response.data.mediakontentsajta);
return presentMedia(response.data.mediaKontentSajta);
},
}),
}),

View File

@ -3,6 +3,7 @@
import { MapPin } from 'lucide-react';
import Image from 'next/image';
import Link from 'next/link';
import { useEffect } from 'react';
import { useTextController } from '@/shared/language/hooks/use-text-controller';
import { useMediaController } from '@/shared/media/hooks/use-media-controller';
@ -12,8 +13,32 @@ export const HeroSection = () => {
const { t } = useTextController();
const { m } = useMediaController();
useEffect(() => {
const iframe = document.getElementById('xtraseats-iframe');
iframe?.addEventListener('load', () => {
window.addEventListener('message', function (event) {
// Optional: validate event.origin === "https://app.realpromo.io"
if (iframe && event.data.iframeHeight) {
if (iframe) {
iframe.style.height = event.data.iframeHeight + 10 + 'px';
}
}
});
});
}, []);
return (
<section className='relative'>
<iframe
src='http://localhost:3001/events/world-championship-grappling-superfights-23b1?iframe=true&fullHeight=true'
title='iFrame'
width='100%'
height='100vh'
scrolling='yes'
allow='fullscreen'
id='xtraseats-iframe'
></iframe>
<div className='relative h-[550px] w-full overflow-hidden bg-black sm:h-[500px] xl:h-[650px]'>
<div
style={{