feat(landing): get title from cms
This commit is contained in:
@@ -6,10 +6,7 @@ interface Props {
|
|||||||
description?: string
|
description?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const {
|
const { title = '', description = '' } = Astro.props
|
||||||
title = 'SOFTCLICK - Российские IT-решения с 2021 года',
|
|
||||||
description = 'SOFTCLICK - российская IT-компания, специализирующаяся на импортозамещении и внедрении отечественных решений',
|
|
||||||
} = Astro.props
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<html lang="ru">
|
<html lang="ru">
|
||||||
|
|||||||
@@ -1,9 +1,21 @@
|
|||||||
---
|
---
|
||||||
import Layout from '../layouts/Layout.astro'
|
import Layout from '../layouts/Layout.astro'
|
||||||
import '../styles/globals.css'
|
import '../styles/globals.css'
|
||||||
|
import { siteConfigQuery } from '../graphql-documents/site-config.gql.generated'
|
||||||
|
|
||||||
|
let siteTitle = ''
|
||||||
|
let siteDescription = ''
|
||||||
|
|
||||||
|
try {
|
||||||
|
const siteResult = await siteConfigQuery.execute()
|
||||||
|
siteTitle = siteResult.data?.siteConfig?.title ?? ''
|
||||||
|
siteDescription = siteResult.data?.siteConfig?.description ?? ''
|
||||||
|
} catch {
|
||||||
|
// CMS may be unavailable on error pages
|
||||||
|
}
|
||||||
---
|
---
|
||||||
|
|
||||||
<Layout>
|
<Layout title={siteTitle} description={siteDescription}>
|
||||||
<div class="min-h-screen grid content-center justify-items-center">
|
<div class="min-h-screen grid content-center justify-items-center">
|
||||||
<div>500</div>
|
<div>500</div>
|
||||||
<div>Мы скоро всё починим</div>
|
<div>Мы скоро всё починим</div>
|
||||||
|
|||||||
@@ -13,7 +13,10 @@ const [siteResult, menuItemsResult] = await Promise.all([siteConfigQuery.execute
|
|||||||
if (siteResult.errors?.length) {
|
if (siteResult.errors?.length) {
|
||||||
throw new Error(siteResult.errors.map(e => e.message).join(', '))
|
throw new Error(siteResult.errors.map(e => e.message).join(', '))
|
||||||
}
|
}
|
||||||
const contacts = siteResult.data?.siteConfig?.contacts?.filter(c => c != null) ?? []
|
const siteConfig = siteResult.data?.siteConfig
|
||||||
|
const siteTitle = siteConfig?.title ?? ''
|
||||||
|
const siteDescription = siteConfig?.description ?? ''
|
||||||
|
const contacts = siteConfig?.contacts?.filter(c => c != null) ?? []
|
||||||
if (menuItemsResult.errors?.length) {
|
if (menuItemsResult.errors?.length) {
|
||||||
throw new Error(menuItemsResult.errors.map(e => e.message).join(', '))
|
throw new Error(menuItemsResult.errors.map(e => e.message).join(', '))
|
||||||
}
|
}
|
||||||
@@ -51,10 +54,13 @@ const vendors = (category.vendors?.filter(v => v != null) ?? []).map(vendor => (
|
|||||||
}))
|
}))
|
||||||
---
|
---
|
||||||
|
|
||||||
<Layout>
|
<Layout
|
||||||
|
title={title ? `${title} | ${siteTitle}` : siteTitle}
|
||||||
|
description={description ?? siteDescription}
|
||||||
|
>
|
||||||
<div class="min-h-screen bg-white w-full overflow-x-hidden">
|
<div class="min-h-screen bg-white w-full overflow-x-hidden">
|
||||||
<Header client:load contacts={contacts} solutions={solutionCategories} services={serviceCategories} />
|
<Header client:load siteTitle={siteTitle} contacts={contacts} solutions={solutionCategories} services={serviceCategories} />
|
||||||
<CategoryView client:load badge={badge} title={title} description={description} vendors={vendors} contacts={contacts} />
|
<CategoryView client:load badge={badge} title={title} description={description} vendors={vendors} contacts={contacts} />
|
||||||
<Footer client:load contacts={contacts} solutionCategories={solutionCategories} />
|
<Footer client:load siteTitle={siteTitle} contacts={contacts} solutionCategories={solutionCategories} />
|
||||||
</div>
|
</div>
|
||||||
</Layout>
|
</Layout>
|
||||||
|
|||||||
@@ -26,7 +26,10 @@ if (menuItemsResult.errors?.length) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const homePage = homeResult.data?.homePage ?? null
|
const homePage = homeResult.data?.homePage ?? null
|
||||||
const contacts = siteResult.data?.siteConfig?.contacts?.filter(c => c != null) ?? []
|
const siteConfig = siteResult.data?.siteConfig
|
||||||
|
const siteTitle = siteConfig?.title ?? ''
|
||||||
|
const siteDescription = siteConfig?.description ?? ''
|
||||||
|
const contacts = siteConfig?.contacts?.filter(c => c != null) ?? []
|
||||||
const menuItems = (menuItemsResult.data?.categories?.filter(c => c != null) ?? []).sort(
|
const menuItems = (menuItemsResult.data?.categories?.filter(c => c != null) ?? []).sort(
|
||||||
(a, b) => a.sortOrder - b.sortOrder
|
(a, b) => a.sortOrder - b.sortOrder
|
||||||
)
|
)
|
||||||
@@ -35,10 +38,10 @@ const solutionCategories = menuItems.filter(c => c.group === Enum_Category_Group
|
|||||||
const serviceCategories = menuItems.filter(c => c.group === Enum_Category_Group.Service)
|
const serviceCategories = menuItems.filter(c => c.group === Enum_Category_Group.Service)
|
||||||
---
|
---
|
||||||
|
|
||||||
<Layout>
|
<Layout title={siteTitle} description={siteDescription}>
|
||||||
<div class="min-h-screen bg-white w-full overflow-x-hidden">
|
<div class="min-h-screen bg-white w-full overflow-x-hidden">
|
||||||
<Header client:load contacts={contacts} solutions={solutionCategories} services={serviceCategories} />
|
<Header client:load siteTitle={siteTitle} contacts={contacts} solutions={solutionCategories} services={serviceCategories} />
|
||||||
<HomePage client:load homePage={homePage} contacts={contacts} />
|
<HomePage client:load homePage={homePage} contacts={contacts} />
|
||||||
<Footer client:load contacts={contacts} solutionCategories={solutionCategories} />
|
<Footer client:load siteTitle={siteTitle} contacts={contacts} solutionCategories={solutionCategories} />
|
||||||
</div>
|
</div>
|
||||||
</Layout>
|
</Layout>
|
||||||
|
|||||||
@@ -7,11 +7,12 @@ import type { SiteConfigContact } from '../lib/cms/contact/types'
|
|||||||
type CategoryNavItem = NonNullable<MenuItemsQuery['categories'][number]>
|
type CategoryNavItem = NonNullable<MenuItemsQuery['categories'][number]>
|
||||||
|
|
||||||
export interface FooterProps {
|
export interface FooterProps {
|
||||||
|
siteTitle?: string
|
||||||
contacts?: readonly SiteConfigContact[]
|
contacts?: readonly SiteConfigContact[]
|
||||||
solutionCategories?: CategoryNavItem[]
|
solutionCategories?: CategoryNavItem[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export function Footer({ contacts = [], solutionCategories = [] }: FooterProps) {
|
export function Footer({ siteTitle = '', contacts = [], solutionCategories = [] }: FooterProps) {
|
||||||
return (
|
return (
|
||||||
<footer className="bg-gray-900 text-gray-400 pt-20 pb-10 border-t border-gray-800">
|
<footer className="bg-gray-900 text-gray-400 pt-20 pb-10 border-t border-gray-800">
|
||||||
<div className="max-w-400 mx-auto px-6 xl:px-12 2xl:px-16">
|
<div className="max-w-400 mx-auto px-6 xl:px-12 2xl:px-16">
|
||||||
@@ -21,7 +22,7 @@ export function Footer({ contacts = [], solutionCategories = [] }: FooterProps)
|
|||||||
<div className="w-9 h-9 bg-linear-to-br from-blue-600 to-blue-700 rounded-lg flex items-center justify-center shadow-md">
|
<div className="w-9 h-9 bg-linear-to-br from-blue-600 to-blue-700 rounded-lg flex items-center justify-center shadow-md">
|
||||||
<div className="w-5 h-5 border-2 border-white rounded"></div>
|
<div className="w-5 h-5 border-2 border-white rounded"></div>
|
||||||
</div>
|
</div>
|
||||||
<span className="text-2xl text-white tracking-tight">SOFTCLICK</span>
|
<span className="text-2xl text-white tracking-tight">{siteTitle}</span>
|
||||||
</div>
|
</div>
|
||||||
<p className="mb-6 leading-relaxed">Комплексные IT-решения для развития бизнеса</p>
|
<p className="mb-6 leading-relaxed">Комплексные IT-решения для развития бизнеса</p>
|
||||||
<div className="flex gap-4">
|
<div className="flex gap-4">
|
||||||
@@ -106,7 +107,7 @@ export function Footer({ contacts = [], solutionCategories = [] }: FooterProps)
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="pt-8 border-t border-gray-800 flex flex-col md:flex-row justify-between items-center gap-4">
|
<div className="pt-8 border-t border-gray-800 flex flex-col md:flex-row justify-between items-center gap-4">
|
||||||
<div>© 2025 SOFTCLICK. Все права защищены.</div>
|
<div>© 2025 {siteTitle}. Все права защищены.</div>
|
||||||
<div className="flex gap-6">
|
<div className="flex gap-6">
|
||||||
<a href="#" className="hover:text-blue-400 transition-colors">
|
<a href="#" className="hover:text-blue-400 transition-colors">
|
||||||
Политика конфиденциальности
|
Политика конфиденциальности
|
||||||
|
|||||||
@@ -8,12 +8,13 @@ import { navigateHomeSectionAnchor } from '../lib/scrollToHash'
|
|||||||
type CategoryNavItem = NonNullable<MenuItemsQuery['categories'][number]>
|
type CategoryNavItem = NonNullable<MenuItemsQuery['categories'][number]>
|
||||||
|
|
||||||
export interface HeaderProps {
|
export interface HeaderProps {
|
||||||
|
siteTitle?: string
|
||||||
contacts?: readonly SiteConfigContact[]
|
contacts?: readonly SiteConfigContact[]
|
||||||
solutions?: readonly CategoryNavItem[]
|
solutions?: readonly CategoryNavItem[]
|
||||||
services?: readonly CategoryNavItem[]
|
services?: readonly CategoryNavItem[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export function Header({ contacts = [], solutions = [], services = [] }: HeaderProps) {
|
export function Header({ siteTitle = '', contacts = [], solutions = [], services = [] }: HeaderProps) {
|
||||||
const [isMenuOpen, setIsMenuOpen] = useState(false)
|
const [isMenuOpen, setIsMenuOpen] = useState(false)
|
||||||
const [isSolutionsOpen, setIsSolutionsOpen] = useState(false)
|
const [isSolutionsOpen, setIsSolutionsOpen] = useState(false)
|
||||||
const [isServicesOpen, setIsServicesOpen] = useState(false)
|
const [isServicesOpen, setIsServicesOpen] = useState(false)
|
||||||
@@ -25,7 +26,7 @@ export function Header({ contacts = [], solutions = [], services = [] }: HeaderP
|
|||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<div className="flex items-center gap-12">
|
<div className="flex items-center gap-12">
|
||||||
<a href="/" className="flex items-center gap-3 group">
|
<a href="/" className="flex items-center gap-3 group">
|
||||||
<span className="text-2xl text-gray-900 tracking-wide font-bold">SOFTCLICK</span>
|
<span className="text-2xl text-gray-900 tracking-wide font-bold">{siteTitle}</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<div className="hidden lg:flex items-center gap-8">
|
<div className="hidden lg:flex items-center gap-8">
|
||||||
|
|||||||
Reference in New Issue
Block a user