diff --git a/components/LoginButton.tsx b/components/LoginButton.tsx index 12b62d42..5d576061 100644 --- a/components/LoginButton.tsx +++ b/components/LoginButton.tsx @@ -6,11 +6,19 @@ import { ButtonPrimary } from "./Buttons"; import { ActionButton } from "./ActionBar/ActionButton"; import { AccountSmall } from "./Icons/AccountSmall"; import { useIsMobile } from "src/hooks/isMobile"; -import { HandleInput } from "./Subscribe/HandleSubscribe"; -import { EmailInput } from "./Subscribe/EmailSubscribe"; +import { + AtmosphericHandleInfo, + HandleInput, +} from "./Subscribe/HandleSubscribe"; +import { EmailInput, EmailConfirm } from "./Subscribe/EmailSubscribe"; import { useState } from "react"; import { GoToArrow } from "./Icons/GoToArrow"; import { ToggleGroup } from "./ToggleGroup"; +import { Modal } from "./Modal"; +import { useToaster } from "./Toast"; +import { InfoSmall } from "./Icons/InfoSmall"; +import { HelpSmall } from "./Icons/HelpSmall"; +import { HelpTiny } from "./Icons/HelpTiny"; export function LoginButton() { let identityData = useIdentityData(); @@ -36,12 +44,14 @@ export function LoginActionButton() { let [state, setState] = useState<"log in" | "sign up" | "email log in">( "log in", ); + let [loginEmail, setLoginEmail] = useState(""); + let toaster = useToaster(); return ( } label="Sign In" /> } @@ -56,27 +66,61 @@ export function LoginActionButton() { /> {state === "log in" ? ( <> -

Atmospheric handle

- +
+

Log into the Atmosphere

+ } /> +
+ } + />
) : state === "email log in" ? ( <> - +

Log in with Email

+ + + } + > + { + toaster({ + content:
Welcome back!
, + type: "success", + }); + }} + /> + + } + />
) : ( diff --git a/components/Subscribe/EmailSubscribe.tsx b/components/Subscribe/EmailSubscribe.tsx index c8d9cc9d..c4013565 100644 --- a/components/Subscribe/EmailSubscribe.tsx +++ b/components/Subscribe/EmailSubscribe.tsx @@ -1,85 +1,32 @@ "use client"; import * as OneTimePasswordField from "@radix-ui/react-one-time-password-field"; import { ButtonPrimary } from "components/Buttons"; - import { Input } from "components/Input"; -import { Modal } from "components/Modal"; -import { useState } from "react"; -import { EmailSubscribeSuccess } from "./EmailSubscribeSuccess"; -import { GoToArrow } from "components/Icons/GoToArrow"; -import { useToaster } from "components/Toast"; export const EmailInput = (props: { - action: "link" | "subscribe" | "login"; + action: React.ReactNode; autoFocus?: boolean; - user?: { - loggedIn: boolean; - email: string | undefined; - handle: string | undefined; - }; + large?: boolean; + value: string; + onChange: (val: string) => void; + disabled?: boolean; }) => { - let [value, setValue] = useState( - props.user?.loggedIn && props.user?.email ? props.user?.email : "", - ); - let [state, setState] = useState<"confirm" | "success">( - props.user?.loggedIn && props.user?.email ? "success" : "confirm", - ); - let toaster = useToaster(); - return ( -
+
setValue(e.target.value)} + value={props.value} + onChange={(e) => props.onChange(e.target.value)} /> - - {props.action === "login" ? ( - - ) : ( - - {props.action === "link" ? "Link" : "Subscribe"} - - )} -
- } - > - {state === "success" ? ( - - ) : ( - { - props.action === "subscribe" - ? setState("success") - : props.action === "link" - ? toaster({ - content: ( -
Linked your email!
- ), - type: "success", - }) - : toaster({ - content:
Welcome back!
, - type: "success", - }); - }} - /> - )} - +
+ {props.action} +
); }; diff --git a/components/Subscribe/HandleSubscribe.tsx b/components/Subscribe/HandleSubscribe.tsx index ea49bdee..67448b46 100644 --- a/components/Subscribe/HandleSubscribe.tsx +++ b/components/Subscribe/HandleSubscribe.tsx @@ -14,7 +14,6 @@ import { } from "./Logos"; import { Separator } from "components/Layout"; -import { GoToArrow } from "components/Icons/GoToArrow"; export const SubscribeWithHandle = (props: { autoFocus?: boolean; @@ -71,42 +70,28 @@ export const LinkHandle = (props: { compact?: boolean }) => { export const HandleInput = (props: { autoFocus?: boolean; - action?: "subscribe" | "link" | "login"; + action?: React.ReactNode; className?: string; + large?: boolean; }) => { let [handleValue, setHandleValue] = useState(""); return (
-
+
@
setHandleValue(e.target.value)} /> -
- {props.action === "login" ? ( - - ) : ( - - {props.action === "link" - ? "Link" - : props.action === "subscribe" - ? "Subscribe" - : null} - - )} -
+ {props.action}
); }; @@ -167,31 +152,27 @@ export const AtmosphericHandleInfo = (props: { trigger?: React.ReactNode }) => { props.trigger ) : (
- What's a universal handle? + What's the Atmosphere
) } >
- Your universal handle is the username you use to sign into enabled apps - like...{" "} + The Atmosphere is a family of apps that you can access with a single + account
-
+ +
Apps like...
+
} name="Leaflet" /> } name="Bluesky" /> } name="Blacksky" /> } name="Eurosky" /> } name="Tangled" />
-
-
A handle can log into ANY enabled app.
-
- ie, you can log into Leaflet with the handle you made - for Bluesky! -
-
+ - Create a handle on Bluesky! + Sign up through Bluesky! ); diff --git a/components/Subscribe/ManageSubscribe.tsx b/components/Subscribe/ManageSubscribe.tsx index 3c038bc9..7133e6c4 100644 --- a/components/Subscribe/ManageSubscribe.tsx +++ b/components/Subscribe/ManageSubscribe.tsx @@ -1,9 +1,12 @@ -import { ButtonSecondary } from "components/Buttons"; +"use client"; +import { useState } from "react"; +import { ButtonPrimary, ButtonSecondary } from "components/Buttons"; import { CheckTiny } from "components/Icons/CheckTiny"; import { GoToArrow } from "components/Icons/GoToArrow"; import { Modal } from "components/Modal"; +import { useToaster } from "components/Toast"; import { LinkHandle } from "./HandleSubscribe"; -import { EmailInput } from "./EmailSubscribe"; +import { EmailInput, EmailConfirm } from "./EmailSubscribe"; export const ManageSubscription = (props: { newsletterMode: boolean; @@ -14,6 +17,8 @@ export const ManageSubscription = (props: { subscribed: boolean; }; }) => { + let [email, setEmail] = useState(props.user?.email ?? ""); + let toaster = useToaster(); let prefClassName = "flex gap-2 justify-between font-bold text-secondary items-center"; return ( @@ -68,7 +73,33 @@ export const ManageSubscription = (props: { to get updates right to your inbox!
- + + link + + } + > + { + toaster({ + content:
Email Linked!
, + type: "success", + }); + }} + /> + + } + /> ) : null} {!props.user.handle ? ( diff --git a/components/Subscribe/SubscribeButton.tsx b/components/Subscribe/SubscribeButton.tsx index 253576f4..e816f8cd 100644 --- a/components/Subscribe/SubscribeButton.tsx +++ b/components/Subscribe/SubscribeButton.tsx @@ -1,5 +1,8 @@ +"use client"; +import { useState } from "react"; import { SubscribeWithHandle } from "./HandleSubscribe"; -import { EmailInput } from "./EmailSubscribe"; +import { EmailInput, EmailConfirm } from "./EmailSubscribe"; +import { EmailSubscribeSuccess } from "./EmailSubscribeSuccess"; import { Modal } from "components/Modal"; import { ButtonPrimary } from "components/Buttons"; import { PostPubInfo } from "app/lish/[did]/[publication]/[rkey]/PostPubInfo"; @@ -44,15 +47,42 @@ export const SubscribeInput = (props: { subscribed: boolean; }; }) => { + let [email, setEmail] = useState(props.user?.email ?? ""); + let [confirmState, setConfirmState] = useState<"confirm" | "success">( + "confirm", + ); + if (props.user.subscribed) { return ; } if (props.newsletterMode) { return ( + subscribe + + } + > + {confirmState === "success" ? ( + + ) : ( + setConfirmState("success")} + /> + )} + + } /> ); } else