+19
-5
src/routes/profile.$did/index.tsx
+19
-5
src/routes/profile.$did/index.tsx
···
286
286
const {agent} = useAuth()
287
287
const {data: identity} = useQueryIdentity(targetdidorhandle);
288
288
289
-
const mutualfollows = useGetOneToOneState(agent?.did ? {
289
+
const theyFollowYouRes = useGetOneToOneState(agent?.did ? {
290
290
target: agent?.did,
291
291
user: identity?.did ?? targetdidorhandle,
292
292
collection: "app.bsky.graph.follow",
293
293
path: ".subject"
294
294
}:undefined);
295
295
296
-
const ismutual: boolean = (!!mutualfollows?.length && mutualfollows.length > 0)
296
+
const youFollowThemRes = useGetFollowState({
297
+
target: identity?.did ?? targetdidorhandle,
298
+
user: agent?.did,
299
+
});
300
+
301
+
const theyFollowYou: boolean = (!!theyFollowYouRes?.length && theyFollowYouRes.length > 0)
302
+
const youFollowThem: boolean = (!!youFollowThemRes?.length && youFollowThemRes.length > 0)
297
303
298
304
return (
299
305
<>
306
+
{/* if not self */}
300
307
{identity?.did !== agent?.did ? (
301
308
<>
302
-
{!(ismutual) ? (
303
-
<></>
309
+
{(theyFollowYou) ? (
310
+
<>
311
+
{youFollowThem ? (
312
+
<div className=" text-sm px-1.5 py-0.5 text-gray-500 bg-gray-200 dark:text-gray-400 dark:bg-gray-800 rounded-lg flex flex-row items-center justify-center">mutuals</div>
313
+
) : (
314
+
<div className=" text-sm px-1.5 py-0.5 text-gray-500 bg-gray-200 dark:text-gray-400 dark:bg-gray-800 rounded-lg flex flex-row items-center justify-center">follows you</div>
315
+
)
316
+
}
317
+
</>
304
318
) : (
305
-
<div className=" text-sm px-1.5 py-0.5 text-gray-500 bg-gray-200 dark:text-gray-400 dark:bg-gray-800 rounded-lg flex flex-row items-center justify-center">mutuals</div>
319
+
<></>
306
320
)}
307
321
</>
308
322
) : (