dev work
This commit is contained in:
parent
6e7977997e
commit
8aa67df5c7
22 changed files with 300 additions and 240 deletions
|
|
@ -21,9 +21,9 @@ if (formDraft && Object.keys(formDraft).length) {
|
|||
const pickValue = (key: string) =>
|
||||
typeof formDraft?.[key] === "string" ? formDraft[key] : undefined;
|
||||
|
||||
const nameValue = pickValue("name");
|
||||
const phoneValue = pickValue("phone");
|
||||
const msgValue = pickValue("msg");
|
||||
const nameValue = pickValue("name") || (await Astro.session?.get("name"));
|
||||
const phoneValue = pickValue("phone") || (await Astro.session?.get("phone"));
|
||||
const msgValue = pickValue("msg") || (await Astro.session?.get("msg"));
|
||||
---
|
||||
|
||||
<Layout>
|
||||
|
|
@ -52,15 +52,15 @@ const msgValue = pickValue("msg");
|
|||
errorIcon &&
|
||||
progressIcon
|
||||
) {
|
||||
cap.addEventListener("solve", function (e) {
|
||||
const humanness = Math.round((85 + Math.random() * 14.9) * 10) / 10;
|
||||
cap.addEventListener("solve", function () {
|
||||
const humanness = Math.round((90 + Math.random() * 9.9) * 10) / 10; // rounds to 1 decimal place
|
||||
statusText.textContent = `${humanness}% human. Good enough!`;
|
||||
progressIcon.classList.add("hidden");
|
||||
errorIcon.classList.add("hidden");
|
||||
initIcon.classList.add("hidden");
|
||||
completeIcon.classList.remove("hidden");
|
||||
});
|
||||
cap.addEventListener("error", function (e) {
|
||||
cap.addEventListener("error", function () {
|
||||
statusText.textContent = "Oops! We crashed!";
|
||||
progressIcon.classList.add("hidden");
|
||||
completeIcon.classList.add("hidden");
|
||||
|
|
@ -167,9 +167,12 @@ const msgValue = pickValue("msg");
|
|||
id="name"
|
||||
name="name"
|
||||
aria-describedby="name"
|
||||
placeholder="Alice Bob"
|
||||
placeholder="Alice Bobston"
|
||||
value={nameValue}
|
||||
/>
|
||||
{error.name && <p id="error_name">{error.name.join(",")}</p>}
|
||||
{"name" in error && error.name && (
|
||||
<p id="error_name">{error.name}</p>
|
||||
)}
|
||||
</label>
|
||||
<label for="phone">
|
||||
Phone
|
||||
|
|
@ -179,21 +182,19 @@ const msgValue = pickValue("msg");
|
|||
name="phone"
|
||||
aria-describedby="error_phone"
|
||||
placeholder="555-555-5555"
|
||||
value={phoneValue}
|
||||
/>
|
||||
{error.phone && <p id="error_phone">{error.phone.join(",")}</p>}
|
||||
{"phone" in error && error.phone && (
|
||||
<p id="error_phone">{error.phone}</p>
|
||||
)}
|
||||
</label>
|
||||
<label for="msg">
|
||||
Msg
|
||||
<div class="textarea-wrapper">
|
||||
<textarea
|
||||
id="msg"
|
||||
name="msg"
|
||||
oninput="this.parentNode.dataset.replicatedValue = this.value"
|
||||
aria-describedby="error_msg"
|
||||
placeholder="I think badblocks rocks! Lorem ipsum dolor sit amet, consectetur adipiscing elit."
|
||||
/>
|
||||
<div class="textarea-wrapper" data-replicated-value={msgValue}>
|
||||
{/* prettier-ignore */}
|
||||
<textarea id="msg" name="msg" oninput="this.parentNode.dataset.replicatedValue = this.value" aria-describedby="error_msg" placeholder="I think badblocks rocks! Lorem ipsum dolor sit amet, consectetur adipiscing elit.">{msgValue}</textarea>
|
||||
</div>
|
||||
{error.msg && <p id="error_msg">{error.msg.join(",")}</p>}
|
||||
{"msg" in error && error.msg && <p id="error_msg">{error.msg}</p>}
|
||||
</label>
|
||||
<button
|
||||
id="send_otp"
|
||||
|
|
@ -215,7 +216,7 @@ const msgValue = pickValue("msg");
|
|||
name="otp"
|
||||
aria-describedby="error_otp"
|
||||
/>
|
||||
{error.otp && <p id="error_otp">{error.otp.join(",")}</p>}
|
||||
{"otp" in error && error.otp && <p id="error_otp">{error.otp}</p>}
|
||||
</label>
|
||||
<button
|
||||
id="reset"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue