diff --git a/app/globals.css b/app/globals.css --- a/app/globals.css +++ b/app/globals.css @@ -621,7 +621,6 @@ overflow: hidden; transition: max-height 200ms ease, - max-image 200ms ease, opacity 200ms ease; background: rgba(var(--bg-page), var(--bg-page-alpha)); border-radius: 4px; diff --git a/components/Combobox.tsx b/components/Combobox.tsx --- a/components/Combobox.tsx +++ b/components/Combobox.tsx @@ -24,7 +24,6 @@ trigger?: React.ReactNode; triggerClassName?: string; className?: string; - width?: string; results: string[]; onSelect?: () => void; onOpenChange?: (open: boolean) => void; diff --git a/components/LoginButton.tsx b/components/LoginButton.tsx --- a/components/LoginButton.tsx +++ b/components/LoginButton.tsx @@ -40,6 +40,7 @@ noEmailLogin={props.noEmailLogin} redirectRoute={props.redirectRoute} open={open} + onSuccess={() => setOpen(false)} /> ); @@ -50,9 +51,9 @@ noEmailLogin?: boolean; redirectRoute?: string; open?: boolean; + onSuccess?: () => void; }) => { let identityData = useIdentityData(); - if (identityData.identity) return null; let [state, setState] = useState< "log in" | "sign up" | "email log in" | "email confirm" >("log in"); @@ -61,12 +62,24 @@ let [loading, setLoading] = useState(false); let toaster = useToaster(); + if (identityData.identity) return null; + const handleEmailSubmit = async () => { setLoading(true); - const id = await requestAuthEmailToken(loginEmail); - setLoading(false); - setTokenId(id); - setState("email confirm"); + try { + const id = await requestAuthEmailToken(loginEmail); + setTokenId(id); + setState("email confirm"); + } catch (e) { + toaster({ + content: ( +
Could not send email — please try again
+ ), + type: "error", + }); + } finally { + setLoading(false); + } }; const handleCodeSubmit = async (code: string) => { @@ -79,11 +92,17 @@ content:
Incorrect code!
, type: "error", }); - } else { - const localLeaflets = getHomeDocs(); - await loginWithEmailToken(localLeaflets.filter((l) => !l.hidden)); - mutate("identity"); + return; } + const localLeaflets = getHomeDocs(); + await loginWithEmailToken(localLeaflets.filter((l) => !l.hidden)); + mutate("identity"); + toaster({ + content:
Logged in! Welcome!
, + type: "success", + }); + setLoading(false); + props.onSuccess?.(); }; return ( diff --git a/app/login/LoginForm.tsx b/app/login/LoginForm.tsx deleted file mode 100644 --- a/app/login/LoginForm.tsx +++ /dev/null @@ -1,75 +0,0 @@ -"use client"; -import { - confirmEmailAuthToken, - requestAuthEmailToken, -} from "actions/emailAuth"; -import { loginWithEmailToken } from "actions/login"; -import { ActionAfterSignIn } from "app/api/oauth/[route]/afterSignInActions"; -import { getHomeDocs } from "app/(home-pages)/home/storage"; -import { ButtonPrimary } from "components/Buttons"; -import { ArrowRightTiny } from "components/Icons/ArrowRightTiny"; -import { BlueskySmall } from "components/Icons/BlueskySmall"; -import { Input } from "components/Input"; -import { useSmoker, useToaster } from "components/Toast"; -import React, { useState } from "react"; -import { mutate } from "swr"; -import { BlueskyTiny } from "components/Icons/BlueskyTiny"; - -export function BlueskyLogin(props: { - redirectRoute?: string; - action?: ActionAfterSignIn; - compact?: boolean; -}) { - const [signingWithHandle, setSigningWithHandle] = useState(false); - const [handle, setHandle] = useState(""); - - return ( -
- - {props.action && ( - - )} - {signingWithHandle ? ( -
- setHandle(e.target.value)} - required - /> - Sign In -
- ) : ( -
- - {props.compact ? : } - {props.compact ? "Link" : "Log In/Sign Up with"} Bluesky - - -
- )} -
- ); -} diff --git a/components/ActionBar/Publications.tsx b/components/ActionBar/Publications.tsx --- a/components/ActionBar/Publications.tsx +++ b/components/ActionBar/Publications.tsx @@ -14,7 +14,6 @@ import { SpeedyLink } from "components/SpeedyLink"; import { PublishSmall } from "components/Icons/PublishSmall"; import { Popover } from "components/Popover"; -import { BlueskyLogin } from "app/login/LoginForm"; import { ButtonPrimary, ButtonSecondary } from "components/Buttons"; import { useIsMobile } from "src/hooks/isMobile"; import { useState } from "react"; diff --git a/components/Subscribe/HandleInput.tsx b/components/Subscribe/HandleInput.tsx --- a/components/Subscribe/HandleInput.tsx +++ b/components/Subscribe/HandleInput.tsx @@ -2,7 +2,7 @@ import { Agent } from "@atproto/api"; import { Input } from "components/Input"; import { Combobox, ComboboxResult } from "components/Combobox"; -import { useState } from "react"; +import { useRef, useState } from "react"; import { useDebouncedEffect } from "src/hooks/useDebouncedEffect"; import { DotLoader } from "components/utils/DotLoader"; import { theme } from "tailwind.config"; @@ -27,6 +27,7 @@ let [suggestions, setSuggestions] = useState([]); let [dropdownOpen, setDropdownOpen] = useState(false); let [highlighted, setHighlighted] = useState(undefined); + let requestIdRef = useRef(0); useDebouncedEffect( async () => { @@ -35,11 +36,13 @@ setDropdownOpen(false); return; } + const requestId = ++requestIdRef.current; const agent = new Agent("https://public.api.bsky.app"); const result = await agent.searchActorsTypeahead({ q: handleValue, limit: 8, }); + if (requestId !== requestIdRef.current) return; const actors = result.data.actors.map((actor) => ({ handle: actor.handle, did: actor.did, diff --git a/app/lish/[did]/[publication]/[rkey]/PostPubInfo.tsx b/app/lish/[did]/[publication]/[rkey]/PostPubInfo.tsx --- a/app/lish/[did]/[publication]/[rkey]/PostPubInfo.tsx +++ b/app/lish/[did]/[publication]/[rkey]/PostPubInfo.tsx @@ -4,8 +4,8 @@ newsletterMode: true, user: { loggedIn: true, - email: "thisiscelinepark@gmail.com", - handle: "cozylittle.house", + email: "example@example.com", + handle: "example.handle", subscribed: false, }, };