diff --git a/src/element/FollowsList.tsx b/src/element/FollowsList.tsx
index d2bb2afb..53c53788 100644
--- a/src/element/FollowsList.tsx
+++ b/src/element/FollowsList.tsx
@@ -1,8 +1,8 @@
import { useMemo } from "react";
import useFollowsFeed from "../feed/FollowsFeed";
import { HexKey } from "../nostr";
-import EventKind from "../nostr/EventKind";
import FollowListBase from "./FollowListBase";
+import { getFollowers} from "../feed/FollowsFeed";
export interface FollowsListProps {
pubkey: HexKey
@@ -12,9 +12,7 @@ export default function FollowsList({ pubkey }: FollowsListProps) {
const feed = useFollowsFeed(pubkey);
const pubkeys = useMemo(() => {
- let contactLists = feed?.notes.filter(a => a.kind === EventKind.ContactList && a.pubkey === pubkey);
- let pTags = contactLists?.map(a => a.tags.filter(b => b[0] === "p").map(c => c[1]));
- return [...new Set(pTags?.flat())];
+ return getFollowers(feed, pubkey);
}, [feed]);
return
diff --git a/src/element/FollowsYou.tsx b/src/element/FollowsYou.tsx
new file mode 100644
index 00000000..1a6fe38b
--- /dev/null
+++ b/src/element/FollowsYou.tsx
@@ -0,0 +1,27 @@
+import { useMemo } from "react";
+import { useSelector } from "react-redux";
+import { HexKey } from "../nostr";
+import { RootState } from "../state/Store";
+import useFollowsFeed from "../feed/FollowsFeed";
+import { getFollowers } from "../feed/FollowsFeed";
+
+export interface FollowsYouProps {
+ pubkey: HexKey
+}
+
+export default function FollowsYou({ pubkey }: FollowsYouProps ) {
+ const feed = useFollowsFeed(pubkey);
+ const loginPubKey = useSelector(s => s.login.publicKey);
+
+ const pubkeys = useMemo(() => {
+ return getFollowers(feed, pubkey);
+ }, [feed]);
+
+ const followsMe = pubkeys.includes(loginPubKey!) ?? false ;
+
+ return (
+ <>
+ { followsMe ? follows you
: null }
+ >
+ )
+}
diff --git a/src/feed/FollowsFeed.ts b/src/feed/FollowsFeed.ts
index 657f3f0b..7dd61b5a 100644
--- a/src/feed/FollowsFeed.ts
+++ b/src/feed/FollowsFeed.ts
@@ -1,8 +1,9 @@
import { useMemo } from "react";
import { HexKey } from "../nostr";
import EventKind from "../nostr/EventKind";
-import { Subscriptions } from "../nostr/Subscriptions";
+import { Subscriptions} from "../nostr/Subscriptions";
import useSubscription from "./Subscription";
+import { NoteStore } from "./Subscription"
export default function useFollowsFeed(pubkey: HexKey) {
const sub = useMemo(() => {
@@ -15,4 +16,10 @@ export default function useFollowsFeed(pubkey: HexKey) {
}, [pubkey]);
return useSubscription(sub);
-}
\ No newline at end of file
+}
+
+export function getFollowers(feed: NoteStore, pubkey: HexKey) {
+ let contactLists = feed?.notes.filter(a => a.kind === EventKind.ContactList && a.pubkey === pubkey);
+ let pTags = contactLists?.map(a => a.tags.filter(b => b[0] === "p").map(c => c[1]));
+ return [...new Set(pTags?.flat())];
+}
diff --git a/src/pages/ProfilePage.tsx b/src/pages/ProfilePage.tsx
index 7802601f..f143d629 100644
--- a/src/pages/ProfilePage.tsx
+++ b/src/pages/ProfilePage.tsx
@@ -20,6 +20,7 @@ import FollowersList from "../element/FollowersList";
import FollowsList from "../element/FollowsList";
import { RootState } from "../state/Store";
import { HexKey } from "../nostr";
+import FollowsYou from "../element/FollowsYou"
enum ProfileTab {
Notes = "Notes",
@@ -50,6 +51,14 @@ export default function ProfilePage() {
{user?.display_name || user?.name || 'Nostrich'}
{user?.nip05 && }
+ { followsYou() }
+
+ )
+ }
+ function followsYou(){
+ return (
+
)
}