remove company website pages

This commit is contained in:
root
2026-05-17 08:53:19 -04:00
parent f52e53519c
commit 84285335a4
58 changed files with 106 additions and 5065 deletions
-2
View File
@@ -2,5 +2,3 @@ export * from './damage'
export * from './fuel'
export * from './api'
export * from './marketplace-homepage'
export * from './public-homepage-layout'
export * from './public-site-sections'
@@ -1,87 +0,0 @@
export const PUBLIC_HOMEPAGE_GRID_COLUMNS = 12
export const PUBLIC_HOMEPAGE_GRID_ROWS = 12
export type PublicHomepageSectionType = 'hero' | 'offers' | 'vehicles' | 'pricing'
export type PublicHomepageLayoutItem = {
id: string
type: PublicHomepageSectionType
x: number
y: number
w: number
h: number
}
export type PublicHomepageLayout = {
items: PublicHomepageLayoutItem[]
}
export const defaultPublicHomepageLayout: PublicHomepageLayout = {
items: [
{ id: 'hero', type: 'hero', x: 1, y: 1, w: 7, h: 5 },
{ id: 'offers', type: 'offers', x: 8, y: 1, w: 5, h: 3 },
{ id: 'vehicles', type: 'vehicles', x: 1, y: 6, w: 7, h: 4 },
{ id: 'pricing', type: 'pricing', x: 8, y: 4, w: 5, h: 6 },
],
}
const SECTION_LIMITS: Record<PublicHomepageSectionType, { minW: number; minH: number; maxW: number; maxH: number }> = {
hero: { minW: 4, minH: 4, maxW: 12, maxH: 8 },
offers: { minW: 3, minH: 2, maxW: 12, maxH: 8 },
vehicles: { minW: 4, minH: 3, maxW: 12, maxH: 8 },
pricing: { minW: 4, minH: 4, maxW: 12, maxH: 9 },
}
function clamp(value: number, min: number, max: number) {
return Math.min(Math.max(value, min), max)
}
export function clonePublicHomepageLayout(): PublicHomepageLayout {
return JSON.parse(JSON.stringify(defaultPublicHomepageLayout)) as PublicHomepageLayout
}
export function getPublicHomepageSectionLimits(type: PublicHomepageSectionType) {
return SECTION_LIMITS[type]
}
export function normalizePublicHomepageLayoutItem(item: PublicHomepageLayoutItem): PublicHomepageLayoutItem {
const limits = SECTION_LIMITS[item.type]
const w = clamp(Math.round(item.w), limits.minW, limits.maxW)
const h = clamp(Math.round(item.h), limits.minH, limits.maxH)
const x = clamp(Math.round(item.x), 1, PUBLIC_HOMEPAGE_GRID_COLUMNS - w + 1)
const y = clamp(Math.round(item.y), 1, PUBLIC_HOMEPAGE_GRID_ROWS - h + 1)
return {
id: item.id,
type: item.type,
x,
y,
w,
h,
}
}
export function resolvePublicHomepageLayout(
layout?: Partial<PublicHomepageLayout> | null,
visibleTypes?: PublicHomepageSectionType[],
): PublicHomepageLayout {
const defaultsByType = new Map(defaultPublicHomepageLayout.items.map((item) => [item.type, item] as const))
const allowedTypes = new Set<PublicHomepageSectionType>(visibleTypes ?? (['hero', 'offers', 'vehicles', 'pricing'] as PublicHomepageSectionType[]))
const items = (layout?.items ?? [])
.filter((item): item is PublicHomepageLayoutItem => {
if (!item || typeof item !== 'object') return false
if (!('type' in item) || !allowedTypes.has(item.type as PublicHomepageSectionType)) return false
return ['id', 'x', 'y', 'w', 'h'].every((key) => key in item)
})
.map((item) => normalizePublicHomepageLayoutItem(item))
const seen = new Set(items.map((item) => item.type))
for (const type of allowedTypes) {
if (seen.has(type)) continue
const fallback = defaultsByType.get(type)
if (fallback) items.push(fallback)
}
return {
items: items.sort((a, b) => (a.y - b.y) || (a.x - b.x)),
}
}
@@ -1,99 +0,0 @@
export type PublicSitePageSections = {
home: {
hero: boolean
offers: boolean
vehicles: boolean
pricing: boolean
}
about: {
hero: boolean
highlights: boolean
details: boolean
}
offers: {
header: boolean
grid: boolean
}
pricing: {
hero: boolean
plans: boolean
payments: boolean
faq: boolean
}
vehicles: {
header: boolean
filters: boolean
grid: boolean
}
vehicleDetail: {
gallery: boolean
summary: boolean
}
blog: {
hero: boolean
posts: boolean
}
contact: {
content: boolean
}
booking: {
content: boolean
}
bookingConfirmation: {
hero: boolean
summary: boolean
actions: boolean
}
}
export const defaultPublicSitePageSections: PublicSitePageSections = {
home: {
hero: true,
offers: true,
vehicles: true,
pricing: true,
},
about: {
hero: true,
highlights: true,
details: true,
},
offers: {
header: true,
grid: true,
},
pricing: {
hero: true,
plans: true,
payments: true,
faq: true,
},
vehicles: {
header: true,
filters: true,
grid: true,
},
vehicleDetail: {
gallery: true,
summary: true,
},
blog: {
hero: true,
posts: true,
},
contact: {
content: true,
},
booking: {
content: true,
},
bookingConfirmation: {
hero: true,
summary: true,
actions: true,
},
}
export function clonePublicSitePageSections(): PublicSitePageSections {
return JSON.parse(JSON.stringify(defaultPublicSitePageSections)) as PublicSitePageSections
}