diff --git a/src/components/board-buttons/board-buttons.tsx b/src/components/board-buttons/board-buttons.tsx index 6ee39ad0..87fcaf6b 100644 --- a/src/components/board-buttons/board-buttons.tsx +++ b/src/components/board-buttons/board-buttons.tsx @@ -20,7 +20,7 @@ import CatalogSearch from '../catalog-search'; import Tooltip from '../tooltip'; import { ModQueueButton } from '../../views/mod-queue/mod-queue'; import styles from './board-buttons.module.css'; -import _ from 'lodash'; +import { capitalize } from 'lodash'; interface BoardButtonsProps { address?: string | undefined; @@ -510,13 +510,13 @@ const PostPageStats = () => { const linkCount = useCountLinksInReplies(comment); const displayReplyCount = replyCount !== undefined ? replyCount.toString() : '?'; - const replyCountTooltip = replyCount !== undefined ? _.capitalize(t('replies')) : t('loading'); + const replyCountTooltip = replyCount !== undefined ? capitalize(t('replies')) : t('loading'); return ( - {pinned && `${_.capitalize(t('sticky'))} / `} - {closed && `${_.capitalize(t('closed'))} / `} - / + {pinned && `${capitalize(t('sticky'))} / `} + {closed && `${capitalize(t('closed'))} / `} + / ); }; diff --git a/src/components/board-header/board-header.tsx b/src/components/board-header/board-header.tsx index 920acf00..96447a58 100644 --- a/src/components/board-header/board-header.tsx +++ b/src/components/board-header/board-header.tsx @@ -14,7 +14,7 @@ import useIsMobile from '../../hooks/use-is-mobile'; import useIsSubplebbitOffline from '../../hooks/use-is-subplebbit-offline'; import { shouldShowSnow } from '../../lib/snow'; import Tooltip from '../tooltip'; -import _ from 'lodash'; +import { startCase } from 'lodash'; import { BANNERS } from '../../generated/asset-manifest'; const ImageBanner = () => { @@ -78,7 +78,7 @@ const BoardHeader = () => { : isInSubscriptionsView ? '/subs/ - Subscriptions' : isInModView - ? _.startCase(t('boards_you_moderate')) + ? startCase(t('boards_you_moderate')) : defaultSubplebbit?.title || stableSubplebbit?.title; const subtitle = isInAllView ? '' : isInSubscriptionsView ? subscriptionsSubtitle : isInModView ? '/mod/' : `${address || subplebbitAddress || ''}`; diff --git a/src/components/catalog-row/catalog-row.tsx b/src/components/catalog-row/catalog-row.tsx index 19aca254..2b1f386a 100644 --- a/src/components/catalog-row/catalog-row.tsx +++ b/src/components/catalog-row/catalog-row.tsx @@ -22,7 +22,7 @@ import useWindowWidth from '../../hooks/use-window-width'; import { ContentPreview } from '../../views/home/popular-threads-box'; import PostMenuDesktop from '../post-desktop/post-menu-desktop'; import styles from './catalog-row.module.css'; -import _ from 'lodash'; +import { capitalize } from 'lodash'; import { selectPostMenuProps } from '../../lib/utils/post-menu-props'; interface CatalogPostMediaProps { @@ -286,7 +286,7 @@ const CatalogPost = memo( t('posted_by') )}{' '} - {author?.displayName || _.capitalize(t('anonymous'))} + {author?.displayName || capitalize(t('anonymous'))} {isCatalogPostAuthorMod && {` ## Board ${catalogPostAuthorRole}`}} {(isInAllView || isInSubscriptionsView) && subplebbitAddress && ` to p/${Plebbit.getShortAddress({ address: subplebbitAddress })}`} @@ -295,7 +295,7 @@ const CatalogPost = memo(
{t('last_reply_by')}{' '} - {lastReply?.author?.displayName || _.capitalize(t('anonymous'))} + {lastReply?.author?.displayName || capitalize(t('anonymous'))} {isLastReplyAuthorMod && ` ## Board ${lastReplyAuthorRole}`} {getFormattedTimeAgo(lastReply?.timestamp)} diff --git a/src/components/catalog-search/catalog-search.tsx b/src/components/catalog-search/catalog-search.tsx index 3be3ad64..86685b30 100644 --- a/src/components/catalog-search/catalog-search.tsx +++ b/src/components/catalog-search/catalog-search.tsx @@ -4,7 +4,7 @@ import { useLocation, useNavigate } from 'react-router-dom'; import styles from './catalog-search.module.css'; import useIsMobile from '../../hooks/use-is-mobile'; import useCatalogFiltersStore from '../../stores/use-catalog-filters-store'; -import _ from 'lodash'; +import { debounce } from 'lodash'; const CatalogSearch = () => { const { t } = useTranslation(); @@ -44,7 +44,7 @@ const CatalogSearch = () => { // Create a debounced version of setSearchFilter and URL update // eslint-disable-next-line react-hooks/exhaustive-deps const debouncedSetSearchFilter = useCallback( - _.debounce((text: string) => { + debounce((text: string) => { if (text.trim()) { setSearchFilter(text); updateURL(text); diff --git a/src/components/challenge-modal/challenge-modal.tsx b/src/components/challenge-modal/challenge-modal.tsx index 1eb1b3b2..eb4120cf 100644 --- a/src/components/challenge-modal/challenge-modal.tsx +++ b/src/components/challenge-modal/challenge-modal.tsx @@ -6,7 +6,7 @@ import useIsMobile from '../../hooks/use-is-mobile'; import useChallengesStore from '../../stores/use-challenges-store'; import useTheme from '../../hooks/use-theme'; import styles from './challenge-modal.module.css'; -import _ from 'lodash'; +import { capitalize } from 'lodash'; import { useSpring, animated } from '@react-spring/web'; import { useDrag } from '@use-gesture/react'; @@ -269,7 +269,7 @@ const Challenge = ({ challenge, closeModal }: ChallengeProps) => { {isIframeChallenge && !showIframeConfirmation ? null : ( <>
- +
{title && (
diff --git a/src/components/comment-content/comment-content.tsx b/src/components/comment-content/comment-content.tsx index dacedfd5..29e08097 100644 --- a/src/components/comment-content/comment-content.tsx +++ b/src/components/comment-content/comment-content.tsx @@ -14,7 +14,7 @@ import ReplyQuotePreview from '../../components/reply-quote-preview'; import Markdown from '../../components/markdown'; import Tooltip from '../../components/tooltip'; import styles from '../../views/post/post.module.css'; -import _ from 'lodash'; +import { capitalize } from 'lodash'; const QuotedCidLink = ({ cid, postCid }: { cid: string; postCid: string }) => { const commentFromStore = useSubplebbitsPagesStore((state) => state.comments[cid]); @@ -88,16 +88,16 @@ const CommentContent = ({ comment: post }: { comment: Comment }) => { ({t('this_post_was_removed')})

- {`${_.capitalize(t('reason'))}: "${reason}"`} + {`${capitalize(t('reason'))}: "${reason}"`} ) : ( - {_.capitalize(t('this_post_was_removed'))}. + {capitalize(t('this_post_was_removed'))}. ) ) : deleted ? ( reason ? ( <> {t('user_deleted_this_post')}{' '} - {`${_.capitalize(t('reason'))}: "${reason}"`} + {`${capitalize(t('reason'))}: "${reason}"`} ) : ( {t('user_deleted_this_post')} @@ -159,7 +159,7 @@ const CommentContent = ({ comment: post }: { comment: Comment }) => { address: subplebbitAddress && Plebbit.getShortAddress({ address: subplebbitAddress }), timestamp: getFormattedDate(post?.author?.subplebbit?.banExpiresAt), interpolation: { escapeValue: false }, - })}${reason ? `. ${_.capitalize(t('reason'))}: "${reason}"` : ''}`} + })}${reason ? `. ${capitalize(t('reason'))}: "${reason}"` : ''}`} /> )} diff --git a/src/components/edit-menu/edit-menu.tsx b/src/components/edit-menu/edit-menu.tsx index ed969bea..07c9bd64 100644 --- a/src/components/edit-menu/edit-menu.tsx +++ b/src/components/edit-menu/edit-menu.tsx @@ -12,7 +12,7 @@ import { import styles from './edit-menu.module.css'; import { alertChallengeVerificationFailed } from '../../lib/utils/challenge-utils'; import useChallengesStore from '../../stores/use-challenges-store'; -import _ from 'lodash'; +import { capitalize } from 'lodash'; import useIsMobile from '../../hooks/use-is-mobile'; import useAuthorPrivileges from '../../hooks/use-author-privileges'; @@ -277,14 +277,14 @@ const EditMenu = ({ post }: { post: Comment }) => {
{isContentEditorOpen && ( @@ -307,13 +307,13 @@ const EditMenu = ({ post }: { post: Comment }) => { {' '}
@@ -322,7 +322,7 @@ const EditMenu = ({ post }: { post: Comment }) => { [ ] @@ -331,7 +331,7 @@ const EditMenu = ({ post }: { post: Comment }) => { [ ] @@ -339,7 +339,7 @@ const EditMenu = ({ post }: { post: Comment }) => { [ ] @@ -378,7 +378,7 @@ const EditMenu = ({ post }: { post: Comment }) => { )}
- {_.capitalize(t('reason'))}? ({t('optional')}) + {capitalize(t('reason'))}? ({t('optional')}) {deleted ? ( - _.capitalize(t('deleted')) + capitalize(t('deleted')) ) : removed ? ( - _.capitalize(t('removed')) + capitalize(t('removed')) ) : displayName ? ( displayName.length <= 20 ? ( displayName @@ -254,7 +254,7 @@ const PostInfo = ({ /> ) ) : ( - _.capitalize(t('anonymous')) + capitalize(t('anonymous')) )} {!(deleted || removed) && authorRole && ( @@ -328,7 +328,7 @@ const PostInfo = ({ <> No. - {state === 'failed' || stateString === 'Failed' ? _.capitalize(t('failed')) : state === 'pending' ? _.capitalize(t('pending')) : ''} + {state === 'failed' || stateString === 'Failed' ? capitalize(t('failed')) : state === 'pending' ? capitalize(t('pending')) : ''} )} @@ -346,7 +346,7 @@ const PostInfo = ({ [ !cid && e.preventDefault()}> - {_.capitalize(t('reply'))} + {capitalize(t('reply'))} ] @@ -507,9 +507,9 @@ const PostMedia = ({ )} {t('link')}:{' '} - {spoiler ? _.capitalize(t('spoiler')) : url && url.length > 30 ? url.slice(0, 30) + '...' : url} + {spoiler ? capitalize(t('spoiler')) : url && url.length > 30 ? url.slice(0, 30) + '...' : url} {' '} - ({type && _.lowerCase(getDisplayMediaInfoType(type, t))} + ({type && lowerCase(getDisplayMediaInfoType(type, t))} {mediaDimensions && `, ${mediaDimensions}`}) {!showThumbnail && (type === 'iframe' || type === 'video' || type === 'audio') && ( diff --git a/src/components/post-desktop/post-menu-desktop/post-menu-desktop.tsx b/src/components/post-desktop/post-menu-desktop/post-menu-desktop.tsx index 0f3c0013..e61d0ef7 100644 --- a/src/components/post-desktop/post-menu-desktop/post-menu-desktop.tsx +++ b/src/components/post-desktop/post-menu-desktop/post-menu-desktop.tsx @@ -12,7 +12,7 @@ import { getBoardPath } from '../../../lib/utils/route-utils'; import { useDirectories } from '../../../hooks/use-directories'; import { isAllView, isCatalogView, isPostPageView, isSubscriptionsView } from '../../../lib/utils/view-utils'; import useHide from '../../../hooks/use-hide'; -import _ from 'lodash'; +import { capitalize } from 'lodash'; import { PostMenuProps } from '../../../lib/utils/post-menu-props'; type CopyLinkButtonProps = @@ -99,7 +99,7 @@ const ImageSearchButton = ({ url, onClose }: { url: string; onClose: () => void ref={refs.setReference} onClick={onClose} > - {_.capitalize(t('image_search'))} » + {capitalize(t('image_search'))} » {isImageSearchMenuOpen && (
diff --git a/src/components/post-form/post-form.tsx b/src/components/post-form/post-form.tsx index 2cea55fc..4fc8b088 100644 --- a/src/components/post-form/post-form.tsx +++ b/src/components/post-form/post-form.tsx @@ -18,7 +18,7 @@ import usePublishReply from '../../hooks/use-publish-reply'; import FileUploader from '../../plugins/file-uploader'; import styles from './post-form.module.css'; import { Capacitor } from '@capacitor/core'; -import _ from 'lodash'; +import { capitalize, debounce } from 'lodash'; const isAndroid = Capacitor.getPlatform() === 'android'; @@ -79,7 +79,7 @@ const PostFormTable = ({ closeForm, postCid }: { closeForm: () => void; postCid: const [lengthError, setLengthError] = useState(null); const checkContentLength = useRef( - _.debounce((content: string, t: Function) => { + debounce((content: string, t: Function) => { const length = content.trim().length; if (length > 2000) { setLengthError(`${t('error')}: ${t('comment_field_too_long', { length })}`); @@ -247,7 +247,7 @@ const PostFormTable = ({ closeForm, postCid }: { closeForm: () => void; postCid: { const newDisplayName = e.target.value.trim() || undefined; @@ -326,7 +326,7 @@ const PostFormTable = ({ closeForm, postCid }: { closeForm: () => void; postCid: type='checkbox' onChange={(e) => (isInPostView ? setPublishReplyOptions({ spoiler: e.target.checked }) : setPublishPostOptions({ spoiler: e.target.checked }))} /> - {_.capitalize(t('spoiler'))}? + {capitalize(t('spoiler'))}? ] diff --git a/src/components/post-mobile/post-mobile.tsx b/src/components/post-mobile/post-mobile.tsx index 358699c0..3040333d 100644 --- a/src/components/post-mobile/post-mobile.tsx +++ b/src/components/post-mobile/post-mobile.tsx @@ -30,7 +30,7 @@ import PostMenuMobile from './post-menu-mobile'; import ReplyQuotePreview from '../reply-quote-preview'; import Tooltip from '../tooltip'; import { PostProps } from '../../views/post/post'; -import _ from 'lodash'; +import { capitalize, lowerCase } from 'lodash'; import useReplyModalStore from '../../stores/use-reply-modal-store'; import { selectPostMenuProps } from '../../lib/utils/post-menu-props'; import useChallengesStore from '../../stores/use-challenges-store'; @@ -204,9 +204,9 @@ const PostInfoAndMedia = ({ post, postReplyCount = 0, roles, threadNumber }: Pos {removed ? ( - _.capitalize(t('removed')) + capitalize(t('removed')) ) : deleted ? ( - _.capitalize(t('deleted')) + capitalize(t('deleted')) ) : displayName ? ( displayName.length <= 20 ? ( displayName @@ -217,7 +217,7 @@ const PostInfoAndMedia = ({ post, postReplyCount = 0, roles, threadNumber }: Pos /> ) ) : ( - _.capitalize(t('anonymous')) + capitalize(t('anonymous')) )}{' '} {!(deleted || removed) && authorRole && ( @@ -242,9 +242,9 @@ const PostInfoAndMedia = ({ post, postReplyCount = 0, roles, threadNumber }: Pos <> (ID: {''} {removed ? ( - _.lowerCase(t('removed')) + lowerCase(t('removed')) ) : deleted ? ( - _.lowerCase(t('deleted')) + lowerCase(t('deleted')) ) : ( No. - {state === 'failed' || stateString === 'Failed' ? _.capitalize(t('failed')) : state === 'pending' ? _.capitalize(t('pending')) : ''} + {state === 'failed' || stateString === 'Failed' ? capitalize(t('failed')) : state === 'pending' ? capitalize(t('pending')) : ''} )} diff --git a/src/components/reply-modal/reply-modal.tsx b/src/components/reply-modal/reply-modal.tsx index c32ec98c..d7d8ea8f 100644 --- a/src/components/reply-modal/reply-modal.tsx +++ b/src/components/reply-modal/reply-modal.tsx @@ -13,7 +13,7 @@ import usePublishReply from '../../hooks/use-publish-reply'; import useIsMobile from '../../hooks/use-is-mobile'; import styles from './reply-modal.module.css'; import { LinkTypePreviewer } from '../post-form'; -import _ from 'lodash'; +import { capitalize, debounce } from 'lodash'; import FileUploader from '../../plugins/file-uploader'; import { Capacitor } from '@capacitor/core'; import { useSpring, animated } from '@react-spring/web'; @@ -56,7 +56,7 @@ const ReplyModal = ({ closeModal, showReplyModal, parentCid, parentNumber, threa const [lengthError, setLengthError] = useState(null); const checkContentLength = useRef( - _.debounce((content: string, t: Function) => { + debounce((content: string, t: Function) => { const length = content.trim().length; if (length > 2000) { setError(null); @@ -327,7 +327,7 @@ const ReplyModal = ({ closeModal, showReplyModal, parentCid, parentNumber, threa { setAccount({ ...account, author: { ...account?.author, displayName: e.target.value } }); setPublishReplyOptions({ displayName: e.target.value }); @@ -338,7 +338,7 @@ const ReplyModal = ({ closeModal, showReplyModal, parentCid, parentNumber, threa { setUrl(e.target.value); setPublishReplyOptions({ link: e.target.value }); @@ -386,7 +386,7 @@ const ReplyModal = ({ closeModal, showReplyModal, parentCid, parentNumber, threa [ ] diff --git a/src/components/settings-modal/avatar-settings/avatar-settings.tsx b/src/components/settings-modal/avatar-settings/avatar-settings.tsx index 58ab356d..aee274b7 100644 --- a/src/components/settings-modal/avatar-settings/avatar-settings.tsx +++ b/src/components/settings-modal/avatar-settings/avatar-settings.tsx @@ -5,7 +5,7 @@ import styles from './avatar-settings.module.css'; import { Trans, useTranslation } from 'react-i18next'; import LoadingEllipsis from '../../loading-ellipsis'; import ErrorDisplay from '../../error-display/error-display'; -import _ from 'lodash'; +import { capitalize } from 'lodash'; const AvatarPreview = ({ avatar }: any) => { const { t } = useTranslation(); @@ -132,7 +132,7 @@ const AvatarSettings = () => {
- {_.capitalize(t('chain_ticker'))}: + {capitalize(t('chain_ticker'))}: {
- {_.capitalize(t('timestamp'))}: + {capitalize(t('timestamp'))}: { />
- {_.capitalize(t('paste_signature'))}: + {capitalize(t('paste_signature'))}: { walletsArray.length > 0 ? (
- {_.capitalize(t('chain_ticker'))}: + {capitalize(t('chain_ticker'))}: setWalletsArrayProperty(selectedWallet, 'chainTicker', e.target.value)} @@ -111,7 +111,7 @@ const CryptoWalletsForm = ({ account }: { account: Account | undefined }) => { />
- {_.capitalize(t('wallet_address'))}: + {capitalize(t('wallet_address'))}: setWalletsArrayProperty(selectedWallet, 'address', e.target.value)} @@ -133,7 +133,7 @@ const CryptoWalletsForm = ({ account }: { account: Account | undefined }) => {
- {_.capitalize(t('timestamp'))}: + {capitalize(t('timestamp'))}: setWalletsArrayProperty(selectedWallet, 'timestamp', Number(e.target.value))} @@ -142,7 +142,7 @@ const CryptoWalletsForm = ({ account }: { account: Account | undefined }) => { />
- {_.capitalize(t('paste_signature'))}: + {capitalize(t('paste_signature'))}: setWalletsArrayProperty(selectedWallet, 'signature', e.target.value)} diff --git a/src/components/settings-modal/interface-settings/interface-settings.tsx b/src/components/settings-modal/interface-settings/interface-settings.tsx index 9be9bf36..8146db14 100644 --- a/src/components/settings-modal/interface-settings/interface-settings.tsx +++ b/src/components/settings-modal/interface-settings/interface-settings.tsx @@ -4,7 +4,7 @@ import useAvatarVisibilityStore from '../../../stores/use-avatar-visibility-stor import useTheme from '../../../hooks/use-theme'; import packageJson from '../../../../package.json'; import styles from './interface-settings.module.css'; -import _ from 'lodash'; +import { capitalize } from 'lodash'; import useInterfaceSettingsStore from '../../../stores/use-interface-settings-store'; import useCatalogFiltersStore from '../../../stores/use-catalog-filters-store'; import useExpandedMediaStore from '../../../stores/use-expanded-media-store'; @@ -138,16 +138,16 @@ const InterfaceSettings = () => { return (
- {_.capitalize(t('version'))}: + {capitalize(t('version'))}:
- {_.capitalize(t('update'))}: + {capitalize(t('update'))}:
- {_.capitalize(t('style'))}: