UNPKG

portal-www

Version:

Nova Portal Website. Based on Next starter by Ueno

90 lines (77 loc) 2.23 kB
import { ServiceStatus, ServiceType } from 'typings/graphql'; type NavItem = { id: string; text: string; href: string; }; // Navigation for /thjonustur/{service-id}/... export function getServiceSubnav( serviceType: string | undefined | null, customerId: string | undefined, serviceId: string, status: ServiceStatus, ): NavItem[] { const Overview = { id: 'overview', text: 'common:hero.overview', href: `/beta/${customerId}/thjonustur/${serviceId}`, }; const Abroad = { id: 'abroad', text: 'common:hero.abroad', href: `/beta/${customerId}/thjonustur/${serviceId}/utlond`, }; const Report = { id: 'report', text: 'common:hero.report', href: `/beta/${customerId}/thjonustur/${serviceId}/sundurlidun`, }; const Subscriptions = { id: 'subscriptions', text: 'common:hero.subscriptions', href: `/beta/${customerId}/thjonustur/${serviceId}`, }; const History = { id: 'history', text: 'common:hero.history', href: `/beta/${customerId}/thjonustur/${serviceId}/sagan`, }; const Refillhistory = { id: 'refillhistory', text: 'common:hero.refillHistory', href: `/beta/${customerId}/thjonustur/${serviceId}/afyllingarsaga`, }; const Paymenthistory = { id: 'Paymenthistory', text: 'common:hero.payedHistory', href: `/beta/${customerId}/thjonustur/${serviceId}/greidslusaga`, }; const Settings = { id: 'settings', text: 'common:hero.settings', href: `/beta/${customerId}/thjonustur/${serviceId}/stillingar`, }; if (status === ServiceStatus.Terminated) { return [Overview, History]; } switch (serviceType) { case ServiceType.Mobile: return [Overview, Abroad, Report, Refillhistory, Settings]; break; case ServiceType.MobileInternet: return [Overview, Report, Refillhistory, Settings]; break; case ServiceType.Landline: return [Overview, Report, Refillhistory, Settings]; break; case ServiceType.Fiber: return [Overview, Report, Settings, History]; break; case ServiceType.Tv: return [Subscriptions, History, Paymenthistory, Settings]; break; default: return [Overview]; break; } }