From cb5e40f9b5fb0ae4bb9a769dd7a9c83c2af18a65 Mon Sep 17 00:00:00 2001 From: Max Nanis Date: Fri, 11 Sep 2026 07:49:51 -0700 Subject: Transfer page. Jenkins CDN. Layout url check --- jb-ui/src/pages/Transfer.tsx | 171 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 144 insertions(+), 27 deletions(-) (limited to 'jb-ui/src/pages/Transfer.tsx') diff --git a/jb-ui/src/pages/Transfer.tsx b/jb-ui/src/pages/Transfer.tsx index 6e087d6..bef40d4 100644 --- a/jb-ui/src/pages/Transfer.tsx +++ b/jb-ui/src/pages/Transfer.tsx @@ -1,50 +1,167 @@ -import { clsx } from "clsx"; +import { type FormEvent, useState } from "react"; +import { useAppDispatch, useAppSelector } from "@/hooks"; +import { Button } from "@/components/ui/button"; +import max_lulu from "./max-and-lulu.jpg"; -import { useSelector } from "react-redux"; +// const handleInputChange = ( +// event: React.KeyboardEvent, +// ) => {}; -const Transfer = function () { - let error = []; +// const handleKeyPress = (event: KeyboardEvent) => {}; +// const handleSubmit = (e) => { +// e.preventDefault(); +// console.log("Form submitted successfully!"); +// }; + +const TransferComplete = function () { + return ( +
+

+ Please check your email. +

+

+ If you don't recieve anything, please check your spam folder, or try + again shortly. +

+

+ We will be assisting account transfers throughout the rest of the month. + If you have any further questions or concerns, please email us directly + with your desired account email and the AMT ID to associate with your + worker history. +

+ Max and Lulu +
+ ); +}; + +type RequestState = "idle" | "working" | "sent" | "failed"; - const handleInputChange = ( - event: React.KeyboardEvent, - ) => {}; +const TransferSubmit = function ({ onSubmitSuccess }) { + const [email, setEmail] = useState(""); + const [state, setState] = useState("idle"); + const bpuid = useAppSelector((state) => state.app.bpuid); - const handleKeyPress = (event: KeyboardEvent) => {}; + const submit = async (event: FormEvent) => { + event.preventDefault(); + setState("working"); - const handleSubmit = (e) => { - e.preventDefault(); - console.log("Form submitted successfully!"); + try { + const response = await fetch("/auth/link-amt/request", { + method: "POST", + credentials: "include", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ + email: email, + amt_worker_id: bpuid, + }), + }); + + if (!response.ok) throw new Error("Account-link request failed"); + + const body = (await response.json()) as { magic_link?: string }; + console.log(body.magic_link ?? null); + onSubmitSuccess(); + } catch { + setState("failed"); + } }; return (

Transfer Required

-

- James Billings is finished 😭 Just Kidding!!! -

+ James Billings is no longer available on Amazon Mechanical Turk. Our + dedicated platform will enable you to do the same work as always, paid + directly to you. +
+ Enter your email below to transfer your account history. +
+ This will allow you to keep your full account history and wallet + balance. + + +
+ setEmail(event.target.value)} + placeholder="you@example.com" + /> + +
- + {state === "sent" && ( +

+ Check your email to finish linking your account. +

+ )} + + {state === "failed" &&

Unable to send the link. Please try again.

}
); }; +const Transfer = function () { + const assignment_id = useAppSelector((state) => state.app.assignment_id); + const bpuid = useAppSelector((state) => state.app.bpuid); + const [submitted, setSubmitted] = useState(false); + + if (!bpuid) { + return ( +

+ No Worker ID found. Please access this page through the Amazon + Mechanical Turk platform. +

+ ); + } + + if (!assignment_id) { + return ( +

+ No Assignment ID found. Please access this page through the Amazon + Mechanical Turk platform. +

+ ); + } + + return ( + <> + {submitted ? ( + + ) : ( + setSubmitted(true)} /> + )} + + ); +}; + export default Transfer; -- cgit v1.2.3