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

View File

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

View File

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

View File

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

View File

@ -57,7 +57,7 @@ export const mainPageApi = taylorAPI.injectEndpoints({
transformResponse: (response: any) => { transformResponse: (response: any) => {
return { return {
team: presentTeamMembers(response.data.komanda), team: presentTeamMembers(response.data.komanda),
history: presentHistoryItems(response.data.istoriyakompanii), history: presentHistoryItems(response.data.istoriyaKompanii),
stations: presentStations(response.data.azs), stations: presentStations(response.data.azs),
reviews: presentReviews(response.data.otzyvy), reviews: presentReviews(response.data.otzyvy),
}; };
@ -75,7 +75,7 @@ export const mainPageApi = taylorAPI.injectEndpoints({
transformResponse: (response: any) => { transformResponse: (response: any) => {
return { 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) => { 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) => { 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 { MapPin } from 'lucide-react';
import Image from 'next/image'; import Image from 'next/image';
import Link from 'next/link'; import Link from 'next/link';
import { useEffect } from 'react';
import { useTextController } from '@/shared/language/hooks/use-text-controller'; import { useTextController } from '@/shared/language/hooks/use-text-controller';
import { useMediaController } from '@/shared/media/hooks/use-media-controller'; import { useMediaController } from '@/shared/media/hooks/use-media-controller';
@ -12,8 +13,32 @@ export const HeroSection = () => {
const { t } = useTextController(); const { t } = useTextController();
const { m } = useMediaController(); 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 ( return (
<section className='relative'> <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 className='relative h-[550px] w-full overflow-hidden bg-black sm:h-[500px] xl:h-[650px]'>
<div <div
style={{ style={{