module ApplicationHelper include Pagy::Frontend if defined?(Pagy) # Helper method for time period selector styling def time_period_class(period) base_classes = "px-4 py-2 text-sm font-medium border-r border-gray-300 last:border-r-0" if @time_period == period base_classes + " bg-blue-600 text-white" else base_classes + " text-gray-700 hover:bg-gray-50" end end # Custom pagination with Tailwind CSS styling def pagy_nav_tailwind(pagy, pagy_id: nil) return '' if pagy.pages <= 1 html = '' raw html end # Helper methods for job queue status colors def job_queue_status_color(status) case status.to_s when 'healthy' 'bg-green-500' when 'warning' 'bg-yellow-500' when 'critical' 'bg-red-500' when 'error' 'bg-gray-500' else 'bg-blue-500' end end def job_queue_status_text_color(status) case status.to_s when 'healthy' 'text-green-600' when 'warning' 'text-yellow-600' when 'critical' 'text-red-600' when 'error' 'text-gray-600' else 'text-blue-600' end end # Parse user agent string into readable components def parse_user_agent(user_agent) return nil if user_agent.blank? client = DeviceDetector.new(user_agent) { name: client.name, version: client.full_version, os_name: client.os_name, os_version: client.os_full_version, device_type: client.device_type || "desktop", device_name: client.device_name, bot: client.bot?, bot_name: client.bot_name, raw: user_agent } end end