fix: format

This commit is contained in:
kawamataryo 2024-11-16 12:34:57 +09:00
parent 8d54bf7159
commit 60a885e31d
2 changed files with 19 additions and 11 deletions

View File

@ -27,7 +27,9 @@ export const getAccountNameAndDisplayName = (userCell: Element) => {
const twDisplayName = displayNameEl?.textContent; const twDisplayName = displayNameEl?.textContent;
const bskyHandle = const bskyHandle =
userCell.textContent?.match(/([^/\s]+\.bsky\.social)/)?.[1] ?? userCell.textContent?.match(/([^/\s]+\.bsky\.social)/)?.[1] ??
userCell.textContent?.match(/bsky\.app\/profile\/([^/\s]+)…?/)?.[1] ?? userCell.textContent
?.match(/bsky\.app\/profile\/([^/\s]+)…?/)?.[1]
?.replace("…", "") ??
null; null;
return { return {

View File

@ -113,7 +113,9 @@ export const useRetrieveBskyUsers = () => {
if (messageName === "search_bsky_user_on_list_members_page") { if (messageName === "search_bsky_user_on_list_members_page") {
// select the modal wrapper using viewport selector to avoid conflation with feed in the background // select the modal wrapper using viewport selector to avoid conflation with feed in the background
scrollElement = document.querySelector('div[data-viewportview="true"]') as HTMLElement; scrollElement = document.querySelector(
'div[data-viewportview="true"]',
) as HTMLElement;
// base interval off of intitial scroll height // base interval off of intitial scroll height
modalScrollInterval = scrollElement.scrollHeight; modalScrollInterval = scrollElement.scrollHeight;
} else { } else {
@ -147,13 +149,19 @@ export const useRetrieveBskyUsers = () => {
// break if bottom is reached // break if bottom is reached
if (scrollElement instanceof HTMLElement) { if (scrollElement instanceof HTMLElement) {
if (scrollElement.scrollTop + scrollElement.clientHeight >= scrollElement.scrollHeight) { if (
scrollElement.scrollTop + scrollElement.clientHeight >=
scrollElement.scrollHeight
) {
setIsBottomReached(true); setIsBottomReached(true);
setLoading(false); setLoading(false);
} }
} else { } else {
const documentElement = document.documentElement; const documentElement = document.documentElement;
if (documentElement.scrollTop + documentElement.clientHeight >= documentElement.scrollHeight) { if (
documentElement.scrollTop + documentElement.clientHeight >=
documentElement.scrollHeight
) {
setIsBottomReached(true); setIsBottomReached(true);
setLoading(false); setLoading(false);
} }
@ -196,13 +204,11 @@ export const useRetrieveBskyUsers = () => {
bskyClient.current = new BskyServiceWorkerClient(session); bskyClient.current = new BskyServiceWorkerClient(session);
startRetrieveLoop(messageName).catch( startRetrieveLoop(messageName).catch((e) => {
(e) => {
console.error(e); console.error(e);
setErrorMessage(e.message); setErrorMessage(e.message);
setLoading(false); setLoading(false);
}, });
);
setLoading(true); setLoading(true);
await setUsers([]); await setUsers([]);
showModal(); showModal();