From e1927f633cab988ceeb8bcd51dd03aaa5b3f2392 Mon Sep 17 00:00:00 2001 From: Ben Woodward Date: Sat, 24 Jan 2026 20:46:24 -0800 Subject: Updates jan 2026 (#313) * Update dependencies to latest versions and migrate to React 19 - Update all dependencies to latest versions - Migrate to React 19 createRoot API (replaces deprecated ReactDOM.render) - Update qrcode.react import to v4 named export (QRCodeSVG) * Format CSS with prettier * Add Hebrew translation * Add Slovak translation * Add Malagasy translation * Add Bangla translation * Init field * Change the logic concerning number of cards to print * fix/clean * Fix Increment-field-ID-in-the-print-area * Increment-field-ID-in-the-print-area * Review id implementation logic * Fix git commit * Handle Query parameter * Fix package.json * Fix query parameter for language * fix query parameter for language * Fix EncryptionModeChange query parameters // Error when non in query * Fix EncryptionModeChange query parameters // Error when empty in query * clean Setting.js don't need to import i18n * clean file App.js * first iteration for Hash * Add Esperanto translation * Update translations for Occitan 2 lines added * Update translations.js Added Swiss German to the Translations JavaScript-File * Update translations.js Removed custom Translations-Strings of my own Version. * Update README.md * Format translations.js with prettier --------- Co-authored-by: Ido Bronfeld Co-authored-by: Matej Kubinec Co-authored-by: mpilasy <88362233+mpilasy@users.noreply.github.com> Co-authored-by: Tarek Hasan <94107336+Tarek-Hasan@users.noreply.github.com> Co-authored-by: ofostier Co-authored-by: zeecho <30541894+zeecho@users.noreply.github.com> Co-authored-by: Mejans <61360811+Mejans@users.noreply.github.com> Co-authored-by: Jan Zehnder <44242812+NZehnder@users.noreply.github.com> --- src/components/Settings.js | 1 + src/components/WifiCard.js | 13 +++++++----- src/components/style.css | 7 ++++++ src/components/useHashParam.js | 48 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 64 insertions(+), 5 deletions(-) create mode 100644 src/components/useHashParam.js (limited to 'src/components') diff --git a/src/components/Settings.js b/src/components/Settings.js index 837b4f0..0485aaf 100644 --- a/src/components/Settings.js +++ b/src/components/Settings.js @@ -20,6 +20,7 @@ export const Settings = (props) => { { label: 'WEP', value: 'WEP' }, ]; const eapMethods = [{ label: 'PWD', value: 'PWD' }]; + const langSelectDefaultValue = () => { const t = Translations.filter((t) => t.id === i18n.language); if (t.length !== 1) { diff --git a/src/components/WifiCard.js b/src/components/WifiCard.js index 70e1189..e977ac8 100644 --- a/src/components/WifiCard.js +++ b/src/components/WifiCard.js @@ -8,7 +8,7 @@ import { Text, TextareaField, } from 'evergreen-ui'; -import QRCode from 'qrcode.react'; +import { QRCodeSVG as QRCode } from 'qrcode.react'; import { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import logo from '../../src/images/wifi.png'; @@ -71,6 +71,9 @@ export const WifiCard = (props) => { return !eapIdentityFieldLabel() ? '' : t('wifi.encryption.eapMethod'); }; + const keyid = props.keyid || ''; + const suffixKeyID = (prefix) => `${prefix}-${keyid}`; + return ( { { {props.settings.encryptionMode === 'WPA2-EAP' && ( <> { /> { )} {!(props.settings.hidePassword || !props.settings.encryptionMode) && ( { + const hash = location.hash.slice(1); + const [prefix, query] = hash.split('?'); + + return [prefix, new URLSearchParams(query)]; +}; + +const getHashParam = (key, location = window.location) => { + const [_, searchParams] = getHashSearchParams(location); + return searchParams.get(key); +}; + +const setHashParam = (key, value, location = window.location) => { + const [prefix, searchParams] = getHashSearchParams(location); + + if (typeof value === 'undefined') { + searchParams.delete(key); + } else { + searchParams.set(key, value); + } + + const search = searchParams.toString(); + location.hash = search ? `${prefix}?${search}` : prefix; +}; + +const useHashParam = (key) => { + const [innerValue, setInnerValue] = useState(); + + useEffect(() => { + const handleHashChange = () => setInnerValue(getHashParam(key)); + handleHashChange(); + window.addEventListener('hashchange', handleHashChange); + return () => window.removeEventListener('hashchange', handleHashChange); + }, [key]); + + const setValue = useCallback( + (value) => { + setHashParam(key, value); + }, + [key] + ); + + return [innerValue, setValue]; +}; + +export default useHashParam; -- cgit v1.2.3