diff --git a/src/components/Login.tsx b/src/components/Login.tsx index f388241..5c3a24b 100644 --- a/src/components/Login.tsx +++ b/src/components/Login.tsx @@ -154,7 +154,19 @@ const TabButton = ({ label, active, onClick }: { label: string; active: boolean; const OAuthForm = () => { const { loginWithOAuth } = useAuth(); const [handle, setHandle] = useState(""); - const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); if (handle.trim()) loginWithOAuth(handle); }; + + useEffect(() => { + const lastHandle = localStorage.getItem("lastHandle"); + if (lastHandle) setHandle(lastHandle); + }, []); + + const handleSubmit = (e: React.FormEvent) => { + e.preventDefault(); + if (handle.trim()) { + localStorage.setItem("lastHandle", handle); + loginWithOAuth(handle); + } + }; return (

Sign in with AT. Your password is never shared.

@@ -171,10 +183,16 @@ const PasswordForm = () => { const [serviceURL, setServiceURL] = useState("bsky.social"); const [error, setError] = useState(null); + useEffect(() => { + const lastHandle = localStorage.getItem("lastHandle"); + if (lastHandle) setUser(lastHandle); + }, []); + const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setError(null); try { + localStorage.setItem("lastHandle", user); await loginWithPassword(user, password, `https://${serviceURL}`); } catch (err) { setError("Login failed. Check your handle and App Password."); diff --git a/src/routes/profile.$did/index.tsx b/src/routes/profile.$did/index.tsx index ccd0c98..64949f1 100644 --- a/src/routes/profile.$did/index.tsx +++ b/src/routes/profile.$did/index.tsx @@ -7,22 +7,34 @@ import { useQueryIdentity, useQueryProfile, useInfiniteQueryAuthorFeed, + useQueryConstellation, + type linksRecordsResponse, } from "~/utils/useQuery"; +import { useAuth } from "~/providers/UnifiedAuthProvider"; +import { AtUri } from "@atproto/api"; +import { TID } from "@atproto/common-web"; +import { toggleFollow, useGetFollowState } from "~/utils/followState"; export const Route = createFileRoute("/profile/$did/")({ component: ProfileComponent, }); function ProfileComponent() { + // booo bad this is not always the did it might be a handle, use identity.did instead const { did } = Route.useParams(); const queryClient = useQueryClient(); - + const { agent } = useAuth(); const { data: identity, isLoading: isIdentityLoading, error: identityError, } = useQueryIdentity(did); + const followRecords = useGetFollowState({ + target: identity?.did || did, + user: agent?.did, + }); + const resolvedDid = did.startsWith("did:") ? did : identity?.did; const resolvedHandle = did.startsWith("did:") ? identity?.handle : did; const pdsUrl = identity?.pds; @@ -141,14 +153,37 @@ function ProfileComponent() { also delay the backfill to be on demand because it would be pretty intense also save it persistently */} - {true ? ( + {identity?.did !== agent?.did ? ( <> - - + {!(followRecords?.length && followRecords?.length > 0) ? ( + + ) : ( + + )} ) : (