mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
chore(deps): use published bitsocial react hooks
This commit is contained in:
+1
-1
@@ -8,7 +8,7 @@
|
||||
"license": "GPL-3.0-or-later",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@bitsocialnet/bitsocial-react-hooks": "https://codeload.github.com/bitsocialnet/bitsocial-react-hooks/tar.gz/9f4614fdb0779cc2a629ef270609d32efaf7713f",
|
||||
"@bitsocial/bitsocial-react-hooks": "0.1.2",
|
||||
"@capacitor/app": "7.0.1",
|
||||
"@capacitor/status-bar": "7.0.1",
|
||||
"@capawesome/capacitor-android-edge-to-edge-support": "7.2.2",
|
||||
|
||||
+1
-1
@@ -4,6 +4,6 @@ These rules apply to `src/**`. Follow the repo-root `AGENTS.md` first, then use
|
||||
|
||||
- Keep route composition in `src/views/`, reusable UI in `src/components/`, shared logic in `src/hooks/`, and shared app state in `src/stores/`.
|
||||
- Before adding new state, decide whether it belongs in render, a reusable hook, or a Zustand store. Do not duplicate the same state logic across views.
|
||||
- Use `@bitsocialnet/bitsocial-react-hooks` for data access. Do not add data-fetching `useEffect` calls or effects that only synchronize derived state.
|
||||
- Use `@bitsocial/bitsocial-react-hooks` for data access. Do not add data-fetching `useEffect` calls or effects that only synchronize derived state.
|
||||
- When changing React UI logic, run `yarn doctor` in addition to build, lint, and type-check. When changing layout or interaction, verify desktop and mobile behavior with `playwright-cli`.
|
||||
- Prefer extending nearby tests under `src/**/__tests__/` when touching already-covered behavior.
|
||||
|
||||
@@ -45,7 +45,7 @@ const testState = vi.hoisted(() => ({
|
||||
useThemeMock: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks', () => ({
|
||||
useAccount: () => testState.account,
|
||||
useAccountComment: ({ commentIndex }: { commentIndex?: number }) => (typeof commentIndex === 'number' ? testState.accountComments[commentIndex] : undefined),
|
||||
useCommunity: (options?: { communityAddress?: string; community?: { name?: string; publicKey?: string } }) => {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { lazy, Suspense, useEffect } from 'react';
|
||||
import { Navigate, Outlet, Route, Routes, useLocation, useParams } from 'react-router-dom';
|
||||
import { useAccount, useCommunity } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import { useAccount, useCommunity } from '@bitsocial/bitsocial-react-hooks';
|
||||
import { initSnow, removeSnow } from './lib/snow';
|
||||
import { isAllView, isCatalogView, isModView, isSubscriptionsView } from './lib/utils/view-utils';
|
||||
import { preloadReplyModal, preloadThemeAssets } from './lib/utils/preload-utils';
|
||||
|
||||
@@ -78,7 +78,7 @@ vi.mock('react-i18next', () => ({
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks', () => ({
|
||||
useAccount: () => ({ author: { address: '0xviewer' } }),
|
||||
useAccountComment: () => undefined,
|
||||
useEditedComment: () => ({ editedComment: undefined }),
|
||||
|
||||
@@ -72,7 +72,7 @@ vi.mock('react-router-dom', async () => {
|
||||
};
|
||||
});
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks', () => ({
|
||||
useAccount: () => undefined,
|
||||
useAccountComment: () => testState.accountComment,
|
||||
useComment: ({ commentCid }: { commentCid?: string }) => (commentCid ? testState.commentsByCid[commentCid] : undefined),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Link, useLocation, useNavigate, useParams } from 'react-router-dom';
|
||||
import { useComment, useSubscribe } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import { useComment, useSubscribe } from '@bitsocial/bitsocial-react-hooks';
|
||||
import { isAllView, isCatalogView, isModView, isModQueueView, isPendingPostView, isPostPageView, isSubscriptionsView } from '../../lib/utils/view-utils';
|
||||
import { usePostPageNumber } from '../../hooks/use-post-page-number';
|
||||
import { useDirectories, useDirectoryByAddress } from '../../hooks/use-directories';
|
||||
|
||||
@@ -51,13 +51,13 @@ vi.mock('react-router-dom', async () => {
|
||||
};
|
||||
});
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks', () => ({
|
||||
useAccount: () => undefined,
|
||||
useAccountComment: () => testState.accountComment,
|
||||
useCommunity: () => testState.community,
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks/dist/stores/accounts', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks/dist/stores/accounts', () => ({
|
||||
default: (selector: (state: { activeAccountId?: string; accounts: Record<string, { subscriptions?: string[] }> }) => unknown) =>
|
||||
selector({
|
||||
accounts: {
|
||||
@@ -69,7 +69,7 @@ vi.mock('@bitsocialnet/bitsocial-react-hooks/dist/stores/accounts', () => ({
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks/dist/stores/communities', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks/dist/stores/communities', () => ({
|
||||
default: (selector: (state: { communities: typeof testState.communities }) => unknown) =>
|
||||
selector({
|
||||
communities: testState.communities,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useLocation, useParams, useNavigate } from 'react-router-dom';
|
||||
import { useCommunity } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import useAccountsStore from '@bitsocialnet/bitsocial-react-hooks/dist/stores/accounts';
|
||||
import { useCommunity } from '@bitsocial/bitsocial-react-hooks';
|
||||
import useAccountsStore from '@bitsocial/bitsocial-react-hooks/dist/stores/accounts';
|
||||
import getShortAddress from '../../lib/get-short-address';
|
||||
import { useCommunityIdentifier } from '../../hooks/use-community-identifiers';
|
||||
import { useStableCommunity } from '../../hooks/use-stable-community';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useCommunity } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import { useCommunity } from '@bitsocial/bitsocial-react-hooks';
|
||||
import { useCommunityIdentifier } from '../../hooks/use-community-identifiers';
|
||||
import { useDirectoryByAddress } from '../../hooks/use-directories';
|
||||
import useIsCommunityOffline from '../../hooks/use-is-community-offline';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useState, useMemo } from 'react';
|
||||
import { Link, useLocation } from 'react-router-dom';
|
||||
import { useAccount } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import { useAccount } from '@bitsocial/bitsocial-react-hooks';
|
||||
import useBoardsBarEditModalStore from '../../stores/use-boards-bar-edit-modal-store';
|
||||
import useBoardsBarVisibilityStore from '../../stores/use-boards-bar-visibility-store';
|
||||
import { getAllBoardCodes } from '../../constants/board-codes';
|
||||
|
||||
@@ -52,12 +52,12 @@ vi.mock('react-router-dom', async () => {
|
||||
};
|
||||
});
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks', () => ({
|
||||
useAccount: () => undefined,
|
||||
useAccountComment: () => testState.accountComment,
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks/dist/stores/accounts', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks/dist/stores/accounts', () => ({
|
||||
default: (selector: (state: { activeAccountId: string; accounts: Record<string, { subscriptions: string[] }> }) => unknown) =>
|
||||
selector({
|
||||
activeAccountId: 'account-1',
|
||||
|
||||
@@ -2,7 +2,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { Link, useLocation, useNavigate, useParams } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import getShortAddress from '../../lib/get-short-address';
|
||||
import useAccountsStore from '@bitsocialnet/bitsocial-react-hooks/dist/stores/accounts';
|
||||
import useAccountsStore from '@bitsocial/bitsocial-react-hooks/dist/stores/accounts';
|
||||
import { isAllView, isCatalogView, isModView, isSubscriptionsView } from '../../lib/utils/view-utils';
|
||||
import { useAccountCommunityAddresses } from '../../hooks/use-account-community-addresses';
|
||||
import { useDirectories, useDirectoriesMetadata, DirectoryCommunity } from '../../hooks/use-directories';
|
||||
|
||||
@@ -67,7 +67,7 @@ vi.mock('react-i18next', () => ({
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks', () => ({
|
||||
useReplies: ({ comment, sortType }: { comment?: TestComment; sortType?: string }) => {
|
||||
if (comment) {
|
||||
testState.lastRepliesComment = comment;
|
||||
@@ -92,7 +92,7 @@ vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
|
||||
},
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks/dist/lib/localforage-lru/index.js', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks/dist/lib/localforage-lru/index.js', () => ({
|
||||
default: {
|
||||
createInstance: () => ({
|
||||
entries: vi.fn().mockResolvedValue([]),
|
||||
|
||||
@@ -3,7 +3,7 @@ import { createPortal } from 'react-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Link, useLocation, useParams } from 'react-router-dom';
|
||||
import { useFloating, offset, size, Placement } from '@floating-ui/react';
|
||||
import { Comment, useReplies } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import { Comment, useReplies } from '@bitsocial/bitsocial-react-hooks';
|
||||
import getShortAddress from '../../lib/get-short-address';
|
||||
import { shouldShowSnow } from '../../lib/snow';
|
||||
import { getHasThumbnail } from '../../lib/utils/media-utils';
|
||||
|
||||
@@ -36,7 +36,7 @@ vi.mock('react-i18next', () => ({
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks', () => ({
|
||||
useAccount: () => testState.account,
|
||||
useComment: ({ commentCid }: { commentCid?: string }) => (commentCid ? testState.commentsByCid[commentCid] : undefined),
|
||||
}));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useRef, useState, useEffect, useCallback } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Challenge as ChallengeType, useAccount, useComment } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import { Challenge as ChallengeType, useAccount, useComment } from '@bitsocial/bitsocial-react-hooks';
|
||||
import { getPublicationPreview, getPublicationType, getVotePreview } from '../../lib/utils/challenge-utils';
|
||||
import useIsMobile from '../../hooks/use-is-mobile';
|
||||
import useChallengesStore from '../../stores/use-challenges-store';
|
||||
|
||||
@@ -85,11 +85,11 @@ vi.mock('react-router-dom', async () => {
|
||||
};
|
||||
});
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks', () => ({
|
||||
useComment: ({ commentCid }: { commentCid?: string }) => (commentCid ? testState.commentsByCid[commentCid] : undefined),
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks/dist/stores/communities-pages', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks/dist/stores/communities-pages', () => ({
|
||||
default: (selector: (state: { comments: Record<string, TestComment> }) => unknown) =>
|
||||
selector({
|
||||
comments: testState.commentsByCid,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Fragment, type ReactNode, useMemo, useState } from 'react';
|
||||
import { useLocation, useParams } from 'react-router-dom';
|
||||
import { Trans, useTranslation } from 'react-i18next';
|
||||
import { Comment, useComment } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import useCommunitiesPagesStore from '@bitsocialnet/bitsocial-react-hooks/dist/stores/communities-pages';
|
||||
import { Comment, useComment } from '@bitsocial/bitsocial-react-hooks';
|
||||
import useCommunitiesPagesStore from '@bitsocial/bitsocial-react-hooks/dist/stores/communities-pages';
|
||||
import usePostNumberStore from '../../stores/use-post-number-store';
|
||||
import getShortAddress from '../../lib/get-short-address';
|
||||
import { getFormattedDate, getFormattedTimeAgo } from '../../lib/utils/time-utils';
|
||||
|
||||
@@ -73,7 +73,7 @@ vi.mock('@floating-ui/react', () => ({
|
||||
useRole: () => ({}),
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks', () => ({
|
||||
useAccount: () => testState.account,
|
||||
usePublishCommentEdit: (options: Record<string, any>) => {
|
||||
testState.authorOptions = options;
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
usePublishCommentEdit,
|
||||
usePublishCommentModeration,
|
||||
PublishCommentModerationOptions,
|
||||
} from '@bitsocialnet/bitsocial-react-hooks';
|
||||
} from '@bitsocial/bitsocial-react-hooks';
|
||||
import styles from './edit-menu.module.css';
|
||||
import { alertChallengeVerificationFailed } from '../../lib/utils/challenge-utils';
|
||||
import { isCommentArchived } from '../../lib/utils/comment-moderation-utils';
|
||||
|
||||
@@ -30,7 +30,7 @@ vi.mock('react-i18next', () => ({
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks', () => ({
|
||||
useComment: () => testState.post,
|
||||
}));
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useLocation, useParams } from 'react-router-dom';
|
||||
import { useComment } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import { useComment } from '@bitsocial/bitsocial-react-hooks';
|
||||
import BoardsBar from '../boards-bar';
|
||||
import SiteLegalMeta from '../site-legal-meta';
|
||||
import StyleSelector from '../style-selector/style-selector';
|
||||
|
||||
@@ -25,7 +25,7 @@ vi.mock('react-i18next', () => ({
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks', () => ({
|
||||
useAccount: () => ({ id: 'account-1' }),
|
||||
}));
|
||||
|
||||
|
||||
@@ -59,11 +59,11 @@ vi.mock('@floating-ui/react', () => ({
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks', () => ({
|
||||
useComment: ({ commentCid }: { commentCid?: string }) => (commentCid ? testState.comments[commentCid] : undefined),
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks/dist/stores/communities-pages', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks/dist/stores/communities-pages', () => ({
|
||||
default: (selector: (state: { comments: typeof testState.comments }) => unknown) =>
|
||||
selector({
|
||||
comments: testState.comments,
|
||||
|
||||
@@ -3,7 +3,7 @@ import { useEffect, useRef, useState } from 'react';
|
||||
import { createPortal } from 'react-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { useAccount } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import { useAccount } from '@bitsocial/bitsocial-react-hooks';
|
||||
import { useDirectories } from '../../hooks/use-directories';
|
||||
import useIsMobile from '../../hooks/use-is-mobile';
|
||||
import { resolveExternalQuoteTarget } from '../../lib/utils/external-quote-resolver';
|
||||
|
||||
@@ -13,8 +13,8 @@ import { is5chanLink, transform5chanLinkToInternal, isValidCrossboardPattern } f
|
||||
import { CROSSBOARD_NUMBER_QUOTE_TOKEN_REGEX, type ExternalQuoteReference } from '../../lib/utils/external-quote-utils';
|
||||
import { isUnavailableQuoteTarget } from '../../lib/utils/quote-link-utils';
|
||||
import usePostNumberStore, { getCidForPostNumber } from '../../stores/use-post-number-store';
|
||||
import useCommunitiesPagesStore from '@bitsocialnet/bitsocial-react-hooks/dist/stores/communities-pages';
|
||||
import { useComment } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import useCommunitiesPagesStore from '@bitsocial/bitsocial-react-hooks/dist/stores/communities-pages';
|
||||
import { useComment } from '@bitsocial/bitsocial-react-hooks';
|
||||
import ReplyQuotePreview from '../reply-quote-preview';
|
||||
import ExternalNumberQuoteLink from './external-number-quote-link';
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { useEffect, useRef, useState, useCallback, useMemo } from 'react';
|
||||
import { Trans, useTranslation } from 'react-i18next';
|
||||
import { Link, useLocation, useNavigationType, useParams } from 'react-router-dom';
|
||||
import { Virtuoso, VirtuosoHandle, StateSnapshot } from 'react-virtuoso';
|
||||
import { Comment, useEditedComment, useReplies, useAccount } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import { Comment, useEditedComment, useReplies, useAccount } from '@bitsocial/bitsocial-react-hooks';
|
||||
import getShortAddress from '../../lib/get-short-address';
|
||||
import styles from '../../views/post/post.module.css';
|
||||
import { CommentMediaInfo, getDisplayMediaInfoType, getHasThumbnail, getMediaDimensions } from '../../lib/utils/media-utils';
|
||||
@@ -47,7 +47,7 @@ import useThreadLiveUpdatesStore from '../../stores/use-thread-live-updates-stor
|
||||
import useRegisterFreshReplies from '../../hooks/use-register-fresh-replies';
|
||||
import useReplyHeightEstimates from '../../hooks/use-reply-height-estimates';
|
||||
import { alertChallengeVerificationFailed } from '../../lib/utils/challenge-utils';
|
||||
import { usePublishCommentModeration } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import { usePublishCommentModeration } from '@bitsocial/bitsocial-react-hooks';
|
||||
import useQuotedByMap from '../../hooks/use-quoted-by-map';
|
||||
import useProgressiveRender from '../../hooks/use-progressive-render';
|
||||
import useFreshReplies from '../../hooks/use-fresh-replies';
|
||||
|
||||
@@ -25,7 +25,7 @@ vi.mock('react-i18next', () => ({
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks/dist/lib/localforage-lru/index.js', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks/dist/lib/localforage-lru/index.js', () => ({
|
||||
default: {
|
||||
createInstance: () => ({
|
||||
entries: vi.fn().mockResolvedValue([]),
|
||||
|
||||
@@ -63,7 +63,7 @@ vi.mock('react-router-dom', async () => {
|
||||
};
|
||||
});
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks', () => ({
|
||||
setAccount: (account: unknown) => testState.setAccountMock(account),
|
||||
useAccount: () => testState.account,
|
||||
useAccountComment: () => testState.accountComment,
|
||||
@@ -74,11 +74,11 @@ vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
|
||||
useEditedComment: () => ({ editedComment: testState.editedComment }),
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks/dist/stores/communities', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks/dist/stores/communities', () => ({
|
||||
default: (selector: (state: { communities: typeof testState.communities }) => unknown) => selector({ communities: testState.communities }),
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks/dist/stores/communities-pages', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks/dist/stores/communities-pages', () => ({
|
||||
default: (selector: (state: { comments: typeof testState.comments }) => unknown) => selector({ comments: testState.comments }),
|
||||
}));
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useLocation, useNavigate, useParams } from 'react-router-dom';
|
||||
import { Comment, setAccount, useAccount, useEditedComment } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import { Comment, setAccount, useAccount, useEditedComment } from '@bitsocial/bitsocial-react-hooks';
|
||||
import getShortAddress from '../../lib/get-short-address';
|
||||
import useCommunitiesPagesStore from '@bitsocialnet/bitsocial-react-hooks/dist/stores/communities-pages';
|
||||
import useCommunitiesPagesStore from '@bitsocial/bitsocial-react-hooks/dist/stores/communities-pages';
|
||||
import { getLinkMediaInfo } from '../../lib/utils/media-utils';
|
||||
import { isValidURL } from '../../lib/utils/url-utils';
|
||||
import { isAllView, isCatalogView, isModQueueView, isModView, isPostPageView, isSubscriptionsView } from '../../lib/utils/view-utils';
|
||||
|
||||
@@ -29,12 +29,12 @@ vi.mock('react-i18next', () => ({
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks', () => ({
|
||||
useAccount: () => ({ author: { address: '0xmod' }, signer: { address: '0xauthor' } }),
|
||||
usePublishCommentEdit: () => ({ publishCommentEdit: vi.fn().mockResolvedValue(undefined) }),
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks/dist/lib/localforage-lru/index.js', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks/dist/lib/localforage-lru/index.js', () => ({
|
||||
default: {
|
||||
createInstance: () => ({
|
||||
entries: vi.fn().mockResolvedValue([]),
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { createPortal } from 'react-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import type { ChallengeVerification, Comment } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import { useAccount, usePublishCommentEdit } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import type { ChallengeVerification, Comment } from '@bitsocial/bitsocial-react-hooks';
|
||||
import { useAccount, usePublishCommentEdit } from '@bitsocial/bitsocial-react-hooks';
|
||||
import { autoUpdate, flip, FloatingFocusManager, offset, shift, useClick, useDismiss, useFloating, useId, useInteractions, useRole } from '@floating-ui/react';
|
||||
import styles from './post-menu-mobile.module.css';
|
||||
import { getCommentMediaInfo } from '../../../lib/utils/media-utils';
|
||||
|
||||
@@ -2,7 +2,7 @@ import { useEffect, useRef, useState, useCallback, useMemo } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Link, useLocation, useNavigationType, useParams } from 'react-router-dom';
|
||||
import { Virtuoso, VirtuosoHandle, StateSnapshot } from 'react-virtuoso';
|
||||
import { Comment, useEditedComment, useReplies, useAccount, usePublishCommentModeration } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import { Comment, useEditedComment, useReplies, useAccount, usePublishCommentModeration } from '@bitsocial/bitsocial-react-hooks';
|
||||
import getShortAddress from '../../lib/get-short-address';
|
||||
import styles from '../../views/post/post.module.css';
|
||||
import { shouldShowSnow } from '../../lib/snow';
|
||||
|
||||
@@ -70,7 +70,7 @@ vi.mock('react-i18next', () => ({
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks', () => ({
|
||||
setAccount: (account: unknown) => testState.setAccountMock(account),
|
||||
useAccount: () => testState.account,
|
||||
useCommunity: (options?: { community?: { name?: string; publicKey?: string } }) => {
|
||||
@@ -79,7 +79,7 @@ vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
|
||||
},
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks/dist/stores/communities', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks/dist/stores/communities', () => ({
|
||||
default: <T,>(selector: (state: { communities: typeof testState.communities }) => T) =>
|
||||
selector({
|
||||
communities: testState.communities,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import { useLocation, useParams } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { setAccount, useAccount } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import { setAccount, useAccount } from '@bitsocial/bitsocial-react-hooks';
|
||||
import { isValidURL } from '../../lib/utils/url-utils';
|
||||
import { isAllView, isModView, isSubscriptionsView } from '../../lib/utils/view-utils';
|
||||
import useSelectedTextStore from '../../stores/use-selected-text-store';
|
||||
|
||||
@@ -59,7 +59,7 @@ vi.mock('react-router-dom', async () => {
|
||||
};
|
||||
});
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks', () => ({
|
||||
useAccount: () => testState.account,
|
||||
useAccountComment: (options?: { commentCid?: string }) => {
|
||||
testState.accountCommentCalls.push(options);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import { createPortal } from 'react-dom';
|
||||
import { Link, useLocation, useNavigate } from 'react-router-dom';
|
||||
import { Comment, useAccount } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import { Comment, useAccount } from '@bitsocial/bitsocial-react-hooks';
|
||||
import { useFloating, offset, shift, size, autoUpdate, Placement } from '@floating-ui/react';
|
||||
import { useDirectories } from '../../hooks/use-directories';
|
||||
import useSafeAccountComment from '../../hooks/use-safe-account-comment';
|
||||
|
||||
@@ -29,7 +29,7 @@ vi.mock('react-i18next', () => ({
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks', () => ({
|
||||
useAccount: hookMocks.useAccount,
|
||||
useAccounts: hookMocks.useAccounts,
|
||||
deleteAccount: hookMocks.deleteAccount,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { memo } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { deleteAccount, exportAccount, importAccount, setActiveAccount, useAccount, useAccounts } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import { deleteAccount, exportAccount, importAccount, setActiveAccount, useAccount, useAccounts } from '@bitsocial/bitsocial-react-hooks';
|
||||
import styles from './account-settings.module.css';
|
||||
import { Capacitor } from '@capacitor/core';
|
||||
import { useLocation, useNavigate } from 'react-router-dom';
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ vi.mock('react-i18next', () => ({
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks', () => ({
|
||||
setAccount: (account: unknown) => testState.setAccountMock(account),
|
||||
useAccount: () => testState.account,
|
||||
usePkcRpcSettings: () => testState.rpcSettings,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { memo, RefObject, useRef, useState } from 'react';
|
||||
import { setAccount, useAccount, usePkcRpcSettings } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import { setAccount, useAccount, usePkcRpcSettings } from '@bitsocial/bitsocial-react-hooks';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import styles from './advanced-settings.module.css';
|
||||
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ vi.mock('react-i18next', () => ({
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks', () => ({
|
||||
setAccount: hookMocks.setAccount,
|
||||
useAccount: hookMocks.useAccount,
|
||||
useResolvedAuthorAddress: hookMocks.useResolvedAuthorAddress,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { memo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useAccount, setAccount, useResolvedAuthorAddress } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import { useAccount, setAccount, useResolvedAuthorAddress } from '@bitsocial/bitsocial-react-hooks';
|
||||
import styles from './crypto-address-setting.module.css';
|
||||
|
||||
const withErrorHandling = async <T,>(fn: () => Promise<T>, onError: (e: unknown) => void): Promise<T | undefined> => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { memo, useState } from 'react';
|
||||
import { Account, setAccount, useAccount } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import { Account, setAccount, useAccount } from '@bitsocial/bitsocial-react-hooks';
|
||||
import styles from './crypto-wallets-setting.module.css';
|
||||
import { Trans, useTranslation } from 'react-i18next';
|
||||
import capitalize from 'lodash/capitalize';
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ vi.mock('react-i18next', () => ({
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks', () => ({
|
||||
useAccount: () => accountState.value,
|
||||
useSubscribe: ({ communityAddress }: { communityAddress: string }) =>
|
||||
subscriptionMocks.byAddress.get(communityAddress) ?? {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { setAccount, useAccount, useSubscribe } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import { setAccount, useAccount, useSubscribe } from '@bitsocial/bitsocial-react-hooks';
|
||||
import getShortAddress from '../../../lib/get-short-address';
|
||||
import styles from './subscriptions-setting.module.css';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { Virtuoso, type SizeFunction } from 'react-virtuoso';
|
||||
import type { Comment } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import type { Comment } from '@bitsocial/bitsocial-react-hooks';
|
||||
import { MemoryRouter, Route, Routes } from 'react-router-dom';
|
||||
import CatalogRow from '../components/catalog-row';
|
||||
import { Post } from '../views/post';
|
||||
|
||||
@@ -23,12 +23,12 @@ const testState = vi.hoisted(() => ({
|
||||
communitySnapshot: undefined as unknown,
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks', () => ({
|
||||
useAccount: () => testState.account,
|
||||
useAccountCommunities: () => ({ accountCommunities: testState.accountCommunities }),
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks/dist/lib/utils', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks/dist/lib/utils', () => ({
|
||||
flattenCommentsPages: () => testState.flattenedReplies,
|
||||
}));
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ const testState = vi.hoisted(() => ({
|
||||
publishCommentMock: vi.fn(async () => undefined),
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks', () => ({
|
||||
deleteComment: (targetComment: string | number) => testState.deleteCommentMock(targetComment),
|
||||
usePublishComment: (options: Record<string, any> | undefined) => {
|
||||
testState.lastPublishOptions = options;
|
||||
|
||||
@@ -18,7 +18,7 @@ const testState = vi.hoisted(() => ({
|
||||
xhrResponses: new Map<string, { response?: ArrayBuffer; status: number; statusText: string }>(),
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks/dist/lib/localforage-lru/index.js', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks/dist/lib/localforage-lru/index.js', () => ({
|
||||
default: {
|
||||
createInstance: () => ({
|
||||
getItem: testState.cacheGetItemMock,
|
||||
|
||||
@@ -21,7 +21,7 @@ const testState = vi.hoisted(() => ({
|
||||
replies: [] as TestComment[],
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks', () => ({
|
||||
useAccountComments: (options?: { commentIndices?: number[] }) => {
|
||||
testState.accountCommentsCalls.push(options);
|
||||
|
||||
|
||||
@@ -19,14 +19,14 @@ const testState = vi.hoisted(() => ({
|
||||
},
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks', () => ({
|
||||
useFeed: (options: Record<string, unknown> | undefined) => {
|
||||
testState.preloadOptions = options;
|
||||
return { feed: testState.preloadFeed };
|
||||
},
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks/dist/stores/feeds', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks/dist/stores/feeds', () => ({
|
||||
default: (selector: (state: { feedsOptions: Record<string, unknown>; loadedFeeds: Record<string, unknown> }) => unknown) =>
|
||||
selector({
|
||||
feedsOptions: testState.feedsOptions,
|
||||
|
||||
@@ -17,7 +17,7 @@ const testState = vi.hoisted(() => ({
|
||||
publishCommentMock: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks', () => ({
|
||||
usePublishComment: (options: Record<string, any>) => {
|
||||
testState.lastPublishOptions = options;
|
||||
return {
|
||||
|
||||
@@ -27,7 +27,7 @@ vi.mock('react-i18next', () => ({
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks', () => ({
|
||||
useAccount: () => testState.account,
|
||||
usePublishComment: (options: Record<string, any>) => {
|
||||
testState.lastPublishOptions = options;
|
||||
|
||||
@@ -12,7 +12,7 @@ const testState = vi.hoisted(() => ({
|
||||
replies: [] as Array<Record<string, unknown>>,
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({}));
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks', () => ({}));
|
||||
|
||||
let container: HTMLDivElement;
|
||||
let latestValue: ReturnType<typeof useQuotedByMap>;
|
||||
|
||||
@@ -14,7 +14,7 @@ const testState = vi.hoisted(() => ({
|
||||
options: undefined as { accountName?: string; commentCid?: string; commentIndex?: number | string } | undefined,
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks', () => ({
|
||||
useAccount: (options?: { accountName?: string }) => {
|
||||
if (!options?.accountName) {
|
||||
return testState.account;
|
||||
|
||||
@@ -11,7 +11,7 @@ const testState = vi.hoisted(() => ({
|
||||
communities: {} as Record<string, unknown>,
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks/dist/stores/communities', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks/dist/stores/communities', () => ({
|
||||
default: (selector: (state: { communities: typeof testState.communities }) => unknown) =>
|
||||
selector({
|
||||
communities: testState.communities,
|
||||
|
||||
@@ -19,7 +19,7 @@ const testState = vi.hoisted(() => ({
|
||||
communitiesStates: {} as Record<string, { clientUrls: string[]; communityAddresses: string[] }>,
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks', () => ({
|
||||
useClientsStates: () => ({
|
||||
states: testState.clientsStates,
|
||||
}),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useMemo } from 'react';
|
||||
import { useAccountCommunities } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import { useAccountCommunities } from '@bitsocial/bitsocial-react-hooks';
|
||||
import type { DirectoryCommunity } from './use-directories';
|
||||
|
||||
export const useAccountCommunitiesWithMetadata = (): DirectoryCommunity[] => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useMemo } from 'react';
|
||||
import { useAccountCommunities } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import { useAccountCommunities } from '@bitsocial/bitsocial-react-hooks';
|
||||
|
||||
export const useAccountCommunityAddresses = (): string[] => {
|
||||
const { accountCommunities } = useAccountCommunities({ onlyIfCached: true });
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useMemo } from 'react';
|
||||
import { useAccount } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import { useAccount } from '@bitsocial/bitsocial-react-hooks';
|
||||
import { useCommunityField } from './use-stable-community';
|
||||
|
||||
interface AuthorPrivilegesProps {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useEffect } from 'react';
|
||||
import { create } from 'zustand';
|
||||
import { useCommunityStats } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import { useCommunityStats } from '@bitsocial/bitsocial-react-hooks';
|
||||
import { useCommunityIdentifier } from './use-community-identifiers';
|
||||
|
||||
type CommunityStatsState = {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useMemo } from 'react';
|
||||
import type { CommunityIdentifier } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import type { CommunityIdentifier } from '@bitsocial/bitsocial-react-hooks';
|
||||
import { findDirectoryByAddress, type DirectoryCommunity, useDirectories } from './use-directories';
|
||||
|
||||
const isLikelyCommunityName = (value: string) => value.includes('.');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useMemo } from 'react';
|
||||
import { Comment } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import { flattenCommentsPages } from '@bitsocialnet/bitsocial-react-hooks/dist/lib/utils';
|
||||
import { Comment } from '@bitsocial/bitsocial-react-hooks';
|
||||
import { flattenCommentsPages } from '@bitsocial/bitsocial-react-hooks/dist/lib/utils';
|
||||
|
||||
const useCountLinksInReplies = (comment: Comment, firstXReplies?: number) => {
|
||||
let linkCount = 0;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useCallback, useMemo, useRef, useState } from 'react';
|
||||
import { ChallengeVerification, Comment, PublishCommentOptions, deleteComment, usePublishComment } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import { ChallengeVerification, Comment, PublishCommentOptions, deleteComment, usePublishComment } from '@bitsocial/bitsocial-react-hooks';
|
||||
import { alertChallengeVerificationFailed } from '../lib/utils/challenge-utils';
|
||||
import useChallengesStore from '../stores/use-challenges-store';
|
||||
import { getCommentCommunityAddress } from '../lib/utils/comment-utils';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import localForageLru from '@bitsocialnet/bitsocial-react-hooks/dist/lib/localforage-lru/index.js';
|
||||
import localForageLru from '@bitsocial/bitsocial-react-hooks/dist/lib/localforage-lru/index.js';
|
||||
|
||||
const gifFrameDb = localForageLru.createInstance({ name: '5chanGifFrames', size: 500 });
|
||||
const failedUrls = new Set<string>();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useMemo } from 'react';
|
||||
import { Comment, useAccountComments } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import { Comment, useAccountComments } from '@bitsocial/bitsocial-react-hooks';
|
||||
|
||||
// Keep the hook on its indexed fast path when there are no reply indices to resolve.
|
||||
const EMPTY_ACCOUNT_COMMENT_LOOKUP = { commentIndices: [-1] };
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useCallback, useMemo } from 'react';
|
||||
import { create } from 'zustand';
|
||||
import localForageLru from '@bitsocialnet/bitsocial-react-hooks/dist/lib/localforage-lru/index.js';
|
||||
import localForageLru from '@bitsocial/bitsocial-react-hooks/dist/lib/localforage-lru/index.js';
|
||||
|
||||
interface HideStoreState {
|
||||
hiddenCids: { [key: string]: boolean };
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useEffect } from 'react';
|
||||
import { Community } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import { Community } from '@bitsocial/bitsocial-react-hooks';
|
||||
import { getFormattedTimeAgo } from '../lib/utils/time-utils';
|
||||
import useCommunityOfflineStore from '../stores/use-community-offline-store';
|
||||
import useCommunitiesLoadingStartTimestamps from '../stores/use-communities-loading-start-timestamps-store';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useMemo } from 'react';
|
||||
import { Comment, type Community } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import { Comment, type Community } from '@bitsocial/bitsocial-react-hooks';
|
||||
import { getCommentMediaInfo, getHasThumbnail } from '../lib/utils/media-utils';
|
||||
import useCommunitiesLoadingStartTimestamps from '../stores/use-communities-loading-start-timestamps-store';
|
||||
import { useCurrentTime } from './use-current-time';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useMemo } from 'react';
|
||||
import { useFeed } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import useFeedsStore from '@bitsocialnet/bitsocial-react-hooks/dist/stores/feeds';
|
||||
import { useFeed } from '@bitsocial/bitsocial-react-hooks';
|
||||
import useFeedsStore from '@bitsocial/bitsocial-react-hooks/dist/stores/feeds';
|
||||
import { useDirectoryByAddress } from './use-directories';
|
||||
import { useBoardFeedPageSize } from './use-board-feed-page-size';
|
||||
import { useCommunityIdentifier } from './use-community-identifiers';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useMemo } from 'react';
|
||||
import { useAccount, useResolvedAuthorAddress } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import { useAccount, useResolvedAuthorAddress } from '@bitsocial/bitsocial-react-hooks';
|
||||
|
||||
type PublishAuthorDomainBlockReason = 'resolving' | 'unresolved' | 'mismatch';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { Comment, usePublishComment } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import { Comment, usePublishComment } from '@bitsocial/bitsocial-react-hooks';
|
||||
import usePublishPostStore from '../stores/use-publish-post-store';
|
||||
import useChallengesStore from '../stores/use-challenges-store';
|
||||
import usePublishAuthorDomainGuard, { getPublishAuthorDomainErrorMessage } from './use-publish-author-domain-guard';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Comment, useAccount, usePublishComment } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import { Comment, useAccount, usePublishComment } from '@bitsocial/bitsocial-react-hooks';
|
||||
import { useDirectories } from './use-directories';
|
||||
import usePublishReplyStore from '../stores/use-publish-reply-store';
|
||||
import usePostNumberStore, { getScopedNumberToCidMap } from '../stores/use-post-number-store';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useCallback, useMemo, useRef } from 'react';
|
||||
import { Comment } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import { Comment } from '@bitsocial/bitsocial-react-hooks';
|
||||
import { QUOTE_NUMBER_REGEX } from '../lib/utils/url-utils';
|
||||
import usePostNumberStore, { getScopedNumberToCidMap } from '../stores/use-post-number-store';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useRef } from 'react';
|
||||
import type { Comment } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import type { Comment } from '@bitsocial/bitsocial-react-hooks';
|
||||
import usePostNumberStore from '../stores/use-post-number-store';
|
||||
import { getCommentCommunityAddress } from '../lib/utils/comment-utils';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useMemo } from 'react';
|
||||
import type { Comment } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import type { Comment } from '@bitsocial/bitsocial-react-hooks';
|
||||
import type { SizeFunction } from 'react-virtuoso';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import useWindowWidth from './use-window-width';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useMemo } from 'react';
|
||||
import { useAccount, useAccountComment } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import { useAccount, useAccountComment } from '@bitsocial/bitsocial-react-hooks';
|
||||
|
||||
type SafeAccountCommentOptions = {
|
||||
accountName?: string;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import useCommunitiesStore from '@bitsocialnet/bitsocial-react-hooks/dist/stores/communities';
|
||||
import type { Community } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import useCommunitiesStore from '@bitsocial/bitsocial-react-hooks/dist/stores/communities';
|
||||
import type { Community } from '@bitsocial/bitsocial-react-hooks';
|
||||
import { normalizeBoardAddress } from './use-directories';
|
||||
|
||||
type CommunityLike = Record<string, unknown> | Community | undefined;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useMemo } from 'react';
|
||||
import { useClientsStates, useCommunity, useCommunitiesStates } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import { useClientsStates, useCommunity, useCommunitiesStates } from '@bitsocial/bitsocial-react-hooks';
|
||||
import debounce from 'lodash/debounce';
|
||||
import getShortAddress from '../lib/get-short-address';
|
||||
import { useCommunityIdentifiers } from './use-community-identifiers';
|
||||
|
||||
@@ -11,7 +11,7 @@ const testState = vi.hoisted(() => ({
|
||||
localForageSetItemMock: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks/dist/lib/localforage-lru/index.js', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks/dist/lib/localforage-lru/index.js', () => ({
|
||||
default: {
|
||||
createInstance: () => ({
|
||||
getItem: (url: string) => testState.localForageGetItemMock(url),
|
||||
|
||||
@@ -5,7 +5,7 @@ const testState = vi.hoisted(() => ({
|
||||
communities: {} as Record<string, { roles?: Record<string, { role?: string }> }>,
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks/dist/stores/communities', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks/dist/stores/communities', () => ({
|
||||
default: {
|
||||
getState: () => ({
|
||||
communities: testState.communities,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Comment } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import type { Comment } from '@bitsocial/bitsocial-react-hooks';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { getRenderableMobileBacklinks } from '../reply-backlink-utils';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Comment } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import { Comment } from '@bitsocial/bitsocial-react-hooks';
|
||||
|
||||
export function getThreadPostCountsByAuthor(post: Comment | undefined, replies: Comment[] = []): Map<string, number> {
|
||||
const counts = new Map<string, number>();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ChallengeVerification } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import { ChallengeVerification } from '@bitsocial/bitsocial-react-hooks';
|
||||
import { getFallbackDirectoriesData } from '../../hooks/use-directories';
|
||||
import { getCommentCommunityAddress } from './comment-utils';
|
||||
import { getBoardPath } from './route-utils';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Comment } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import feedsStore from '@bitsocialnet/bitsocial-react-hooks/dist/stores/feeds';
|
||||
import repliesStore, { feedOptionsToFeedName } from '@bitsocialnet/bitsocial-react-hooks/dist/stores/replies';
|
||||
import communitiesPagesStore from '@bitsocialnet/bitsocial-react-hooks/dist/stores/communities-pages';
|
||||
import type { Comment } from '@bitsocial/bitsocial-react-hooks';
|
||||
import feedsStore from '@bitsocial/bitsocial-react-hooks/dist/stores/feeds';
|
||||
import repliesStore, { feedOptionsToFeedName } from '@bitsocial/bitsocial-react-hooks/dist/stores/replies';
|
||||
import communitiesPagesStore from '@bitsocial/bitsocial-react-hooks/dist/stores/communities-pages';
|
||||
import type { DirectoryCommunity } from '../../hooks/use-directories';
|
||||
import usePostNumberStore from '../../stores/use-post-number-store';
|
||||
import type { ExternalQuoteReference, ExternalQuoteSearchStatus } from './external-quote-utils';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import localForageLru from '@bitsocialnet/bitsocial-react-hooks/dist/lib/localforage-lru/index.js';
|
||||
import localForageLru from '@bitsocial/bitsocial-react-hooks/dist/lib/localforage-lru/index.js';
|
||||
import { canEmbed } from '../../components/embed';
|
||||
import memoize from 'memoizee';
|
||||
import { isValidURL } from './url-utils';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Comment } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import type { Comment } from '@bitsocial/bitsocial-react-hooks';
|
||||
import { getCommentCommunityAddress } from './comment-utils';
|
||||
import { getThreadTopNavigationState } from './thread-scroll-utils';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Comment } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import communitiesStore from '@bitsocialnet/bitsocial-react-hooks/dist/stores/communities';
|
||||
import type { Comment } from '@bitsocial/bitsocial-react-hooks';
|
||||
import communitiesStore from '@bitsocial/bitsocial-react-hooks/dist/stores/communities';
|
||||
import { getCommentCommunityAddress } from './comment-utils';
|
||||
|
||||
type CommunityLike = {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Comment } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import type { Comment } from '@bitsocial/bitsocial-react-hooks';
|
||||
import { getCommentCommunityAddress } from './comment-utils';
|
||||
|
||||
export type PostMenuProps = {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Comment } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import type { Comment } from '@bitsocial/bitsocial-react-hooks';
|
||||
import { layout, layoutNextLine, prepare, prepareWithSegments } from '@chenglou/pretext';
|
||||
import { getCommentMediaInfo, getHasThumbnail } from './media-utils';
|
||||
import { removeMarkdown } from './post-utils';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Comment } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import type { Comment } from '@bitsocial/bitsocial-react-hooks';
|
||||
|
||||
type QuoteTargetAvailability = 'available' | 'unresolved' | 'unavailable';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Comment } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import type { Comment } from '@bitsocial/bitsocial-react-hooks';
|
||||
|
||||
interface GetRenderableMobileBacklinksArgs {
|
||||
cid?: string;
|
||||
|
||||
@@ -5,7 +5,7 @@ const testState = vi.hoisted(() => ({
|
||||
setItemMock: vi.fn(async () => undefined),
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks/dist/lib/localforage-lru/index.js', () => ({
|
||||
vi.mock('@bitsocial/bitsocial-react-hooks/dist/lib/localforage-lru/index.js', () => ({
|
||||
default: {
|
||||
createInstance: () => ({
|
||||
entries: testState.entriesMock,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { create } from 'zustand';
|
||||
import { persist } from 'zustand/middleware';
|
||||
import type { Comment } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import type { Comment } from '@bitsocial/bitsocial-react-hooks';
|
||||
import { getCommentCommunityAddress } from '../lib/utils/comment-utils';
|
||||
import { commentMatchesPattern } from '../lib/utils/pattern-utils';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { create } from 'zustand';
|
||||
import { Challenge } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import { Challenge } from '@bitsocial/bitsocial-react-hooks';
|
||||
|
||||
let nextChallengeId = 0;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { create } from 'zustand';
|
||||
import type { Comment } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import type { Comment } from '@bitsocial/bitsocial-react-hooks';
|
||||
import { normalizeBoardAddress } from '../hooks/use-directories';
|
||||
import { getCommentCommunityAddress } from '../lib/utils/comment-utils';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ChallengeVerification, Comment, PublishCommentOptions } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import { ChallengeVerification, Comment, PublishCommentOptions } from '@bitsocial/bitsocial-react-hooks';
|
||||
import { create } from 'zustand';
|
||||
import { alertChallengeVerificationFailed } from '../lib/utils/challenge-utils';
|
||||
import { getCommentCommunityAddress } from '../lib/utils/comment-utils';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ChallengeVerification, Comment, PublishCommentOptions } from '@bitsocialnet/bitsocial-react-hooks';
|
||||
import { ChallengeVerification, Comment, PublishCommentOptions } from '@bitsocial/bitsocial-react-hooks';
|
||||
import { create } from 'zustand';
|
||||
import { alertChallengeVerificationFailed } from '../lib/utils/challenge-utils';
|
||||
import { getCommentCommunityAddress } from '../lib/utils/comment-utils';
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user