React + Vite frontend with bilingual EN/RU support, vehicle listings, detail pages with photo gallery, and dummy vehicle data. Spring Boot backend scaffold included. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
27 lines
580 B
JavaScript
27 lines
580 B
JavaScript
import { vehicles } from '../data/vehicles.js'
|
|
|
|
export function getAllVehicles() {
|
|
return vehicles
|
|
}
|
|
|
|
export function getVehicleById(id) {
|
|
return vehicles.find(v => v.id === Number(id)) ?? null
|
|
}
|
|
|
|
export function getVehiclesByType(type) {
|
|
return vehicles.filter(v => v.type === type)
|
|
}
|
|
|
|
export function getFeaturedVehicles(limit = 6) {
|
|
return vehicles.slice(0, limit)
|
|
}
|
|
|
|
export function getStats() {
|
|
return {
|
|
cars: vehicles.filter(v => v.type === 'car').length,
|
|
trucks: vehicles.filter(v => v.type === 'truck').length,
|
|
sellers: 540,
|
|
rating: '4.8',
|
|
}
|
|
}
|