+19
-5
src/routes/profile.$did/index.tsx
+19
-5
src/routes/profile.$did/index.tsx
···
286
const {agent} = useAuth()
287
const {data: identity} = useQueryIdentity(targetdidorhandle);
288
289
-
const mutualfollows = useGetOneToOneState(agent?.did ? {
290
target: agent?.did,
291
user: identity?.did ?? targetdidorhandle,
292
collection: "app.bsky.graph.follow",
293
path: ".subject"
294
}:undefined);
295
296
-
const ismutual: boolean = (!!mutualfollows?.length && mutualfollows.length > 0)
297
298
return (
299
<>
300
{identity?.did !== agent?.did ? (
301
<>
302
-
{!(ismutual) ? (
303
-
<></>
304
) : (
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>
306
)}
307
</>
308
) : (
···
286
const {agent} = useAuth()
287
const {data: identity} = useQueryIdentity(targetdidorhandle);
288
289
+
const theyFollowYouRes = useGetOneToOneState(agent?.did ? {
290
target: agent?.did,
291
user: identity?.did ?? targetdidorhandle,
292
collection: "app.bsky.graph.follow",
293
path: ".subject"
294
}:undefined);
295
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)
303
304
return (
305
<>
306
+
{/* if not self */}
307
{identity?.did !== agent?.did ? (
308
<>
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
+
</>
318
) : (
319
+
<></>
320
)}
321
</>
322
) : (