import type { PlasmoCSConfig } from "plasmo"; import React from "react"; import AlertError from "~lib/components/AlertError"; import AlertSuccess from "~lib/components/AlertSuccess"; import MatchTypeFilter from "~lib/components/MatchTypeFilter"; import Modal from "~lib/components/Modal"; import UserCard from "~lib/components/UserCard"; import UserCardSkeleton from "~lib/components/UserCardSkeleton"; import { MESSAGE_NAMES } from "~lib/constants"; import { useRetrieveBskyUsers } from "~lib/hooks/useRetrieveBskyUsers"; import cssText from "data-text:~style.content.css"; export const config: PlasmoCSConfig = { matches: ["https://twitter.com/*", "https://x.com/*"], all_frames: true, }; export const getStyle = () => { const style = document.createElement("style"); // patch for shadow dom style.textContent = cssText.replaceAll(":root", ":host"); return style; }; const App = () => { const { initialize, modalRef, users, loading, handleClickAction, actionMode, errorMessage, restart, isRateLimitError, isSucceeded, matchTypeFilter, changeMatchTypeFilter, filteredUsers, } = useRetrieveBskyUsers(); React.useEffect(() => { const messageHandler = ( message: { name: (typeof MESSAGE_NAMES)[keyof typeof MESSAGE_NAMES]; body: { userId: string; password: string; }; }, _sender: chrome.runtime.MessageSender, sendResponse: (response?: Record) => void, ) => { if (Object.values(MESSAGE_NAMES).includes(message.name)) { initialize({ identifier: message.body.userId, password: message.body.password, messageName: message.name, }) .then(() => { sendResponse({ hasError: false }); }) .catch((e) => { console.error(e); sendResponse({ hasError: true, message: e.toString() }); }); return true; } return false; }; chrome.runtime.onMessage.addListener(messageHandler); return () => { chrome.runtime.onMessage.removeListener(messageHandler); }; }, [initialize]); return ( <>

Find Bluesky Users

{loading && (

)}

Detected:

{users.length}

{isSucceeded && ( {users.length} Bluesky accounts detected. )} {errorMessage && ( {errorMessage} )}
{filteredUsers.length > 0 ? (
{filteredUsers.map((user) => ( ))}
) : ( loading && )}
); }; export default App;