refactor: rename

This commit is contained in:
kawamataryo 2024-11-19 21:19:48 +09:00
parent bc1dcc32d3
commit e07fbf91c3
4 changed files with 7 additions and 7 deletions

View File

@ -1,4 +1,4 @@
import type { CrawledUser } from "~types"; import type { CrawledUserInfo } from "~types";
import { BSKY_DOMAIN } from "./constants"; import { BSKY_DOMAIN } from "./constants";
export const getUserCells = ({ export const getUserCells = ({
@ -22,7 +22,7 @@ export const getUserCells = ({
return Array.from(userCells); return Array.from(userCells);
}; };
export const extractUserData = (userCell: Element): CrawledUser => { export const extractUserData = (userCell: Element): CrawledUserInfo => {
const anchors = Array.from(userCell.querySelectorAll("a")); const anchors = Array.from(userCell.querySelectorAll("a"));
const [avatarEl, displayNameEl] = anchors; const [avatarEl, displayNameEl] = anchors;
const accountName = avatarEl?.getAttribute("href")?.replace("/", ""); const accountName = avatarEl?.getAttribute("href")?.replace("/", "");

View File

@ -11,7 +11,7 @@ import {
import { extractUserData, getUserCells } from "~lib/domHelpers"; import { extractUserData, getUserCells } from "~lib/domHelpers";
import { searchBskyUser } from "~lib/searchBskyUsers"; import { searchBskyUser } from "~lib/searchBskyUsers";
import { wait } from "~lib/utils"; import { wait } from "~lib/utils";
import type { CrawledUser, MatchType } from "~types"; import type { CrawledUserInfo, MatchType } from "~types";
export type BskyUser = { export type BskyUser = {
did: string; did: string;
@ -65,7 +65,7 @@ export const useRetrieveBskyUsers = () => {
}; };
const retrieveBskyUsers = React.useCallback( const retrieveBskyUsers = React.useCallback(
async (usersData: CrawledUser[]) => { async (usersData: CrawledUserInfo[]) => {
for (const userData of usersData) { for (const userData of usersData) {
const searchResult = await searchBskyUser({ const searchResult = await searchBskyUser({
client: bskyClient.current, client: bskyClient.current,

View File

@ -1,7 +1,7 @@
import type { ProfileView } from "@atproto/api/dist/client/types/app/bsky/actor/defs"; import type { ProfileView } from "@atproto/api/dist/client/types/app/bsky/actor/defs";
import { isSimilarUser } from "~lib/bskyHelpers"; import { isSimilarUser } from "~lib/bskyHelpers";
import { isOneSymbol } from "~lib/utils"; import { isOneSymbol } from "~lib/utils";
import type { CrawledUser } from "~types"; import type { CrawledUserInfo } from "~types";
import type { BskyServiceWorkerClient } from "./bskyServiceWorkerClient"; import type { BskyServiceWorkerClient } from "./bskyServiceWorkerClient";
import { BSKY_PROFILE_LABEL } from "./constants"; import { BSKY_PROFILE_LABEL } from "./constants";
@ -16,7 +16,7 @@ export const searchBskyUser = async ({
userData, userData,
}: { }: {
client: BskyServiceWorkerClient; client: BskyServiceWorkerClient;
userData: CrawledUser; userData: CrawledUserInfo;
}) => { }) => {
const searchTerms = [ const searchTerms = [
...(userData.bskyHandle ? [userData.bskyHandle] : []), ...(userData.bskyHandle ? [userData.bskyHandle] : []),

View File

@ -23,7 +23,7 @@ export type MatchTypeFilterValue = {
[BSKY_USER_MATCH_TYPE.FOLLOWING]: boolean; [BSKY_USER_MATCH_TYPE.FOLLOWING]: boolean;
}; };
export type CrawledUser = { export type CrawledUserInfo = {
accountName: string; accountName: string;
displayName: string; displayName: string;
accountNameRemoveUnderscore: string; accountNameRemoveUnderscore: string;