Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove CAPTCHA flow from components showcase #1846

Merged
merged 1 commit into from
Sep 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 2 additions & 30 deletions src/showcase/src/components.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { mkAnchorPicker } from "$src/components/anchorPicker";
import { pinInput } from "$src/components/pinInput";
import { toast } from "$src/components/toast";
import { badChallenge, promptCaptchaPage } from "$src/flows/register/captcha";
import { mount, withRef } from "$src/utils/lit-html";
import { withRef } from "$src/utils/lit-html";
import { Chan, NonEmptyArray, asNonEmptyArray } from "$src/utils/utils";
import { TemplateResult, html, render } from "lit-html";
import { asyncReplace } from "lit-html/directives/async-replace.js";
import { Ref, createRef, ref } from "lit-html/directives/ref.js";
import { dummyChallenge, i18n } from "./showcase";

export const componentsPage = () => {
document.title = "Components";
Expand All @@ -16,7 +14,7 @@ export const componentsPage = () => {
};

const components = (): TemplateResult => {
return html`${mkToast()} ${choosePin()} ${pickAnchor()}${completeCaptcha()}`;
return html`${mkToast()} ${choosePin()} ${pickAnchor()}`;
};

const mkToast = (): TemplateResult => {
Expand Down Expand Up @@ -108,29 +106,3 @@ const pickAnchor = (): TemplateResult => {
)} </div>
</div>`;
};

const completeCaptcha = (): TemplateResult => {
return html` <div
${mount((container) =>
container instanceof HTMLElement
? promptCaptchaPage(
{
cancel: () => console.log("canceled"),
requestChallenge: () =>
new Promise((resolve) => setTimeout(resolve, 1000)).then(
() => dummyChallenge
),
verifyChallengeChars: (cr) =>
new Promise((resolve) => setTimeout(resolve, 1000)).then(() =>
cr.chars === "8wJ6Q" ? "yes" : badChallenge
),
onContinue: () => console.log("Done"),
i18n,
focus: false,
},
container
)
: ""
)}
></div>`;
};
Loading