diff --git a/.github/workflows/pl-hooks.yaml b/.github/workflows/pl-hooks.yaml new file mode 100644 index 000000000..c1d03506b --- /dev/null +++ b/.github/workflows/pl-hooks.yaml @@ -0,0 +1,41 @@ +name: pl-hooks CI + +on: + push: + branches: [ "develop" ] + pull_request: + branches: [ "develop" ] + +jobs: + build: + runs-on: ubuntu-latest + name: Test for a successful build + strategy: + matrix: + node-version: [21.x] + + steps: + - name: Install system dependencies + run: sudo apt install -y unzip + + - name: Checkout code + uses: actions/checkout@v3 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + + - name: Install deps + working-directory: ./packages/pl-hooks + run: yarn install --ignore-scripts + + - name: Lint + working-directory: ./packages/pl-hooks + run: yarn lint + + - name: build + env: + NODE_ENV: production + working-directory: ./packages/pl-hooks + run: yarn build diff --git a/README.md b/README.md index f7ff188c7..68f3587f6 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ This repo hosts a few of my projects related to the Fediverse client `pl-fe`. Th - [pl-fe](./packages/pl-fe/) — a social networking client app forked from Soapbox - [pl-api](./packages/pl-api) — a library for interacting with Mastodon API-compatible servers, focused on support for projects extending the official Mastodon API. It is used by `pl-fe`. +- [pl-hooks](./packages/pl-hooks) — a library including hooks for integrating with Mastodon API, based on `pl-api` and TanStack. It is intended to be used within `pl-fe`. Work in progress. More projects to be announced. diff --git a/package.json b/package.json index b1b0b5b5f..3f8146324 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,6 @@ "husky": "^9.0.0", "lint-staged": ">=10" }, - "workspaces": ["pl-api", "pl-fe"], + "workspaces": ["pl-api", "pl-fe", "pl-hooks"], "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" } diff --git a/packages/pl-api/lib/entities/account.ts b/packages/pl-api/lib/entities/account.ts index 37c37b004..35ee9c76c 100644 --- a/packages/pl-api/lib/entities/account.ts +++ b/packages/pl-api/lib/entities/account.ts @@ -6,10 +6,7 @@ import { relationshipSchema } from './relationship'; import { roleSchema } from './role'; import { coerceObject, datetimeSchema, filteredArray } from './utils'; -const filterBadges = (tags?: string[]) => - tags?.filter(tag => tag.startsWith('badge:')).map(tag => v.parse(roleSchema, { id: tag, name: tag.replace(/^badge:/, '') })); - -const getDomainFromURL = (account: any): string => { +const getDomainFromURL = (account: Pick): string => { try { const url = account.url; return new URL(url).host; @@ -18,7 +15,7 @@ const getDomainFromURL = (account: any): string => { } }; -const guessFqn = (account: any): string => { +const guessFqn = (account: Pick): string => { const acct = account.acct; const [user, domain] = acct.split('@'); @@ -29,6 +26,9 @@ const guessFqn = (account: any): string => { } }; +const filterBadges = (tags?: string[]) => + tags?.filter(tag => tag.startsWith('badge:')).map(tag => v.parse(roleSchema, { id: tag, name: tag.replace(/^badge:/, '') })); + const preprocessAccount = v.transform((account: any) => { if (!account?.acct) return null; @@ -144,6 +144,7 @@ const baseAccountSchema = v.object({ header_description: v.fallback(v.string(), ''), verified: v.fallback(v.optional(v.boolean()), undefined), + domain: v.fallback(v.string(), ''), __meta: coerceObject({ pleroma: v.fallback(v.any(), undefined), diff --git a/packages/pl-api/lib/entities/interaction-policy.ts b/packages/pl-api/lib/entities/interaction-policy.ts index d76b064e2..ace8b2fba 100644 --- a/packages/pl-api/lib/entities/interaction-policy.ts +++ b/packages/pl-api/lib/entities/interaction-policy.ts @@ -4,8 +4,10 @@ import { coerceObject } from './utils'; const interactionPolicyEntrySchema = v.picklist(['public', 'followers', 'following', 'mutuals', 'mentioned', 'author', 'me']); +type InteractionPolicyEntry = v.InferOutput; + const interactionPolicyRuleSchema = coerceObject({ - always: v.fallback(v.array(interactionPolicyEntrySchema), ['public']), + always: v.fallback(v.array(interactionPolicyEntrySchema), ['public', 'me']), with_approval: v.fallback(v.array(interactionPolicyEntrySchema), []), }); @@ -27,5 +29,5 @@ const interactionPoliciesSchema = coerceObject({ type InteractionPolicies = v.InferOutput; -export { interactionPolicySchema, interactionPoliciesSchema, type InteractionPolicy, type InteractionPolicies }; +export { interactionPolicySchema, interactionPoliciesSchema, type InteractionPolicyEntry, type InteractionPolicy, type InteractionPolicies }; diff --git a/packages/pl-api/lib/entities/status.ts b/packages/pl-api/lib/entities/status.ts index b89c78578..dd7b24f4d 100644 --- a/packages/pl-api/lib/entities/status.ts +++ b/packages/pl-api/lib/entities/status.ts @@ -1,7 +1,7 @@ import pick from 'lodash.pick'; import * as v from 'valibot'; -import { accountSchema } from './account'; +import { type Account, accountSchema } from './account'; import { customEmojiSchema } from './custom-emoji'; import { emojiReactionSchema } from './emoji-reaction'; import { filterResultSchema } from './filter-result'; @@ -19,7 +19,7 @@ const statusEventSchema = v.object({ name: v.fallback(v.string(), ''), start_time: v.fallback(v.nullable(datetimeSchema), null), end_time: v.fallback(v.nullable(datetimeSchema), null), - join_mode: v.fallback(v.nullable(v.picklist(['free', 'restricted', 'invite'])), null), + join_mode: v.fallback(v.nullable(v.picklist(['free', 'restricted', 'invite', 'external'])), null), participants_count: v.fallback(v.number(), 0), location: v.fallback(v.nullable(v.object({ name: v.fallback(v.string(), ''), @@ -41,7 +41,7 @@ const baseStatusSchema = v.object({ uri: v.fallback(v.pipe(v.string(), v.url()), ''), created_at: v.fallback(datetimeSchema, new Date().toISOString()), account: accountSchema, - content: v.fallback(v.string(), ''), + content: v.fallback(v.pipe(v.string(), v.transform((note => note === '

' ? '' : note))), ''), visibility: v.fallback(v.string(), 'public'), sensitive: v.pipe(v.unknown(), v.transform(Boolean)), spoiler_text: v.fallback(v.string(), ''), @@ -149,9 +149,15 @@ const statusWithoutAccountSchema = v.pipe(v.any(), v.transform(preprocess), v.ob quote: v.fallback(v.nullable(v.lazy(() => statusSchema)), null), })); +type StatusWithoutAccount = Omit, 'account'> & { + account: Account | null; + reblog: Status | null; + quote: Status | null; +} + type Status = v.InferOutput & { reblog: Status | null; quote: Status | null; } -export { statusSchema, statusWithoutAccountSchema, type Status }; +export { statusSchema, statusWithoutAccountSchema, type Status, type StatusWithoutAccount }; diff --git a/packages/pl-api/lib/entities/translation.ts b/packages/pl-api/lib/entities/translation.ts index ed2727841..4ecc043a6 100644 --- a/packages/pl-api/lib/entities/translation.ts +++ b/packages/pl-api/lib/entities/translation.ts @@ -25,7 +25,6 @@ const translationSchema = v.pipe( if (translation?.text) return { content: translation.text, detected_source_language: translation.detected_language, - provider: '', }; return translation; @@ -37,7 +36,7 @@ const translationSchema = v.pipe( poll: v.fallback(v.optional(translationPollSchema), undefined), media_attachments: filteredArray(translationMediaAttachment), detected_source_language: v.string(), - provider: v.string(), + provider: v.fallback(v.nullable(v.string()), null), }), ); diff --git a/packages/pl-api/lib/features.ts b/packages/pl-api/lib/features.ts index 82058cff3..31261f0cd 100644 --- a/packages/pl-api/lib/features.ts +++ b/packages/pl-api/lib/features.ts @@ -85,6 +85,12 @@ const AKKOMA = 'akkoma'; */ const GLITCH = 'glitch'; +/** + * glitch-soc, fork of Mastodon that provides local posting and a wider range of content types. + * @see {@link https://github.com/hometown-fork/hometown} + */ +const HOMETOWN = 'hometown'; + /** * Pl, fork of Pleroma developed by pl-api author. * @see {@link https://github.com/mkljczk/pl} @@ -113,7 +119,7 @@ const getFeatures = (instance: Instance) => { * @see PATCH /api/v1/accounts/update_credentials */ accountAvatarDescription: any([ - v.software === GOTOSOCIAL && gte(v.version, '0.16.1'), + v.software === GOTOSOCIAL && gte(v.version, '0.17.0'), v.software === PLEROMA && v.build === PL, ]), @@ -202,6 +208,7 @@ const getFeatures = (instance: Instance) => { * @see {@link https://docs.joinmastodon.org/methods/announcements/} */ announcements: any([ + v.software === FIREFISH, v.software === ICESHRIMP, v.software === MASTODON, v.software === PLEROMA, @@ -270,6 +277,7 @@ const getFeatures = (instance: Instance) => { */ bots: any([ v.software === GOTOSOCIAL, + v.software === ICESHRIMP, v.software === MASTODON, v.software === PLEROMA, ]), @@ -302,7 +310,7 @@ const getFeatures = (instance: Instance) => { conversations: any([ v.software === FIREFISH, v.software === FRIENDICA, - v.software === GOTOSOCIAL && gte(v.version, '0.16.1'), + v.software === GOTOSOCIAL && gte(v.version, '0.17.0'), v.software === ICESHRIMP, v.software === MASTODON, v.software === PIXELFED, @@ -397,6 +405,7 @@ const getFeatures = (instance: Instance) => { * @see PUT /api/v1/statuses/:id */ editStatuses: any([ + v.software === FIREFISH, v.software === FRIENDICA && gte(v.version, '2022.12.0'), v.software === ICESHRIMP, v.software === MASTODON, @@ -430,6 +439,7 @@ const getFeatures = (instance: Instance) => { * @see POST /v1/statuses/:id/unreact/:emoji */ emojiReacts: any([ + v.software === FIREFISH, v.software === MITRA && gte(v.version, '2.21.0'), v.software === PLEROMA, instance ? instance.configuration.reactions.max_reactions > 0 : false, @@ -529,7 +539,7 @@ const getFeatures = (instance: Instance) => { * @see POST /api/v1/tags/:name/unfollow */ followHashtags: any([ - v.software === GOTOSOCIAL && gte(v.version, '0.16.1'), + v.software === GOTOSOCIAL && gte(v.version, '0.17.0'), v.software === MASTODON && gte(v.compatVersion, '4.0.0'), v.software === PLEROMA && v.build === AKKOMA, v.software === PLEROMA && v.build === PL, @@ -541,6 +551,7 @@ const getFeatures = (instance: Instance) => { * @see PATCH /api/v1/accounts/update_credentials */ followRequests: any([ + v.software === FIREFISH, v.software === GOTOSOCIAL, v.software === MASTODON, v.software === MITRA, @@ -553,7 +564,7 @@ const getFeatures = (instance: Instance) => { * @see GET /api/v1/followed_tags */ followedHashtagsList: any([ - v.software === GOTOSOCIAL && gte(v.version, '0.16.1'), + v.software === GOTOSOCIAL && gte(v.version, '0.17.0'), v.software === MASTODON && gte(v.compatVersion, '4.1.0'), v.software === PLEROMA && v.build === AKKOMA, v.software === PLEROMA && v.build === PL, @@ -612,7 +623,7 @@ const getFeatures = (instance: Instance) => { * @see POST /api/v1/import */ importBlocks: any([ - v.software === GOTOSOCIAL && gte(v.version, '0.16.1'), + v.software === GOTOSOCIAL && gte(v.version, '0.17.0'), v.software === PLEROMA, ]), @@ -623,7 +634,7 @@ const getFeatures = (instance: Instance) => { */ importFollows: any([ - v.software === GOTOSOCIAL && gte(v.version, '0.16.1'), + v.software === GOTOSOCIAL && gte(v.version, '0.17.0'), v.software === PLEROMA, ]), @@ -637,7 +648,7 @@ const getFeatures = (instance: Instance) => { * Allow to specify mode of data import to either `merge` or `overwrite`. * @see POST /api/v1/import */ - importOverwrite: v.software === GOTOSOCIAL && gte(v.version, '0.16.1'), + importOverwrite: v.software === GOTOSOCIAL && gte(v.version, '0.17.0'), /** * View posts from specific instance. @@ -651,13 +662,14 @@ const getFeatures = (instance: Instance) => { * @see {@link https://docs.joinmastodon.org/methods/instance/#v2} */ instanceV2: any([ + v.software === FIREFISH, v.software === GOTOSOCIAL, v.software === MASTODON && gte(v.compatVersion, '4.0.0'), v.software === PLEROMA && v.build === REBASED && gte(v.version, '2.6.0'), v.software === PLEROMA && gte(v.version, '2.7.0'), ]), - interactionRequests: v.software === GOTOSOCIAL && gte(v.version, '0.16.1'), + interactionRequests: v.software === GOTOSOCIAL && gte(v.version, '0.17.0'), /** * Server-side status language detection. @@ -688,7 +700,10 @@ const getFeatures = (instance: Instance) => { * Ability to post statuses that don't federate. * @see POST /api/v1/statuses */ - localOnlyStatuses: federation && v.software === GOTOSOCIAL, + localOnlyStatuses: federation && any([ + v.software === GOTOSOCIAL, + v.software === MASTODON && v.build === HOMETOWN, + ]), /** * Can sign in using username instead of e-mail address. @@ -745,6 +760,7 @@ const getFeatures = (instance: Instance) => { * @see POST /api/v2/media */ mediaV2: any([ + v.software === FIREFISH, v.software === ICESHRIMP, v.software === MASTODON, v.software === MITRA, @@ -822,6 +838,7 @@ const getFeatures = (instance: Instance) => { * @see GET /api/v1/notifications */ notificationsIncludeTypes: any([ + v.software === FIREFISH, v.software === ICESHRIMP, v.software === MASTODON, v.software === PLEROMA && gte(v.version, '2.5.0'), @@ -919,6 +936,7 @@ const getFeatures = (instance: Instance) => { * @see PATCH /api/v1/accounts/update_credentials */ profileFields: any([ + v.software === ICESHRIMP, v.software === MASTODON, v.software === PLEROMA, v.software === TAKAHE && gte(v.version, '0.7.0'), @@ -1018,6 +1036,7 @@ const getFeatures = (instance: Instance) => { * @see {@link https://docs.joinmastodon.org/methods/scheduled_statuses/} */ scheduledStatuses: any([ + v.software === FIREFISH, v.software === FRIENDICA, v.software === MASTODON, v.software === PLEROMA, @@ -1140,6 +1159,7 @@ const getFeatures = (instance: Instance) => { */ trendingStatuses: any([ v.software === DITTO, + v.software === FIREFISH, v.software === FRIENDICA && gte(v.version, '2022.12.0'), v.software === ICESHRIMP, v.software === MASTODON, @@ -1151,6 +1171,7 @@ const getFeatures = (instance: Instance) => { */ trends: any([ v.software === DITTO, + v.software === FIREFISH, v.software === FRIENDICA && gte(v.version, '2022.12.0'), v.software === ICESHRIMP, v.software === MASTODON, @@ -1205,7 +1226,7 @@ const parseVersion = (version: string): Backend => { const compat = match ? semverParse(match[1]) || semverCoerce(match[1]) : null; if (match && semver && compat) { return { - build: semver.build[0], + build: semver.build[0]?.split('-')[0], compatVersion: compat.version, software: match[2] || MASTODON, version: semver.version.split('-')[0], diff --git a/packages/pl-api/package.json b/packages/pl-api/package.json index 6df7d29b5..73c958266 100644 --- a/packages/pl-api/package.json +++ b/packages/pl-api/package.json @@ -1,6 +1,6 @@ { "name": "pl-api", - "version": "0.1.3", + "version": "0.1.4", "type": "module", "homepage": "https://github.com/mkljczk/pl-fe/tree/fork/packages/pl-api", "repository": { diff --git a/packages/pl-fe/CHANGELOG.md b/packages/pl-fe/CHANGELOG.md index eeaa47b75..4cde8e7dd 100644 --- a/packages/pl-fe/CHANGELOG.md +++ b/packages/pl-fe/CHANGELOG.md @@ -35,6 +35,8 @@ Changes made since the project forked from Soapbox in April 2024. - You can browse Bubble timeline, if supported by backend. - Mastodon displays trending articles on Search page. - Posts can be addressed to lists of users, on Pleroma. +- Support for events with external registration. +- Added a dedicated wrench reaction button. ### Changed @@ -67,6 +69,7 @@ Changes made since the project forked from Soapbox in April 2024. **Internal:** - Migrated some local stores from Redux to Zustand. +- Posts are now emojified during render, instead of when inserting posts to the state. **Dependencies:** - `@tanstack/react-virtual` is used for list virtualization, instead of `react-virtuoso`. This improves compatibility with Ladybird browser. diff --git a/packages/pl-fe/favicon.ico b/packages/pl-fe/favicon.ico new file mode 100644 index 000000000..460204573 Binary files /dev/null and b/packages/pl-fe/favicon.ico differ diff --git a/packages/pl-fe/package.json b/packages/pl-fe/package.json index a513efd81..46f871c66 100644 --- a/packages/pl-fe/package.json +++ b/packages/pl-fe/package.json @@ -102,7 +102,7 @@ "mini-css-extract-plugin": "^2.9.1", "multiselect-react-dropdown": "^2.0.25", "path-browserify": "^1.0.1", - "pl-api": "^0.1.3", + "pl-api": "^0.1.4", "postcss": "^8.4.47", "process": "^0.11.10", "punycode": "^2.1.1", diff --git a/packages/pl-fe/src/actions/bookmarks.ts b/packages/pl-fe/src/actions/bookmarks.ts index 276e1b397..49de0a058 100644 --- a/packages/pl-fe/src/actions/bookmarks.ts +++ b/packages/pl-fe/src/actions/bookmarks.ts @@ -90,7 +90,6 @@ type BookmarksAction = ReturnType | ReturnType | ReturnType - | ReturnType | ReturnType | ReturnType | ReturnType; diff --git a/packages/pl-fe/src/actions/importer/index.ts b/packages/pl-fe/src/actions/importer/index.ts index 8315825dd..c97486900 100644 --- a/packages/pl-fe/src/actions/importer/index.ts +++ b/packages/pl-fe/src/actions/importer/index.ts @@ -6,11 +6,9 @@ import { normalizeGroup } from 'pl-fe/normalizers/group'; import type { Account as BaseAccount, Group, Poll, Status as BaseStatus } from 'pl-api'; import type { AppDispatch } from 'pl-fe/store'; -const STATUS_IMPORT = 'STATUS_IMPORT'; -const STATUSES_IMPORT = 'STATUSES_IMPORT'; -const POLLS_IMPORT = 'POLLS_IMPORT'; - -const importAccount = (data: BaseAccount) => importAccounts([data]); +const STATUS_IMPORT = 'STATUS_IMPORT' as const; +const STATUSES_IMPORT = 'STATUSES_IMPORT' as const; +const POLLS_IMPORT = 'POLLS_IMPORT' as const; const importAccounts = (data: Array) => (dispatch: AppDispatch) => { try { @@ -153,20 +151,19 @@ const importFetchedPoll = (poll: Poll) => dispatch(importPolls([poll])); }; +type ImporterAction = + | ReturnType + | ReturnType + | ReturnType; + export { STATUS_IMPORT, STATUSES_IMPORT, POLLS_IMPORT, - importAccount, - importAccounts, - importGroup, - importGroups, - importStatus, - importStatuses, - importPolls, importFetchedAccount, importFetchedAccounts, importFetchedStatus, importFetchedStatuses, importFetchedPoll, + type ImporterAction, }; diff --git a/packages/pl-fe/src/actions/modals.ts b/packages/pl-fe/src/actions/modals.ts deleted file mode 100644 index 8b15c3e64..000000000 --- a/packages/pl-fe/src/actions/modals.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { useModalsStore } from 'pl-fe/stores/modals'; - -import type { ModalType } from 'pl-fe/features/ui/components/modal-root'; -import type { OpenModalProps } from 'pl-fe/stores/modals'; - -const openModal = (...props: OpenModalProps) => () => { - useModalsStore.getState().openModal(...props); -}; - -const closeModal = (type?: ModalType) => () => { - useModalsStore.getState().closeModal(type); -}; - -export { - openModal, - closeModal, -}; diff --git a/packages/pl-fe/src/actions/preload.ts b/packages/pl-fe/src/actions/preload.ts index 4b77263eb..29a212a66 100644 --- a/packages/pl-fe/src/actions/preload.ts +++ b/packages/pl-fe/src/actions/preload.ts @@ -68,7 +68,6 @@ export { PLEROMA_PRELOAD_IMPORT, MASTODON_PRELOAD_IMPORT, preload, - preloadPleroma, preloadMastodon, type PreloadAction, }; diff --git a/packages/pl-fe/src/actions/push-notifications/index.ts b/packages/pl-fe/src/actions/push-notifications/index.ts index 6fe35b844..f850f7f1f 100644 --- a/packages/pl-fe/src/actions/push-notifications/index.ts +++ b/packages/pl-fe/src/actions/push-notifications/index.ts @@ -1,25 +1,6 @@ -import { register, saveSettings } from './registerer'; -import { - SET_BROWSER_SUPPORT, - SET_SUBSCRIPTION, - CLEAR_SUBSCRIPTION, - SET_ALERTS, - setAlerts, -} from './setter'; - -import type { AppDispatch } from 'pl-fe/store'; - -const changeAlerts = (path: Array, value: any) => - (dispatch: AppDispatch) => { - dispatch(setAlerts(path, value)); - dispatch(saveSettings() as any); - }; - +export { register } from './registerer'; export { SET_BROWSER_SUPPORT, SET_SUBSCRIPTION, CLEAR_SUBSCRIPTION, - SET_ALERTS, - register, - changeAlerts, -}; +} from './setter'; diff --git a/packages/pl-fe/src/actions/push-notifications/setter.ts b/packages/pl-fe/src/actions/push-notifications/setter.ts index 046a18fb3..dfa931d4b 100644 --- a/packages/pl-fe/src/actions/push-notifications/setter.ts +++ b/packages/pl-fe/src/actions/push-notifications/setter.ts @@ -3,7 +3,6 @@ import type { WebPushSubscription } from 'pl-api'; const SET_BROWSER_SUPPORT = 'PUSH_NOTIFICATIONS_SET_BROWSER_SUPPORT' as const; const SET_SUBSCRIPTION = 'PUSH_NOTIFICATIONS_SET_SUBSCRIPTION' as const; const CLEAR_SUBSCRIPTION = 'PUSH_NOTIFICATIONS_CLEAR_SUBSCRIPTION' as const; -const SET_ALERTS = 'PUSH_NOTIFICATIONS_SET_ALERTS' as const; const setBrowserSupport = (value: boolean) => ({ type: SET_BROWSER_SUPPORT, @@ -19,26 +18,17 @@ const clearSubscription = () => ({ type: CLEAR_SUBSCRIPTION, }); -const setAlerts = (path: Array, value: any) => ({ - type: SET_ALERTS, - path, - value, -}); - type SetterAction = | ReturnType | ReturnType - | ReturnType - | ReturnType; + | ReturnType; export { SET_BROWSER_SUPPORT, SET_SUBSCRIPTION, CLEAR_SUBSCRIPTION, - SET_ALERTS, setBrowserSupport, setSubscription, clearSubscription, - setAlerts, type SetterAction, }; diff --git a/packages/pl-fe/src/actions/push-subscriptions.ts b/packages/pl-fe/src/actions/push-subscriptions.ts index 306fc5dfc..332f9bc42 100644 --- a/packages/pl-fe/src/actions/push-subscriptions.ts +++ b/packages/pl-fe/src/actions/push-subscriptions.ts @@ -7,21 +7,11 @@ const createPushSubscription = (params: CreatePushNotificationsSubscriptionParam (dispatch: AppDispatch, getState: () => RootState) => getClient(getState).pushNotifications.createSubscription(params); -const fetchPushSubscription = () => - (dispatch: AppDispatch, getState: () => RootState) => - getClient(getState).pushNotifications.getSubscription(); - const updatePushSubscription = (params: UpdatePushNotificationsSubscriptionParams) => (dispatch: AppDispatch, getState: () => RootState) => getClient(getState).pushNotifications.updateSubscription(params); -const deletePushSubscription = () => - (dispatch: AppDispatch, getState: () => RootState) => - getClient(getState).pushNotifications.deleteSubscription(); - export { createPushSubscription, - fetchPushSubscription, updatePushSubscription, - deletePushSubscription, }; diff --git a/packages/pl-fe/src/actions/statuses.ts b/packages/pl-fe/src/actions/statuses.ts index 0e9c78eae..54fca4893 100644 --- a/packages/pl-fe/src/actions/statuses.ts +++ b/packages/pl-fe/src/actions/statuses.ts @@ -273,14 +273,6 @@ const expandStatusSpoiler = (statusIds: string[] | string) => { }; }; -const toggleStatusSpoilerExpanded = (status: Pick) => { - if (status.expanded) { - return collapseStatusSpoiler(status.id); - } else { - return expandStatusSpoiler(status.id); - } -}; - let TRANSLATIONS_QUEUE: Set = new Set(); let TRANSLATIONS_TIMEOUT: NodeJS.Timeout | null = null; @@ -414,7 +406,6 @@ export { toggleStatusMediaHidden, expandStatusSpoiler, collapseStatusSpoiler, - toggleStatusSpoilerExpanded, translateStatus, undoStatusTranslation, unfilterStatus, diff --git a/packages/pl-fe/src/api/hooks/accounts/useAccountList.ts b/packages/pl-fe/src/api/hooks/accounts/use-account-list.ts similarity index 94% rename from packages/pl-fe/src/api/hooks/accounts/useAccountList.ts rename to packages/pl-fe/src/api/hooks/accounts/use-account-list.ts index 558be5cb2..a0ea24fe1 100644 --- a/packages/pl-fe/src/api/hooks/accounts/useAccountList.ts +++ b/packages/pl-fe/src/api/hooks/accounts/use-account-list.ts @@ -1,11 +1,11 @@ import { useInfiniteQuery } from '@tanstack/react-query'; import { Entities } from 'pl-fe/entity-store/entities'; -import { useClient } from 'pl-fe/hooks/useClient'; +import { useClient } from 'pl-fe/hooks/use-client'; import { type Account, normalizeAccount } from 'pl-fe/normalizers/account'; import { flattenPages } from 'pl-fe/utils/queries'; -import { useRelationships } from './useRelationships'; +import { useRelationships } from './use-relationships'; import type { PaginatedResponse, Account as BaseAccount } from 'pl-api'; import type { EntityFn } from 'pl-fe/entity-store/hooks/types'; @@ -72,7 +72,6 @@ const useFollowers = (accountId: string | undefined) => { }; export { - useAccountList, useBlocks, useMutes, useFollowing, diff --git a/packages/pl-fe/src/api/hooks/accounts/useAccountLookup.ts b/packages/pl-fe/src/api/hooks/accounts/use-account-lookup.ts similarity index 82% rename from packages/pl-fe/src/api/hooks/accounts/useAccountLookup.ts rename to packages/pl-fe/src/api/hooks/accounts/use-account-lookup.ts index d0a050262..ac3806700 100644 --- a/packages/pl-fe/src/api/hooks/accounts/useAccountLookup.ts +++ b/packages/pl-fe/src/api/hooks/accounts/use-account-lookup.ts @@ -2,14 +2,14 @@ import { useEffect } from 'react'; import { useHistory } from 'react-router-dom'; import { Entities } from 'pl-fe/entity-store/entities'; -import { useEntityLookup } from 'pl-fe/entity-store/hooks/useEntityLookup'; -import { useClient } from 'pl-fe/hooks/useClient'; -import { useFeatures } from 'pl-fe/hooks/useFeatures'; -import { useLoggedIn } from 'pl-fe/hooks/useLoggedIn'; +import { useEntityLookup } from 'pl-fe/entity-store/hooks/use-entity-lookup'; +import { useClient } from 'pl-fe/hooks/use-client'; +import { useFeatures } from 'pl-fe/hooks/use-features'; +import { useLoggedIn } from 'pl-fe/hooks/use-logged-in'; import { type Account, normalizeAccount } from 'pl-fe/normalizers/account'; -import { useAccountScrobble } from './useAccountScrobble'; -import { useRelationship } from './useRelationship'; +import { useAccountScrobble } from './use-account-scrobble'; +import { useRelationship } from './use-relationship'; import type { Account as BaseAccount } from 'pl-api'; diff --git a/packages/pl-fe/src/api/hooks/accounts/useAccountScrobble.ts b/packages/pl-fe/src/api/hooks/accounts/use-account-scrobble.ts similarity index 87% rename from packages/pl-fe/src/api/hooks/accounts/useAccountScrobble.ts rename to packages/pl-fe/src/api/hooks/accounts/use-account-scrobble.ts index 86269a3ed..deacc8964 100644 --- a/packages/pl-fe/src/api/hooks/accounts/useAccountScrobble.ts +++ b/packages/pl-fe/src/api/hooks/accounts/use-account-scrobble.ts @@ -1,7 +1,7 @@ import { useQuery } from '@tanstack/react-query'; -import { useClient } from 'pl-fe/hooks/useClient'; -import { useFeatures } from 'pl-fe/hooks/useFeatures'; +import { useClient } from 'pl-fe/hooks/use-client'; +import { useFeatures } from 'pl-fe/hooks/use-features'; import type { Scrobble } from 'pl-api'; diff --git a/packages/pl-fe/src/api/hooks/accounts/useAccount.ts b/packages/pl-fe/src/api/hooks/accounts/use-account.ts similarity index 80% rename from packages/pl-fe/src/api/hooks/accounts/useAccount.ts rename to packages/pl-fe/src/api/hooks/accounts/use-account.ts index 70a97262d..2f27e7ef7 100644 --- a/packages/pl-fe/src/api/hooks/accounts/useAccount.ts +++ b/packages/pl-fe/src/api/hooks/accounts/use-account.ts @@ -2,15 +2,15 @@ import { useEffect, useMemo } from 'react'; import { useHistory } from 'react-router-dom'; import { Entities } from 'pl-fe/entity-store/entities'; -import { useEntity } from 'pl-fe/entity-store/hooks/useEntity'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; -import { useClient } from 'pl-fe/hooks/useClient'; -import { useFeatures } from 'pl-fe/hooks/useFeatures'; -import { useLoggedIn } from 'pl-fe/hooks/useLoggedIn'; +import { useEntity } from 'pl-fe/entity-store/hooks/use-entity'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; +import { useClient } from 'pl-fe/hooks/use-client'; +import { useFeatures } from 'pl-fe/hooks/use-features'; +import { useLoggedIn } from 'pl-fe/hooks/use-logged-in'; import { type Account, normalizeAccount } from 'pl-fe/normalizers/account'; -import { useAccountScrobble } from './useAccountScrobble'; -import { useRelationship } from './useRelationship'; +import { useAccountScrobble } from './use-account-scrobble'; +import { useRelationship } from './use-relationship'; import type { Account as BaseAccount } from 'pl-api'; @@ -32,7 +32,7 @@ const useAccount = (accountId?: string, opts: UseAccountOpts = {}) => { { enabled: !!accountId, transform: normalizeAccount }, ); - const meta = useAppSelector((state) => accountId && state.accounts_meta[accountId] || {}); + const meta = useAppSelector((state) => accountId && state.accounts_meta[accountId]); const { relationship, diff --git a/packages/pl-fe/src/api/hooks/accounts/useFollow.ts b/packages/pl-fe/src/api/hooks/accounts/use-follow.ts similarity index 88% rename from packages/pl-fe/src/api/hooks/accounts/useFollow.ts rename to packages/pl-fe/src/api/hooks/accounts/use-follow.ts index 931487734..790b522a5 100644 --- a/packages/pl-fe/src/api/hooks/accounts/useFollow.ts +++ b/packages/pl-fe/src/api/hooks/accounts/use-follow.ts @@ -1,9 +1,9 @@ import { importEntities } from 'pl-fe/entity-store/actions'; import { Entities } from 'pl-fe/entity-store/entities'; -import { useTransaction } from 'pl-fe/entity-store/hooks/useTransaction'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useClient } from 'pl-fe/hooks/useClient'; -import { useLoggedIn } from 'pl-fe/hooks/useLoggedIn'; +import { useTransaction } from 'pl-fe/entity-store/hooks/use-transaction'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useClient } from 'pl-fe/hooks/use-client'; +import { useLoggedIn } from 'pl-fe/hooks/use-logged-in'; interface FollowOpts { reblogs?: boolean; diff --git a/packages/pl-fe/src/api/hooks/accounts/useRelationship.ts b/packages/pl-fe/src/api/hooks/accounts/use-relationship.ts similarity index 81% rename from packages/pl-fe/src/api/hooks/accounts/useRelationship.ts rename to packages/pl-fe/src/api/hooks/accounts/use-relationship.ts index e2bce4815..003a127b7 100644 --- a/packages/pl-fe/src/api/hooks/accounts/useRelationship.ts +++ b/packages/pl-fe/src/api/hooks/accounts/use-relationship.ts @@ -1,9 +1,9 @@ import * as v from 'valibot'; import { Entities } from 'pl-fe/entity-store/entities'; -import { useEntity } from 'pl-fe/entity-store/hooks/useEntity'; -import { useClient } from 'pl-fe/hooks/useClient'; -import { useLoggedIn } from 'pl-fe/hooks/useLoggedIn'; +import { useEntity } from 'pl-fe/entity-store/hooks/use-entity'; +import { useClient } from 'pl-fe/hooks/use-client'; +import { useLoggedIn } from 'pl-fe/hooks/use-logged-in'; import type { Relationship } from 'pl-api'; diff --git a/packages/pl-fe/src/api/hooks/accounts/useRelationships.ts b/packages/pl-fe/src/api/hooks/accounts/use-relationships.ts similarity index 84% rename from packages/pl-fe/src/api/hooks/accounts/useRelationships.ts rename to packages/pl-fe/src/api/hooks/accounts/use-relationships.ts index c0b44e5cb..89d59a47f 100644 --- a/packages/pl-fe/src/api/hooks/accounts/useRelationships.ts +++ b/packages/pl-fe/src/api/hooks/accounts/use-relationships.ts @@ -1,7 +1,7 @@ import { Entities } from 'pl-fe/entity-store/entities'; -import { useBatchedEntities } from 'pl-fe/entity-store/hooks/useBatchedEntities'; -import { useClient } from 'pl-fe/hooks/useClient'; -import { useLoggedIn } from 'pl-fe/hooks/useLoggedIn'; +import { useBatchedEntities } from 'pl-fe/entity-store/hooks/use-batched-entities'; +import { useClient } from 'pl-fe/hooks/use-client'; +import { useLoggedIn } from 'pl-fe/hooks/use-logged-in'; import type { Relationship } from 'pl-api'; diff --git a/packages/pl-fe/src/api/hooks/admin/useAnnouncements.ts b/packages/pl-fe/src/api/hooks/admin/use-announcements.ts similarity index 96% rename from packages/pl-fe/src/api/hooks/admin/useAnnouncements.ts rename to packages/pl-fe/src/api/hooks/admin/use-announcements.ts index 6c2c78ff1..c313e0895 100644 --- a/packages/pl-fe/src/api/hooks/admin/useAnnouncements.ts +++ b/packages/pl-fe/src/api/hooks/admin/use-announcements.ts @@ -7,10 +7,10 @@ import { } from 'pl-api'; import * as v from 'valibot'; -import { useClient } from 'pl-fe/hooks/useClient'; +import { useClient } from 'pl-fe/hooks/use-client'; import { queryClient } from 'pl-fe/queries/client'; -import { useAnnouncements as useUserAnnouncements } from '../announcements/useAnnouncements'; +import { useAnnouncements as useUserAnnouncements } from '../announcements/use-announcements'; const useAnnouncements = () => { const client = useClient(); diff --git a/packages/pl-fe/src/api/hooks/admin/useDomains.ts b/packages/pl-fe/src/api/hooks/admin/use-domains.ts similarity index 97% rename from packages/pl-fe/src/api/hooks/admin/useDomains.ts rename to packages/pl-fe/src/api/hooks/admin/use-domains.ts index 4f11adb8b..b375db877 100644 --- a/packages/pl-fe/src/api/hooks/admin/useDomains.ts +++ b/packages/pl-fe/src/api/hooks/admin/use-domains.ts @@ -1,6 +1,6 @@ import { useMutation, useQuery } from '@tanstack/react-query'; -import { useClient } from 'pl-fe/hooks/useClient'; +import { useClient } from 'pl-fe/hooks/use-client'; import { queryClient } from 'pl-fe/queries/client'; import type { AdminDomain } from 'pl-api'; diff --git a/packages/pl-fe/src/api/hooks/admin/useModerationLog.ts b/packages/pl-fe/src/api/hooks/admin/use-moderation-log.ts similarity index 94% rename from packages/pl-fe/src/api/hooks/admin/useModerationLog.ts rename to packages/pl-fe/src/api/hooks/admin/use-moderation-log.ts index 9ef56c684..48e2bb05e 100644 --- a/packages/pl-fe/src/api/hooks/admin/useModerationLog.ts +++ b/packages/pl-fe/src/api/hooks/admin/use-moderation-log.ts @@ -1,7 +1,7 @@ import { useInfiniteQuery } from '@tanstack/react-query'; import { PaginatedResponse } from 'pl-api'; -import { useClient } from 'pl-fe/hooks/useClient'; +import { useClient } from 'pl-fe/hooks/use-client'; import { flattenPages } from 'pl-fe/utils/queries'; import type { AdminModerationLogEntry } from 'pl-api'; diff --git a/packages/pl-fe/src/api/hooks/admin/useRelays.ts b/packages/pl-fe/src/api/hooks/admin/use-relays.ts similarity index 96% rename from packages/pl-fe/src/api/hooks/admin/useRelays.ts rename to packages/pl-fe/src/api/hooks/admin/use-relays.ts index 4ad7d9782..551b58f80 100644 --- a/packages/pl-fe/src/api/hooks/admin/useRelays.ts +++ b/packages/pl-fe/src/api/hooks/admin/use-relays.ts @@ -1,6 +1,6 @@ import { useMutation, useQuery } from '@tanstack/react-query'; -import { useClient } from 'pl-fe/hooks/useClient'; +import { useClient } from 'pl-fe/hooks/use-client'; import { queryClient } from 'pl-fe/queries/client'; import type { AdminRelay } from 'pl-api'; diff --git a/packages/pl-fe/src/api/hooks/admin/useRules.ts b/packages/pl-fe/src/api/hooks/admin/use-rules.ts similarity index 97% rename from packages/pl-fe/src/api/hooks/admin/useRules.ts rename to packages/pl-fe/src/api/hooks/admin/use-rules.ts index 2906cbda5..26be9e15e 100644 --- a/packages/pl-fe/src/api/hooks/admin/useRules.ts +++ b/packages/pl-fe/src/api/hooks/admin/use-rules.ts @@ -1,6 +1,6 @@ import { useMutation, useQuery } from '@tanstack/react-query'; -import { useClient } from 'pl-fe/hooks/useClient'; +import { useClient } from 'pl-fe/hooks/use-client'; import { queryClient } from 'pl-fe/queries/client'; import type { AdminRule } from 'pl-api'; diff --git a/packages/pl-fe/src/api/hooks/admin/useSuggest.ts b/packages/pl-fe/src/api/hooks/admin/use-suggest.ts similarity index 90% rename from packages/pl-fe/src/api/hooks/admin/useSuggest.ts rename to packages/pl-fe/src/api/hooks/admin/use-suggest.ts index f392e9151..643e34d37 100644 --- a/packages/pl-fe/src/api/hooks/admin/useSuggest.ts +++ b/packages/pl-fe/src/api/hooks/admin/use-suggest.ts @@ -1,6 +1,6 @@ import { EntityCallbacks } from 'pl-fe/entity-store/hooks/types'; -import { useTransaction } from 'pl-fe/entity-store/hooks/useTransaction'; -import { useClient } from 'pl-fe/hooks/useClient'; +import { useTransaction } from 'pl-fe/entity-store/hooks/use-transaction'; +import { useClient } from 'pl-fe/hooks/use-client'; import type { Account } from 'pl-fe/normalizers/account'; diff --git a/packages/pl-fe/src/api/hooks/admin/useVerify.ts b/packages/pl-fe/src/api/hooks/admin/use-verify.ts similarity index 92% rename from packages/pl-fe/src/api/hooks/admin/useVerify.ts rename to packages/pl-fe/src/api/hooks/admin/use-verify.ts index c3b4e956a..f0e04db04 100644 --- a/packages/pl-fe/src/api/hooks/admin/useVerify.ts +++ b/packages/pl-fe/src/api/hooks/admin/use-verify.ts @@ -1,5 +1,5 @@ -import { useTransaction } from 'pl-fe/entity-store/hooks/useTransaction'; -import { useClient } from 'pl-fe/hooks/useClient'; +import { useTransaction } from 'pl-fe/entity-store/hooks/use-transaction'; +import { useClient } from 'pl-fe/hooks/use-client'; import type { EntityCallbacks } from 'pl-fe/entity-store/hooks/types'; import type { Account } from 'pl-fe/normalizers/account'; diff --git a/packages/pl-fe/src/api/hooks/announcements/useAnnouncements.ts b/packages/pl-fe/src/api/hooks/announcements/use-announcements.ts similarity index 98% rename from packages/pl-fe/src/api/hooks/announcements/useAnnouncements.ts rename to packages/pl-fe/src/api/hooks/announcements/use-announcements.ts index 04443affd..a5e64dbd8 100644 --- a/packages/pl-fe/src/api/hooks/announcements/useAnnouncements.ts +++ b/packages/pl-fe/src/api/hooks/announcements/use-announcements.ts @@ -2,7 +2,7 @@ import { useMutation, useQuery } from '@tanstack/react-query'; import { announcementReactionSchema, type AnnouncementReaction, type Announcement } from 'pl-api'; import * as v from 'valibot'; -import { useClient } from 'pl-fe/hooks/useClient'; +import { useClient } from 'pl-fe/hooks/use-client'; import { queryClient } from 'pl-fe/queries/client'; const updateReaction = (reaction: AnnouncementReaction, count: number, me?: boolean, overwrite?: boolean) => v.parse(announcementReactionSchema, { diff --git a/packages/pl-fe/src/api/hooks/groups/useBlockGroupMember.ts b/packages/pl-fe/src/api/hooks/groups/use-block-group-member.ts similarity index 80% rename from packages/pl-fe/src/api/hooks/groups/useBlockGroupMember.ts rename to packages/pl-fe/src/api/hooks/groups/use-block-group-member.ts index 7821a83da..673b261dd 100644 --- a/packages/pl-fe/src/api/hooks/groups/useBlockGroupMember.ts +++ b/packages/pl-fe/src/api/hooks/groups/use-block-group-member.ts @@ -1,6 +1,6 @@ import { Entities } from 'pl-fe/entity-store/entities'; -import { useCreateEntity } from 'pl-fe/entity-store/hooks/useCreateEntity'; -import { useClient } from 'pl-fe/hooks/useClient'; +import { useCreateEntity } from 'pl-fe/entity-store/hooks/use-create-entity'; +import { useClient } from 'pl-fe/hooks/use-client'; import type { Group } from 'pl-api'; import type { Account } from 'pl-fe/normalizers/account'; diff --git a/packages/pl-fe/src/api/hooks/groups/useCreateGroup.ts b/packages/pl-fe/src/api/hooks/groups/use-create-group.ts similarity index 82% rename from packages/pl-fe/src/api/hooks/groups/useCreateGroup.ts rename to packages/pl-fe/src/api/hooks/groups/use-create-group.ts index 34422ebb5..5cf5b6b5f 100644 --- a/packages/pl-fe/src/api/hooks/groups/useCreateGroup.ts +++ b/packages/pl-fe/src/api/hooks/groups/use-create-group.ts @@ -1,6 +1,6 @@ import { Entities } from 'pl-fe/entity-store/entities'; -import { useCreateEntity } from 'pl-fe/entity-store/hooks/useCreateEntity'; -import { useClient } from 'pl-fe/hooks/useClient'; +import { useCreateEntity } from 'pl-fe/entity-store/hooks/use-create-entity'; +import { useClient } from 'pl-fe/hooks/use-client'; import { normalizeGroup, type Group } from 'pl-fe/normalizers/group'; import type { Group as BaseGroup, CreateGroupParams } from 'pl-api'; diff --git a/packages/pl-fe/src/api/hooks/groups/useDeleteGroupStatus.ts b/packages/pl-fe/src/api/hooks/groups/use-delete-group-status.ts similarity index 78% rename from packages/pl-fe/src/api/hooks/groups/useDeleteGroupStatus.ts rename to packages/pl-fe/src/api/hooks/groups/use-delete-group-status.ts index 2481a6977..f2a08bd13 100644 --- a/packages/pl-fe/src/api/hooks/groups/useDeleteGroupStatus.ts +++ b/packages/pl-fe/src/api/hooks/groups/use-delete-group-status.ts @@ -1,6 +1,6 @@ import { Entities } from 'pl-fe/entity-store/entities'; -import { useDeleteEntity } from 'pl-fe/entity-store/hooks/useDeleteEntity'; -import { useClient } from 'pl-fe/hooks/useClient'; +import { useDeleteEntity } from 'pl-fe/entity-store/hooks/use-delete-entity'; +import { useClient } from 'pl-fe/hooks/use-client'; import type { Group } from 'pl-api'; diff --git a/packages/pl-fe/src/api/hooks/groups/useDeleteGroup.ts b/packages/pl-fe/src/api/hooks/groups/use-delete-group.ts similarity index 73% rename from packages/pl-fe/src/api/hooks/groups/useDeleteGroup.ts rename to packages/pl-fe/src/api/hooks/groups/use-delete-group.ts index 560746c2d..3be1ce329 100644 --- a/packages/pl-fe/src/api/hooks/groups/useDeleteGroup.ts +++ b/packages/pl-fe/src/api/hooks/groups/use-delete-group.ts @@ -1,6 +1,6 @@ import { Entities } from 'pl-fe/entity-store/entities'; -import { useDeleteEntity } from 'pl-fe/entity-store/hooks/useDeleteEntity'; -import { useClient } from 'pl-fe/hooks/useClient'; +import { useDeleteEntity } from 'pl-fe/entity-store/hooks/use-delete-entity'; +import { useClient } from 'pl-fe/hooks/use-client'; const useDeleteGroup = () => { const client = useClient(); diff --git a/packages/pl-fe/src/api/hooks/groups/useDemoteGroupMember.ts b/packages/pl-fe/src/api/hooks/groups/use-demote-group-member.ts similarity index 85% rename from packages/pl-fe/src/api/hooks/groups/useDemoteGroupMember.ts rename to packages/pl-fe/src/api/hooks/groups/use-demote-group-member.ts index 5f8ee3e08..7a1a6c64c 100644 --- a/packages/pl-fe/src/api/hooks/groups/useDemoteGroupMember.ts +++ b/packages/pl-fe/src/api/hooks/groups/use-demote-group-member.ts @@ -1,8 +1,8 @@ import * as v from 'valibot'; import { Entities } from 'pl-fe/entity-store/entities'; -import { useCreateEntity } from 'pl-fe/entity-store/hooks/useCreateEntity'; -import { useClient } from 'pl-fe/hooks/useClient'; +import { useCreateEntity } from 'pl-fe/entity-store/hooks/use-create-entity'; +import { useClient } from 'pl-fe/hooks/use-client'; import { normalizeGroupMember } from 'pl-fe/normalizers/group-member'; import type { Group, GroupMember as GroupMember, GroupRole } from 'pl-api'; diff --git a/packages/pl-fe/src/api/hooks/groups/useGroupMedia.test.ts b/packages/pl-fe/src/api/hooks/groups/use-group-media.test.ts similarity index 96% rename from packages/pl-fe/src/api/hooks/groups/useGroupMedia.test.ts rename to packages/pl-fe/src/api/hooks/groups/use-group-media.test.ts index e8b045445..3e27a9be5 100644 --- a/packages/pl-fe/src/api/hooks/groups/useGroupMedia.test.ts +++ b/packages/pl-fe/src/api/hooks/groups/use-group-media.test.ts @@ -2,7 +2,7 @@ import { __stub } from 'pl-fe/api'; import { buildStatus } from 'pl-fe/jest/factory'; import { renderHook, waitFor } from 'pl-fe/jest/test-helpers'; -import { useGroupMedia } from './useGroupMedia'; +import { useGroupMedia } from './use-group-media'; const status = buildStatus(); const groupId = '1'; diff --git a/packages/pl-fe/src/api/hooks/groups/useGroupMedia.ts b/packages/pl-fe/src/api/hooks/groups/use-group-media.ts similarity index 77% rename from packages/pl-fe/src/api/hooks/groups/useGroupMedia.ts rename to packages/pl-fe/src/api/hooks/groups/use-group-media.ts index 9f2b099c4..d2b413483 100644 --- a/packages/pl-fe/src/api/hooks/groups/useGroupMedia.ts +++ b/packages/pl-fe/src/api/hooks/groups/use-group-media.ts @@ -1,6 +1,6 @@ import { Entities } from 'pl-fe/entity-store/entities'; -import { useEntities } from 'pl-fe/entity-store/hooks/useEntities'; -import { useClient } from 'pl-fe/hooks/useClient'; +import { useEntities } from 'pl-fe/entity-store/hooks/use-entities'; +import { useClient } from 'pl-fe/hooks/use-client'; import { normalizeStatus } from 'pl-fe/normalizers/status'; const useGroupMedia = (groupId: string) => { diff --git a/packages/pl-fe/src/api/hooks/groups/useGroupMembers.test.ts b/packages/pl-fe/src/api/hooks/groups/use-group-members.test.ts similarity index 96% rename from packages/pl-fe/src/api/hooks/groups/useGroupMembers.test.ts rename to packages/pl-fe/src/api/hooks/groups/use-group-members.test.ts index 317862a81..d6dbf53dc 100644 --- a/packages/pl-fe/src/api/hooks/groups/useGroupMembers.test.ts +++ b/packages/pl-fe/src/api/hooks/groups/use-group-members.test.ts @@ -4,7 +4,7 @@ import { __stub } from 'pl-fe/api'; import { buildGroupMember } from 'pl-fe/jest/factory'; import { renderHook, waitFor } from 'pl-fe/jest/test-helpers'; -import { useGroupMembers } from './useGroupMembers'; +import { useGroupMembers } from './use-group-members'; const groupMember = buildGroupMember(); const groupId = '1'; diff --git a/packages/pl-fe/src/api/hooks/groups/useGroupMembers.ts b/packages/pl-fe/src/api/hooks/groups/use-group-members.ts similarity index 84% rename from packages/pl-fe/src/api/hooks/groups/useGroupMembers.ts rename to packages/pl-fe/src/api/hooks/groups/use-group-members.ts index 9a2978831..d8e8df888 100644 --- a/packages/pl-fe/src/api/hooks/groups/useGroupMembers.ts +++ b/packages/pl-fe/src/api/hooks/groups/use-group-members.ts @@ -1,6 +1,6 @@ import { Entities } from 'pl-fe/entity-store/entities'; -import { useEntities } from 'pl-fe/entity-store/hooks/useEntities'; -import { useClient } from 'pl-fe/hooks/useClient'; +import { useEntities } from 'pl-fe/entity-store/hooks/use-entities'; +import { useClient } from 'pl-fe/hooks/use-client'; import { normalizeGroupMember, type GroupMember } from 'pl-fe/normalizers/group-member'; import type { GroupMember as BaseGroupMember, GroupRoles } from 'pl-api'; diff --git a/packages/pl-fe/src/api/hooks/groups/useGroupMembershipRequests.ts b/packages/pl-fe/src/api/hooks/groups/use-group-membership-requests.ts similarity index 84% rename from packages/pl-fe/src/api/hooks/groups/useGroupMembershipRequests.ts rename to packages/pl-fe/src/api/hooks/groups/use-group-membership-requests.ts index ead857e73..2951f1cdb 100644 --- a/packages/pl-fe/src/api/hooks/groups/useGroupMembershipRequests.ts +++ b/packages/pl-fe/src/api/hooks/groups/use-group-membership-requests.ts @@ -1,12 +1,12 @@ import { GroupRoles } from 'pl-api'; import { Entities } from 'pl-fe/entity-store/entities'; -import { useDismissEntity } from 'pl-fe/entity-store/hooks/useDismissEntity'; -import { useEntities } from 'pl-fe/entity-store/hooks/useEntities'; -import { useClient } from 'pl-fe/hooks/useClient'; +import { useDismissEntity } from 'pl-fe/entity-store/hooks/use-dismiss-entity'; +import { useEntities } from 'pl-fe/entity-store/hooks/use-entities'; +import { useClient } from 'pl-fe/hooks/use-client'; import { normalizeAccount } from 'pl-fe/normalizers/account'; -import { useGroupRelationship } from './useGroupRelationship'; +import { useGroupRelationship } from './use-group-relationship'; import type { ExpandedEntitiesPath } from 'pl-fe/entity-store/hooks/types'; diff --git a/packages/pl-fe/src/api/hooks/groups/useGroupRelationship.ts b/packages/pl-fe/src/api/hooks/groups/use-group-relationship.ts similarity index 84% rename from packages/pl-fe/src/api/hooks/groups/useGroupRelationship.ts rename to packages/pl-fe/src/api/hooks/groups/use-group-relationship.ts index 196fe73f4..dfa7f4e69 100644 --- a/packages/pl-fe/src/api/hooks/groups/useGroupRelationship.ts +++ b/packages/pl-fe/src/api/hooks/groups/use-group-relationship.ts @@ -1,8 +1,8 @@ import * as v from 'valibot'; import { Entities } from 'pl-fe/entity-store/entities'; -import { useEntity } from 'pl-fe/entity-store/hooks/useEntity'; -import { useClient } from 'pl-fe/hooks/useClient'; +import { useEntity } from 'pl-fe/entity-store/hooks/use-entity'; +import { useClient } from 'pl-fe/hooks/use-client'; import type { GroupRelationship } from 'pl-api'; diff --git a/packages/pl-fe/src/api/hooks/groups/useGroupRelationships.ts b/packages/pl-fe/src/api/hooks/groups/use-group-relationships.ts similarity index 84% rename from packages/pl-fe/src/api/hooks/groups/useGroupRelationships.ts rename to packages/pl-fe/src/api/hooks/groups/use-group-relationships.ts index 6aff57056..f6cc6e946 100644 --- a/packages/pl-fe/src/api/hooks/groups/useGroupRelationships.ts +++ b/packages/pl-fe/src/api/hooks/groups/use-group-relationships.ts @@ -1,7 +1,7 @@ import { Entities } from 'pl-fe/entity-store/entities'; -import { useBatchedEntities } from 'pl-fe/entity-store/hooks/useBatchedEntities'; -import { useClient } from 'pl-fe/hooks/useClient'; -import { useLoggedIn } from 'pl-fe/hooks/useLoggedIn'; +import { useBatchedEntities } from 'pl-fe/entity-store/hooks/use-batched-entities'; +import { useClient } from 'pl-fe/hooks/use-client'; +import { useLoggedIn } from 'pl-fe/hooks/use-logged-in'; import type { GroupRelationship } from 'pl-api'; diff --git a/packages/pl-fe/src/api/hooks/groups/useGroup.test.ts b/packages/pl-fe/src/api/hooks/groups/use-group.test.ts similarity index 96% rename from packages/pl-fe/src/api/hooks/groups/useGroup.test.ts rename to packages/pl-fe/src/api/hooks/groups/use-group.test.ts index 0f46a7f0a..5bf5d0548 100644 --- a/packages/pl-fe/src/api/hooks/groups/useGroup.test.ts +++ b/packages/pl-fe/src/api/hooks/groups/use-group.test.ts @@ -2,7 +2,7 @@ import { __stub } from 'pl-fe/api'; import { buildGroup } from 'pl-fe/jest/factory'; import { renderHook, waitFor } from 'pl-fe/jest/test-helpers'; -import { useGroup } from './useGroup'; +import { useGroup } from './use-group'; const group = buildGroup({ id: '1', display_name: 'soapbox' }); diff --git a/packages/pl-fe/src/api/hooks/groups/useGroup.ts b/packages/pl-fe/src/api/hooks/groups/use-group.ts similarity index 84% rename from packages/pl-fe/src/api/hooks/groups/useGroup.ts rename to packages/pl-fe/src/api/hooks/groups/use-group.ts index 2389d2e7b..ef1e2203b 100644 --- a/packages/pl-fe/src/api/hooks/groups/useGroup.ts +++ b/packages/pl-fe/src/api/hooks/groups/use-group.ts @@ -2,11 +2,11 @@ import { useEffect } from 'react'; import { useHistory } from 'react-router-dom'; import { Entities } from 'pl-fe/entity-store/entities'; -import { useEntity } from 'pl-fe/entity-store/hooks/useEntity'; -import { useClient } from 'pl-fe/hooks/useClient'; +import { useEntity } from 'pl-fe/entity-store/hooks/use-entity'; +import { useClient } from 'pl-fe/hooks/use-client'; import { normalizeGroup, type Group } from 'pl-fe/normalizers/group'; -import { useGroupRelationship } from './useGroupRelationship'; +import { useGroupRelationship } from './use-group-relationship'; import type { Group as BaseGroup } from 'pl-api'; diff --git a/packages/pl-fe/src/api/hooks/groups/useGroups.test.ts b/packages/pl-fe/src/api/hooks/groups/use-groups.test.ts similarity index 96% rename from packages/pl-fe/src/api/hooks/groups/useGroups.test.ts rename to packages/pl-fe/src/api/hooks/groups/use-groups.test.ts index 856a1289b..b7559a5c8 100644 --- a/packages/pl-fe/src/api/hooks/groups/useGroups.test.ts +++ b/packages/pl-fe/src/api/hooks/groups/use-groups.test.ts @@ -5,7 +5,7 @@ import { __stub } from 'pl-fe/api'; import { buildGroup } from 'pl-fe/jest/factory'; import { renderHook, waitFor } from 'pl-fe/jest/test-helpers'; -import { useGroups } from './useGroups'; +import { useGroups } from './use-groups'; const group = buildGroup({ id: '1', display_name: 'soapbox' }); const store = { diff --git a/packages/pl-fe/src/api/hooks/groups/useGroups.ts b/packages/pl-fe/src/api/hooks/groups/use-groups.ts similarity index 76% rename from packages/pl-fe/src/api/hooks/groups/useGroups.ts rename to packages/pl-fe/src/api/hooks/groups/use-groups.ts index be212bdfe..43aff160b 100644 --- a/packages/pl-fe/src/api/hooks/groups/useGroups.ts +++ b/packages/pl-fe/src/api/hooks/groups/use-groups.ts @@ -1,10 +1,10 @@ import { Entities } from 'pl-fe/entity-store/entities'; -import { useEntities } from 'pl-fe/entity-store/hooks/useEntities'; -import { useClient } from 'pl-fe/hooks/useClient'; -import { useFeatures } from 'pl-fe/hooks/useFeatures'; +import { useEntities } from 'pl-fe/entity-store/hooks/use-entities'; +import { useClient } from 'pl-fe/hooks/use-client'; +import { useFeatures } from 'pl-fe/hooks/use-features'; import { normalizeGroup, type Group } from 'pl-fe/normalizers/group'; -import { useGroupRelationships } from './useGroupRelationships'; +import { useGroupRelationships } from './use-group-relationships'; import type { Group as BaseGroup } from 'pl-api'; diff --git a/packages/pl-fe/src/api/hooks/groups/useJoinGroup.ts b/packages/pl-fe/src/api/hooks/groups/use-join-group.ts similarity index 74% rename from packages/pl-fe/src/api/hooks/groups/useJoinGroup.ts rename to packages/pl-fe/src/api/hooks/groups/use-join-group.ts index abe50d8ad..b30912c33 100644 --- a/packages/pl-fe/src/api/hooks/groups/useJoinGroup.ts +++ b/packages/pl-fe/src/api/hooks/groups/use-join-group.ts @@ -1,8 +1,8 @@ import { Entities } from 'pl-fe/entity-store/entities'; -import { useCreateEntity } from 'pl-fe/entity-store/hooks/useCreateEntity'; -import { useClient } from 'pl-fe/hooks/useClient'; +import { useCreateEntity } from 'pl-fe/entity-store/hooks/use-create-entity'; +import { useClient } from 'pl-fe/hooks/use-client'; -import { useGroups } from './useGroups'; +import { useGroups } from './use-groups'; import type { Group } from 'pl-api'; diff --git a/packages/pl-fe/src/api/hooks/groups/useLeaveGroup.ts b/packages/pl-fe/src/api/hooks/groups/use-leave-group.ts similarity index 74% rename from packages/pl-fe/src/api/hooks/groups/useLeaveGroup.ts rename to packages/pl-fe/src/api/hooks/groups/use-leave-group.ts index ac8aba380..d102e0e84 100644 --- a/packages/pl-fe/src/api/hooks/groups/useLeaveGroup.ts +++ b/packages/pl-fe/src/api/hooks/groups/use-leave-group.ts @@ -1,8 +1,8 @@ import { Entities } from 'pl-fe/entity-store/entities'; -import { useCreateEntity } from 'pl-fe/entity-store/hooks/useCreateEntity'; -import { useClient } from 'pl-fe/hooks/useClient'; +import { useCreateEntity } from 'pl-fe/entity-store/hooks/use-create-entity'; +import { useClient } from 'pl-fe/hooks/use-client'; -import { useGroups } from './useGroups'; +import { useGroups } from './use-groups'; import type { Group } from 'pl-api'; diff --git a/packages/pl-fe/src/api/hooks/groups/usePromoteGroupMember.ts b/packages/pl-fe/src/api/hooks/groups/use-promote-group-member.ts similarity index 85% rename from packages/pl-fe/src/api/hooks/groups/usePromoteGroupMember.ts rename to packages/pl-fe/src/api/hooks/groups/use-promote-group-member.ts index d961d7caa..84a132593 100644 --- a/packages/pl-fe/src/api/hooks/groups/usePromoteGroupMember.ts +++ b/packages/pl-fe/src/api/hooks/groups/use-promote-group-member.ts @@ -1,8 +1,8 @@ import * as v from 'valibot'; import { Entities } from 'pl-fe/entity-store/entities'; -import { useCreateEntity } from 'pl-fe/entity-store/hooks/useCreateEntity'; -import { useClient } from 'pl-fe/hooks/useClient'; +import { useCreateEntity } from 'pl-fe/entity-store/hooks/use-create-entity'; +import { useClient } from 'pl-fe/hooks/use-client'; import { normalizeGroupMember } from 'pl-fe/normalizers/group-member'; import type { Group, GroupMember, GroupRole } from 'pl-api'; diff --git a/packages/pl-fe/src/api/hooks/groups/useUpdateGroup.ts b/packages/pl-fe/src/api/hooks/groups/use-update-group.ts similarity index 83% rename from packages/pl-fe/src/api/hooks/groups/useUpdateGroup.ts rename to packages/pl-fe/src/api/hooks/groups/use-update-group.ts index efe91ed34..b838f9c83 100644 --- a/packages/pl-fe/src/api/hooks/groups/useUpdateGroup.ts +++ b/packages/pl-fe/src/api/hooks/groups/use-update-group.ts @@ -1,6 +1,6 @@ import { Entities } from 'pl-fe/entity-store/entities'; -import { useCreateEntity } from 'pl-fe/entity-store/hooks/useCreateEntity'; -import { useClient } from 'pl-fe/hooks/useClient'; +import { useCreateEntity } from 'pl-fe/entity-store/hooks/use-create-entity'; +import { useClient } from 'pl-fe/hooks/use-client'; import { normalizeGroup } from 'pl-fe/normalizers/group'; interface UpdateGroupParams { diff --git a/packages/pl-fe/src/api/hooks/instance/useTranslationLanguages.ts b/packages/pl-fe/src/api/hooks/instance/use-translation-languages.ts similarity index 81% rename from packages/pl-fe/src/api/hooks/instance/useTranslationLanguages.ts rename to packages/pl-fe/src/api/hooks/instance/use-translation-languages.ts index 471c20595..0fcdc3fab 100644 --- a/packages/pl-fe/src/api/hooks/instance/useTranslationLanguages.ts +++ b/packages/pl-fe/src/api/hooks/instance/use-translation-languages.ts @@ -1,9 +1,9 @@ import { useQuery } from '@tanstack/react-query'; -import { useClient } from 'pl-fe/hooks/useClient'; -import { useFeatures } from 'pl-fe/hooks/useFeatures'; -import { useInstance } from 'pl-fe/hooks/useInstance'; -import { useLoggedIn } from 'pl-fe/hooks/useLoggedIn'; +import { useClient } from 'pl-fe/hooks/use-client'; +import { useFeatures } from 'pl-fe/hooks/use-features'; +import { useInstance } from 'pl-fe/hooks/use-instance'; +import { useLoggedIn } from 'pl-fe/hooks/use-logged-in'; const useTranslationLanguages = () => { const client = useClient(); diff --git a/packages/pl-fe/src/api/hooks/settings/useInteractionPolicies.ts b/packages/pl-fe/src/api/hooks/settings/use-interaction-policies.ts similarity index 87% rename from packages/pl-fe/src/api/hooks/settings/useInteractionPolicies.ts rename to packages/pl-fe/src/api/hooks/settings/use-interaction-policies.ts index e01792253..645df7fa0 100644 --- a/packages/pl-fe/src/api/hooks/settings/useInteractionPolicies.ts +++ b/packages/pl-fe/src/api/hooks/settings/use-interaction-policies.ts @@ -2,9 +2,9 @@ import { useMutation, useQuery } from '@tanstack/react-query'; import { type InteractionPolicies, interactionPoliciesSchema } from 'pl-api'; import * as v from 'valibot'; -import { useClient } from 'pl-fe/hooks/useClient'; -import { useFeatures } from 'pl-fe/hooks/useFeatures'; -import { useLoggedIn } from 'pl-fe/hooks/useLoggedIn'; +import { useClient } from 'pl-fe/hooks/use-client'; +import { useFeatures } from 'pl-fe/hooks/use-features'; +import { useLoggedIn } from 'pl-fe/hooks/use-logged-in'; import { queryClient } from 'pl-fe/queries/client'; const emptySchema = v.parse(interactionPoliciesSchema, {}); diff --git a/packages/pl-fe/src/api/hooks/statuses/useBookmarkFolder.ts b/packages/pl-fe/src/api/hooks/statuses/use-bookmark-folder.ts similarity index 83% rename from packages/pl-fe/src/api/hooks/statuses/useBookmarkFolder.ts rename to packages/pl-fe/src/api/hooks/statuses/use-bookmark-folder.ts index 33b0122fd..397517553 100644 --- a/packages/pl-fe/src/api/hooks/statuses/useBookmarkFolder.ts +++ b/packages/pl-fe/src/api/hooks/statuses/use-bookmark-folder.ts @@ -1,8 +1,8 @@ import { Entities } from 'pl-fe/entity-store/entities'; import { selectEntity } from 'pl-fe/entity-store/selectors'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; -import { useBookmarkFolders } from './useBookmarkFolders'; +import { useBookmarkFolders } from './use-bookmark-folders'; import type{ BookmarkFolder } from 'pl-api'; diff --git a/packages/pl-fe/src/api/hooks/statuses/useBookmarkFolders.ts b/packages/pl-fe/src/api/hooks/statuses/use-bookmark-folders.ts similarity index 74% rename from packages/pl-fe/src/api/hooks/statuses/useBookmarkFolders.ts rename to packages/pl-fe/src/api/hooks/statuses/use-bookmark-folders.ts index 11bdf3495..f936e4f19 100644 --- a/packages/pl-fe/src/api/hooks/statuses/useBookmarkFolders.ts +++ b/packages/pl-fe/src/api/hooks/statuses/use-bookmark-folders.ts @@ -1,7 +1,7 @@ import { Entities } from 'pl-fe/entity-store/entities'; -import { useEntities } from 'pl-fe/entity-store/hooks/useEntities'; -import { useClient } from 'pl-fe/hooks/useClient'; -import { useFeatures } from 'pl-fe/hooks/useFeatures'; +import { useEntities } from 'pl-fe/entity-store/hooks/use-entities'; +import { useClient } from 'pl-fe/hooks/use-client'; +import { useFeatures } from 'pl-fe/hooks/use-features'; import type { BookmarkFolder } from 'pl-api'; diff --git a/packages/pl-fe/src/api/hooks/statuses/useCreateBookmarkFolder.ts b/packages/pl-fe/src/api/hooks/statuses/use-create-bookmark-folder.ts similarity index 79% rename from packages/pl-fe/src/api/hooks/statuses/useCreateBookmarkFolder.ts rename to packages/pl-fe/src/api/hooks/statuses/use-create-bookmark-folder.ts index 0944609f1..8f351906b 100644 --- a/packages/pl-fe/src/api/hooks/statuses/useCreateBookmarkFolder.ts +++ b/packages/pl-fe/src/api/hooks/statuses/use-create-bookmark-folder.ts @@ -1,6 +1,6 @@ import { Entities } from 'pl-fe/entity-store/entities'; -import { useCreateEntity } from 'pl-fe/entity-store/hooks/useCreateEntity'; -import { useClient } from 'pl-fe/hooks/useClient'; +import { useCreateEntity } from 'pl-fe/entity-store/hooks/use-create-entity'; +import { useClient } from 'pl-fe/hooks/use-client'; interface CreateBookmarkFolderParams { name: string; diff --git a/packages/pl-fe/src/api/hooks/statuses/useDeleteBookmarkFolder.ts b/packages/pl-fe/src/api/hooks/statuses/use-delete-bookmark-folder.ts similarity index 76% rename from packages/pl-fe/src/api/hooks/statuses/useDeleteBookmarkFolder.ts rename to packages/pl-fe/src/api/hooks/statuses/use-delete-bookmark-folder.ts index 4df699db0..feaf10793 100644 --- a/packages/pl-fe/src/api/hooks/statuses/useDeleteBookmarkFolder.ts +++ b/packages/pl-fe/src/api/hooks/statuses/use-delete-bookmark-folder.ts @@ -1,6 +1,6 @@ import { Entities } from 'pl-fe/entity-store/entities'; -import { useDeleteEntity } from 'pl-fe/entity-store/hooks/useDeleteEntity'; -import { useClient } from 'pl-fe/hooks/useClient'; +import { useDeleteEntity } from 'pl-fe/entity-store/hooks/use-delete-entity'; +import { useClient } from 'pl-fe/hooks/use-client'; const useDeleteBookmarkFolder = () => { const client = useClient(); diff --git a/packages/pl-fe/src/api/hooks/statuses/useUpdateBookmarkFolder.ts b/packages/pl-fe/src/api/hooks/statuses/use-update-bookmark-folder.ts similarity index 80% rename from packages/pl-fe/src/api/hooks/statuses/useUpdateBookmarkFolder.ts rename to packages/pl-fe/src/api/hooks/statuses/use-update-bookmark-folder.ts index 955690f8e..4fa91b784 100644 --- a/packages/pl-fe/src/api/hooks/statuses/useUpdateBookmarkFolder.ts +++ b/packages/pl-fe/src/api/hooks/statuses/use-update-bookmark-folder.ts @@ -1,6 +1,6 @@ import { Entities } from 'pl-fe/entity-store/entities'; -import { useCreateEntity } from 'pl-fe/entity-store/hooks/useCreateEntity'; -import { useClient } from 'pl-fe/hooks/useClient'; +import { useCreateEntity } from 'pl-fe/entity-store/hooks/use-create-entity'; +import { useClient } from 'pl-fe/hooks/use-client'; interface UpdateBookmarkFolderParams { name: string; diff --git a/packages/pl-fe/src/api/hooks/streaming/useCommunityStream.ts b/packages/pl-fe/src/api/hooks/streaming/use-community-stream.ts similarity index 82% rename from packages/pl-fe/src/api/hooks/streaming/useCommunityStream.ts rename to packages/pl-fe/src/api/hooks/streaming/use-community-stream.ts index 4de3dcdc0..7ec260687 100644 --- a/packages/pl-fe/src/api/hooks/streaming/useCommunityStream.ts +++ b/packages/pl-fe/src/api/hooks/streaming/use-community-stream.ts @@ -1,4 +1,4 @@ -import { useTimelineStream } from './useTimelineStream'; +import { useTimelineStream } from './use-timeline-stream'; interface UseCommunityStreamOpts { onlyMedia?: boolean; diff --git a/packages/pl-fe/src/api/hooks/streaming/useDirectStream.ts b/packages/pl-fe/src/api/hooks/streaming/use-direct-stream.ts similarity index 60% rename from packages/pl-fe/src/api/hooks/streaming/useDirectStream.ts rename to packages/pl-fe/src/api/hooks/streaming/use-direct-stream.ts index 5ef2ca45c..995cabe76 100644 --- a/packages/pl-fe/src/api/hooks/streaming/useDirectStream.ts +++ b/packages/pl-fe/src/api/hooks/streaming/use-direct-stream.ts @@ -1,4 +1,4 @@ -import { useTimelineStream } from './useTimelineStream'; +import { useTimelineStream } from './use-timeline-stream'; const useDirectStream = () => useTimelineStream('direct'); diff --git a/packages/pl-fe/src/api/hooks/streaming/useGroupStream.ts b/packages/pl-fe/src/api/hooks/streaming/use-group-stream.ts similarity index 68% rename from packages/pl-fe/src/api/hooks/streaming/useGroupStream.ts rename to packages/pl-fe/src/api/hooks/streaming/use-group-stream.ts index a2e9a0a6e..4092cc6a5 100644 --- a/packages/pl-fe/src/api/hooks/streaming/useGroupStream.ts +++ b/packages/pl-fe/src/api/hooks/streaming/use-group-stream.ts @@ -1,4 +1,4 @@ -import { useTimelineStream } from './useTimelineStream'; +import { useTimelineStream } from './use-timeline-stream'; const useGroupStream = (groupId: string) => useTimelineStream('group', { group: groupId } as any); diff --git a/packages/pl-fe/src/api/hooks/streaming/useHashtagStream.ts b/packages/pl-fe/src/api/hooks/streaming/use-hashtag-stream.ts similarity index 65% rename from packages/pl-fe/src/api/hooks/streaming/useHashtagStream.ts rename to packages/pl-fe/src/api/hooks/streaming/use-hashtag-stream.ts index 77e5517cf..9cd4d4115 100644 --- a/packages/pl-fe/src/api/hooks/streaming/useHashtagStream.ts +++ b/packages/pl-fe/src/api/hooks/streaming/use-hashtag-stream.ts @@ -1,4 +1,4 @@ -import { useTimelineStream } from './useTimelineStream'; +import { useTimelineStream } from './use-timeline-stream'; const useHashtagStream = (tag: string) => useTimelineStream('hashtag', { tag }); diff --git a/packages/pl-fe/src/api/hooks/streaming/useListStream.ts b/packages/pl-fe/src/api/hooks/streaming/use-list-stream.ts similarity index 61% rename from packages/pl-fe/src/api/hooks/streaming/useListStream.ts rename to packages/pl-fe/src/api/hooks/streaming/use-list-stream.ts index 95bb114f8..fde472b2a 100644 --- a/packages/pl-fe/src/api/hooks/streaming/useListStream.ts +++ b/packages/pl-fe/src/api/hooks/streaming/use-list-stream.ts @@ -1,6 +1,6 @@ -import { useLoggedIn } from 'pl-fe/hooks/useLoggedIn'; +import { useLoggedIn } from 'pl-fe/hooks/use-logged-in'; -import { useTimelineStream } from './useTimelineStream'; +import { useTimelineStream } from './use-timeline-stream'; const useListStream = (listId: string) => { const { isLoggedIn } = useLoggedIn(); diff --git a/packages/pl-fe/src/api/hooks/streaming/usePublicStream.ts b/packages/pl-fe/src/api/hooks/streaming/use-public-stream.ts similarity index 78% rename from packages/pl-fe/src/api/hooks/streaming/usePublicStream.ts rename to packages/pl-fe/src/api/hooks/streaming/use-public-stream.ts index 30c523e20..18b2a6a8a 100644 --- a/packages/pl-fe/src/api/hooks/streaming/usePublicStream.ts +++ b/packages/pl-fe/src/api/hooks/streaming/use-public-stream.ts @@ -1,4 +1,4 @@ -import { useTimelineStream } from './useTimelineStream'; +import { useTimelineStream } from './use-timeline-stream'; interface UsePublicStreamOpts { onlyMedia?: boolean; diff --git a/packages/pl-fe/src/api/hooks/streaming/useRemoteStream.ts b/packages/pl-fe/src/api/hooks/streaming/use-remote-stream.ts similarity index 82% rename from packages/pl-fe/src/api/hooks/streaming/useRemoteStream.ts rename to packages/pl-fe/src/api/hooks/streaming/use-remote-stream.ts index a7435feb9..402f693c9 100644 --- a/packages/pl-fe/src/api/hooks/streaming/useRemoteStream.ts +++ b/packages/pl-fe/src/api/hooks/streaming/use-remote-stream.ts @@ -1,4 +1,4 @@ -import { useTimelineStream } from './useTimelineStream'; +import { useTimelineStream } from './use-timeline-stream'; interface UseRemoteStreamOpts { instance: string; diff --git a/packages/pl-fe/src/api/hooks/streaming/useTimelineStream.ts b/packages/pl-fe/src/api/hooks/streaming/use-timeline-stream.ts similarity index 92% rename from packages/pl-fe/src/api/hooks/streaming/useTimelineStream.ts rename to packages/pl-fe/src/api/hooks/streaming/use-timeline-stream.ts index ce94aca46..07c2a140a 100644 --- a/packages/pl-fe/src/api/hooks/streaming/useTimelineStream.ts +++ b/packages/pl-fe/src/api/hooks/streaming/use-timeline-stream.ts @@ -1,8 +1,8 @@ import { useEffect, useRef } from 'react'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; -import { useClient } from 'pl-fe/hooks/useClient'; -import { useInstance } from 'pl-fe/hooks/useInstance'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; +import { useClient } from 'pl-fe/hooks/use-client'; +import { useInstance } from 'pl-fe/hooks/use-instance'; import { getAccessToken } from 'pl-fe/utils/auth'; import type { StreamingEvent } from 'pl-api'; diff --git a/packages/pl-fe/src/api/hooks/streaming/useUserStream.ts b/packages/pl-fe/src/api/hooks/streaming/use-user-stream.ts similarity index 95% rename from packages/pl-fe/src/api/hooks/streaming/useUserStream.ts rename to packages/pl-fe/src/api/hooks/streaming/use-user-stream.ts index 35c3aca81..eb717f8bd 100644 --- a/packages/pl-fe/src/api/hooks/streaming/useUserStream.ts +++ b/packages/pl-fe/src/api/hooks/streaming/use-user-stream.ts @@ -11,17 +11,17 @@ import { useStatContext } from 'pl-fe/contexts/stat-context'; import { importEntities } from 'pl-fe/entity-store/actions'; import { Entities } from 'pl-fe/entity-store/entities'; import { selectEntity } from 'pl-fe/entity-store/selectors'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useLoggedIn } from 'pl-fe/hooks/useLoggedIn'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useLoggedIn } from 'pl-fe/hooks/use-logged-in'; import messages from 'pl-fe/messages'; import { queryClient } from 'pl-fe/queries/client'; import { useSettingsStore } from 'pl-fe/stores/settings'; import { getUnreadChatsCount, updateChatListItem } from 'pl-fe/utils/chats'; import { play, soundCache } from 'pl-fe/utils/sounds'; -import { updateReactions } from '../announcements/useAnnouncements'; +import { updateReactions } from '../announcements/use-announcements'; -import { useTimelineStream } from './useTimelineStream'; +import { useTimelineStream } from './use-timeline-stream'; import type { Announcement, AnnouncementReaction, FollowRelationshipUpdate, Relationship, StreamingEvent } from 'pl-api'; import type { AppDispatch, RootState } from 'pl-fe/store'; diff --git a/packages/pl-fe/src/api/hooks/trends/useTrendingLinks.ts b/packages/pl-fe/src/api/hooks/trends/use-trending-links.ts similarity index 71% rename from packages/pl-fe/src/api/hooks/trends/useTrendingLinks.ts rename to packages/pl-fe/src/api/hooks/trends/use-trending-links.ts index 9eaa55af1..9d7d31fc3 100644 --- a/packages/pl-fe/src/api/hooks/trends/useTrendingLinks.ts +++ b/packages/pl-fe/src/api/hooks/trends/use-trending-links.ts @@ -1,7 +1,7 @@ import { Entities } from 'pl-fe/entity-store/entities'; -import { useEntities } from 'pl-fe/entity-store/hooks/useEntities'; -import { useClient } from 'pl-fe/hooks/useClient'; -import { useFeatures } from 'pl-fe/hooks/useFeatures'; +import { useEntities } from 'pl-fe/entity-store/hooks/use-entities'; +import { useClient } from 'pl-fe/hooks/use-client'; +import { useFeatures } from 'pl-fe/hooks/use-features'; import type { TrendsLink } from 'pl-api'; diff --git a/packages/pl-fe/src/components/__mocks__/react-inlinesvg.tsx b/packages/pl-fe/src/components/__mocks__/react-inlinesvg.tsx deleted file mode 100644 index f5eea5371..000000000 --- a/packages/pl-fe/src/components/__mocks__/react-inlinesvg.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import React from 'react'; - -interface IInlineSVG { - loader?: JSX.Element; -} - -const InlineSVG: React.FC = ({ loader }): JSX.Element => { - if (loader) { - return loader; - } else { - throw 'You used react-inlinesvg without a loader! This will cause jumpy loading during render.'; - } -}; - -export { InlineSVG as default }; diff --git a/packages/pl-fe/src/components/account-hover-card.tsx b/packages/pl-fe/src/components/account-hover-card.tsx index 0426fba86..1286f798a 100644 --- a/packages/pl-fe/src/components/account-hover-card.tsx +++ b/packages/pl-fe/src/components/account-hover-card.tsx @@ -5,7 +5,7 @@ import { useIntl, FormattedMessage } from 'react-intl'; import { useHistory } from 'react-router-dom'; import { fetchRelationships } from 'pl-fe/actions/accounts'; -import { useAccount } from 'pl-fe/api/hooks/accounts/useAccount'; +import { useAccount } from 'pl-fe/api/hooks/accounts/use-account'; import Badge from 'pl-fe/components/badge'; import Card, { CardBody } from 'pl-fe/components/ui/card'; import HStack from 'pl-fe/components/ui/hstack'; @@ -14,8 +14,8 @@ import Stack from 'pl-fe/components/ui/stack'; import Text from 'pl-fe/components/ui/text'; import ActionButton from 'pl-fe/features/ui/components/action-button'; import { UserPanel } from 'pl-fe/features/ui/util/async-components'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; import { useAccountHoverCardStore } from 'pl-fe/stores/account-hover-card'; import { showAccountHoverCard } from './hover-account-wrapper'; diff --git a/packages/pl-fe/src/components/account.tsx b/packages/pl-fe/src/components/account.tsx index affda2e66..d4b52b06c 100644 --- a/packages/pl-fe/src/components/account.tsx +++ b/packages/pl-fe/src/components/account.tsx @@ -13,7 +13,7 @@ import Text from 'pl-fe/components/ui/text'; import VerificationBadge from 'pl-fe/components/verification-badge'; import Emojify from 'pl-fe/features/emoji/emojify'; import ActionButton from 'pl-fe/features/ui/components/action-button'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; import { getAcct } from 'pl-fe/utils/accounts'; import { displayFqn } from 'pl-fe/utils/state'; diff --git a/packages/pl-fe/src/components/animated-number.tsx b/packages/pl-fe/src/components/animated-number.tsx index f359940a4..6d7df23e8 100644 --- a/packages/pl-fe/src/components/animated-number.tsx +++ b/packages/pl-fe/src/components/animated-number.tsx @@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react'; import { useIntl, type IntlShape } from 'react-intl'; import { TransitionMotion, spring } from 'react-motion'; -import { useSettings } from 'pl-fe/hooks/useSettings'; +import { useSettings } from 'pl-fe/hooks/use-settings'; import { isNumber, roundDown } from 'pl-fe/utils/numbers'; const obfuscatedCount = (count: number): string => { diff --git a/packages/pl-fe/src/components/announcements/announcement.tsx b/packages/pl-fe/src/components/announcements/announcement.tsx index c99cb6385..f0536fec2 100644 --- a/packages/pl-fe/src/components/announcements/announcement.tsx +++ b/packages/pl-fe/src/components/announcements/announcement.tsx @@ -3,7 +3,7 @@ import { FormattedDate } from 'react-intl'; import Stack from 'pl-fe/components/ui/stack'; import Text from 'pl-fe/components/ui/text'; -import { useFeatures } from 'pl-fe/hooks/useFeatures'; +import { useFeatures } from 'pl-fe/hooks/use-features'; import { getTextDirection } from 'pl-fe/utils/rtl'; import AnnouncementContent from './announcement-content'; diff --git a/packages/pl-fe/src/components/announcements/announcements-panel.tsx b/packages/pl-fe/src/components/announcements/announcements-panel.tsx index c01e0433d..558b99a38 100644 --- a/packages/pl-fe/src/components/announcements/announcements-panel.tsx +++ b/packages/pl-fe/src/components/announcements/announcements-panel.tsx @@ -5,11 +5,11 @@ import { FormattedMessage } from 'react-intl'; import ReactSwipeableViews from 'react-swipeable-views'; import { createSelector } from 'reselect'; -import { useAnnouncements } from 'pl-fe/api/hooks/announcements/useAnnouncements'; +import { useAnnouncements } from 'pl-fe/api/hooks/announcements/use-announcements'; import Card from 'pl-fe/components/ui/card'; import HStack from 'pl-fe/components/ui/hstack'; import Widget from 'pl-fe/components/ui/widget'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; import Announcement from './announcement'; diff --git a/packages/pl-fe/src/components/announcements/emoji.tsx b/packages/pl-fe/src/components/announcements/emoji.tsx index 44b918cf5..cc2de4f89 100644 --- a/packages/pl-fe/src/components/announcements/emoji.tsx +++ b/packages/pl-fe/src/components/announcements/emoji.tsx @@ -1,7 +1,7 @@ import React from 'react'; import unicodeMapping from 'pl-fe/features/emoji/mapping'; -import { useSettings } from 'pl-fe/hooks/useSettings'; +import { useSettings } from 'pl-fe/hooks/use-settings'; import { joinPublicPath } from 'pl-fe/utils/static'; import type { Map as ImmutableMap } from 'immutable'; diff --git a/packages/pl-fe/src/components/announcements/reaction.tsx b/packages/pl-fe/src/components/announcements/reaction.tsx index 0664e7131..983e774c5 100644 --- a/packages/pl-fe/src/components/announcements/reaction.tsx +++ b/packages/pl-fe/src/components/announcements/reaction.tsx @@ -1,7 +1,7 @@ import clsx from 'clsx'; import React, { useState } from 'react'; -import { useAnnouncements } from 'pl-fe/api/hooks/announcements/useAnnouncements'; +import { useAnnouncements } from 'pl-fe/api/hooks/announcements/use-announcements'; import AnimatedNumber from 'pl-fe/components/animated-number'; import unicodeMapping from 'pl-fe/features/emoji/mapping'; diff --git a/packages/pl-fe/src/components/announcements/reactions-bar.tsx b/packages/pl-fe/src/components/announcements/reactions-bar.tsx index cbb8f079b..36b605626 100644 --- a/packages/pl-fe/src/components/announcements/reactions-bar.tsx +++ b/packages/pl-fe/src/components/announcements/reactions-bar.tsx @@ -2,9 +2,9 @@ import clsx from 'clsx'; import React from 'react'; import { TransitionMotion, spring } from 'react-motion'; -import { useAnnouncements } from 'pl-fe/api/hooks/announcements/useAnnouncements'; +import { useAnnouncements } from 'pl-fe/api/hooks/announcements/use-announcements'; import EmojiPickerDropdown from 'pl-fe/features/emoji/containers/emoji-picker-dropdown-container'; -import { useSettings } from 'pl-fe/hooks/useSettings'; +import { useSettings } from 'pl-fe/hooks/use-settings'; import Reaction from './reaction'; diff --git a/packages/pl-fe/src/components/attachment-thumbs.tsx b/packages/pl-fe/src/components/attachment-thumbs.tsx index 7ce15ca65..1129afd21 100644 --- a/packages/pl-fe/src/components/attachment-thumbs.tsx +++ b/packages/pl-fe/src/components/attachment-thumbs.tsx @@ -1,7 +1,7 @@ import React, { Suspense } from 'react'; import { MediaGallery } from 'pl-fe/features/ui/util/async-components'; -import { useSettings } from 'pl-fe/hooks/useSettings'; +import { useSettings } from 'pl-fe/hooks/use-settings'; import { useModalsStore } from 'pl-fe/stores/modals'; import { isMediaVisible } from './statuses/sensitive-content-overlay'; diff --git a/packages/pl-fe/src/components/autosuggest-account-input.tsx b/packages/pl-fe/src/components/autosuggest-account-input.tsx index c002189a0..ed166d14e 100644 --- a/packages/pl-fe/src/components/autosuggest-account-input.tsx +++ b/packages/pl-fe/src/components/autosuggest-account-input.tsx @@ -4,7 +4,7 @@ import React, { useState, useRef, useCallback, useEffect } from 'react'; import { accountSearch } from 'pl-fe/actions/accounts'; import AutosuggestInput, { AutoSuggestion } from 'pl-fe/components/autosuggest-input'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; import type { Menu } from 'pl-fe/components/dropdown-menu'; import type { InputThemes } from 'pl-fe/components/ui/input'; diff --git a/packages/pl-fe/src/components/autosuggest-location.tsx b/packages/pl-fe/src/components/autosuggest-location.tsx index 06dba47d3..77f9f30ec 100644 --- a/packages/pl-fe/src/components/autosuggest-location.tsx +++ b/packages/pl-fe/src/components/autosuggest-location.tsx @@ -4,7 +4,7 @@ import HStack from 'pl-fe/components/ui/hstack'; import Icon from 'pl-fe/components/ui/icon'; import Stack from 'pl-fe/components/ui/stack'; import Text from 'pl-fe/components/ui/text'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; const buildingCommunityIcon = require('@tabler/icons/outline/building-community.svg'); const homeIcon = require('@tabler/icons/outline/home-2.svg'); diff --git a/packages/pl-fe/src/components/avatar-stack.tsx b/packages/pl-fe/src/components/avatar-stack.tsx index 9f367d201..6cfd85065 100644 --- a/packages/pl-fe/src/components/avatar-stack.tsx +++ b/packages/pl-fe/src/components/avatar-stack.tsx @@ -4,7 +4,7 @@ import React from 'react'; import Avatar from 'pl-fe/components/ui/avatar'; import HStack from 'pl-fe/components/ui/hstack'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; import { makeGetAccount } from 'pl-fe/selectors'; import type { Account } from 'pl-fe/normalizers/account'; diff --git a/packages/pl-fe/src/components/birthday-input.tsx b/packages/pl-fe/src/components/birthday-input.tsx index 0ddae1780..7928abf9d 100644 --- a/packages/pl-fe/src/components/birthday-input.tsx +++ b/packages/pl-fe/src/components/birthday-input.tsx @@ -3,8 +3,8 @@ import { defineMessages, useIntl } from 'react-intl'; import IconButton from 'pl-fe/components/icon-button'; import { DatePicker } from 'pl-fe/features/ui/util/async-components'; -import { useFeatures } from 'pl-fe/hooks/useFeatures'; -import { useInstance } from 'pl-fe/hooks/useInstance'; +import { useFeatures } from 'pl-fe/hooks/use-features'; +import { useInstance } from 'pl-fe/hooks/use-instance'; const messages = defineMessages({ birthdayPlaceholder: { id: 'edit_profile.fields.birthday_placeholder', defaultMessage: 'Your birthday' }, diff --git a/packages/pl-fe/src/components/birthday-panel.tsx b/packages/pl-fe/src/components/birthday-panel.tsx index c3ef42c05..1e1d579a4 100644 --- a/packages/pl-fe/src/components/birthday-panel.tsx +++ b/packages/pl-fe/src/components/birthday-panel.tsx @@ -5,8 +5,8 @@ import { FormattedMessage } from 'react-intl'; import { fetchBirthdayReminders } from 'pl-fe/actions/accounts'; import Widget from 'pl-fe/components/ui/widget'; import AccountContainer from 'pl-fe/containers/account-container'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; const timeToMidnight = () => { const now = new Date(); diff --git a/packages/pl-fe/src/components/domain.tsx b/packages/pl-fe/src/components/domain.tsx index 8af041f16..ec7c899cb 100644 --- a/packages/pl-fe/src/components/domain.tsx +++ b/packages/pl-fe/src/components/domain.tsx @@ -5,7 +5,7 @@ import { unblockDomain } from 'pl-fe/actions/domain-blocks'; import HStack from 'pl-fe/components/ui/hstack'; import IconButton from 'pl-fe/components/ui/icon-button'; import Text from 'pl-fe/components/ui/text'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; const messages = defineMessages({ blockDomainConfirm: { id: 'confirmations.domain_block.confirm', defaultMessage: 'Hide entire domain' }, diff --git a/packages/pl-fe/src/components/event-preview.tsx b/packages/pl-fe/src/components/event-preview.tsx index c952cbdb7..81692d410 100644 --- a/packages/pl-fe/src/components/event-preview.tsx +++ b/packages/pl-fe/src/components/event-preview.tsx @@ -11,7 +11,7 @@ import VerificationBadge from 'pl-fe/components/verification-badge'; import Emojify from 'pl-fe/features/emoji/emojify'; import EventActionButton from 'pl-fe/features/event/components/event-action-button'; import EventDate from 'pl-fe/features/event/components/event-date'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; import type { Status as StatusEntity } from 'pl-fe/normalizers/status'; diff --git a/packages/pl-fe/src/components/fork-awesome-icon.tsx b/packages/pl-fe/src/components/fork-awesome-icon.tsx index cdceef256..f86048d73 100644 --- a/packages/pl-fe/src/components/fork-awesome-icon.tsx +++ b/packages/pl-fe/src/components/fork-awesome-icon.tsx @@ -31,4 +31,4 @@ const ForkAwesomeIcon: React.FC = ({ id, className, fixedWidth ); }; -export { type IForkAwesomeIcon, ForkAwesomeIcon as default }; +export { ForkAwesomeIcon as default }; diff --git a/packages/pl-fe/src/components/gdpr-banner.tsx b/packages/pl-fe/src/components/gdpr-banner.tsx index 3dec3dbf5..0f86c8e2d 100644 --- a/packages/pl-fe/src/components/gdpr-banner.tsx +++ b/packages/pl-fe/src/components/gdpr-banner.tsx @@ -7,8 +7,8 @@ import Button from 'pl-fe/components/ui/button'; import HStack from 'pl-fe/components/ui/hstack'; import Stack from 'pl-fe/components/ui/stack'; import Text from 'pl-fe/components/ui/text'; -import { useInstance } from 'pl-fe/hooks/useInstance'; -import { usePlFeConfig } from 'pl-fe/hooks/usePlFeConfig'; +import { useInstance } from 'pl-fe/hooks/use-instance'; +import { usePlFeConfig } from 'pl-fe/hooks/use-pl-fe-config'; const acceptedGdpr = !!localStorage.getItem('plfe:gdpr'); diff --git a/packages/pl-fe/src/components/helmet.tsx b/packages/pl-fe/src/components/helmet.tsx index b88b30f50..cc3df2a76 100644 --- a/packages/pl-fe/src/components/helmet.tsx +++ b/packages/pl-fe/src/components/helmet.tsx @@ -1,9 +1,9 @@ import React from 'react'; import { Helmet as ReactHelmet } from 'react-helmet-async'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; -import { useInstance } from 'pl-fe/hooks/useInstance'; -import { useSettings } from 'pl-fe/hooks/useSettings'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; +import { useInstance } from 'pl-fe/hooks/use-instance'; +import { useSettings } from 'pl-fe/hooks/use-settings'; import { RootState } from 'pl-fe/store'; import FaviconService from 'pl-fe/utils/favicon-service'; diff --git a/packages/pl-fe/src/components/hover-account-wrapper.tsx b/packages/pl-fe/src/components/hover-account-wrapper.tsx index 3e7886d43..057c01a61 100644 --- a/packages/pl-fe/src/components/hover-account-wrapper.tsx +++ b/packages/pl-fe/src/components/hover-account-wrapper.tsx @@ -3,7 +3,7 @@ import debounce from 'lodash/debounce'; import React, { useRef } from 'react'; import { fetchAccount } from 'pl-fe/actions/accounts'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; import { isMobile } from 'pl-fe/is-mobile'; import { useAccountHoverCardStore } from 'pl-fe/stores/account-hover-card'; diff --git a/packages/pl-fe/src/components/location-search.tsx b/packages/pl-fe/src/components/location-search.tsx index 4ee53f9b3..444c7c25c 100644 --- a/packages/pl-fe/src/components/location-search.tsx +++ b/packages/pl-fe/src/components/location-search.tsx @@ -7,7 +7,7 @@ import { defineMessages, useIntl } from 'react-intl'; import { locationSearch } from 'pl-fe/actions/events'; import AutosuggestInput, { AutoSuggestion } from 'pl-fe/components/autosuggest-input'; import Icon from 'pl-fe/components/icon'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; import AutosuggestLocation from './autosuggest-location'; diff --git a/packages/pl-fe/src/components/media-gallery.tsx b/packages/pl-fe/src/components/media-gallery.tsx index dfdfb1c63..78124f4a4 100644 --- a/packages/pl-fe/src/components/media-gallery.tsx +++ b/packages/pl-fe/src/components/media-gallery.tsx @@ -5,8 +5,8 @@ import Blurhash from 'pl-fe/components/blurhash'; import Icon from 'pl-fe/components/icon'; import StillImage from 'pl-fe/components/still-image'; import { MIMETYPE_ICONS } from 'pl-fe/components/upload'; -import { usePlFeConfig } from 'pl-fe/hooks/usePlFeConfig'; -import { useSettings } from 'pl-fe/hooks/useSettings'; +import { usePlFeConfig } from 'pl-fe/hooks/use-pl-fe-config'; +import { useSettings } from 'pl-fe/hooks/use-settings'; import { truncateFilename } from 'pl-fe/utils/media'; import { isIOS } from '../is-mobile'; @@ -564,7 +564,4 @@ const MediaGallery: React.FC = (props) => { ); }; -export { - type IMediaGallery, - MediaGallery as default, -}; +export { MediaGallery as default }; diff --git a/packages/pl-fe/src/components/modal-root.tsx b/packages/pl-fe/src/components/modal-root.tsx index e223a819a..d0e1f57d4 100644 --- a/packages/pl-fe/src/components/modal-root.tsx +++ b/packages/pl-fe/src/components/modal-root.tsx @@ -5,8 +5,8 @@ import { useHistory } from 'react-router-dom'; import { cancelReplyCompose } from 'pl-fe/actions/compose'; import { saveDraftStatus } from 'pl-fe/actions/draft-statuses'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { usePrevious } from 'pl-fe/hooks/usePrevious'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { usePrevious } from 'pl-fe/hooks/use-previous'; import { useModalsStore } from 'pl-fe/stores/modals'; import type { ModalType } from 'pl-fe/features/ui/components/modal-root'; diff --git a/packages/pl-fe/src/components/navlinks.tsx b/packages/pl-fe/src/components/navlinks.tsx index 84dc68735..ee84fd150 100644 --- a/packages/pl-fe/src/components/navlinks.tsx +++ b/packages/pl-fe/src/components/navlinks.tsx @@ -2,8 +2,8 @@ import React from 'react'; import { Link } from 'react-router-dom'; import Text from 'pl-fe/components/ui/text'; -import { usePlFeConfig } from 'pl-fe/hooks/usePlFeConfig'; -import { useSettings } from 'pl-fe/hooks/useSettings'; +import { usePlFeConfig } from 'pl-fe/hooks/use-pl-fe-config'; +import { useSettings } from 'pl-fe/hooks/use-settings'; interface INavlinks { type: string; diff --git a/packages/pl-fe/src/components/parsed-content.tsx b/packages/pl-fe/src/components/parsed-content.tsx index 2573a3c4b..2ed7bed59 100644 --- a/packages/pl-fe/src/components/parsed-content.tsx +++ b/packages/pl-fe/src/components/parsed-content.tsx @@ -107,9 +107,9 @@ const ParsedContent: React.FC = (({ html, mentions, hasQuote, em } }, - transform(reactNode) { + transform(reactNode, _domNode, index) { if (typeof reactNode === 'string') { - return ; + return ; } return reactNode as JSX.Element; diff --git a/packages/pl-fe/src/components/polls/poll-footer.tsx b/packages/pl-fe/src/components/polls/poll-footer.tsx index b63aaa4a5..f9aeccb43 100644 --- a/packages/pl-fe/src/components/polls/poll-footer.tsx +++ b/packages/pl-fe/src/components/polls/poll-footer.tsx @@ -7,7 +7,7 @@ import HStack from 'pl-fe/components/ui/hstack'; import Stack from 'pl-fe/components/ui/stack'; import Text from 'pl-fe/components/ui/text'; import Tooltip from 'pl-fe/components/ui/tooltip'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; import RelativeTimestamp from '../relative-timestamp'; diff --git a/packages/pl-fe/src/components/polls/poll.tsx b/packages/pl-fe/src/components/polls/poll.tsx index 71c7efb30..efe4fdff0 100644 --- a/packages/pl-fe/src/components/polls/poll.tsx +++ b/packages/pl-fe/src/components/polls/poll.tsx @@ -4,8 +4,8 @@ import { defineMessages, useIntl } from 'react-intl'; import { vote } from 'pl-fe/actions/polls'; import Stack from 'pl-fe/components/ui/stack'; import Text from 'pl-fe/components/ui/text'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; import { useModalsStore } from 'pl-fe/stores/modals'; import PollFooter from './poll-footer'; diff --git a/packages/pl-fe/src/components/quoted-status-indicator.tsx b/packages/pl-fe/src/components/quoted-status-indicator.tsx index 9dc699214..b88eae652 100644 --- a/packages/pl-fe/src/components/quoted-status-indicator.tsx +++ b/packages/pl-fe/src/components/quoted-status-indicator.tsx @@ -3,7 +3,7 @@ import React, { useCallback } from 'react'; import HStack from 'pl-fe/components/ui/hstack'; import Icon from 'pl-fe/components/ui/icon'; import Text from 'pl-fe/components/ui/text'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; import { makeGetStatus } from 'pl-fe/selectors'; interface IQuotedStatusIndicator { diff --git a/packages/pl-fe/src/components/relative-timestamp.tsx b/packages/pl-fe/src/components/relative-timestamp.tsx index cd6c890c4..8329c4baa 100644 --- a/packages/pl-fe/src/components/relative-timestamp.tsx +++ b/packages/pl-fe/src/components/relative-timestamp.tsx @@ -199,6 +199,5 @@ const RelativeTimestamp = injectIntl(class RelativeTimestamp extends React.Compo export { dateFormatOptions, - timeAgoString, RelativeTimestamp as default, }; diff --git a/packages/pl-fe/src/components/scroll-top-button.tsx b/packages/pl-fe/src/components/scroll-top-button.tsx index f0d517231..b1d9794cd 100644 --- a/packages/pl-fe/src/components/scroll-top-button.tsx +++ b/packages/pl-fe/src/components/scroll-top-button.tsx @@ -4,7 +4,7 @@ import { useIntl, MessageDescriptor } from 'react-intl'; import Icon from 'pl-fe/components/ui/icon'; import Text from 'pl-fe/components/ui/text'; -import { useSettings } from 'pl-fe/hooks/useSettings'; +import { useSettings } from 'pl-fe/hooks/use-settings'; interface IScrollTopButton { /** Callback when clicked, and also when scrolled to the top. */ diff --git a/packages/pl-fe/src/components/scrollable-list.tsx b/packages/pl-fe/src/components/scrollable-list.tsx index 4f3d34b5f..db0c9a8c0 100644 --- a/packages/pl-fe/src/components/scrollable-list.tsx +++ b/packages/pl-fe/src/components/scrollable-list.tsx @@ -6,7 +6,7 @@ import React, { useEffect, useMemo, useRef } from 'react'; import LoadMore from 'pl-fe/components/load-more'; import Card from 'pl-fe/components/ui/card'; import Spinner from 'pl-fe/components/ui/spinner'; -import { useSettings } from 'pl-fe/hooks/useSettings'; +import { useSettings } from 'pl-fe/hooks/use-settings'; interface IScrollableListBase { /** Pagination callback when the end of the list is reached. */ diff --git a/packages/pl-fe/src/components/sentry-feedback-form.tsx b/packages/pl-fe/src/components/sentry-feedback-form.tsx index 1c295ee9f..6e9756630 100644 --- a/packages/pl-fe/src/components/sentry-feedback-form.tsx +++ b/packages/pl-fe/src/components/sentry-feedback-form.tsx @@ -7,7 +7,7 @@ import FormActions from 'pl-fe/components/ui/form-actions'; import FormGroup from 'pl-fe/components/ui/form-group'; import Text from 'pl-fe/components/ui/text'; import Textarea from 'pl-fe/components/ui/textarea'; -import { useOwnAccount } from 'pl-fe/hooks/useOwnAccount'; +import { useOwnAccount } from 'pl-fe/hooks/use-own-account'; import { captureSentryFeedback } from 'pl-fe/sentry'; interface ISentryFeedbackForm { diff --git a/packages/pl-fe/src/components/sidebar-menu.tsx b/packages/pl-fe/src/components/sidebar-menu.tsx index 9420042d1..90e51a2b5 100644 --- a/packages/pl-fe/src/components/sidebar-menu.tsx +++ b/packages/pl-fe/src/components/sidebar-menu.tsx @@ -5,7 +5,7 @@ import { defineMessages, useIntl, FormattedMessage } from 'react-intl'; import { Link, NavLink } from 'react-router-dom'; import { fetchOwnAccounts, logOut, switchAccount } from 'pl-fe/actions/auth'; -import { useAccount } from 'pl-fe/api/hooks/accounts/useAccount'; +import { useAccount } from 'pl-fe/api/hooks/accounts/use-account'; import Account from 'pl-fe/components/account'; import Divider from 'pl-fe/components/ui/divider'; import HStack from 'pl-fe/components/ui/hstack'; @@ -13,11 +13,11 @@ import Icon from 'pl-fe/components/ui/icon'; import Stack from 'pl-fe/components/ui/stack'; import Text from 'pl-fe/components/ui/text'; import ProfileStats from 'pl-fe/features/ui/components/profile-stats'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; -import { useFeatures } from 'pl-fe/hooks/useFeatures'; -import { useInstance } from 'pl-fe/hooks/useInstance'; -import { useRegistrationStatus } from 'pl-fe/hooks/useRegistrationStatus'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; +import { useFeatures } from 'pl-fe/hooks/use-features'; +import { useInstance } from 'pl-fe/hooks/use-instance'; +import { useRegistrationStatus } from 'pl-fe/hooks/use-registration-status'; import { makeGetOtherAccounts } from 'pl-fe/selectors'; import { useSettingsStore } from 'pl-fe/stores/settings'; import { useUiStore } from 'pl-fe/stores/ui'; diff --git a/packages/pl-fe/src/components/sidebar-navigation-link.tsx b/packages/pl-fe/src/components/sidebar-navigation-link.tsx index 8b66abf63..d26e7b898 100644 --- a/packages/pl-fe/src/components/sidebar-navigation-link.tsx +++ b/packages/pl-fe/src/components/sidebar-navigation-link.tsx @@ -2,7 +2,7 @@ import clsx from 'clsx'; import React from 'react'; import { NavLink } from 'react-router-dom'; -import { useSettings } from 'pl-fe/hooks/useSettings'; +import { useSettings } from 'pl-fe/hooks/use-settings'; import Icon from './ui/icon'; import Text from './ui/text'; diff --git a/packages/pl-fe/src/components/sidebar-navigation.tsx b/packages/pl-fe/src/components/sidebar-navigation.tsx index 684bc27c1..002fcde9d 100644 --- a/packages/pl-fe/src/components/sidebar-navigation.tsx +++ b/packages/pl-fe/src/components/sidebar-navigation.tsx @@ -5,13 +5,13 @@ import Icon from 'pl-fe/components/ui/icon'; import Stack from 'pl-fe/components/ui/stack'; import ComposeButton from 'pl-fe/features/ui/components/compose-button'; import ProfileDropdown from 'pl-fe/features/ui/components/profile-dropdown'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; -import { useFeatures } from 'pl-fe/hooks/useFeatures'; -import { useInstance } from 'pl-fe/hooks/useInstance'; -import { useLogo } from 'pl-fe/hooks/useLogo'; -import { useOwnAccount } from 'pl-fe/hooks/useOwnAccount'; -import { useRegistrationStatus } from 'pl-fe/hooks/useRegistrationStatus'; -import { useSettings } from 'pl-fe/hooks/useSettings'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; +import { useFeatures } from 'pl-fe/hooks/use-features'; +import { useInstance } from 'pl-fe/hooks/use-instance'; +import { useLogo } from 'pl-fe/hooks/use-logo'; +import { useOwnAccount } from 'pl-fe/hooks/use-own-account'; +import { useRegistrationStatus } from 'pl-fe/hooks/use-registration-status'; +import { useSettings } from 'pl-fe/hooks/use-settings'; import Account from './account'; import DropdownMenu, { Menu } from './dropdown-menu'; diff --git a/packages/pl-fe/src/components/site-error-boundary.tsx b/packages/pl-fe/src/components/site-error-boundary.tsx index 3a76e3b40..2b2ce2241 100644 --- a/packages/pl-fe/src/components/site-error-boundary.tsx +++ b/packages/pl-fe/src/components/site-error-boundary.tsx @@ -7,8 +7,8 @@ import HStack from 'pl-fe/components/ui/hstack'; import Stack from 'pl-fe/components/ui/stack'; import Text from 'pl-fe/components/ui/text'; import Textarea from 'pl-fe/components/ui/textarea'; -import { useLogo } from 'pl-fe/hooks/useLogo'; -import { usePlFeConfig } from 'pl-fe/hooks/usePlFeConfig'; +import { useLogo } from 'pl-fe/hooks/use-logo'; +import { usePlFeConfig } from 'pl-fe/hooks/use-pl-fe-config'; import { captureSentryException } from 'pl-fe/sentry'; import KVStore from 'pl-fe/storage/kv-store'; import sourceCode from 'pl-fe/utils/code'; diff --git a/packages/pl-fe/src/components/site-logo.tsx b/packages/pl-fe/src/components/site-logo.tsx index b194be332..83336a3ac 100644 --- a/packages/pl-fe/src/components/site-logo.tsx +++ b/packages/pl-fe/src/components/site-logo.tsx @@ -2,7 +2,7 @@ import clsx from 'clsx'; import React from 'react'; import { defineMessages, useIntl } from 'react-intl'; -import { useLogo } from 'pl-fe/hooks/useLogo'; +import { useLogo } from 'pl-fe/hooks/use-logo'; const messages = defineMessages({ logo: { id: 'generic.logo', defaultMessage: 'Logo' }, diff --git a/packages/pl-fe/src/components/status-action-bar.tsx b/packages/pl-fe/src/components/status-action-bar.tsx index f4588cfa9..d56ca7f67 100644 --- a/packages/pl-fe/src/components/status-action-bar.tsx +++ b/packages/pl-fe/src/components/status-action-bar.tsx @@ -14,22 +14,22 @@ import { initReport, ReportableEntities } from 'pl-fe/actions/reports'; import { changeSetting } from 'pl-fe/actions/settings'; import { deleteStatus, editStatus, toggleMuteStatus, translateStatus, undoStatusTranslation } from 'pl-fe/actions/statuses'; import { deleteFromTimelines } from 'pl-fe/actions/timelines'; -import { useBlockGroupMember } from 'pl-fe/api/hooks/groups/useBlockGroupMember'; -import { useDeleteGroupStatus } from 'pl-fe/api/hooks/groups/useDeleteGroupStatus'; -import { useGroup } from 'pl-fe/api/hooks/groups/useGroup'; -import { useGroupRelationship } from 'pl-fe/api/hooks/groups/useGroupRelationship'; -import { useTranslationLanguages } from 'pl-fe/api/hooks/instance/useTranslationLanguages'; +import { useBlockGroupMember } from 'pl-fe/api/hooks/groups/use-block-group-member'; +import { useDeleteGroupStatus } from 'pl-fe/api/hooks/groups/use-delete-group-status'; +import { useGroup } from 'pl-fe/api/hooks/groups/use-group'; +import { useGroupRelationship } from 'pl-fe/api/hooks/groups/use-group-relationship'; +import { useTranslationLanguages } from 'pl-fe/api/hooks/instance/use-translation-languages'; import DropdownMenu from 'pl-fe/components/dropdown-menu'; import StatusActionButton from 'pl-fe/components/status-action-button'; import HStack from 'pl-fe/components/ui/hstack'; import EmojiPickerDropdown from 'pl-fe/features/emoji/containers/emoji-picker-dropdown-container'; import { languages } from 'pl-fe/features/preferences'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; -import { useFeatures } from 'pl-fe/hooks/useFeatures'; -import { useInstance } from 'pl-fe/hooks/useInstance'; -import { useOwnAccount } from 'pl-fe/hooks/useOwnAccount'; -import { useSettings } from 'pl-fe/hooks/useSettings'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; +import { useFeatures } from 'pl-fe/hooks/use-features'; +import { useInstance } from 'pl-fe/hooks/use-instance'; +import { useOwnAccount } from 'pl-fe/hooks/use-own-account'; +import { useSettings } from 'pl-fe/hooks/use-settings'; import { useChats } from 'pl-fe/queries/chats'; import { useModalsStore } from 'pl-fe/stores/modals'; import toast from 'pl-fe/toast'; @@ -43,6 +43,7 @@ import type { UnauthorizedModalAction } from 'pl-fe/features/ui/components/modal import type { Account } from 'pl-fe/normalizers/account'; import type { Group } from 'pl-fe/normalizers/group'; import type { SelectedStatus } from 'pl-fe/selectors'; +import type { Me } from 'pl-fe/types/pl-fe'; const messages = defineMessages({ adminAccount: { id: 'status.admin_account', defaultMessage: 'Moderate @{name}' }, @@ -110,29 +111,358 @@ const messages = defineMessages({ hideTranslation: { id: 'status.hide_translation', defaultMessage: 'Hide translation' }, }); -interface IStatusActionBar { - status: SelectedStatus; +interface IActionButton extends Pick { + me: Me; + onOpenUnauthorizedModal: (action?: UnauthorizedModalAction) => void; +} + +interface IReplyButton extends IActionButton { rebloggedBy?: Account; - withLabels?: boolean; +} + +const ReplyButton: React.FC = ({ + status, + statusActionButtonTheme, + withLabels, + me, + onOpenUnauthorizedModal, + rebloggedBy, +}) => { + const dispatch = useAppDispatch(); + const intl = useIntl(); + + const { groupRelationship } = useGroupRelationship(status.group_id || undefined); + + let replyTitle; + let replyDisabled = false; + const replyCount = status.replies_count; + + if ((status.group as Group)?.membership_required && !groupRelationship?.member) { + replyDisabled = true; + replyTitle = intl.formatMessage(messages.replies_disabled_group); + } + + if (!status.in_reply_to_id) { + replyTitle = intl.formatMessage(messages.reply); + } else { + replyTitle = intl.formatMessage(messages.replyAll); + } + + const handleReplyClick: React.MouseEventHandler = (e) => { + if (me) { + dispatch(replyCompose(status, rebloggedBy)); + } else { + onOpenUnauthorizedModal('REPLY'); + } + }; + + const replyButton = ( + + ); + + return status.group ? ( + + {replyButton} + + ) : replyButton; +}; + +interface IReblogButton extends IActionButton { + publicStatus: boolean; +} + +const ReblogButton: React.FC = ({ + status, + statusActionButtonTheme, + withLabels, + me, + onOpenUnauthorizedModal, + publicStatus, +}) => { + const dispatch = useAppDispatch(); + const features = useFeatures(); + const intl = useIntl(); + + const { boostModal } = useSettings(); + const { openModal } = useModalsStore(); + + let reblogIcon = require('@tabler/icons/outline/repeat.svg'); + + if (status.visibility === 'direct') { + reblogIcon = require('@tabler/icons/outline/mail.svg'); + } else if (status.visibility === 'private' || status.visibility === 'mutuals_only') { + reblogIcon = require('@tabler/icons/outline/lock.svg'); + } + + const handleReblogClick: React.EventHandler = e => { + if (me) { + const modalReblog = () => dispatch(toggleReblog(status)); + if ((e && e.shiftKey) || !boostModal) { + modalReblog(); + } else { + openModal('BOOST', { statusId: status.id, onReblog: modalReblog }); + } + } else { + onOpenUnauthorizedModal('REBLOG'); + } + }; + + const handleReblogLongPress = status.reblogs_count ? () => { + openModal('REBLOGS', { statusId: status.id }); + } : undefined; + + const reblogButton = ( + + ); + + if (!features.quotePosts || !me) return reblogButton; + + const handleQuoteClick: React.EventHandler = (e) => { + if (me) { + dispatch(quoteCompose(status)); + } else { + onOpenUnauthorizedModal('REBLOG'); + } + }; + + const reblogMenu = [{ + text: intl.formatMessage(status.reblogged ? messages.cancel_reblog_private : messages.reblog), + action: handleReblogClick, + icon: require('@tabler/icons/outline/repeat.svg'), + }, { + text: intl.formatMessage(messages.quotePost), + action: handleQuoteClick, + icon: require('@tabler/icons/outline/quote.svg'), + }]; + + return ( + + {reblogButton} + + ); +}; + +const FavouriteButton: React.FC = ({ + status, + statusActionButtonTheme, + me, + withLabels, + onOpenUnauthorizedModal, +}) => { + const dispatch = useAppDispatch(); + const features = useFeatures(); + const intl = useIntl(); + + const { openModal } = useModalsStore(); + + const handleFavouriteClick: React.EventHandler = (e) => { + if (me) { + dispatch(toggleFavourite(status)); + } else { + onOpenUnauthorizedModal('FAVOURITE'); + } + }; + + const handleFavouriteLongPress = status.favourites_count ? () => { + openModal('FAVOURITES', { statusId: status.id }); + } : undefined; + + return ( + + ); +}; + +const DislikeButton: React.FC = ({ + status, + statusActionButtonTheme, + withLabels, + me, + onOpenUnauthorizedModal, +}) => { + const dispatch = useAppDispatch(); + const features = useFeatures(); + const intl = useIntl(); + + const { openModal } = useModalsStore(); + + if (!features.statusDislikes) return; + + const handleDislikeClick: React.EventHandler = (e) => { + if (me) { + dispatch(toggleDislike(status)); + } else { + onOpenUnauthorizedModal('DISLIKE'); + } + }; + + const handleDislikeLongPress = status.dislikes_count ? () => { + openModal('DISLIKES', { statusId: status.id }); + } : undefined; + + return ( + + ); +}; + +const WrenchButton: React.FC = ({ + status, + statusActionButtonTheme, + withLabels, + me, +}) => { + const dispatch = useAppDispatch(); + const intl = useIntl(); + const features = useFeatures(); + + const { openModal } = useModalsStore(); + const { showWrenchButton } = useSettings(); + + if (!me || withLabels || !features.emojiReacts || !showWrenchButton) return; + + const wrenches = showWrenchButton && status.emoji_reactions.find(emoji => emoji.name === '🔧') || undefined; + + const handleWrenchClick: React.EventHandler = (e) => { + if (wrenches?.me) { + dispatch(unEmojiReact(status, '🔧')); + } else { + dispatch(emojiReact(status, '🔧')); + } + }; + + const handleWrenchLongPress = wrenches?.count ? () => { + openModal('REACTIONS', { statusId: status.id, reaction: wrenches.name }); + } : undefined; + + return ( + + ); +}; + +const EmojiPickerButton: React.FC> = ({ + status, + statusActionButtonTheme, + withLabels, + me, +}) => { + const dispatch = useAppDispatch(); + + const features = useFeatures(); + + const handlePickEmoji = (emoji: EmojiType) => { + dispatch(emojiReact(status, emoji.custom ? emoji.id : emoji.native, emoji.custom ? emoji.imageUrl : undefined)); + }; + + return me && !withLabels && features.emojiReacts && ( + + ); +}; + +const ShareButton: React.FC> = ({ + status, + statusActionButtonTheme, +}) => { + const intl = useIntl(); + + const handleShareClick = () => { + navigator.share({ + text: status.search_index, + url: status.uri, + }).catch((e) => { + if (e.name !== 'AbortError') console.error(e); + }); + }; + + const canShare = ('share' in navigator) && (status.visibility === 'public' || status.visibility === 'group'); + + return canShare && ( + + ); +}; + +interface IMenuButton extends IActionButton { expandable?: boolean; - space?: 'sm' | 'md' | 'lg'; - statusActionButtonTheme?: 'default' | 'inverse'; fromBookmarks?: boolean; } -const StatusActionBar: React.FC = ({ +const MenuButton: React.FC = ({ status, - withLabels = false, + statusActionButtonTheme, + withLabels, + me, expandable, - space = 'sm', - statusActionButtonTheme = 'default', - fromBookmarks = false, - rebloggedBy, + fromBookmarks, }) => { const intl = useIntl(); const history = useHistory(); const dispatch = useAppDispatch(); const match = useRouteMatch<{ groupId: string }>('/groups/:groupId'); + const { boostModal } = useSettings(); const { openModal } = useModalsStore(); const { group } = useGroup((status.group as Group)?.id as string); @@ -140,13 +470,10 @@ const StatusActionBar: React.FC = ({ const blockGroupMember = useBlockGroupMember(group as Group, status.account); const { getOrCreateChatByAccountId } = useChats(); - const me = useAppSelector(state => state.me); const { groupRelationship } = useGroupRelationship(status.group_id || undefined); const features = useFeatures(); const instance = useInstance(); - const { autoTranslate, boostModal, deleteModal, knownLanguages, showWrenchButton } = useSettings(); - - const wrenches = showWrenchButton && status.emoji_reactions.find(emoji => emoji.name === '🔧') || undefined; + const { autoTranslate, deleteModal, knownLanguages } = useSettings(); const { translationLanguages } = useTranslationLanguages(); @@ -166,76 +493,6 @@ const StatusActionBar: React.FC = ({ const isStaff = account ? account.is_admin || account.is_moderator : false; const isAdmin = account ? account.is_admin : false; - if (!status) { - return null; - } - - const onOpenUnauthorizedModal = (action?: UnauthorizedModalAction) => { - openModal('UNAUTHORIZED', { - action, - ap_id: status.url, - }); - }; - - const handleReplyClick: React.MouseEventHandler = (e) => { - if (me) { - dispatch(replyCompose(status, rebloggedBy)); - } else { - onOpenUnauthorizedModal('REPLY'); - } - }; - - const handleShareClick = () => { - navigator.share({ - text: status.search_index, - url: status.uri, - }).catch((e) => { - if (e.name !== 'AbortError') console.error(e); - }); - }; - - const handleFavouriteClick: React.EventHandler = (e) => { - if (me) { - dispatch(toggleFavourite(status)); - } else { - onOpenUnauthorizedModal('FAVOURITE'); - } - }; - - const handleFavouriteLongPress = status.favourites_count ? () => { - openModal('FAVOURITES', { statusId: status.id }); - } : undefined; - - const handleDislikeClick: React.EventHandler = (e) => { - if (me) { - dispatch(toggleDislike(status)); - } else { - onOpenUnauthorizedModal('DISLIKE'); - } - }; - - const handleWrenchClick: React.EventHandler = (e) => { - if (!me) { - onOpenUnauthorizedModal('DISLIKE'); - } else if (wrenches?.me) { - dispatch(unEmojiReact(status, '🔧')); - } else { - dispatch(emojiReact(status, '🔧')); - } - }; - - const handleDislikeLongPress = status.dislikes_count ? () => { - openModal('DISLIKES', { statusId: status.id }); - } : undefined; - - const handleWrenchLongPress = wrenches?.count ? () => { - openModal('REACTIONS', { statusId: status.id, reaction: wrenches.name }); - } : undefined; - - const handlePickEmoji = (emoji: EmojiType) => { - dispatch(emojiReact(status, emoji.custom ? emoji.id : emoji.native, emoji.custom ? emoji.imageUrl : undefined)); - }; - const handleBookmarkClick: React.EventHandler = (e) => { dispatch(toggleBookmark(status)); }; @@ -246,31 +503,6 @@ const StatusActionBar: React.FC = ({ }); }; - const handleReblogClick: React.EventHandler = e => { - if (me) { - const modalReblog = () => dispatch(toggleReblog(status)); - if ((e && e.shiftKey) || !boostModal) { - modalReblog(); - } else { - openModal('BOOST', { statusId: status.id, onReblog: modalReblog }); - } - } else { - onOpenUnauthorizedModal('REBLOG'); - } - }; - - const handleReblogLongPress = status.reblogs_count ? () => { - openModal('REBLOGS', { statusId: status.id }); - } : undefined; - - const handleQuoteClick: React.EventHandler = (e) => { - if (me) { - dispatch(quoteCompose(status)); - } else { - onOpenUnauthorizedModal('REBLOG'); - } - }; - const doDeleteStatus = (withRedraft = false) => { if (!deleteModal) { dispatch(deleteStatus(status.id, withRedraft)); @@ -301,6 +533,15 @@ const StatusActionBar: React.FC = ({ dispatch(togglePin(status)); }; + const handleReblogClick: React.EventHandler = (e) => { + const modalReblog = () => dispatch(toggleReblog(status)); + if ((e && e.shiftKey) || !boostModal) { + modalReblog(); + } else { + openModal('BOOST', { statusId: status.id, onReblog: modalReblog }); + } + }; + const handleMentionClick: React.EventHandler = (e) => { dispatch(mentionCompose(status.account)); }; @@ -669,71 +910,55 @@ const StatusActionBar: React.FC = ({ const publicStatus = ['public', 'unlisted', 'group'].includes(status.visibility); - const replyCount = status.replies_count; - const reblogCount = status.reblogs_count; - const quoteCount = status.quotes_count; - const favouriteCount = status.favourites_count; - const menu = _makeMenu(publicStatus); - let reblogIcon = require('@tabler/icons/outline/repeat.svg'); - let replyTitle; - let replyDisabled = false; - if (status.visibility === 'direct') { - reblogIcon = require('@tabler/icons/outline/mail.svg'); - } else if (status.visibility === 'private' || status.visibility === 'mutuals_only') { - reblogIcon = require('@tabler/icons/outline/lock.svg'); - } - - if ((status.group as Group)?.membership_required && !groupRelationship?.member) { - replyDisabled = true; - replyTitle = intl.formatMessage(messages.replies_disabled_group); - } - - const replyButton = ( - + return ( + + + ); +}; - const reblogMenu = [{ - text: intl.formatMessage(status.reblogged ? messages.cancel_reblog_private : messages.reblog), - action: handleReblogClick, - icon: require('@tabler/icons/outline/repeat.svg'), - }, { - text: intl.formatMessage(messages.quotePost), - action: handleQuoteClick, - icon: require('@tabler/icons/outline/quote.svg'), - }]; +interface IStatusActionBar { + status: SelectedStatus; + rebloggedBy?: Account; + withLabels?: boolean; + expandable?: boolean; + space?: 'sm' | 'md' | 'lg'; + statusActionButtonTheme?: 'default' | 'inverse'; + fromBookmarks?: boolean; +} - const reblogButton = ( - - ); +const StatusActionBar: React.FC = ({ + status, + withLabels = false, + expandable, + space = 'sm', + statusActionButtonTheme = 'default', + fromBookmarks = false, + rebloggedBy, +}) => { - if (!status.in_reply_to_id) { - replyTitle = intl.formatMessage(messages.reply); - } else { - replyTitle = intl.formatMessage(messages.replyAll); + const { openModal } = useModalsStore(); + + const me = useAppSelector(state => state.me); + + if (!status) { + return null; } - const canShare = ('share' in navigator) && (status.visibility === 'public' || status.visibility === 'group'); + const onOpenUnauthorizedModal = (action?: UnauthorizedModalAction) => { + openModal('UNAUTHORIZED', { + action, + ap_id: status.url, + }); + }; + + const publicStatus = ['public', 'unlisted', 'group'].includes(status.visibility); const spacing: { [key: string]: React.ComponentProps['space']; @@ -752,92 +977,69 @@ const StatusActionBar: React.FC = ({ onClick={e => e.stopPropagation()} alignItems='center' > - {status.group ? ( - - {replyButton} - - ) : replyButton} - - {(features.quotePosts && me) ? ( - - {reblogButton} - - ) : ( - reblogButton - )} - - - {features.statusDislikes && ( - - )} + - {me && !withLabels && features.emojiReacts && showWrenchButton && ( - - )} + - {me && !withLabels && features.emojiReacts && ( - - )} + - {canShare && ( - - )} + - - - + + + + + ); diff --git a/packages/pl-fe/src/components/status-action-button.tsx b/packages/pl-fe/src/components/status-action-button.tsx index 450dd3f7a..e1bf3f007 100644 --- a/packages/pl-fe/src/components/status-action-button.tsx +++ b/packages/pl-fe/src/components/status-action-button.tsx @@ -5,7 +5,7 @@ import React from 'react'; import Emoji from 'pl-fe/components/ui/emoji'; import Icon from 'pl-fe/components/ui/icon'; import Text from 'pl-fe/components/ui/text'; -import { useSettings } from 'pl-fe/hooks/useSettings'; +import { useSettings } from 'pl-fe/hooks/use-settings'; import AnimatedNumber from './animated-number'; diff --git a/packages/pl-fe/src/components/status-hover-card.tsx b/packages/pl-fe/src/components/status-hover-card.tsx index 299125919..380a5f478 100644 --- a/packages/pl-fe/src/components/status-hover-card.tsx +++ b/packages/pl-fe/src/components/status-hover-card.tsx @@ -8,8 +8,8 @@ import { fetchStatus } from 'pl-fe/actions/statuses'; import { showStatusHoverCard } from 'pl-fe/components/hover-status-wrapper'; import Card, { CardBody } from 'pl-fe/components/ui/card'; import StatusContainer from 'pl-fe/containers/status-container'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; import { useStatusHoverCardStore } from 'pl-fe/stores/status-hover-card'; interface IStatusHoverCard { diff --git a/packages/pl-fe/src/components/status-language-picker.tsx b/packages/pl-fe/src/components/status-language-picker.tsx index 396e6f178..12af6318b 100644 --- a/packages/pl-fe/src/components/status-language-picker.tsx +++ b/packages/pl-fe/src/components/status-language-picker.tsx @@ -6,7 +6,7 @@ import HStack from 'pl-fe/components/ui/hstack'; import Icon from 'pl-fe/components/ui/icon'; import Text from 'pl-fe/components/ui/text'; import { type Language, languages } from 'pl-fe/features/preferences'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; import DropdownMenu from './dropdown-menu'; diff --git a/packages/pl-fe/src/components/status-list.tsx b/packages/pl-fe/src/components/status-list.tsx index 8b287db35..182883598 100644 --- a/packages/pl-fe/src/components/status-list.tsx +++ b/packages/pl-fe/src/components/status-list.tsx @@ -12,7 +12,7 @@ import StatusContainer from 'pl-fe/containers/status-container'; import FeedSuggestions from 'pl-fe/features/feed-suggestions/feed-suggestions'; import PlaceholderStatus from 'pl-fe/features/placeholder/components/placeholder-status'; import PendingStatus from 'pl-fe/features/ui/components/pending-status'; -import { usePlFeConfig } from 'pl-fe/hooks/usePlFeConfig'; +import { usePlFeConfig } from 'pl-fe/hooks/use-pl-fe-config'; interface IStatusList extends Omit { /** Unique key to preserve the scroll position when navigating back. */ diff --git a/packages/pl-fe/src/components/status-media.tsx b/packages/pl-fe/src/components/status-media.tsx index f0cf4e7e6..63c241fc2 100644 --- a/packages/pl-fe/src/components/status-media.tsx +++ b/packages/pl-fe/src/components/status-media.tsx @@ -4,7 +4,7 @@ import AttachmentThumbs from 'pl-fe/components/attachment-thumbs'; import PreviewCard from 'pl-fe/components/preview-card'; import PlaceholderCard from 'pl-fe/features/placeholder/components/placeholder-card'; import { MediaGallery, Video, Audio } from 'pl-fe/features/ui/util/async-components'; -import { useSettings } from 'pl-fe/hooks/useSettings'; +import { useSettings } from 'pl-fe/hooks/use-settings'; import { useModalsStore } from 'pl-fe/stores/modals'; import { isMediaVisible } from './statuses/sensitive-content-overlay'; diff --git a/packages/pl-fe/src/components/status-mention.tsx b/packages/pl-fe/src/components/status-mention.tsx index d0b002397..5fdd267d2 100644 --- a/packages/pl-fe/src/components/status-mention.tsx +++ b/packages/pl-fe/src/components/status-mention.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { Link } from 'react-router-dom'; -import { useAccount } from 'pl-fe/api/hooks/accounts/useAccount'; +import { useAccount } from 'pl-fe/api/hooks/accounts/use-account'; import HoverAccountWrapper from './hover-account-wrapper'; diff --git a/packages/pl-fe/src/components/status-reactions-bar.tsx b/packages/pl-fe/src/components/status-reactions-bar.tsx index 032357b13..3fccfe466 100644 --- a/packages/pl-fe/src/components/status-reactions-bar.tsx +++ b/packages/pl-fe/src/components/status-reactions-bar.tsx @@ -10,10 +10,10 @@ import Icon from 'pl-fe/components/ui/icon'; import Text from 'pl-fe/components/ui/text'; import EmojiPickerDropdown from 'pl-fe/features/emoji/containers/emoji-picker-dropdown-container'; import unicodeMapping from 'pl-fe/features/emoji/mapping'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useFeatures } from 'pl-fe/hooks/useFeatures'; -import { useLoggedIn } from 'pl-fe/hooks/useLoggedIn'; -import { useSettings } from 'pl-fe/hooks/useSettings'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useFeatures } from 'pl-fe/hooks/use-features'; +import { useLoggedIn } from 'pl-fe/hooks/use-logged-in'; +import { useSettings } from 'pl-fe/hooks/use-settings'; import { useModalsStore } from 'pl-fe/stores/modals'; import AnimatedNumber from './animated-number'; diff --git a/packages/pl-fe/src/components/status.tsx b/packages/pl-fe/src/components/status.tsx index 67812204d..e8ef7344c 100644 --- a/packages/pl-fe/src/components/status.tsx +++ b/packages/pl-fe/src/components/status.tsx @@ -16,9 +16,9 @@ import Emojify from 'pl-fe/features/emoji/emojify'; import StatusTypeIcon from 'pl-fe/features/status/components/status-type-icon'; import QuotedStatus from 'pl-fe/features/status/containers/quoted-status-container'; import { HotKeys } from 'pl-fe/features/ui/components/hotkeys'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; -import { useSettings } from 'pl-fe/hooks/useSettings'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; +import { useSettings } from 'pl-fe/hooks/use-settings'; import { makeGetStatus, type SelectedStatus } from 'pl-fe/selectors'; import { useModalsStore } from 'pl-fe/stores/modals'; import { textForScreenReader } from 'pl-fe/utils/status'; diff --git a/packages/pl-fe/src/components/statuses/sensitive-content-overlay.tsx b/packages/pl-fe/src/components/statuses/sensitive-content-overlay.tsx index 5fd218a89..c12247809 100644 --- a/packages/pl-fe/src/components/statuses/sensitive-content-overlay.tsx +++ b/packages/pl-fe/src/components/statuses/sensitive-content-overlay.tsx @@ -6,8 +6,8 @@ import { hideStatusMedia, revealStatusMedia } from 'pl-fe/actions/statuses'; import Button from 'pl-fe/components/ui/button'; import HStack from 'pl-fe/components/ui/hstack'; import Text from 'pl-fe/components/ui/text'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useSettings } from 'pl-fe/hooks/useSettings'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useSettings } from 'pl-fe/hooks/use-settings'; import type { Status } from 'pl-fe/normalizers/status'; @@ -110,4 +110,4 @@ const SensitiveContentOverlay = React.forwardRef = ({ status }) => { {button} - + : undefined, + }} + /> ); diff --git a/packages/pl-fe/src/components/ui/avatar.tsx b/packages/pl-fe/src/components/ui/avatar.tsx index c18f45bf6..96bb46867 100644 --- a/packages/pl-fe/src/components/ui/avatar.tsx +++ b/packages/pl-fe/src/components/ui/avatar.tsx @@ -60,4 +60,4 @@ const Avatar = (props: IAvatar) => { ); }; -export { Avatar as default, AVATAR_SIZE }; +export { Avatar as default }; diff --git a/packages/pl-fe/src/components/ui/button/index.tsx b/packages/pl-fe/src/components/ui/button/index.tsx index 373b10754..e26c139e4 100644 --- a/packages/pl-fe/src/components/ui/button/index.tsx +++ b/packages/pl-fe/src/components/ui/button/index.tsx @@ -24,6 +24,8 @@ interface IButton extends Pick< text?: React.ReactNode; /** Makes the button into a navlink, if provided. */ to?: string; + /** Makes the button into an anchor, if provided. */ + href?: string; /** Styles the button visually with a predefined theme. */ theme?: ButtonThemes; } @@ -40,6 +42,7 @@ const Button = React.forwardRef(({ text, theme = 'secondary', to, + href, type = 'button', className, ...props @@ -87,10 +90,15 @@ const Button = React.forwardRef(({ ); } + if (href) { + return ( + + {renderButton()} + + ); + } + return renderButton(); }); -export { - Button as default, - Button, -}; +export { Button as default }; diff --git a/packages/pl-fe/src/components/ui/carousel.tsx b/packages/pl-fe/src/components/ui/carousel.tsx deleted file mode 100644 index cacdfa712..000000000 --- a/packages/pl-fe/src/components/ui/carousel.tsx +++ /dev/null @@ -1,112 +0,0 @@ -import React, { useEffect, useState } from 'react'; - -import { useDimensions } from 'pl-fe/hooks/useDimensions'; - -import HStack from './hstack'; -import Icon from './icon'; - -interface ICarousel { - children: any; - /** Optional height to force on controls */ - controlsHeight?: number; - /** How many items in the carousel */ - itemCount: number; - /** The minimum width per item */ - itemWidth: number; - /** Should the controls be disabled? */ - isDisabled?: boolean; -} - -/** - * Carousel - */ -const Carousel: React.FC = (props): JSX.Element => { - const { children, controlsHeight, isDisabled, itemCount, itemWidth } = props; - - // eslint-disable-next-line @typescript-eslint/no-unused-vars - const [ref, setContainerRef, { width: finalContainerWidth }] = useDimensions(); - const containerWidth = finalContainerWidth || ref?.clientWidth; - - const [pageSize, setPageSize] = useState(0); - const [currentPage, setCurrentPage] = useState(1); - - const numberOfPages = Math.ceil(itemCount / pageSize); - const width = containerWidth / (Math.floor(containerWidth / itemWidth)); - - const hasNextPage = currentPage < numberOfPages && numberOfPages > 1; - const hasPrevPage = currentPage > 1 && numberOfPages > 1; - - const handleNextPage = () => setCurrentPage((prevPage) => prevPage + 1); - const handlePrevPage = () => setCurrentPage((prevPage) => prevPage - 1); - - const renderChildren = () => { - if (typeof children === 'function') { - return children({ width: width || 'auto' }); - } - - return children; - }; - - useEffect(() => { - if (containerWidth) { - setPageSize(Math.round(containerWidth / width)); - } - }, [containerWidth, width]); - - return ( - -
- -
- -
- - {renderChildren()} - -
- -
- -
-
- ); -}; - -export { Carousel as default }; diff --git a/packages/pl-fe/src/components/ui/column.tsx b/packages/pl-fe/src/components/ui/column.tsx index 4ebc194f7..48d3f954e 100644 --- a/packages/pl-fe/src/components/ui/column.tsx +++ b/packages/pl-fe/src/components/ui/column.tsx @@ -4,7 +4,7 @@ import React, { useCallback, useEffect, useState } from 'react'; import { useHistory } from 'react-router-dom'; import Helmet from 'pl-fe/components/helmet'; -import { usePlFeConfig } from 'pl-fe/hooks/usePlFeConfig'; +import { usePlFeConfig } from 'pl-fe/hooks/use-pl-fe-config'; import { Card, CardBody, CardHeader, CardTitle, type CardSizes } from './card'; @@ -120,8 +120,6 @@ const Column = React.forwardRef((props, ref): JSX.Eleme }); export { - type IColumn, Column as default, Column, - ColumnHeader, }; diff --git a/packages/pl-fe/src/components/ui/input.tsx b/packages/pl-fe/src/components/ui/input.tsx index 8fc89ce38..6d2434140 100644 --- a/packages/pl-fe/src/components/ui/input.tsx +++ b/packages/pl-fe/src/components/ui/input.tsx @@ -2,7 +2,7 @@ import clsx from 'clsx'; import React from 'react'; import { defineMessages, useIntl } from 'react-intl'; -import { useLocale } from 'pl-fe/hooks/useLocale'; +import { useLocale } from 'pl-fe/hooks/use-locale'; import { getTextDirection } from 'pl-fe/utils/rtl'; import Icon from './icon'; diff --git a/packages/pl-fe/src/components/ui/layout.tsx b/packages/pl-fe/src/components/ui/layout.tsx index 836b1c4a8..86e4c29b3 100644 --- a/packages/pl-fe/src/components/ui/layout.tsx +++ b/packages/pl-fe/src/components/ui/layout.tsx @@ -2,7 +2,7 @@ import clsx from 'clsx'; import React, { Suspense } from 'react'; import StickyBox from 'react-sticky-box'; -import { useFeatures } from 'pl-fe/hooks/useFeatures'; +import { useFeatures } from 'pl-fe/hooks/use-features'; interface ISidebar { children: React.ReactNode; diff --git a/packages/pl-fe/src/components/ui/radio-button.tsx b/packages/pl-fe/src/components/ui/radio-button.tsx deleted file mode 100644 index d72cbc74e..000000000 --- a/packages/pl-fe/src/components/ui/radio-button.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import React, { useMemo } from 'react'; - -import HStack from './hstack'; - -interface IRadioButton { - value: string; - checked?: boolean; - name: string; - onChange: React.ChangeEventHandler; - label: React.ReactNode; -} - -/** - * A group for radio input with label. - */ -const RadioButton: React.FC = ({ name, value, checked, onChange, label }) => { - const formFieldId: string = useMemo(() => `radio-${crypto.randomUUID()}`, []); - - return ( - - - - - - ); -}; - -export { RadioButton as default }; diff --git a/packages/pl-fe/src/components/ui/slider.tsx b/packages/pl-fe/src/components/ui/slider.tsx index 429c4a73e..4ab26fd2c 100644 --- a/packages/pl-fe/src/components/ui/slider.tsx +++ b/packages/pl-fe/src/components/ui/slider.tsx @@ -1,7 +1,7 @@ import throttle from 'lodash/throttle'; import React, { useRef } from 'react'; -type Point = { x: number; y: number }; +import { getPointerPosition } from 'pl-fe/features/video'; interface ISlider { /** Value between 0 and 1. */ @@ -68,56 +68,4 @@ const Slider: React.FC = ({ value, onChange }) => { ); }; -const findElementPosition = (el: HTMLElement) => { - let box; - - if (el.getBoundingClientRect && el.parentNode) { - box = el.getBoundingClientRect(); - } - - if (!box) { - return { - left: 0, - top: 0, - }; - } - - const docEl = document.documentElement; - const body = document.body; - - const clientLeft = docEl.clientLeft || body.clientLeft || 0; - const scrollLeft = window.pageXOffset || body.scrollLeft; - const left = (box.left + scrollLeft) - clientLeft; - - const clientTop = docEl.clientTop || body.clientTop || 0; - const scrollTop = window.pageYOffset || body.scrollTop; - const top = (box.top + scrollTop) - clientTop; - - return { - left: Math.round(left), - top: Math.round(top), - }; -}; - -const getPointerPosition = (el: HTMLElement, event: MouseEvent & TouchEvent): Point => { - const box = findElementPosition(el); - const boxW = el.offsetWidth; - const boxH = el.offsetHeight; - const boxY = box.top; - const boxX = box.left; - - let pageY = event.pageY; - let pageX = event.pageX; - - if (event.changedTouches) { - pageX = event.changedTouches[0].pageX; - pageY = event.changedTouches[0].pageY; - } - - return { - y: Math.max(0, Math.min(1, (pageY - boxY) / boxH)), - x: Math.max(0, Math.min(1, (pageX - boxX) / boxW)), - }; -}; - export { Slider as default }; diff --git a/packages/pl-fe/src/components/ui/textarea.tsx b/packages/pl-fe/src/components/ui/textarea.tsx index 565452ccb..5576ddf4f 100644 --- a/packages/pl-fe/src/components/ui/textarea.tsx +++ b/packages/pl-fe/src/components/ui/textarea.tsx @@ -2,7 +2,7 @@ import clsx from 'clsx'; import React, { useState } from 'react'; import { FormattedMessage } from 'react-intl'; -import { useLocale } from 'pl-fe/hooks/useLocale'; +import { useLocale } from 'pl-fe/hooks/use-locale'; import { getTextDirection } from 'pl-fe/utils/rtl'; import Stack from './stack'; diff --git a/packages/pl-fe/src/components/upload.tsx b/packages/pl-fe/src/components/upload.tsx index b0f756b4e..095407f05 100644 --- a/packages/pl-fe/src/components/upload.tsx +++ b/packages/pl-fe/src/components/upload.tsx @@ -18,7 +18,7 @@ import HStack from 'pl-fe/components/ui/hstack'; import Icon from 'pl-fe/components/ui/icon'; import IconButton from 'pl-fe/components/ui/icon-button'; import Motion from 'pl-fe/features/ui/util/optional-motion'; -import { useSettings } from 'pl-fe/hooks/useSettings'; +import { useSettings } from 'pl-fe/hooks/use-settings'; import { useModalsStore } from 'pl-fe/stores/modals'; import type { MediaAttachment } from 'pl-api'; diff --git a/packages/pl-fe/src/components/verification-badge.tsx b/packages/pl-fe/src/components/verification-badge.tsx index 660483596..886a2c034 100644 --- a/packages/pl-fe/src/components/verification-badge.tsx +++ b/packages/pl-fe/src/components/verification-badge.tsx @@ -3,7 +3,7 @@ import React from 'react'; import { useIntl, defineMessages } from 'react-intl'; import Icon from 'pl-fe/components/ui/icon'; -import { usePlFeConfig } from 'pl-fe/hooks/usePlFeConfig'; +import { usePlFeConfig } from 'pl-fe/hooks/use-pl-fe-config'; const messages = defineMessages({ verified: { id: 'account.verified', defaultMessage: 'Verified Account' }, diff --git a/packages/pl-fe/src/containers/account-container.tsx b/packages/pl-fe/src/containers/account-container.tsx index 8dc9b463c..0fb237734 100644 --- a/packages/pl-fe/src/containers/account-container.tsx +++ b/packages/pl-fe/src/containers/account-container.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import { useAccount } from 'pl-fe/api/hooks/accounts/useAccount'; +import { useAccount } from 'pl-fe/api/hooks/accounts/use-account'; import Account, { IAccount } from 'pl-fe/components/account'; interface IAccountContainer extends Omit { diff --git a/packages/pl-fe/src/containers/status-container.tsx b/packages/pl-fe/src/containers/status-container.tsx index bac9121c8..1a71db238 100644 --- a/packages/pl-fe/src/containers/status-container.tsx +++ b/packages/pl-fe/src/containers/status-container.tsx @@ -1,7 +1,7 @@ import React, { useCallback } from 'react'; import Status, { IStatus } from 'pl-fe/components/status'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; import { makeGetStatus } from 'pl-fe/selectors'; interface IStatusContainer extends Omit { diff --git a/packages/pl-fe/src/contexts/chat-context.tsx b/packages/pl-fe/src/contexts/chat-context.tsx index 76141dc3e..ad623593e 100644 --- a/packages/pl-fe/src/contexts/chat-context.tsx +++ b/packages/pl-fe/src/contexts/chat-context.tsx @@ -2,8 +2,8 @@ import React, { createContext, useContext, useEffect, useMemo, useState } from ' import { useHistory, useParams } from 'react-router-dom'; import { toggleMainWindow } from 'pl-fe/actions/chats'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useSettings } from 'pl-fe/hooks/useSettings'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useSettings } from 'pl-fe/hooks/use-settings'; import { useChat } from 'pl-fe/queries/chats'; import type { Chat } from 'pl-api'; diff --git a/packages/pl-fe/src/contexts/stat-context.tsx b/packages/pl-fe/src/contexts/stat-context.tsx index 3918bb6da..8245027db 100644 --- a/packages/pl-fe/src/contexts/stat-context.tsx +++ b/packages/pl-fe/src/contexts/stat-context.tsx @@ -30,4 +30,4 @@ const StatProvider: React.FC = ({ children }) => { const useStatContext = (): IStatContext => useContext(StatContext); -export { StatProvider, useStatContext, IStatContext }; +export { StatProvider, useStatContext }; diff --git a/packages/pl-fe/src/entity-store/hooks/useBatchedEntities.ts b/packages/pl-fe/src/entity-store/hooks/use-batched-entities.ts similarity index 94% rename from packages/pl-fe/src/entity-store/hooks/useBatchedEntities.ts rename to packages/pl-fe/src/entity-store/hooks/use-batched-entities.ts index 40aa0f523..cdb87f016 100644 --- a/packages/pl-fe/src/entity-store/hooks/useBatchedEntities.ts +++ b/packages/pl-fe/src/entity-store/hooks/use-batched-entities.ts @@ -1,9 +1,9 @@ import { useEffect } from 'react'; import * as v from 'valibot'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; -import { useGetState } from 'pl-fe/hooks/useGetState'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; +import { useGetState } from 'pl-fe/hooks/use-get-state'; import { filteredArray } from 'pl-fe/schemas/utils'; import { entitiesFetchFail, entitiesFetchRequest, entitiesFetchSuccess } from '../actions'; diff --git a/packages/pl-fe/src/entity-store/hooks/useCreateEntity.ts b/packages/pl-fe/src/entity-store/hooks/use-create-entity.ts similarity index 93% rename from packages/pl-fe/src/entity-store/hooks/useCreateEntity.ts rename to packages/pl-fe/src/entity-store/hooks/use-create-entity.ts index a7ff90741..81edb991a 100644 --- a/packages/pl-fe/src/entity-store/hooks/useCreateEntity.ts +++ b/packages/pl-fe/src/entity-store/hooks/use-create-entity.ts @@ -1,7 +1,7 @@ import * as v from 'valibot'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useLoading } from 'pl-fe/hooks/useLoading'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useLoading } from 'pl-fe/hooks/use-loading'; import { importEntities } from '../actions'; diff --git a/packages/pl-fe/src/entity-store/hooks/useDeleteEntity.ts b/packages/pl-fe/src/entity-store/hooks/use-delete-entity.ts similarity index 89% rename from packages/pl-fe/src/entity-store/hooks/useDeleteEntity.ts rename to packages/pl-fe/src/entity-store/hooks/use-delete-entity.ts index 7fc6d9537..60568d510 100644 --- a/packages/pl-fe/src/entity-store/hooks/useDeleteEntity.ts +++ b/packages/pl-fe/src/entity-store/hooks/use-delete-entity.ts @@ -1,6 +1,6 @@ -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useGetState } from 'pl-fe/hooks/useGetState'; -import { useLoading } from 'pl-fe/hooks/useLoading'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useGetState } from 'pl-fe/hooks/use-get-state'; +import { useLoading } from 'pl-fe/hooks/use-loading'; import { deleteEntities, importEntities } from '../actions'; diff --git a/packages/pl-fe/src/entity-store/hooks/useDismissEntity.ts b/packages/pl-fe/src/entity-store/hooks/use-dismiss-entity.ts similarity index 87% rename from packages/pl-fe/src/entity-store/hooks/useDismissEntity.ts rename to packages/pl-fe/src/entity-store/hooks/use-dismiss-entity.ts index b8fcd9c9a..cd54fd2d3 100644 --- a/packages/pl-fe/src/entity-store/hooks/useDismissEntity.ts +++ b/packages/pl-fe/src/entity-store/hooks/use-dismiss-entity.ts @@ -1,5 +1,5 @@ -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useLoading } from 'pl-fe/hooks/useLoading'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useLoading } from 'pl-fe/hooks/use-loading'; import { dismissEntities } from '../actions'; diff --git a/packages/pl-fe/src/entity-store/hooks/useEntities.ts b/packages/pl-fe/src/entity-store/hooks/use-entities.ts similarity index 96% rename from packages/pl-fe/src/entity-store/hooks/useEntities.ts rename to packages/pl-fe/src/entity-store/hooks/use-entities.ts index 158345d65..a33ddcfdf 100644 --- a/packages/pl-fe/src/entity-store/hooks/useEntities.ts +++ b/packages/pl-fe/src/entity-store/hooks/use-entities.ts @@ -1,9 +1,9 @@ import { useEffect } from 'react'; import * as v from 'valibot'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; -import { useGetState } from 'pl-fe/hooks/useGetState'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; +import { useGetState } from 'pl-fe/hooks/use-get-state'; import { filteredArray } from 'pl-fe/schemas/utils'; import { entitiesFetchFail, entitiesFetchRequest, entitiesFetchSuccess, invalidateEntityList } from '../actions'; diff --git a/packages/pl-fe/src/entity-store/hooks/useEntityLookup.ts b/packages/pl-fe/src/entity-store/hooks/use-entity-lookup.ts similarity index 89% rename from packages/pl-fe/src/entity-store/hooks/useEntityLookup.ts rename to packages/pl-fe/src/entity-store/hooks/use-entity-lookup.ts index a59be3c67..ce3859ce6 100644 --- a/packages/pl-fe/src/entity-store/hooks/useEntityLookup.ts +++ b/packages/pl-fe/src/entity-store/hooks/use-entity-lookup.ts @@ -1,15 +1,15 @@ import { useEffect, useState } from 'react'; import * as v from 'valibot'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; -import { useLoading } from 'pl-fe/hooks/useLoading'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; +import { useLoading } from 'pl-fe/hooks/use-loading'; import { importEntities } from '../actions'; import { findEntity } from '../selectors'; import type { EntityFn } from './types'; -import type { UseEntityOpts } from './useEntity'; +import type { UseEntityOpts } from './use-entity'; import type { Entity } from '../types'; import type { PlfeResponse } from 'pl-fe/api'; diff --git a/packages/pl-fe/src/entity-store/hooks/useEntity.ts b/packages/pl-fe/src/entity-store/hooks/use-entity.ts similarity index 92% rename from packages/pl-fe/src/entity-store/hooks/useEntity.ts rename to packages/pl-fe/src/entity-store/hooks/use-entity.ts index c4aba44ac..d65b8c469 100644 --- a/packages/pl-fe/src/entity-store/hooks/useEntity.ts +++ b/packages/pl-fe/src/entity-store/hooks/use-entity.ts @@ -1,9 +1,9 @@ import { useEffect, useState } from 'react'; import * as v from 'valibot'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; -import { useLoading } from 'pl-fe/hooks/useLoading'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; +import { useLoading } from 'pl-fe/hooks/use-loading'; import { importEntities } from '../actions'; import { selectEntity } from '../selectors'; diff --git a/packages/pl-fe/src/entity-store/hooks/useTransaction.ts b/packages/pl-fe/src/entity-store/hooks/use-transaction.ts similarity index 90% rename from packages/pl-fe/src/entity-store/hooks/useTransaction.ts rename to packages/pl-fe/src/entity-store/hooks/use-transaction.ts index 374f34aeb..8900f5f1d 100644 --- a/packages/pl-fe/src/entity-store/hooks/useTransaction.ts +++ b/packages/pl-fe/src/entity-store/hooks/use-transaction.ts @@ -1,5 +1,5 @@ import { entitiesTransaction } from 'pl-fe/entity-store/actions'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; import type { EntityTypes } from 'pl-fe/entity-store/entities'; import type { EntitiesTransaction, Entity } from 'pl-fe/entity-store/types'; diff --git a/packages/pl-fe/src/entity-store/hooks/useChangeEntity.ts b/packages/pl-fe/src/entity-store/hooks/useChangeEntity.ts deleted file mode 100644 index 392e8c363..000000000 --- a/packages/pl-fe/src/entity-store/hooks/useChangeEntity.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { importEntities } from 'pl-fe/entity-store/actions'; -import { Entities } from 'pl-fe/entity-store/entities'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useGetState } from 'pl-fe/hooks/useGetState'; - -import type { Entity } from 'pl-fe/entity-store/types'; - -type ChangeEntityFn = (entity: TEntity) => TEntity - -const useChangeEntity = (entityType: Entities) => { - const getState = useGetState(); - const dispatch = useAppDispatch(); - - const changeEntity = (entityId: string, change: ChangeEntityFn): void => { - if (!entityId) return; - const entity = getState().entities[entityType]?.store[entityId] as TEntity | undefined; - if (entity) { - const newEntity = change(entity); - dispatch(importEntities([newEntity], entityType)); - } - }; - - return { changeEntity }; -}; - -export { useChangeEntity, type ChangeEntityFn }; diff --git a/packages/pl-fe/src/entity-store/hooks/useIncrementEntity.ts b/packages/pl-fe/src/entity-store/hooks/useIncrementEntity.ts deleted file mode 100644 index 080bbf7f9..000000000 --- a/packages/pl-fe/src/entity-store/hooks/useIncrementEntity.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useLoading } from 'pl-fe/hooks/useLoading'; - -import { incrementEntities } from '../actions'; - -import { parseEntitiesPath } from './utils'; - -import type { EntityFn, ExpandedEntitiesPath } from './types'; - -/** - * Increases (or decreases) the `totalCount` in the entity list by the specified amount. - * This only works if the API returns an `X-Total-Count` header and your components read it. - */ -const useIncrementEntity = ( - expandedPath: ExpandedEntitiesPath, - diff: number, - entityFn: EntityFn, -) => { - const dispatch = useAppDispatch(); - const [isLoading, setPromise] = useLoading(); - const { entityType, listKey } = parseEntitiesPath(expandedPath); - - const incrementEntity = async (entityId: string): Promise => { - dispatch(incrementEntities(entityType, listKey, diff)); - try { - await setPromise(entityFn(entityId)); - } catch (e) { - dispatch(incrementEntities(entityType, listKey, diff * -1)); - } - }; - - return { - incrementEntity, - isLoading, - }; -}; - -export { useIncrementEntity }; diff --git a/packages/pl-fe/src/entity-store/selectors.ts b/packages/pl-fe/src/entity-store/selectors.ts index d9dcef8fd..c6472f7f1 100644 --- a/packages/pl-fe/src/entity-store/selectors.ts +++ b/packages/pl-fe/src/entity-store/selectors.ts @@ -1,4 +1,4 @@ -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; import type { EntitiesPath } from './hooks/types'; import type { Entity, EntityListState } from './types'; @@ -62,7 +62,6 @@ const findEntity = ( export { selectCache, - selectList, selectListState, useListState, selectEntities, diff --git a/packages/pl-fe/src/features/about/index.tsx b/packages/pl-fe/src/features/about/index.tsx index 23f205284..fe0e53e2c 100644 --- a/packages/pl-fe/src/features/about/index.tsx +++ b/packages/pl-fe/src/features/about/index.tsx @@ -5,9 +5,9 @@ import { useParams } from 'react-router-dom'; import { fetchAboutPage } from 'pl-fe/actions/about'; import { Navlinks } from 'pl-fe/components/navlinks'; import Card from 'pl-fe/components/ui/card'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { usePlFeConfig } from 'pl-fe/hooks/usePlFeConfig'; -import { useSettings } from 'pl-fe/hooks/useSettings'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { usePlFeConfig } from 'pl-fe/hooks/use-pl-fe-config'; +import { useSettings } from 'pl-fe/hooks/use-settings'; import { languages } from '../preferences'; diff --git a/packages/pl-fe/src/features/account-gallery/components/media-item.tsx b/packages/pl-fe/src/features/account-gallery/components/media-item.tsx index 880a22838..7dc02911d 100644 --- a/packages/pl-fe/src/features/account-gallery/components/media-item.tsx +++ b/packages/pl-fe/src/features/account-gallery/components/media-item.tsx @@ -5,7 +5,7 @@ import { Link } from 'react-router-dom'; import Blurhash from 'pl-fe/components/blurhash'; import Icon from 'pl-fe/components/icon'; import StillImage from 'pl-fe/components/still-image'; -import { useSettings } from 'pl-fe/hooks/useSettings'; +import { useSettings } from 'pl-fe/hooks/use-settings'; import { isIOS } from 'pl-fe/is-mobile'; import type { AccountGalleryAttachment } from 'pl-fe/selectors'; diff --git a/packages/pl-fe/src/features/account-gallery/index.tsx b/packages/pl-fe/src/features/account-gallery/index.tsx index 7503c47d6..27cfccc64 100644 --- a/packages/pl-fe/src/features/account-gallery/index.tsx +++ b/packages/pl-fe/src/features/account-gallery/index.tsx @@ -4,13 +4,13 @@ import { FormattedMessage } from 'react-intl'; import { useParams } from 'react-router-dom'; import { fetchAccountTimeline } from 'pl-fe/actions/timelines'; -import { useAccountLookup } from 'pl-fe/api/hooks/accounts/useAccountLookup'; +import { useAccountLookup } from 'pl-fe/api/hooks/accounts/use-account-lookup'; import LoadMore from 'pl-fe/components/load-more'; import MissingIndicator from 'pl-fe/components/missing-indicator'; import Column from 'pl-fe/components/ui/column'; import Spinner from 'pl-fe/components/ui/spinner'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; import { type AccountGalleryAttachment, getAccountGallery } from 'pl-fe/selectors'; import { useModalsStore } from 'pl-fe/stores/modals'; diff --git a/packages/pl-fe/src/features/account-timeline/index.tsx b/packages/pl-fe/src/features/account-timeline/index.tsx index fda8a6f52..276d46db5 100644 --- a/packages/pl-fe/src/features/account-timeline/index.tsx +++ b/packages/pl-fe/src/features/account-timeline/index.tsx @@ -4,16 +4,16 @@ import { useHistory } from 'react-router-dom'; import { fetchAccountByUsername } from 'pl-fe/actions/accounts'; import { fetchAccountTimeline } from 'pl-fe/actions/timelines'; -import { useAccountLookup } from 'pl-fe/api/hooks/accounts/useAccountLookup'; +import { useAccountLookup } from 'pl-fe/api/hooks/accounts/use-account-lookup'; import MissingIndicator from 'pl-fe/components/missing-indicator'; import StatusList from 'pl-fe/components/status-list'; import Card, { CardBody } from 'pl-fe/components/ui/card'; import Spinner from 'pl-fe/components/ui/spinner'; import Text from 'pl-fe/components/ui/text'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; -import { useFeatures } from 'pl-fe/hooks/useFeatures'; -import { useSettings } from 'pl-fe/hooks/useSettings'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; +import { useFeatures } from 'pl-fe/hooks/use-features'; +import { useSettings } from 'pl-fe/hooks/use-settings'; import { makeGetStatusIds } from 'pl-fe/selectors'; const getStatusIds = makeGetStatusIds(); diff --git a/packages/pl-fe/src/features/account/components/header.tsx b/packages/pl-fe/src/features/account/components/header.tsx index 8e54633af..645c28ed0 100644 --- a/packages/pl-fe/src/features/account/components/header.tsx +++ b/packages/pl-fe/src/features/account/components/header.tsx @@ -11,7 +11,7 @@ import { blockDomain, unblockDomain } from 'pl-fe/actions/domain-blocks'; import { initMuteModal } from 'pl-fe/actions/mutes'; import { initReport, ReportableEntities } from 'pl-fe/actions/reports'; import { setSearchAccount } from 'pl-fe/actions/search'; -import { useFollow } from 'pl-fe/api/hooks/accounts/useFollow'; +import { useFollow } from 'pl-fe/api/hooks/accounts/use-follow'; import Badge from 'pl-fe/components/badge'; import DropdownMenu, { Menu } from 'pl-fe/components/dropdown-menu'; import StillImage from 'pl-fe/components/still-image'; @@ -22,10 +22,10 @@ import VerificationBadge from 'pl-fe/components/verification-badge'; import MovedNote from 'pl-fe/features/account-timeline/components/moved-note'; import ActionButton from 'pl-fe/features/ui/components/action-button'; import SubscriptionButton from 'pl-fe/features/ui/components/subscription-button'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; -import { useFeatures } from 'pl-fe/hooks/useFeatures'; -import { useOwnAccount } from 'pl-fe/hooks/useOwnAccount'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; +import { useFeatures } from 'pl-fe/hooks/use-features'; +import { useOwnAccount } from 'pl-fe/hooks/use-own-account'; import { useChats } from 'pl-fe/queries/chats'; import { queryClient } from 'pl-fe/queries/client'; import { useModalsStore } from 'pl-fe/stores/modals'; diff --git a/packages/pl-fe/src/features/admin/announcements.tsx b/packages/pl-fe/src/features/admin/announcements.tsx index 1a3f3b28d..b72abe15e 100644 --- a/packages/pl-fe/src/features/admin/announcements.tsx +++ b/packages/pl-fe/src/features/admin/announcements.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { FormattedDate, FormattedMessage, defineMessages, useIntl } from 'react-intl'; -import { useAnnouncements } from 'pl-fe/api/hooks/admin/useAnnouncements'; +import { useAnnouncements } from 'pl-fe/api/hooks/admin/use-announcements'; import { ParsedContent } from 'pl-fe/components/parsed-content'; import ScrollableList from 'pl-fe/components/scrollable-list'; import Button from 'pl-fe/components/ui/button'; diff --git a/packages/pl-fe/src/features/admin/components/admin-tabs.tsx b/packages/pl-fe/src/features/admin/components/admin-tabs.tsx index 8c85669cd..d7e9eaba5 100644 --- a/packages/pl-fe/src/features/admin/components/admin-tabs.tsx +++ b/packages/pl-fe/src/features/admin/components/admin-tabs.tsx @@ -3,7 +3,7 @@ import { useIntl, defineMessages } from 'react-intl'; import { useRouteMatch } from 'react-router-dom'; import Tabs from 'pl-fe/components/ui/tabs'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; const messages = defineMessages({ dashboard: { id: 'admin_nav.dashboard', defaultMessage: 'Dashboard' }, diff --git a/packages/pl-fe/src/features/admin/components/latest-accounts-panel.tsx b/packages/pl-fe/src/features/admin/components/latest-accounts-panel.tsx index d8cd9a673..f9a5f928f 100644 --- a/packages/pl-fe/src/features/admin/components/latest-accounts-panel.tsx +++ b/packages/pl-fe/src/features/admin/components/latest-accounts-panel.tsx @@ -6,8 +6,8 @@ import { useHistory } from 'react-router-dom'; import { fetchUsers } from 'pl-fe/actions/admin'; import Widget from 'pl-fe/components/ui/widget'; import AccountContainer from 'pl-fe/containers/account-container'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; const messages = defineMessages({ title: { id: 'admin.latest_accounts_panel.title', defaultMessage: 'Latest Accounts' }, diff --git a/packages/pl-fe/src/features/admin/components/registration-mode-picker.tsx b/packages/pl-fe/src/features/admin/components/registration-mode-picker.tsx index 9a111d391..416aaee10 100644 --- a/packages/pl-fe/src/features/admin/components/registration-mode-picker.tsx +++ b/packages/pl-fe/src/features/admin/components/registration-mode-picker.tsx @@ -4,8 +4,8 @@ import { useIntl, defineMessages, FormattedMessage } from 'react-intl'; import { updateConfig } from 'pl-fe/actions/admin'; import { RadioGroup, RadioItem } from 'pl-fe/components/radio'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useInstance } from 'pl-fe/hooks/useInstance'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useInstance } from 'pl-fe/hooks/use-instance'; import toast from 'pl-fe/toast'; type RegistrationMode = 'open' | 'approval' | 'closed'; diff --git a/packages/pl-fe/src/features/admin/components/report-status.tsx b/packages/pl-fe/src/features/admin/components/report-status.tsx index 3cb426314..91eab19fd 100644 --- a/packages/pl-fe/src/features/admin/components/report-status.tsx +++ b/packages/pl-fe/src/features/admin/components/report-status.tsx @@ -7,7 +7,7 @@ import StatusContent from 'pl-fe/components/status-content'; import StatusMedia from 'pl-fe/components/status-media'; import HStack from 'pl-fe/components/ui/hstack'; import Stack from 'pl-fe/components/ui/stack'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; import type { SelectedStatus } from 'pl-fe/selectors'; diff --git a/packages/pl-fe/src/features/admin/components/report.tsx b/packages/pl-fe/src/features/admin/components/report.tsx index a5c51d717..e0eb2e20d 100644 --- a/packages/pl-fe/src/features/admin/components/report.tsx +++ b/packages/pl-fe/src/features/admin/components/report.tsx @@ -12,8 +12,8 @@ import Button from 'pl-fe/components/ui/button'; import HStack from 'pl-fe/components/ui/hstack'; import Stack from 'pl-fe/components/ui/stack'; import Text from 'pl-fe/components/ui/text'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; import { makeGetReport } from 'pl-fe/selectors'; import toast from 'pl-fe/toast'; diff --git a/packages/pl-fe/src/features/admin/components/unapproved-account.tsx b/packages/pl-fe/src/features/admin/components/unapproved-account.tsx index c108b1794..1e5b227b5 100644 --- a/packages/pl-fe/src/features/admin/components/unapproved-account.tsx +++ b/packages/pl-fe/src/features/admin/components/unapproved-account.tsx @@ -1,13 +1,13 @@ import React from 'react'; import { approveUser, deleteUser } from 'pl-fe/actions/admin'; -import { useAccount } from 'pl-fe/api/hooks/accounts/useAccount'; +import { useAccount } from 'pl-fe/api/hooks/accounts/use-account'; import { AuthorizeRejectButtons } from 'pl-fe/components/authorize-reject-buttons'; import HStack from 'pl-fe/components/ui/hstack'; import Stack from 'pl-fe/components/ui/stack'; import Text from 'pl-fe/components/ui/text'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; interface IUnapprovedAccount { accountId: string; diff --git a/packages/pl-fe/src/features/admin/domains.tsx b/packages/pl-fe/src/features/admin/domains.tsx index 83de99735..adb517959 100644 --- a/packages/pl-fe/src/features/admin/domains.tsx +++ b/packages/pl-fe/src/features/admin/domains.tsx @@ -1,7 +1,7 @@ import React, { useEffect } from 'react'; import { FormattedMessage, defineMessages, useIntl } from 'react-intl'; -import { useDomains } from 'pl-fe/api/hooks/admin/useDomains'; +import { useDomains } from 'pl-fe/api/hooks/admin/use-domains'; import { dateFormatOptions } from 'pl-fe/components/relative-timestamp'; import ScrollableList from 'pl-fe/components/scrollable-list'; import Button from 'pl-fe/components/ui/button'; diff --git a/packages/pl-fe/src/features/admin/index.tsx b/packages/pl-fe/src/features/admin/index.tsx index f5601b706..fc15f54e6 100644 --- a/packages/pl-fe/src/features/admin/index.tsx +++ b/packages/pl-fe/src/features/admin/index.tsx @@ -3,7 +3,7 @@ import { defineMessages, useIntl } from 'react-intl'; import { Switch, Route } from 'react-router-dom'; import Column from 'pl-fe/components/ui/column'; -import { useOwnAccount } from 'pl-fe/hooks/useOwnAccount'; +import { useOwnAccount } from 'pl-fe/hooks/use-own-account'; import AdminTabs from './components/admin-tabs'; import Waitlist from './tabs/awaiting-approval'; diff --git a/packages/pl-fe/src/features/admin/moderation-log.tsx b/packages/pl-fe/src/features/admin/moderation-log.tsx index e17496654..fb0ce492b 100644 --- a/packages/pl-fe/src/features/admin/moderation-log.tsx +++ b/packages/pl-fe/src/features/admin/moderation-log.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { defineMessages, FormattedDate, useIntl } from 'react-intl'; -import { useModerationLog } from 'pl-fe/api/hooks/admin/useModerationLog'; +import { useModerationLog } from 'pl-fe/api/hooks/admin/use-moderation-log'; import ScrollableList from 'pl-fe/components/scrollable-list'; import Column from 'pl-fe/components/ui/column'; import Stack from 'pl-fe/components/ui/stack'; diff --git a/packages/pl-fe/src/features/admin/relays.tsx b/packages/pl-fe/src/features/admin/relays.tsx index 8f4b424bc..821310d7a 100644 --- a/packages/pl-fe/src/features/admin/relays.tsx +++ b/packages/pl-fe/src/features/admin/relays.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { FormattedMessage, defineMessages, useIntl } from 'react-intl'; -import { useRelays } from 'pl-fe/api/hooks/admin/useRelays'; +import { useRelays } from 'pl-fe/api/hooks/admin/use-relays'; import ScrollableList from 'pl-fe/components/scrollable-list'; import Button from 'pl-fe/components/ui/button'; import Column from 'pl-fe/components/ui/column'; @@ -10,7 +10,7 @@ import HStack from 'pl-fe/components/ui/hstack'; import Input from 'pl-fe/components/ui/input'; import Stack from 'pl-fe/components/ui/stack'; import Text from 'pl-fe/components/ui/text'; -import { useTextField } from 'pl-fe/hooks/forms/useTextField'; +import { useTextField } from 'pl-fe/hooks/forms/use-text-field'; import toast from 'pl-fe/toast'; import type { AdminRelay as RelayEntity } from 'pl-api'; diff --git a/packages/pl-fe/src/features/admin/rules.tsx b/packages/pl-fe/src/features/admin/rules.tsx index ae0b3f3f8..60e525bbd 100644 --- a/packages/pl-fe/src/features/admin/rules.tsx +++ b/packages/pl-fe/src/features/admin/rules.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { FormattedMessage, defineMessages, useIntl } from 'react-intl'; -import { useRules } from 'pl-fe/api/hooks/admin/useRules'; +import { useRules } from 'pl-fe/api/hooks/admin/use-rules'; import ScrollableList from 'pl-fe/components/scrollable-list'; import Button from 'pl-fe/components/ui/button'; import Column from 'pl-fe/components/ui/column'; diff --git a/packages/pl-fe/src/features/admin/tabs/awaiting-approval.tsx b/packages/pl-fe/src/features/admin/tabs/awaiting-approval.tsx index c1d5f01cf..0a17a57c4 100644 --- a/packages/pl-fe/src/features/admin/tabs/awaiting-approval.tsx +++ b/packages/pl-fe/src/features/admin/tabs/awaiting-approval.tsx @@ -3,8 +3,8 @@ import { defineMessages, useIntl } from 'react-intl'; import { fetchUsers } from 'pl-fe/actions/admin'; import ScrollableList from 'pl-fe/components/scrollable-list'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; import UnapprovedAccount from '../components/unapproved-account'; diff --git a/packages/pl-fe/src/features/admin/tabs/dashboard.tsx b/packages/pl-fe/src/features/admin/tabs/dashboard.tsx index b8e3c8a53..73b56cfcf 100644 --- a/packages/pl-fe/src/features/admin/tabs/dashboard.tsx +++ b/packages/pl-fe/src/features/admin/tabs/dashboard.tsx @@ -5,9 +5,9 @@ import List, { ListItem } from 'pl-fe/components/list'; import { CardTitle } from 'pl-fe/components/ui/card'; import Icon from 'pl-fe/components/ui/icon'; import Stack from 'pl-fe/components/ui/stack'; -import { useFeatures } from 'pl-fe/hooks/useFeatures'; -import { useInstance } from 'pl-fe/hooks/useInstance'; -import { useOwnAccount } from 'pl-fe/hooks/useOwnAccount'; +import { useFeatures } from 'pl-fe/hooks/use-features'; +import { useInstance } from 'pl-fe/hooks/use-instance'; +import { useOwnAccount } from 'pl-fe/hooks/use-own-account'; import sourceCode from 'pl-fe/utils/code'; import { DashCounter, DashCounters } from '../components/dashcounter'; diff --git a/packages/pl-fe/src/features/admin/tabs/reports.tsx b/packages/pl-fe/src/features/admin/tabs/reports.tsx index d45e1d36a..fc6cc0858 100644 --- a/packages/pl-fe/src/features/admin/tabs/reports.tsx +++ b/packages/pl-fe/src/features/admin/tabs/reports.tsx @@ -3,8 +3,8 @@ import { defineMessages, useIntl } from 'react-intl'; import { fetchReports } from 'pl-fe/actions/admin'; import ScrollableList from 'pl-fe/components/scrollable-list'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; import Report from '../components/report'; diff --git a/packages/pl-fe/src/features/admin/user-index.tsx b/packages/pl-fe/src/features/admin/user-index.tsx index 5b44a5574..93fe926e2 100644 --- a/packages/pl-fe/src/features/admin/user-index.tsx +++ b/packages/pl-fe/src/features/admin/user-index.tsx @@ -7,8 +7,8 @@ import ScrollableList from 'pl-fe/components/scrollable-list'; import Column from 'pl-fe/components/ui/column'; import Input from 'pl-fe/components/ui/input'; import AccountContainer from 'pl-fe/containers/account-container'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; const messages = defineMessages({ heading: { id: 'column.admin.users', defaultMessage: 'Users' }, diff --git a/packages/pl-fe/src/features/aliases/components/account.tsx b/packages/pl-fe/src/features/aliases/components/account.tsx index b21834eff..0159aad82 100644 --- a/packages/pl-fe/src/features/aliases/components/account.tsx +++ b/packages/pl-fe/src/features/aliases/components/account.tsx @@ -2,13 +2,13 @@ import React from 'react'; import { defineMessages, useIntl } from 'react-intl'; import { addToAliases } from 'pl-fe/actions/aliases'; -import { useAccount } from 'pl-fe/api/hooks/accounts/useAccount'; +import { useAccount } from 'pl-fe/api/hooks/accounts/use-account'; import AccountComponent from 'pl-fe/components/account'; import IconButton from 'pl-fe/components/icon-button'; import HStack from 'pl-fe/components/ui/hstack'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; -import { useFeatures } from 'pl-fe/hooks/useFeatures'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; +import { useFeatures } from 'pl-fe/hooks/use-features'; const messages = defineMessages({ add: { id: 'aliases.account.add', defaultMessage: 'Create alias' }, diff --git a/packages/pl-fe/src/features/aliases/components/search.tsx b/packages/pl-fe/src/features/aliases/components/search.tsx index 48e5e04df..f17f8ffff 100644 --- a/packages/pl-fe/src/features/aliases/components/search.tsx +++ b/packages/pl-fe/src/features/aliases/components/search.tsx @@ -5,8 +5,8 @@ import { defineMessages, useIntl } from 'react-intl'; import { fetchAliasesSuggestions, clearAliasesSuggestions, changeAliasesSuggestions } from 'pl-fe/actions/aliases'; import Icon from 'pl-fe/components/icon'; import Button from 'pl-fe/components/ui/button'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; const messages = defineMessages({ search: { id: 'aliases.search', defaultMessage: 'Search your old account' }, diff --git a/packages/pl-fe/src/features/aliases/index.tsx b/packages/pl-fe/src/features/aliases/index.tsx index e54f15f1a..d786abfc6 100644 --- a/packages/pl-fe/src/features/aliases/index.tsx +++ b/packages/pl-fe/src/features/aliases/index.tsx @@ -8,10 +8,10 @@ import { CardHeader, CardTitle } from 'pl-fe/components/ui/card'; import Column from 'pl-fe/components/ui/column'; import HStack from 'pl-fe/components/ui/hstack'; import Text from 'pl-fe/components/ui/text'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; -import { useFeatures } from 'pl-fe/hooks/useFeatures'; -import { useOwnAccount } from 'pl-fe/hooks/useOwnAccount'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; +import { useFeatures } from 'pl-fe/hooks/use-features'; +import { useOwnAccount } from 'pl-fe/hooks/use-own-account'; import Account from './components/account'; import Search from './components/search'; diff --git a/packages/pl-fe/src/features/auth-login/components/captcha.tsx b/packages/pl-fe/src/features/auth-login/components/captcha.tsx index 8da0e3e0f..add7cb36a 100644 --- a/packages/pl-fe/src/features/auth-login/components/captcha.tsx +++ b/packages/pl-fe/src/features/auth-login/components/captcha.tsx @@ -6,7 +6,7 @@ import { fetchCaptcha } from 'pl-fe/actions/auth'; import Input from 'pl-fe/components/ui/input'; import Stack from 'pl-fe/components/ui/stack'; import Text from 'pl-fe/components/ui/text'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; const noOp = () => {}; diff --git a/packages/pl-fe/src/features/auth-login/components/consumer-button.tsx b/packages/pl-fe/src/features/auth-login/components/consumer-button.tsx index 0b8c1d238..cad71f2ee 100644 --- a/packages/pl-fe/src/features/auth-login/components/consumer-button.tsx +++ b/packages/pl-fe/src/features/auth-login/components/consumer-button.tsx @@ -4,7 +4,7 @@ import { useIntl, defineMessages } from 'react-intl'; import { prepareRequest } from 'pl-fe/actions/consumer-auth'; import IconButton from 'pl-fe/components/ui/icon-button'; import Tooltip from 'pl-fe/components/ui/tooltip'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; import { capitalize } from 'pl-fe/utils/strings'; const messages = defineMessages({ diff --git a/packages/pl-fe/src/features/auth-login/components/consumers-list.tsx b/packages/pl-fe/src/features/auth-login/components/consumers-list.tsx index 76b143a8c..cacdf1afe 100644 --- a/packages/pl-fe/src/features/auth-login/components/consumers-list.tsx +++ b/packages/pl-fe/src/features/auth-login/components/consumers-list.tsx @@ -5,7 +5,7 @@ import Card from 'pl-fe/components/ui/card'; import HStack from 'pl-fe/components/ui/hstack'; import Stack from 'pl-fe/components/ui/stack'; import Text from 'pl-fe/components/ui/text'; -import { useInstance } from 'pl-fe/hooks/useInstance'; +import { useInstance } from 'pl-fe/hooks/use-instance'; import ConsumerButton from './consumer-button'; diff --git a/packages/pl-fe/src/features/auth-login/components/login-form.tsx b/packages/pl-fe/src/features/auth-login/components/login-form.tsx index 50157f3a3..2752369cf 100644 --- a/packages/pl-fe/src/features/auth-login/components/login-form.tsx +++ b/packages/pl-fe/src/features/auth-login/components/login-form.tsx @@ -7,7 +7,7 @@ import Form from 'pl-fe/components/ui/form'; import FormActions from 'pl-fe/components/ui/form-actions'; import FormGroup from 'pl-fe/components/ui/form-group'; import Input from 'pl-fe/components/ui/input'; -import { useFeatures } from 'pl-fe/hooks/useFeatures'; +import { useFeatures } from 'pl-fe/hooks/use-features'; const messages = defineMessages({ username: { diff --git a/packages/pl-fe/src/features/auth-login/components/login-page.tsx b/packages/pl-fe/src/features/auth-login/components/login-page.tsx index 082b6932e..f13f4cde3 100644 --- a/packages/pl-fe/src/features/auth-login/components/login-page.tsx +++ b/packages/pl-fe/src/features/auth-login/components/login-page.tsx @@ -8,8 +8,8 @@ import { BigCard } from 'pl-fe/components/big-card'; import Button from 'pl-fe/components/ui/button'; import Stack from 'pl-fe/components/ui/stack'; import Text from 'pl-fe/components/ui/text'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; import { useModalsStore } from 'pl-fe/stores/modals'; import { getRedirectUrl } from 'pl-fe/utils/redirect'; import { isStandalone } from 'pl-fe/utils/state'; diff --git a/packages/pl-fe/src/features/auth-login/components/otp-auth-form.tsx b/packages/pl-fe/src/features/auth-login/components/otp-auth-form.tsx index 937a60081..d45214633 100644 --- a/packages/pl-fe/src/features/auth-login/components/otp-auth-form.tsx +++ b/packages/pl-fe/src/features/auth-login/components/otp-auth-form.tsx @@ -10,7 +10,7 @@ import Form from 'pl-fe/components/ui/form'; import FormActions from 'pl-fe/components/ui/form-actions'; import FormGroup from 'pl-fe/components/ui/form-group'; import Input from 'pl-fe/components/ui/input'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; const messages = defineMessages({ otpCodeHint: { id: 'login.fields.otp_code_hint', defaultMessage: 'Enter the two-factor code generated by your phone app or use one of your recovery codes' }, diff --git a/packages/pl-fe/src/features/auth-login/components/password-reset.tsx b/packages/pl-fe/src/features/auth-login/components/password-reset.tsx index 3545b8a98..eed621bad 100644 --- a/packages/pl-fe/src/features/auth-login/components/password-reset.tsx +++ b/packages/pl-fe/src/features/auth-login/components/password-reset.tsx @@ -9,8 +9,8 @@ import Form from 'pl-fe/components/ui/form'; import FormActions from 'pl-fe/components/ui/form-actions'; import FormGroup from 'pl-fe/components/ui/form-group'; import Input from 'pl-fe/components/ui/input'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useFeatures } from 'pl-fe/hooks/useFeatures'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useFeatures } from 'pl-fe/hooks/use-features'; import toast from 'pl-fe/toast'; const messages = defineMessages({ diff --git a/packages/pl-fe/src/features/auth-login/components/registration-form.tsx b/packages/pl-fe/src/features/auth-login/components/registration-form.tsx index 1af855c00..fb957adaa 100644 --- a/packages/pl-fe/src/features/auth-login/components/registration-form.tsx +++ b/packages/pl-fe/src/features/auth-login/components/registration-form.tsx @@ -16,10 +16,10 @@ import Input from 'pl-fe/components/ui/input'; import Select from 'pl-fe/components/ui/select'; import Textarea from 'pl-fe/components/ui/textarea'; import CaptchaField from 'pl-fe/features/auth-login/components/captcha'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useFeatures } from 'pl-fe/hooks/useFeatures'; -import { useInstance } from 'pl-fe/hooks/useInstance'; -import { useSettings } from 'pl-fe/hooks/useSettings'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useFeatures } from 'pl-fe/hooks/use-features'; +import { useInstance } from 'pl-fe/hooks/use-instance'; +import { useSettings } from 'pl-fe/hooks/use-settings'; import { useModalsStore } from 'pl-fe/stores/modals'; import type { CreateAccountParams } from 'pl-api'; @@ -58,7 +58,6 @@ const RegistrationForm: React.FC = ({ inviteToken }) => { const needsConfirmation = instance.pleroma.metadata.account_activation_required; const needsApproval = instance.registrations.approval_required; - const supportsEmailList = features.emailList; const supportsAccountLookup = features.accountLookup; const birthdayRequired = instance.pleroma.metadata.birthday_required; const domains = instance.pleroma.metadata.multitenancy.enabled ? instance.pleroma.metadata.multitenancy.domains!.filter((domain) => domain.public) : undefined; @@ -364,16 +363,6 @@ const RegistrationForm: React.FC = ({ inviteToken }) => { /> - {supportsEmailList && ( - - - - )} - + ); + } + const handleJoin: React.EventHandler = (e) => { e.preventDefault(); diff --git a/packages/pl-fe/src/features/event/components/event-header.tsx b/packages/pl-fe/src/features/event/components/event-header.tsx index 07cdde057..6d458b100 100644 --- a/packages/pl-fe/src/features/event/components/event-header.tsx +++ b/packages/pl-fe/src/features/event/components/event-header.tsx @@ -20,10 +20,10 @@ import Stack from 'pl-fe/components/ui/stack'; import Text from 'pl-fe/components/ui/text'; import VerificationBadge from 'pl-fe/components/verification-badge'; import Emojify from 'pl-fe/features/emoji/emojify'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useFeatures } from 'pl-fe/hooks/useFeatures'; -import { useOwnAccount } from 'pl-fe/hooks/useOwnAccount'; -import { useSettings } from 'pl-fe/hooks/useSettings'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useFeatures } from 'pl-fe/hooks/use-features'; +import { useOwnAccount } from 'pl-fe/hooks/use-own-account'; +import { useSettings } from 'pl-fe/hooks/use-settings'; import { useChats } from 'pl-fe/queries/chats'; import { useModalsStore } from 'pl-fe/stores/modals'; import copy from 'pl-fe/utils/copy'; diff --git a/packages/pl-fe/src/features/event/event-discussion.tsx b/packages/pl-fe/src/features/event/event-discussion.tsx index 4ed638449..b104ba599 100644 --- a/packages/pl-fe/src/features/event/event-discussion.tsx +++ b/packages/pl-fe/src/features/event/event-discussion.tsx @@ -10,12 +10,12 @@ import Tombstone from 'pl-fe/components/tombstone'; import Stack from 'pl-fe/components/ui/stack'; import PlaceholderStatus from 'pl-fe/features/placeholder/components/placeholder-status'; import PendingStatus from 'pl-fe/features/ui/components/pending-status'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; import { makeGetStatus } from 'pl-fe/selectors'; import ComposeForm from '../compose/components/compose-form'; -import { getDescendantsIds } from '../status/components/thread'; +import { makeGetDescendantsIds } from '../status/components/thread'; import ThreadStatus from '../status/components/thread-status'; import type { MediaAttachment } from 'pl-api'; @@ -33,6 +33,7 @@ const EventDiscussion: React.FC = ({ params: { statusId: statu const dispatch = useAppDispatch(); const getStatus = useCallback(makeGetStatus(), []); + const getDescendantsIds = useCallback(makeGetDescendantsIds(), []); const status = useAppSelector(state => getStatus(state, { id: statusId })); const me = useAppSelector((state) => state.me); diff --git a/packages/pl-fe/src/features/event/event-information.tsx b/packages/pl-fe/src/features/event/event-information.tsx index a5d817df8..9c6554185 100644 --- a/packages/pl-fe/src/features/event/event-information.tsx +++ b/packages/pl-fe/src/features/event/event-information.tsx @@ -11,9 +11,9 @@ import Icon from 'pl-fe/components/ui/icon'; import Stack from 'pl-fe/components/ui/stack'; import Text from 'pl-fe/components/ui/text'; import QuotedStatus from 'pl-fe/features/status/containers/quoted-status-container'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; -import { usePlFeConfig } from 'pl-fe/hooks/usePlFeConfig'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; +import { usePlFeConfig } from 'pl-fe/hooks/use-pl-fe-config'; import { makeGetStatus } from 'pl-fe/selectors'; import { useModalsStore } from 'pl-fe/stores/modals'; diff --git a/packages/pl-fe/src/features/events/components/event-carousel.tsx b/packages/pl-fe/src/features/events/components/event-carousel.tsx index 050a6a622..726a1ee13 100644 --- a/packages/pl-fe/src/features/events/components/event-carousel.tsx +++ b/packages/pl-fe/src/features/events/components/event-carousel.tsx @@ -5,7 +5,7 @@ import ReactSwipeableViews from 'react-swipeable-views'; import EventPreview from 'pl-fe/components/event-preview'; import Card from 'pl-fe/components/ui/card'; import Icon from 'pl-fe/components/ui/icon'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; import { makeGetStatus } from 'pl-fe/selectors'; import PlaceholderEventPreview from '../../placeholder/components/placeholder-event-preview'; diff --git a/packages/pl-fe/src/features/events/index.tsx b/packages/pl-fe/src/features/events/index.tsx index 2f6c52538..764edbd41 100644 --- a/packages/pl-fe/src/features/events/index.tsx +++ b/packages/pl-fe/src/features/events/index.tsx @@ -6,8 +6,8 @@ import Button from 'pl-fe/components/ui/button'; import { CardBody, CardHeader, CardTitle } from 'pl-fe/components/ui/card'; import Column from 'pl-fe/components/ui/column'; import HStack from 'pl-fe/components/ui/hstack'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; import { useModalsStore } from 'pl-fe/stores/modals'; import EventCarousel from './components/event-carousel'; diff --git a/packages/pl-fe/src/features/export-data/components/csv-exporter.tsx b/packages/pl-fe/src/features/export-data/components/csv-exporter.tsx index 6fe25ab82..22506e969 100644 --- a/packages/pl-fe/src/features/export-data/components/csv-exporter.tsx +++ b/packages/pl-fe/src/features/export-data/components/csv-exporter.tsx @@ -5,7 +5,7 @@ import Button from 'pl-fe/components/ui/button'; import Form from 'pl-fe/components/ui/form'; import FormActions from 'pl-fe/components/ui/form-actions'; import Text from 'pl-fe/components/ui/text'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; import { AppDispatch, RootState } from 'pl-fe/store'; interface ICSVExporter { diff --git a/packages/pl-fe/src/features/external-login/components/external-login-form.tsx b/packages/pl-fe/src/features/external-login/components/external-login-form.tsx index 383bfa266..9c4e27cd9 100644 --- a/packages/pl-fe/src/features/external-login/components/external-login-form.tsx +++ b/packages/pl-fe/src/features/external-login/components/external-login-form.tsx @@ -8,7 +8,7 @@ import FormActions from 'pl-fe/components/ui/form-actions'; import FormGroup from 'pl-fe/components/ui/form-group'; import Input from 'pl-fe/components/ui/input'; import Spinner from 'pl-fe/components/ui/spinner'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; import toast from 'pl-fe/toast'; const messages = defineMessages({ diff --git a/packages/pl-fe/src/features/favourited-statuses/index.tsx b/packages/pl-fe/src/features/favourited-statuses/index.tsx index ca18af7cf..0d65f821f 100644 --- a/packages/pl-fe/src/features/favourited-statuses/index.tsx +++ b/packages/pl-fe/src/features/favourited-statuses/index.tsx @@ -5,13 +5,13 @@ import { defineMessages, FormattedMessage, useIntl } from 'react-intl'; import { fetchAccount, fetchAccountByUsername } from 'pl-fe/actions/accounts'; import { fetchFavouritedStatuses, expandFavouritedStatuses, fetchAccountFavouritedStatuses, expandAccountFavouritedStatuses } from 'pl-fe/actions/favourites'; -import { useAccountLookup } from 'pl-fe/api/hooks/accounts/useAccountLookup'; +import { useAccountLookup } from 'pl-fe/api/hooks/accounts/use-account-lookup'; import MissingIndicator from 'pl-fe/components/missing-indicator'; import StatusList from 'pl-fe/components/status-list'; import Column from 'pl-fe/components/ui/column'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; -import { useOwnAccount } from 'pl-fe/hooks/useOwnAccount'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; +import { useOwnAccount } from 'pl-fe/hooks/use-own-account'; const messages = defineMessages({ heading: { id: 'column.favourited_statuses', defaultMessage: 'Liked posts' }, diff --git a/packages/pl-fe/src/features/federation-restrictions/components/instance-restrictions.tsx b/packages/pl-fe/src/features/federation-restrictions/components/instance-restrictions.tsx index d86c748af..b537c292e 100644 --- a/packages/pl-fe/src/features/federation-restrictions/components/instance-restrictions.tsx +++ b/packages/pl-fe/src/features/federation-restrictions/components/instance-restrictions.tsx @@ -5,7 +5,7 @@ import Icon from 'pl-fe/components/icon'; import HStack from 'pl-fe/components/ui/hstack'; import Stack from 'pl-fe/components/ui/stack'; import Text from 'pl-fe/components/ui/text'; -import { useInstance } from 'pl-fe/hooks/useInstance'; +import { useInstance } from 'pl-fe/hooks/use-instance'; import type { RemoteInstance } from 'pl-fe/selectors'; diff --git a/packages/pl-fe/src/features/federation-restrictions/components/restricted-instance.tsx b/packages/pl-fe/src/features/federation-restrictions/components/restricted-instance.tsx index 004315fad..f709a9385 100644 --- a/packages/pl-fe/src/features/federation-restrictions/components/restricted-instance.tsx +++ b/packages/pl-fe/src/features/federation-restrictions/components/restricted-instance.tsx @@ -2,7 +2,7 @@ import clsx from 'clsx'; import React, { useState } from 'react'; import Icon from 'pl-fe/components/icon'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; import { makeGetRemoteInstance } from 'pl-fe/selectors'; import InstanceRestrictions from './instance-restrictions'; diff --git a/packages/pl-fe/src/features/federation-restrictions/index.tsx b/packages/pl-fe/src/features/federation-restrictions/index.tsx index 1f827d840..4fa825e32 100644 --- a/packages/pl-fe/src/features/federation-restrictions/index.tsx +++ b/packages/pl-fe/src/features/federation-restrictions/index.tsx @@ -4,8 +4,8 @@ import { defineMessages, useIntl } from 'react-intl'; import ScrollableList from 'pl-fe/components/scrollable-list'; import Accordion from 'pl-fe/components/ui/accordion'; import Column from 'pl-fe/components/ui/column'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; -import { useInstance } from 'pl-fe/hooks/useInstance'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; +import { useInstance } from 'pl-fe/hooks/use-instance'; import { makeGetHosts } from 'pl-fe/selectors'; import { federationRestrictionsDisclosed } from 'pl-fe/utils/state'; diff --git a/packages/pl-fe/src/features/feed-suggestions/feed-suggestions.tsx b/packages/pl-fe/src/features/feed-suggestions/feed-suggestions.tsx index 30229ff7e..2d6bff48c 100644 --- a/packages/pl-fe/src/features/feed-suggestions/feed-suggestions.tsx +++ b/packages/pl-fe/src/features/feed-suggestions/feed-suggestions.tsx @@ -2,13 +2,13 @@ import React from 'react'; import { defineMessages, useIntl } from 'react-intl'; import { Link } from 'react-router-dom'; -import { useAccount } from 'pl-fe/api/hooks/accounts/useAccount'; +import { useAccount } from 'pl-fe/api/hooks/accounts/use-account'; import Card, { CardBody, CardTitle } from 'pl-fe/components/ui/card'; import HStack from 'pl-fe/components/ui/hstack'; import Stack from 'pl-fe/components/ui/stack'; import Text from 'pl-fe/components/ui/text'; import VerificationBadge from 'pl-fe/components/verification-badge'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; import Emojify from '../emoji/emojify'; import ActionButton from '../ui/components/action-button'; diff --git a/packages/pl-fe/src/features/filters/edit-filter.tsx b/packages/pl-fe/src/features/filters/edit-filter.tsx index 113621db0..72c24c442 100644 --- a/packages/pl-fe/src/features/filters/edit-filter.tsx +++ b/packages/pl-fe/src/features/filters/edit-filter.tsx @@ -16,8 +16,8 @@ import Stack from 'pl-fe/components/ui/stack'; import Streamfield from 'pl-fe/components/ui/streamfield'; import Text from 'pl-fe/components/ui/text'; import Toggle from 'pl-fe/components/ui/toggle'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useFeatures } from 'pl-fe/hooks/useFeatures'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useFeatures } from 'pl-fe/hooks/use-features'; import toast from 'pl-fe/toast'; import { SelectDropdown } from '../forms'; diff --git a/packages/pl-fe/src/features/filters/index.tsx b/packages/pl-fe/src/features/filters/index.tsx index b4e99a219..37ba00068 100644 --- a/packages/pl-fe/src/features/filters/index.tsx +++ b/packages/pl-fe/src/features/filters/index.tsx @@ -10,9 +10,9 @@ import Column from 'pl-fe/components/ui/column'; import HStack from 'pl-fe/components/ui/hstack'; import Stack from 'pl-fe/components/ui/stack'; import Text from 'pl-fe/components/ui/text'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; -import { useFeatures } from 'pl-fe/hooks/useFeatures'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; +import { useFeatures } from 'pl-fe/hooks/use-features'; import toast from 'pl-fe/toast'; const messages = defineMessages({ diff --git a/packages/pl-fe/src/features/follow-requests/components/account-authorize.tsx b/packages/pl-fe/src/features/follow-requests/components/account-authorize.tsx index ecbf62c10..24b298e73 100644 --- a/packages/pl-fe/src/features/follow-requests/components/account-authorize.tsx +++ b/packages/pl-fe/src/features/follow-requests/components/account-authorize.tsx @@ -1,10 +1,10 @@ import React from 'react'; import { authorizeFollowRequest, rejectFollowRequest } from 'pl-fe/actions/accounts'; -import { useAccount } from 'pl-fe/api/hooks/accounts/useAccount'; +import { useAccount } from 'pl-fe/api/hooks/accounts/use-account'; import Account from 'pl-fe/components/account'; import { AuthorizeRejectButtons } from 'pl-fe/components/authorize-reject-buttons'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; interface IAccountAuthorize { id: string; diff --git a/packages/pl-fe/src/features/follow-requests/index.tsx b/packages/pl-fe/src/features/follow-requests/index.tsx index 2121537eb..01f845858 100644 --- a/packages/pl-fe/src/features/follow-requests/index.tsx +++ b/packages/pl-fe/src/features/follow-requests/index.tsx @@ -6,8 +6,8 @@ import { fetchFollowRequests, expandFollowRequests } from 'pl-fe/actions/account import ScrollableList from 'pl-fe/components/scrollable-list'; import Column from 'pl-fe/components/ui/column'; import Spinner from 'pl-fe/components/ui/spinner'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; import AccountAuthorize from './components/account-authorize'; diff --git a/packages/pl-fe/src/features/followed-tags/index.tsx b/packages/pl-fe/src/features/followed-tags/index.tsx index f69fb682d..2cc045093 100644 --- a/packages/pl-fe/src/features/followed-tags/index.tsx +++ b/packages/pl-fe/src/features/followed-tags/index.tsx @@ -7,8 +7,8 @@ import Hashtag from 'pl-fe/components/hashtag'; import ScrollableList from 'pl-fe/components/scrollable-list'; import Column from 'pl-fe/components/ui/column'; import PlaceholderHashtag from 'pl-fe/features/placeholder/components/placeholder-hashtag'; -import { useAppDispatch } from 'pl-fe/hooks/useAppDispatch'; -import { useAppSelector } from 'pl-fe/hooks/useAppSelector'; +import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch'; +import { useAppSelector } from 'pl-fe/hooks/use-app-selector'; const messages = defineMessages({ heading: { id: 'column.followed_tags', defaultMessage: 'Followed hashtags' }, diff --git a/packages/pl-fe/src/features/followers/index.tsx b/packages/pl-fe/src/features/followers/index.tsx index 83b4f35e0..f74e35ec8 100644 --- a/packages/pl-fe/src/features/followers/index.tsx +++ b/packages/pl-fe/src/features/followers/index.tsx @@ -1,8 +1,8 @@ import React from 'react'; import { defineMessages, FormattedMessage, useIntl } from 'react-intl'; -import { useFollowers } from 'pl-fe/api/hooks/accounts/useAccountList'; -import { useAccountLookup } from 'pl-fe/api/hooks/accounts/useAccountLookup'; +import { useFollowers } from 'pl-fe/api/hooks/accounts/use-account-list'; +import { useAccountLookup } from 'pl-fe/api/hooks/accounts/use-account-lookup'; import Account from 'pl-fe/components/account'; import MissingIndicator from 'pl-fe/components/missing-indicator'; import ScrollableList from 'pl-fe/components/scrollable-list'; diff --git a/packages/pl-fe/src/features/following/index.tsx b/packages/pl-fe/src/features/following/index.tsx index d555ff8eb..b97b9225d 100644 --- a/packages/pl-fe/src/features/following/index.tsx +++ b/packages/pl-fe/src/features/following/index.tsx @@ -1,8 +1,8 @@ import React from 'react'; import { defineMessages, FormattedMessage, useIntl } from 'react-intl'; -import { useFollowing } from 'pl-fe/api/hooks/accounts/useAccountList'; -import { useAccountLookup } from 'pl-fe/api/hooks/accounts/useAccountLookup'; +import { useFollowing } from 'pl-fe/api/hooks/accounts/use-account-list'; +import { useAccountLookup } from 'pl-fe/api/hooks/accounts/use-account-lookup'; import Account from 'pl-fe/components/account'; import MissingIndicator from 'pl-fe/components/missing-indicator'; import ScrollableList from 'pl-fe/components/scrollable-list'; diff --git a/packages/pl-fe/src/features/forms/index.tsx b/packages/pl-fe/src/features/forms/index.tsx index 01174c076..4d2bc814a 100644 --- a/packages/pl-fe/src/features/forms/index.tsx +++ b/packages/pl-fe/src/features/forms/index.tsx @@ -71,16 +71,6 @@ const LabelInput: React.FC = ({ label, ...props }) => ( ); -interface ILabelTextarea { - label?: React.ReactNode; -} - -const LabelTextarea: React.FC = ({ label, ...props }) => ( - -