fix for linter

This commit is contained in:
Doug Flowers 2024-11-19 18:22:03 -06:00
parent 409cd355b5
commit 8f9993285a
8 changed files with 28 additions and 20 deletions

View File

@ -5,7 +5,9 @@ import { STORAGE_KEYS } from "~lib/constants";
const handler: PlasmoMessaging.MessageHandler = async (req, res) => { const handler: PlasmoMessaging.MessageHandler = async (req, res) => {
const { name, description, userDids } = req.body; const { name, description, userDids } = req.body;
const storage = await chrome.storage.local.get(STORAGE_KEYS.BSKY_CLIENT_SESSION); const storage = await chrome.storage.local.get(
STORAGE_KEYS.BSKY_CLIENT_SESSION,
);
const session = storage[STORAGE_KEYS.BSKY_CLIENT_SESSION]; const session = storage[STORAGE_KEYS.BSKY_CLIENT_SESSION];
if (!session || !session.did) { if (!session || !session.did) {

View File

@ -67,7 +67,10 @@ const App = () => {
const stopAndShowDetectedUsers = async () => { const stopAndShowDetectedUsers = async () => {
stopRetrieveLoop(); stopRetrieveLoop();
await chrome.storage.local.set({ users: JSON.stringify(users), listName: listName }); await chrome.storage.local.set({
users: JSON.stringify(users),
listName: listName,
});
openOptionPage(); openOptionPage();
}; };

View File

@ -124,14 +124,14 @@ export class BskyClient {
}) => { }) => {
const result = await this.agent.com.atproto.repo.createRecord({ const result = await this.agent.com.atproto.repo.createRecord({
repo: this.me.did, repo: this.me.did,
collection: 'app.bsky.graph.list', collection: "app.bsky.graph.list",
record: { record: {
$type: 'app.bsky.graph.list', $type: "app.bsky.graph.list",
purpose: 'app.bsky.graph.defs#curatelist', purpose: "app.bsky.graph.defs#curatelist",
name, name,
description, description,
createdAt: new Date().toISOString() createdAt: new Date().toISOString(),
} },
}); });
return result.data.uri; return result.data.uri;
}; };
@ -145,13 +145,13 @@ export class BskyClient {
}) => { }) => {
return await this.agent.com.atproto.repo.createRecord({ return await this.agent.com.atproto.repo.createRecord({
repo: this.me.did, repo: this.me.did,
collection: 'app.bsky.graph.listitem', collection: "app.bsky.graph.listitem",
record: { record: {
$type: 'app.bsky.graph.listitem', $type: "app.bsky.graph.listitem",
subject: userDid, subject: userDid,
list: listUri, list: listUri,
createdAt: new Date().toISOString() createdAt: new Date().toISOString(),
} },
}); });
}; };

View File

@ -157,10 +157,7 @@ const Sidebar = ({
</svg> </svg>
<p className="text-xl font-bold">Action</p> <p className="text-xl font-bold">Action</p>
</div> </div>
<AsyncButton <AsyncButton onClick={actionAll} label={getActionLabel()} />
onClick={actionAll}
label={getActionLabel()}
/>
<p className="text-xs"> <p className="text-xs">
User detection is not perfect and may include false positives. User detection is not perfect and may include false positives.
</p> </p>

View File

@ -1,8 +1,8 @@
import React from "react"; import React from "react";
import { match } from "ts-pattern"; import { match } from "ts-pattern";
import type { BskyUser } from "~types";
import { ACTION_MODE, MATCH_TYPE_LABEL_AND_COLOR } from "../constants"; import { ACTION_MODE, MATCH_TYPE_LABEL_AND_COLOR } from "../constants";
import AvatarFallbackSvg from "./Icons/AvatarFallbackSvg"; import AvatarFallbackSvg from "./Icons/AvatarFallbackSvg";
import type { BskyUser } from "~types";
export type Props = { export type Props = {
user: BskyUser; user: BskyUser;

View File

@ -25,7 +25,8 @@ export const ACTION_MODE = {
export const MESSAGE_NAME_TO_ACTION_MODE_MAP = { export const MESSAGE_NAME_TO_ACTION_MODE_MAP = {
[MESSAGE_NAMES.SEARCH_BSKY_USER_ON_FOLLOW_PAGE]: ACTION_MODE.FOLLOW, [MESSAGE_NAMES.SEARCH_BSKY_USER_ON_FOLLOW_PAGE]: ACTION_MODE.FOLLOW,
[MESSAGE_NAMES.SEARCH_BSKY_USER_ON_LIST_MEMBERS_PAGE]: ACTION_MODE.IMPORT_LIST, [MESSAGE_NAMES.SEARCH_BSKY_USER_ON_LIST_MEMBERS_PAGE]:
ACTION_MODE.IMPORT_LIST,
[MESSAGE_NAMES.SEARCH_BSKY_USER_ON_BLOCK_PAGE]: ACTION_MODE.BLOCK, [MESSAGE_NAMES.SEARCH_BSKY_USER_ON_BLOCK_PAGE]: ACTION_MODE.BLOCK,
}; };

View File

@ -130,7 +130,7 @@ export const useBskyUserManager = () => {
let actionCount = 0; let actionCount = 0;
if (actionMode === ACTION_MODE.IMPORT_LIST) { if (actionMode === ACTION_MODE.IMPORT_LIST) {
const userDids = filteredUsers.map(user => user.did); const userDids = filteredUsers.map((user) => user.did);
await chrome.runtime.sendMessage({ await chrome.runtime.sendMessage({
name: "createListAndAddUsers", name: "createListAndAddUsers",
body: { body: {

View File

@ -9,7 +9,9 @@ import { XService } from "~lib/services/x";
import type { BskyUser, CrawledUserInfo } from "~types"; import type { BskyUser, CrawledUserInfo } from "~types";
const scrapeListNameFromPage = (): string => { const scrapeListNameFromPage = (): string => {
const listNameElement = document.querySelector('div[aria-label="Timeline: List"] span'); const listNameElement = document.querySelector(
'div[aria-label="Timeline: List"] span'
);
if (listNameElement) { if (listNameElement) {
return listNameElement.textContent.trim(); return listNameElement.textContent.trim();
} }
@ -114,7 +116,10 @@ export const useRetrieveBskyUsers = () => {
); );
React.useEffect(() => { React.useEffect(() => {
chrome.storage.local.set({ users: JSON.stringify(users), listName: listName }); chrome.storage.local.set({
users: JSON.stringify(users),
listName: listName
});
}, [users, listName]); }, [users, listName]);
const stopRetrieveLoop = React.useCallback(() => { const stopRetrieveLoop = React.useCallback(() => {