diff --git a/src/lib/components/UserCard.stories.tsx b/src/lib/components/UserCard.stories.tsx index eda293d..46433a4 100644 --- a/src/lib/components/UserCard.stories.tsx +++ b/src/lib/components/UserCard.stories.tsx @@ -27,12 +27,16 @@ const demoUser: Props["user"] = { Twitter: twitter.com/KawamataRyo GitHub: github.com/kawamataryo Zenn: zenn.dev/ryo_kawamata`, - avatar: "https://avatar.iran.liara.run/public", + avatar: "https://i.pravatar.cc/150?u=123", matchType: BSKY_USER_MATCH_TYPE.HANDLE, isFollowing: false, followingUri: "", isBlocking: false, blockingUri: "", + originalAvatar: "https://i.pravatar.cc/150?u=123", + originalHandle: "kawamataryo", + originalDisplayName: "KawamataRyo", + originalProfileLink: "https://x.com/kawamataryo", }; const mockAction: Props["clickAction"] = async () => { diff --git a/src/lib/components/UserCard.tsx b/src/lib/components/UserCard.tsx index 331193d..f4f65c3 100644 --- a/src/lib/components/UserCard.tsx +++ b/src/lib/components/UserCard.tsx @@ -4,6 +4,74 @@ import type { BskyUser } from "~types"; import { ACTION_MODE, MATCH_TYPE_LABEL_AND_COLOR } from "../constants"; import AvatarFallbackSvg from "./Icons/AvatarFallbackSvg"; +type UserProfileProps = { + avatar: string; + url: string; +}; + +const UserProfile = ({ avatar, url }: UserProfileProps) => ( +
+
+ + {avatar ? : } + +
+
+); + +type UserInfoProps = { + handle: string; + displayName: string; + url: string; +}; + +const UserInfo = ({ handle, displayName, url }: UserInfoProps) => ( +
+

+ + {displayName} + +

+

+ + @{handle} + +

+
+); + +type ActionButtonProps = { + loading: boolean; + actionBtnLabelAndClass: { label: string; class: string }; + handleActionButtonClick: () => void; + setIsBtnHovered: (value: boolean) => void; + setIsJustClicked: (value: boolean) => void; +}; + +const ActionButton = ({ + loading, + actionBtnLabelAndClass, + handleActionButtonClick, + setIsBtnHovered, + setIsJustClicked, +}: ActionButtonProps) => ( + +); + export type Props = { user: BskyUser; actionMode: (typeof ACTION_MODE)[keyof typeof ACTION_MODE]; @@ -82,67 +150,62 @@ const UserCard = ({ user, actionMode, clickAction }: Props) => { }; return ( -
+
-
-
- + +
+
+
+
+
+ + + +
+
+
- +
- +

{user.description}

diff --git a/src/lib/hooks/useRetrieveBskyUsers.ts b/src/lib/hooks/useRetrieveBskyUsers.ts index e7c248b..d73e223 100644 --- a/src/lib/hooks/useRetrieveBskyUsers.ts +++ b/src/lib/hooks/useRetrieveBskyUsers.ts @@ -70,6 +70,10 @@ export const useRetrieveBskyUsers = () => { followingUri: searchResult.bskyProfile.viewer?.following, isBlocking: !!searchResult.bskyProfile.viewer?.blocking, blockingUri: searchResult.bskyProfile.viewer?.blocking, + originalAvatar: userData.originalAvatar, + originalHandle: userData.accountName, + originalDisplayName: userData.displayName, + originalProfileLink: userData.originalProfileLink, }, ]; }); diff --git a/src/lib/services/xService.ts b/src/lib/services/xService.ts index cb0e607..085f013 100644 --- a/src/lib/services/xService.ts +++ b/src/lib/services/xService.ts @@ -20,6 +20,10 @@ export class XService extends AbstractService { ?.match(/bsky\.app\/profile\/([^/\s]+)…?/)?.[1] ?.replace("…", "") ?? ""; + const originalAvatar = userCell + .querySelector('[data-testid^="UserAvatar-Container"]') + ?.querySelector("img") + ?.getAttribute("src"); return { accountName, @@ -27,6 +31,8 @@ export class XService extends AbstractService { accountNameRemoveUnderscore, accountNameReplaceUnderscore, bskyHandle, + originalAvatar, + originalProfileLink: `https://x.com/${accountName}`, }; } diff --git a/src/options.tsx b/src/options.tsx index cb4e13e..ccb559e 100644 --- a/src/options.tsx +++ b/src/options.tsx @@ -48,19 +48,21 @@ const Option = () => { matchTypeStats={matchTypeStats} />
-
-
-
-
- {filteredUsers.map((user) => ( - - ))} -
+
+
+

Source

+

Detected

+
+
+
+ {filteredUsers.map((user) => ( + + ))}
diff --git a/src/types.ts b/src/types.ts index 2c915fa..714ed1c 100644 --- a/src/types.ts +++ b/src/types.ts @@ -16,6 +16,10 @@ export type BskyUser = { followingUri: string | null; isBlocking: boolean; blockingUri: string | null; + originalAvatar: string; + originalHandle: string; + originalDisplayName: string; + originalProfileLink: string; }; export type MatchTypeFilterValue = { @@ -31,4 +35,6 @@ export type CrawledUserInfo = { accountNameRemoveUnderscore: string; accountNameReplaceUnderscore: string; bskyHandle: string; + originalAvatar: string; + originalProfileLink: string; };