import type { Scene, Settings } from '../types'; export const informationOptions = [ { id: 'service', setting: 'infoServiceEnabled', name: 'Маршрут', label: 'Дальше по ближайшему рейсу' }, { id: 'weather', setting: 'infoWeatherEnabled', name: 'Погода', label: 'Погода' }, { id: 'qr', setting: 'infoQrEnabled', name: 'RideBus', label: 'QR-код расписания' }, { id: 'places', setting: 'infoPlacesEnabled', name: 'Места', label: 'До важных мест' }, { id: 'fare', setting: 'infoFareEnabled', name: 'Оплата', label: 'Оплата поездки' }, ] as const; export type InformationAvailable = { places: boolean; fare: boolean }; export function informationBlocks(settings: Settings, available?: InformationAvailable) { return informationOptions.filter(block => settings[block.setting] && (block.id !== 'places' || (available?.places ?? settings.places.length > 0)) && (block.id !== 'fare' || (available?.fare ?? settings.fareRules.length + settings.fareByType.length > 0))); } export function boardScenes(settings: Settings, hasAlerts: boolean, urgent: boolean, available?: InformationAvailable): Scene[] { return ['departures', ...(hasAlerts || informationBlocks(settings, available).length ? ['info'] : []), ...(settings.adsEnabled && !urgent ? ['ad'] : [])] as Scene[]; }