Add option to include a screenshot of the popup
This commit is contained in:
parent
e2922b0342
commit
2bcf72f652
|
@ -1,7 +1,7 @@
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { RequestCluster } from "../request-cluster";
|
import { RequestCluster } from "../request-cluster";
|
||||||
import { StolenDataEntry } from "../stolen-data-entry";
|
import { StolenDataEntry } from "../stolen-data-entry";
|
||||||
import { getDate } from "../util";
|
import { getDate, toBase64 } from "../util";
|
||||||
import DomainSummary from "./domain-summary";
|
import DomainSummary from "./domain-summary";
|
||||||
|
|
||||||
type PopupState = "not_clicked" | "clicked_but_invalid";
|
type PopupState = "not_clicked" | "clicked_but_invalid";
|
||||||
|
@ -17,6 +17,8 @@ export default function EmailTemplate({
|
||||||
const [acceptAllName, setAcceptAllName] = useState<string>(
|
const [acceptAllName, setAcceptAllName] = useState<string>(
|
||||||
"Zaakceptuj wszystkie"
|
"Zaakceptuj wszystkie"
|
||||||
);
|
);
|
||||||
|
const [popupScreenshotBase64, setPopupScreenshotBase64] =
|
||||||
|
useState<string>(null);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
@ -30,6 +32,7 @@ export default function EmailTemplate({
|
||||||
<option value="clicked_but_invalid">Kliknięte, ale nieważne</option>
|
<option value="clicked_but_invalid">Kliknięte, ale nieważne</option>
|
||||||
</select>
|
</select>
|
||||||
{popupState === "clicked_but_invalid" ? (
|
{popupState === "clicked_but_invalid" ? (
|
||||||
|
<>
|
||||||
<div>
|
<div>
|
||||||
<label htmlFor="acceptAllName">
|
<label htmlFor="acceptAllName">
|
||||||
Tekst na przycisku do zatwierdzania wszystkich zgód:
|
Tekst na przycisku do zatwierdzania wszystkich zgód:
|
||||||
|
@ -42,6 +45,22 @@ export default function EmailTemplate({
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<label htmlFor="popup-screenshot">
|
||||||
|
Zrzut ekranu z tego, jak wyglądał popup przed kliknięciem „
|
||||||
|
{acceptAllName}”:
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
{...{
|
||||||
|
type: "file",
|
||||||
|
id: "popup-screenshot",
|
||||||
|
onChange: async (e) => {
|
||||||
|
setPopupScreenshotBase64(await toBase64(e.target.files[0]));
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
) : null}
|
) : null}
|
||||||
<p>
|
<p>
|
||||||
Dzień dobry, w dniu {getDate()} odwiedziłem stronę{" "}
|
Dzień dobry, w dniu {getDate()} odwiedziłem stronę{" "}
|
||||||
|
@ -76,6 +95,7 @@ export default function EmailTemplate({
|
||||||
2016/679 z dnia 27 kwietnia 2016
|
2016/679 z dnia 27 kwietnia 2016
|
||||||
</em>
|
</em>
|
||||||
).
|
).
|
||||||
|
{<img {...{ src: popupScreenshotBase64 }} />}
|
||||||
</p>
|
</p>
|
||||||
) : null}
|
) : null}
|
||||||
<p>
|
<p>
|
||||||
|
|
10
util.ts
10
util.ts
|
@ -128,3 +128,13 @@ export function getDate() {
|
||||||
.toString()
|
.toString()
|
||||||
.padStart(2, "0")}-${d.getDate().toString().padStart(2, "0")}`;
|
.padStart(2, "0")}-${d.getDate().toString().padStart(2, "0")}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function toBase64(file: File): Promise<string> {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
const FR = new FileReader();
|
||||||
|
FR.addEventListener("load", (e) => {
|
||||||
|
resolve(e.target.result as string);
|
||||||
|
});
|
||||||
|
FR.readAsDataURL(file);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user