import ChatMessageRow from '../ChatMessageRow/index.jsx'; import ButtonBoxTile from '../ButtonBoxTile/index.jsx'; function getSafeWikiUrl(rawUrl) { const text = String(rawUrl || '').trim(); if (!text) return ''; try { /* Wiki links are operator-authored registry data, but this still normalizes them before rendering an anchor. Allowing only http/https avoids turning a barcode registry typo into a javascript: link while still supporting both absolute URLs and local wiki paths such as /wiki/object-name. */ const parsed = new URL(text, window.location.origin); if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') return ''; return parsed.href; } catch { return ''; } } function BarcodeScanToast({ payload }) { const wikiUrl = getSafeWikiUrl(payload?.wikiUrl); const label = payload?.label || payload?.code || 'unknown barcode'; return (
Barcode scanned: {label} {wikiUrl ? ( Wiki link ) : null}
Please dock your rover
Your rover is still undocked. Please dock it before leaving the page.
{payload.description}
) : null}{alert.title || 'Alert'} ยท {alert.message}