- Implemented Form301 component for displaying OSHA Form 301 equivalent, including employee and case information. - Created Osha component to manage OSHA recordkeeping, including tabs for 300 Log, 300A Summary, Hours & rates, and Submit to OSHA. - Added functionality for printing and downloading CSV files for OSHA submissions. - Integrated loading and error handling states for data fetching.
41 lines
1.4 KiB
TypeScript
41 lines
1.4 KiB
TypeScript
import { BarChart3, ClipboardCheck, ClipboardList, FileSpreadsheet, LayoutDashboard, MapPin, type LucideIcon } from 'lucide-react'
|
|
import type { Role } from '../../shared/enums.ts'
|
|
|
|
import type { Messages } from '../i18n/en'
|
|
|
|
export interface NavItem {
|
|
label: keyof Messages['nav']
|
|
to: string
|
|
icon: LucideIcon
|
|
/** Hidden from roles below this. */
|
|
minRole?: Role
|
|
}
|
|
|
|
export const primaryNav: NavItem[] = [
|
|
{ label: 'overview', to: '/', icon: LayoutDashboard },
|
|
{ label: 'incidents', to: '/incidents', icon: ClipboardList },
|
|
{ label: 'myActions', to: '/actions', icon: ClipboardCheck },
|
|
{ label: 'locations', to: '/locations', icon: MapPin },
|
|
{ label: 'analytics', to: '/analytics', icon: BarChart3 },
|
|
{ label: 'osha', to: '/osha', icon: FileSpreadsheet, minRole: 'safety_manager' },
|
|
]
|
|
|
|
export function pageTitle(pathname: string): string {
|
|
if (/^\/osha\/cases\//.test(pathname)) return 'Form 301'
|
|
const incident = /^\/incidents\/(\d+)/.exec(pathname)
|
|
if (incident) return `INC-${incident[1].padStart(4, '0')}`
|
|
const titles: Record<string, string> = {
|
|
'/': 'Overview',
|
|
'/incidents': 'Incidents',
|
|
'/actions': 'My actions',
|
|
'/locations': 'Locations',
|
|
'/analytics': 'Analytics',
|
|
'/osha': 'OSHA log',
|
|
'/report': 'Report an incident',
|
|
'/locations/qr': 'QR codes',
|
|
'/settings': 'Settings',
|
|
'/about': 'About',
|
|
}
|
|
return titles[pathname] ?? 'Not found'
|
|
}
|