167 lines
7.0 KiB
TypeScript
167 lines
7.0 KiB
TypeScript
'use client'
|
||
|
||
|
||
import Link from "next/link";
|
||
import Image from "next/image";
|
||
import {
|
||
AppSection, AppText, FaqAccordion, FaqTitle, Footer,
|
||
MainPage,
|
||
HeaderBlock, HeaderPhone,
|
||
Section,
|
||
StartBlock
|
||
} from "@/app/main.styled";
|
||
import StyledButton from "@/components/StyledButton";
|
||
import RoomList from "@/components/RoomsList";
|
||
import PriceList from "@/components/PriceList";
|
||
import FeaturesList from "@/components/FeaturesList";
|
||
import GameList from "@/components/GameList";
|
||
import React, {useEffect, useState} from "react";
|
||
import Accordion from "@/components/Accordion";
|
||
import HeaderPage from "@/components/HeaderPage";
|
||
import {useBronStore} from "@/store/useBronStore";
|
||
import BronModal from "@/components/BronModal";
|
||
import { motion } from "framer-motion";
|
||
|
||
type Faq = {
|
||
id: number
|
||
title: string
|
||
description: string
|
||
}
|
||
type Contacts = {
|
||
id: number
|
||
type: string
|
||
value: string
|
||
}
|
||
|
||
|
||
export default function Home() {
|
||
const open = useBronStore((s) => s.open);
|
||
const [faqs, setFaqs] = useState<Faq[]>([])
|
||
const [contacts, setContacts] = useState<Contacts[]>([])
|
||
|
||
const phone = contacts.find((c)=> c.type ==='phone');
|
||
const tg = contacts.find((c)=> c.type ==='tg');
|
||
const gis2 = contacts.find((c)=> c.type ==='gis2');
|
||
|
||
useEffect(() => {
|
||
async function fetchFaq() {
|
||
const res = await fetch(`/api/faq`);
|
||
const data = await res.json();
|
||
setFaqs(data);
|
||
}
|
||
async function fetchContact() {
|
||
const res = await fetch(`/api/contacts`);
|
||
const data = await res.json();
|
||
setContacts(data);
|
||
}
|
||
|
||
fetchFaq();
|
||
fetchContact();
|
||
}, []);
|
||
|
||
return (
|
||
<MainPage>
|
||
<HeaderPage tg={tg?.value} phone={phone?.value} gis2={gis2?.value} />
|
||
<main>
|
||
<StartBlock>
|
||
|
||
<Image src={'/images/startLeft.png'} alt={'startLeft'} width={482} height={440} />
|
||
|
||
<motion.h1
|
||
initial={{ opacity: 0, y: 40 }}
|
||
animate={{ opacity: 1, y: 0 }}
|
||
transition={{ duration: 0.8, delay: 0.5 }}
|
||
>
|
||
Выигрывай чаще и получай удовольствие <span>от компьютерных игр</span>
|
||
</motion.h1>
|
||
|
||
<motion.div
|
||
initial={{ scale: 0.8, opacity: 0 }}
|
||
animate={{ scale: 1, opacity: 1 }}
|
||
transition={{ duration: 0.8, delay: 0.8 }}
|
||
>
|
||
<StyledButton onClick={() => open('start')} label={'Забронировать место'} padding={'14px 46px'} fontSize={'42px'} />
|
||
</motion.div>
|
||
|
||
|
||
<Image src={'/images/startRight.png'} alt={'startRight'} width={422} height={410} quality={100} />
|
||
</StartBlock>
|
||
<Section className={'roomSection'}>
|
||
<h2>В нашем клубе мы предлагаем только <span>современное и надёжное</span> оборудование, которое обеспечит вам <span>комфортную игру</span></h2>
|
||
<RoomList />
|
||
</Section>
|
||
<Section>
|
||
<PriceList />
|
||
</Section>
|
||
<Section>
|
||
<FeaturesList />
|
||
</Section>
|
||
<Section>
|
||
<GameList tg={tg?.value} />
|
||
</Section>
|
||
<AppSection>
|
||
<AppText>
|
||
<StyledButton label={'Приложение'} padding={'12px 38px'} fontSize={'24px'} />
|
||
<h2>Скоро в твоём смартфоне.</h2>
|
||
<p>Приложение Strike Arena сейчас в разработке. Бронирование, события, профиль и пополнение счёта — <span>всё в одном месте. Скоро.</span></p>
|
||
</AppText>
|
||
<Image className={'phoneApp'} src={'/images/phone.png'} alt={'phone'} width={412} height={414} loading={"lazy"} />
|
||
</AppSection>
|
||
<FaqAccordion>
|
||
<FaqTitle>
|
||
<h2>FAQ</h2>
|
||
<h3>Часто задаваемые вопросы</h3>
|
||
</FaqTitle>
|
||
{faqs.map((faqBlock)=>(
|
||
<Accordion key={faqBlock.id} title={faqBlock.title}>
|
||
{faqBlock.description}
|
||
</Accordion>
|
||
))}
|
||
</FaqAccordion>
|
||
</main>
|
||
<Footer>
|
||
<Link href='/' className={'logo'}>
|
||
<Image src={'/icons/logo.png'} alt={'logo'} width={226} height={60} loading={'lazy'} />
|
||
</Link>
|
||
<Link href='/policy' className={'policy'}>
|
||
Политика<br/> конфиденциальности
|
||
</Link>
|
||
<HeaderBlock className={'footerBlock'}>
|
||
<div>
|
||
{tg ? (
|
||
<Link href={tg.value} className="tgLink" target="_blank">
|
||
<Image src="/icons/tg.png" alt="tg" width={48} height={48} loading="lazy" />
|
||
</Link>
|
||
) : (
|
||
<Image src="/icons/tg.png" alt="tg" width={48} height={48} loading="lazy" />
|
||
)}
|
||
|
||
<Link href="https://vk.ru" className="vkLink" target="_blank">
|
||
<Image src="/icons/vk.svg" alt="vk" width={44} height={44} loading="lazy" />
|
||
</Link>
|
||
|
||
<Link href="https://max.ru" className="maxLink" target="_blank">
|
||
<Image src="/icons/max.svg" alt="max" width={44} height={44} loading="lazy" />
|
||
</Link>
|
||
|
||
{gis2 ? (
|
||
<Link href={gis2.value} className="gis2Link headerImage" target="_blank">
|
||
<Image src="/icons/location.svg" alt="geo" width={37} height={50} loading="lazy" />
|
||
</Link>
|
||
) : (
|
||
<Link href={'/'} className="gis2Link headerImage" target="_blank">
|
||
<Image src="/icons/location.svg" alt="geo" width={37} height={50} loading="lazy" />
|
||
</Link>
|
||
)}
|
||
</div>
|
||
<HeaderPhone className={'footerPhone'}>
|
||
<p style={{ marginBottom: 0 }}>{phone?.value}</p>
|
||
<h4 onClick={() => open('zayvka-game')}>Заказать звонок</h4>
|
||
</HeaderPhone>
|
||
</HeaderBlock>
|
||
</Footer>
|
||
<BronModal />
|
||
</MainPage>
|
||
);
|
||
};
|