import Head from 'next/head' import Link from 'next/link' import styles from './wifi-qrcode.module.scss' import { QRCodeSVG } from 'qrcode.react' function generateQRString(details) { const bits = { S: details.ssid, } if (details.psk) { bits.P = details.psk bits.T = "WPA" } else { bits.T = "nopass" } if (details.hidden) { bits.H = "true" } const escapeStr = (s) => { if (s.match(/^[0-9A-Fa-f]+$/)) { return `"${s}"` } return s } const generateWifiFromBits = (bits) => { let o = []; for (const b in bits) { if (!bits.hasOwnProperty(b)) continue o.push(`${b}:${escapeStr(bits[b])}`) } return o.join(';') } return `WIFI:${generateWifiFromBits(bits)};;` } function WifiQRCode({ details }) { const hasLogo = details.eventName.match(/^http[s]?:/) return (