mirror of
https://gitlab.nic.cz/turris/reforis/foris-js.git
synced 2025-04-20 08:16:38 +02:00
Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
02671fb645 |
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2019-2025 CZ.NIC z.s.p.o. (https://www.nic.cz/)
|
* Copyright (C) 2019-2024 CZ.NIC z.s.p.o. (https://www.nic.cz/)
|
||||||
*
|
*
|
||||||
* This is free software, licensed under the GNU General Public License v3.
|
* This is free software, licensed under the GNU General Public License v3.
|
||||||
* See /LICENSE for more information.
|
* See /LICENSE for more information.
|
||||||
@ -9,7 +9,7 @@ import React, { useState } from "react";
|
|||||||
|
|
||||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
import { QRCodeSVG } from "qrcode.react";
|
import QRCode from "qrcode.react";
|
||||||
|
|
||||||
import { createAndDownloadPdf, toQRCodeContent } from "./qrCodeHelpers";
|
import { createAndDownloadPdf, toQRCodeContent } from "./qrCodeHelpers";
|
||||||
import Button from "../../bootstrap/Button";
|
import Button from "../../bootstrap/Button";
|
||||||
@ -33,7 +33,10 @@ export default function WiFiQRCode({ SSID, password }) {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="input-group-text"
|
className="input-group-text"
|
||||||
onClick={() => setModal(true)}
|
onClick={(e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
setModal(true);
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<FontAwesomeIcon
|
<FontAwesomeIcon
|
||||||
icon="fa-solid fa-qrcode"
|
icon="fa-solid fa-qrcode"
|
||||||
@ -42,14 +45,14 @@ export default function WiFiQRCode({ SSID, password }) {
|
|||||||
className="text-secondary"
|
className="text-secondary"
|
||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
{modal && (
|
{modal ? (
|
||||||
<QRCodeModal
|
<QRCodeModal
|
||||||
setShown={setModal}
|
setShown={setModal}
|
||||||
shown={modal}
|
shown={modal}
|
||||||
SSID={SSID}
|
SSID={SSID}
|
||||||
password={password}
|
password={password}
|
||||||
/>
|
/>
|
||||||
)}
|
) : null}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -66,30 +69,31 @@ function QRCodeModal({ shown, setShown, SSID, password }) {
|
|||||||
<Modal setShown={setShown} shown={shown}>
|
<Modal setShown={setShown} shown={shown}>
|
||||||
<ModalHeader setShown={setShown} title={_("Wi-Fi QR Code")} />
|
<ModalHeader setShown={setShown} title={_("Wi-Fi QR Code")} />
|
||||||
<ModalBody>
|
<ModalBody>
|
||||||
<QRCodeSVG
|
<QRCode
|
||||||
className="d-block mx-auto img-logo-black"
|
className="d-block mx-auto img-logo-black"
|
||||||
|
renderAs="svg"
|
||||||
value={toQRCodeContent(SSID, password)}
|
value={toQRCodeContent(SSID, password)}
|
||||||
level="M"
|
level="M"
|
||||||
size={350}
|
size={350}
|
||||||
marginSize={0}
|
includeMargin
|
||||||
imageSettings={{
|
|
||||||
src: "/reforis/static/reforis/imgs/turris.svg",
|
|
||||||
height: 40,
|
|
||||||
width: 40,
|
|
||||||
excavate: true,
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
</ModalBody>
|
</ModalBody>
|
||||||
<ModalFooter>
|
<ModalFooter>
|
||||||
<Button
|
<Button
|
||||||
className="btn-secondary"
|
className="btn-secondary"
|
||||||
onClick={() => setShown(false)}
|
onClick={(e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
setShown(false);
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{_("Close")}
|
{_("Close")}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
className="btn-primary"
|
className="btn-primary"
|
||||||
onClick={() => createAndDownloadPdf(SSID, password)}
|
onClick={(e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
createAndDownloadPdf(SSID, password);
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<FontAwesomeIcon
|
<FontAwesomeIcon
|
||||||
icon="fa-solid fa-file-download"
|
icon="fa-solid fa-file-download"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user