diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..47078f4c8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/node_modules/ +yarn-error.log* diff --git a/.gitlab/issue_templates/Bug.md b/.gitlab/issue_templates/Bug.md deleted file mode 100644 index 579c32f66..000000000 --- a/.gitlab/issue_templates/Bug.md +++ /dev/null @@ -1,7 +0,0 @@ -### Environment - -* Soapbox version: -* Backend (Mastodon, Pleroma, etc): -* Browser/OS: - -### Bug description diff --git a/.gitlab/merge_request_templates/BeforeAndAfter.md b/.gitlab/merge_request_templates/BeforeAndAfter.md deleted file mode 100644 index 6e457a708..000000000 --- a/.gitlab/merge_request_templates/BeforeAndAfter.md +++ /dev/null @@ -1,8 +0,0 @@ -## Summary - - - -## Screenshots (if appropriate): -| Before | After | -| ------ | ----- | -| | | diff --git a/.gitlab/merge_request_templates/Default.md b/.gitlab/merge_request_templates/Default.md deleted file mode 100644 index 8a6192986..000000000 --- a/.gitlab/merge_request_templates/Default.md +++ /dev/null @@ -1,5 +0,0 @@ -## Summary - - - -## Screenshots (if appropriate): diff --git a/.vscode/soapbox.code-snippets b/.vscode/pl-fe.code-snippets similarity index 89% rename from .vscode/soapbox.code-snippets rename to .vscode/pl-fe.code-snippets index b31d50ff5..6fa3f098f 100644 --- a/.vscode/soapbox.code-snippets +++ b/.vscode/pl-fe.code-snippets @@ -1,5 +1,5 @@ { - // Place your Soapbox workspace snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and + // Place your pl-fe workspace snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and // description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope // is left empty or omitted, the snippet gets applied to all languages. The prefix is what is // used to trigger the snippet and the body will be expanded and inserted. Possible variables are: @@ -41,7 +41,7 @@ "body": [ "import React from 'react';", "", - "import { render, screen } from 'soapbox/jest/test-helpers';", + "import { render, screen } from 'pl-fe/jest/test-helpers';", "", "import ${1:Component} from '${2:..}';", "", diff --git a/packages/pl-fe/.dockerignore b/packages/pl-fe/.dockerignore index 2d53bc7e4..4cee1cc80 100644 --- a/packages/pl-fe/.dockerignore +++ b/packages/pl-fe/.dockerignore @@ -16,7 +16,7 @@ yarn-error.log* /static/ /public/ /dist/ -/soapbox.zip +/pl-fe.zip .idea .DS_Store diff --git a/packages/pl-fe/.gitignore b/packages/pl-fe/.gitignore index 176314352..5c5018c61 100644 --- a/packages/pl-fe/.gitignore +++ b/packages/pl-fe/.gitignore @@ -16,7 +16,7 @@ yarn-error.log* /static/ /public/ /dist/ -/soapbox.zip +/pl-fe.zip .idea .DS_Store diff --git a/packages/pl-fe/.gitlab-ci.yml b/packages/pl-fe/.gitlab-ci.yml deleted file mode 100644 index bec15cbe3..000000000 --- a/packages/pl-fe/.gitlab-ci.yml +++ /dev/null @@ -1,137 +0,0 @@ -image: node:21 - -variables: - NODE_ENV: test - DS_EXCLUDED_ANALYZERS: gemnasium-python - -default: - interruptible: true - -cache: &cache - key: - files: - - yarn.lock - paths: - - node_modules/ - policy: pull - -stages: - - deps - - test - - deploy - - release - -deps: - stage: deps - script: yarn install --ignore-scripts - only: - changes: - - yarn.lock - cache: - <<: *cache - policy: push - -lint: - stage: test - script: yarn lint - only: - changes: - - "**/*.js" - - "**/*.jsx" - - "**/*.cjs" - - "**/*.mjs" - - "**/*.ts" - - "**/*.tsx" - - "**/*.scss" - - "**/*.css" - - ".eslintignore" - - ".eslintrc.json" - - ".stylelintrc.json" - -build: - stage: test - before_script: - - apt-get update -y && apt-get install -y zip - script: - - yarn build - - cp dist/index.html dist/404.html - - cd dist && zip -r ../soapbox.zip . && cd .. - variables: - NODE_ENV: production - artifacts: - paths: - - soapbox.zip - -i18n: - stage: test - script: - - yarn i18n - - git diff --quiet || (echo "Locale files are out of date. Please run `yarn i18n`" && exit 1) - -docs-deploy: - stage: deploy - image: alpine:latest - before_script: - - apk add curl - script: - - curl -X POST -F"token=$CI_JOB_TOKEN" -F'ref=master' https://gitlab.com/api/v4/projects/15685485/trigger/pipeline - only: - variables: - - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME - changes: - - "docs/**/*" - -review: - stage: deploy - environment: - name: review/$CI_COMMIT_REF_NAME - url: https://$CI_COMMIT_REF_SLUG.git.soapbox.pub - before_script: - - apt-get update -y && apt-get install -y unzip - script: - - unzip soapbox.zip -d dist - - npx -y surge dist $CI_COMMIT_REF_SLUG.git.soapbox.pub - allow_failure: true - -pages: - stage: deploy - before_script: - - apt-get update -y && apt-get install -y unzip - script: - # artifacts are kept between jobs - - unzip soapbox.zip -d public - variables: - NODE_ENV: production - artifacts: - paths: - - public - only: - variables: - - $CI_DEFAULT_BRANCH == $CI_COMMIT_REF_NAME - -docker: - stage: deploy - image: docker:25.0.3 - services: - - docker:25.0.3-dind - tags: - - dind - # https://medium.com/devops-with-valentine/how-to-build-a-docker-image-and-push-it-to-the-gitlab-container-registry-from-a-gitlab-ci-pipeline-acac0d1f26df - script: - - echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER $CI_REGISTRY --password-stdin - - docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG . - - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG - rules: - - if: $CI_COMMIT_TAG - interruptible: false - -release: - stage: release - rules: - - if: $CI_COMMIT_TAG - script: - - npx tsx ./scripts/do-release.ts - interruptible: false - -include: - - template: Jobs/Dependency-Scanning.gitlab-ci.yml diff --git a/packages/pl-fe/compose-dev.yaml b/packages/pl-fe/compose-dev.yaml index 2359ac5ba..9bf017511 100644 --- a/packages/pl-fe/compose-dev.yaml +++ b/packages/pl-fe/compose-dev.yaml @@ -3,7 +3,7 @@ services: build: context: . dockerfile: Dockerfile.dev - image: soapbox-dev + image: pl-fe-dev ports: - "3036:3036" volumes: diff --git a/packages/pl-fe/installation/docker.conf.template b/packages/pl-fe/installation/docker.conf.template index 0938b756e..f23969cda 100644 --- a/packages/pl-fe/installation/docker.conf.template +++ b/packages/pl-fe/installation/docker.conf.template @@ -1,4 +1,4 @@ -# Soapbox Nginx for Docker. +# pl-fe Nginx for Docker. # It's intended to be used by the official nginx image, which has templating functionality. # Mount at: `/etc/nginx/templates/default.conf.template` @@ -11,7 +11,7 @@ map $http_upgrade $connection_upgrade { # ActivityPub routing. map $http_accept $activitypub_location { - default @soapbox; + default @pl-fe; "application/activity+json" @backend; 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"' @backend; } @@ -57,7 +57,7 @@ server { # Fallback route. # Try static files, then fall back to the SPA. location / { - try_files $uri @soapbox; + try_files $uri @pl-fe; } # Backend routes. @@ -72,21 +72,21 @@ server { try_files /dev/null $activitypub_location; } - # Soapbox build files. + # pl-fe build files. # New builds produce hashed filenames, so these should be cached heavily. location /packs { add_header Cache-Control "public, max-age=31536000, immutable"; add_header Strict-Transport-Security "max-age=31536000" always; } - # Soapbox ServiceWorker. + # pl-fe ServiceWorker. location = /sw.js { add_header Cache-Control "public, max-age=0"; add_header Strict-Transport-Security "max-age=31536000" always; } - # Soapbox SPA (Single Page App). - location @soapbox { + # pl-fe SPA (Single Page App). + location @pl-fe { try_files /index.html /dev/null; } diff --git a/packages/pl-fe/installation/mastodon.conf b/packages/pl-fe/installation/mastodon.conf index 906401763..6fd2e6f62 100644 --- a/packages/pl-fe/installation/mastodon.conf +++ b/packages/pl-fe/installation/mastodon.conf @@ -1,4 +1,4 @@ -# Nginx configuration for Soapbox atop Mastodon. +# Nginx configuration for pl-fe atop Mastodon. # Adapted from: https://github.com/mastodon/mastodon/blob/b4d373a3df2752d9f8bdc0d7f02350528f3789b2/dist/nginx.conf # # Edit this file to change occurrences of "example.com" to your own domain. @@ -14,7 +14,7 @@ map $http_upgrade $connection_upgrade { # ActivityPub routing. map $http_accept $activitypub_location { - default @soapbox; + default @pl-fe; "application/activity+json" @mastodon; 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"' @mastodon; } @@ -33,7 +33,7 @@ server { listen 80; listen [::]:80; server_name example.com; - root /opt/soapbox; + root /opt/pl-fe; location /.well-known/acme-challenge/ { allow all; } location / { return 301 https://$host$request_uri; } } @@ -58,7 +58,7 @@ server { sendfile on; client_max_body_size 80m; - root /opt/soapbox; + root /opt/pl-fe; gzip on; gzip_disable "msie6"; @@ -93,7 +93,7 @@ server { try_files /dev/null $activitypub_location; } - # Soapbox & Mastodon (frontend) build files. + # pl-fe & Mastodon (frontend) build files. # New builds produce hashed filenames, so these should be cached heavily. location /packs { add_header Cache-Control "public, max-age=31536000, immutable"; @@ -108,7 +108,7 @@ server { try_files $uri @mastodon-packs; } - # Soapbox configuration files. + # pl-fe configuration files. # Enable CORS so we can fetch them. location /instance { add_header Access-Control-Allow-Origin "*"; @@ -119,22 +119,22 @@ server { } } - # Soapbox ServiceWorker. + # pl-fe ServiceWorker. location = /sw.js { add_header Cache-Control "public, max-age=0"; add_header Strict-Transport-Security "max-age=31536000" always; } - # Soapbox SPA (Single Page App). - location @soapbox { + # pl-fe SPA (Single Page App). + location @pl-fe { try_files /index.html /dev/null; } - # Mastodon public files (fallback to Soapbox SPA). + # Mastodon public files (fallback to pl-fe SPA). # https://github.com/mastodon/mastodon/tree/main/public location @mastodon-public { root /home/mastodon/live/public; - try_files $uri @soapbox; + try_files $uri @pl-fe; } # Like Mastodon public, without fallback to SPA. @@ -142,8 +142,8 @@ server { root /home/mastodon/live/public; } - # Soapbox & Mastodon static files. - # Try Soapbox first, Mastodon, then fall back to the SPA. + # pl-fe & Mastodon static files. + # Try pl-fe first, Mastodon, then fall back to the SPA. location @static-files { try_files $uri @mastodon-public; } diff --git a/packages/pl-fe/src/__fixtures__/intlMessages.json b/packages/pl-fe/src/__fixtures__/intlMessages.json index 30ce6f35c..e2bd3bd56 100644 --- a/packages/pl-fe/src/__fixtures__/intlMessages.json +++ b/packages/pl-fe/src/__fixtures__/intlMessages.json @@ -261,7 +261,7 @@ "morefollows.following_label": "…and {count} more {count, plural, one {follow} other {follows}} on remote sites.", "mute_modal.hide_notifications": "Hide notifications from this user?", "navigation_bar.admin_settings": "Admin settings", - "navigation_bar.soapbox_config": "Soapbox config", + "navigation_bar.plfe_config": "Soapbox config", "navigation_bar.blocks": "Blocked users", "navigation_bar.community_timeline": "Local timeline", "navigation_bar.compose": "Compose new post", @@ -740,7 +740,7 @@ "morefollows.following_label": "…and {count} more {count, plural, one {follow} other {follows}} on remote sites.", "mute_modal.hide_notifications": "Hide notifications from this user?", "navigation_bar.admin_settings": "Admin settings", - "navigation_bar.soapbox_config": "Soapbox config", + "navigation_bar.plfe_config": "Soapbox config", "navigation_bar.blocks": "Blocked users", "navigation_bar.community_timeline": "Local timeline", "navigation_bar.compose": "Compose new post", diff --git a/packages/pl-fe/src/__fixtures__/soapbox.json b/packages/pl-fe/src/__fixtures__/pl-fe.json similarity index 100% rename from packages/pl-fe/src/__fixtures__/soapbox.json rename to packages/pl-fe/src/__fixtures__/pl-fe.json diff --git a/packages/pl-fe/src/__fixtures__/spinster-soapbox.json b/packages/pl-fe/src/__fixtures__/spinster-soapbox.json deleted file mode 100644 index 8f3ed63fa..000000000 --- a/packages/pl-fe/src/__fixtures__/spinster-soapbox.json +++ /dev/null @@ -1,119 +0,0 @@ -{ - "allowedEmoji": [ - "👍", - "❤️", - "😆", - "😮", - "😢", - "😡", - "😩" - ], - "brandColor": "#990099", - "copyright": "♡2021. Copying is an act of love. Please copy and share.", - "cryptoAddresses": [ - { - "address": "bc1qv7lk3algpfg4zpyuhvxfm0uza9ck4parz3y3l5", - "note": "", - "ticker": "btc" - }, - { - "address": "0xadc66B63bFee7677CD27CFb81b16a8860f1A1226", - "note": "", - "ticker": "eth" - }, - { - "address": "DSf7UmRf7DGGsjh4QYhzQaqtjJMTXZ8k79", - "note": "", - "ticker": "doge" - }, - { - "address": "ltc1q642pnkuvw0gpuuvddw6vafvl9hhp3efyl9mnqz", - "note": "", - "ticker": "ltc" - }, - { - "address": "t1faHDsoa4bd3pGaLjaU7DiuUtBPzbnEEse", - "note": "", - "ticker": "zec" - }, - { - "address": "XchTLkcSMsDoZGESwr4tqtxSU5dideAZVQ", - "note": "", - "ticker": "dash" - }, - { - "address": "bitcoincash:qp8f80z27294phmhdk55yf05p3f0tkxl4v9r2aavw5", - "note": "", - "ticker": "bch" - } - ], - "cryptoDonatePanel": { - "limit": 1 - }, - "customCss": [ - "/instance/spinster.css" - ], - "defaultSettings": { - "autoPlayGif": false, - "themeMode": "light" - }, - "extensions": { - "patron": { - "enabled": true - } - }, - "logo": "https://spinster.xyz/instance/images/spinster-logo.svg", - "navlinks": { - "homeFooter": [ - { - "title": "About", - "url": "/about" - }, - { - "title": "Terms of Service", - "url": "/about/tos" - }, - { - "title": "Privacy Policy", - "url": "/about/privacy" - }, - { - "title": "DMCA", - "url": "/about/dmca" - }, - { - "title": "Source Code", - "url": "/about#opensource" - } - ] - }, - "promoPanel": { - "items": [ - { - "icon": "shopping-basket", - "text": "Buy Spinster Merch", - "url": "https://shop.4w.pub/collections/spinster" - }, - { - "icon": "eye-slash", - "text": "Privacy Guide", - "url": "https://4w.pub/your-guide-to-spinster-privacy-options/" - }, - { - "icon": "question-circle", - "text": "Spinster FAQs", - "url": "https://spinster.xyz/about#faqs" - }, - { - "icon": "bug", - "text": "Report a Bug", - "url": "https://gitlab.com/soapbox-pub/soapbox-fe/-/issues/" - }, - { - "icon": "fediverse", - "text": "About the Fediverse", - "url": "https://jointhefedi.com/" - } - ] - } -} diff --git a/packages/pl-fe/src/actions/about.test.ts b/packages/pl-fe/src/actions/about.test.ts index 5c8ecba63..edc1c939c 100644 --- a/packages/pl-fe/src/actions/about.test.ts +++ b/packages/pl-fe/src/actions/about.test.ts @@ -1,8 +1,8 @@ // import MockAdapter from 'axios-mock-adapter'; import { Map as ImmutableMap } from 'immutable'; -// import { staticClient } from 'soapbox/api'; -import { mockStore } from 'soapbox/jest/test-helpers'; +// import { staticClient } from 'pl-fe/api'; +import { mockStore } from 'pl-fe/jest/test-helpers'; import { FETCH_ABOUT_PAGE_REQUEST, diff --git a/packages/pl-fe/src/actions/about.ts b/packages/pl-fe/src/actions/about.ts index 376211e43..2dfcf41c2 100644 --- a/packages/pl-fe/src/actions/about.ts +++ b/packages/pl-fe/src/actions/about.ts @@ -1,7 +1,7 @@ import { staticFetch } from '../api'; import type { AnyAction } from 'redux'; -import type { RootState } from 'soapbox/store'; +import type { RootState } from 'pl-fe/store'; const FETCH_ABOUT_PAGE_REQUEST = 'FETCH_ABOUT_PAGE_REQUEST' as const; const FETCH_ABOUT_PAGE_SUCCESS = 'FETCH_ABOUT_PAGE_SUCCESS' as const; diff --git a/packages/pl-fe/src/actions/account-notes.test.ts b/packages/pl-fe/src/actions/account-notes.test.ts index 5cd45f26e..e766e6527 100644 --- a/packages/pl-fe/src/actions/account-notes.test.ts +++ b/packages/pl-fe/src/actions/account-notes.test.ts @@ -1,5 +1,5 @@ -import { __stub } from 'soapbox/api'; -import { mockStore, rootState } from 'soapbox/jest/test-helpers'; +import { __stub } from 'pl-fe/api'; +import { mockStore, rootState } from 'pl-fe/jest/test-helpers'; import { submitAccountNote } from './account-notes'; diff --git a/packages/pl-fe/src/actions/account-notes.ts b/packages/pl-fe/src/actions/account-notes.ts index 750090929..66f3d52b6 100644 --- a/packages/pl-fe/src/actions/account-notes.ts +++ b/packages/pl-fe/src/actions/account-notes.ts @@ -1,7 +1,7 @@ import { getClient } from '../api'; import type { AnyAction } from 'redux'; -import type { RootState } from 'soapbox/store'; +import type { RootState } from 'pl-fe/store'; const ACCOUNT_NOTE_SUBMIT_REQUEST = 'ACCOUNT_NOTE_SUBMIT_REQUEST' as const; const ACCOUNT_NOTE_SUBMIT_SUCCESS = 'ACCOUNT_NOTE_SUBMIT_SUCCESS' as const; diff --git a/packages/pl-fe/src/actions/accounts.test.ts b/packages/pl-fe/src/actions/accounts.test.ts index ff4517d5c..1b0b7e0c7 100644 --- a/packages/pl-fe/src/actions/accounts.test.ts +++ b/packages/pl-fe/src/actions/accounts.test.ts @@ -1,10 +1,10 @@ import { Map as ImmutableMap } from 'immutable'; -import { __stub } from 'soapbox/api'; -import { buildInstance, buildRelationship } from 'soapbox/jest/factory'; -import { mockStore, rootState } from 'soapbox/jest/test-helpers'; -import { normalizeAccount } from 'soapbox/normalizers'; -import { ListRecord, ReducerRecord } from 'soapbox/reducers/user-lists'; +import { __stub } from 'pl-fe/api'; +import { buildInstance, buildRelationship } from 'pl-fe/jest/factory'; +import { mockStore, rootState } from 'pl-fe/jest/test-helpers'; +import { normalizeAccount } from 'pl-fe/normalizers'; +import { ListRecord, ReducerRecord } from 'pl-fe/reducers/user-lists'; import { authorizeFollowRequest, @@ -95,7 +95,7 @@ describe('fetchAccount()', () => { }); describe('with a successful API request', async () => { - const account = await import('soapbox/__fixtures__/pleroma-account.json'); + const account = await import('pl-fe/__fixtures__/pleroma-account.json'); beforeEach(() => { const state = rootState; diff --git a/packages/pl-fe/src/actions/accounts.ts b/packages/pl-fe/src/actions/accounts.ts index ad53e5aab..e0f27c4cd 100644 --- a/packages/pl-fe/src/actions/accounts.ts +++ b/packages/pl-fe/src/actions/accounts.ts @@ -1,18 +1,18 @@ import { PLEROMA, type UpdateNotificationSettingsParams, type Account, type CreateAccountParams, type PaginatedResponse, type Relationship } from 'pl-api'; -import { importEntities } from 'soapbox/entity-store/actions'; -import { Entities } from 'soapbox/entity-store/entities'; -import { selectAccount } from 'soapbox/selectors'; -import { isLoggedIn } from 'soapbox/utils/auth'; +import { importEntities } from 'pl-fe/entity-store/actions'; +import { Entities } from 'pl-fe/entity-store/entities'; +import { selectAccount } from 'pl-fe/selectors'; +import { isLoggedIn } from 'pl-fe/utils/auth'; import { getClient, type PlfeResponse } from '../api'; import { importFetchedAccount, importFetchedAccounts } from './importer'; import type { Map as ImmutableMap } from 'immutable'; -import type { MinifiedStatus } from 'soapbox/reducers/statuses'; -import type { AppDispatch, RootState } from 'soapbox/store'; -import type { History } from 'soapbox/types/history'; +import type { MinifiedStatus } from 'pl-fe/reducers/statuses'; +import type { AppDispatch, RootState } from 'pl-fe/store'; +import type { History } from 'pl-fe/types/history'; const ACCOUNT_CREATE_REQUEST = 'ACCOUNT_CREATE_REQUEST' as const; const ACCOUNT_CREATE_SUCCESS = 'ACCOUNT_CREATE_SUCCESS' as const; diff --git a/packages/pl-fe/src/actions/admin.ts b/packages/pl-fe/src/actions/admin.ts index 0e9c8da4a..48e8bd746 100644 --- a/packages/pl-fe/src/actions/admin.ts +++ b/packages/pl-fe/src/actions/admin.ts @@ -1,13 +1,13 @@ -import { fetchRelationships } from 'soapbox/actions/accounts'; -import { importFetchedAccount, importFetchedAccounts, importFetchedStatuses } from 'soapbox/actions/importer'; -import { accountIdsToAccts } from 'soapbox/selectors'; -import { filterBadges, getTagDiff } from 'soapbox/utils/badges'; +import { fetchRelationships } from 'pl-fe/actions/accounts'; +import { importFetchedAccount, importFetchedAccounts, importFetchedStatuses } from 'pl-fe/actions/importer'; +import { accountIdsToAccts } from 'pl-fe/selectors'; +import { filterBadges, getTagDiff } from 'pl-fe/utils/badges'; import { getClient } from '../api'; import type { Account, AdminGetAccountsParams, AdminGetReportsParams } from 'pl-api'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const ADMIN_CONFIG_FETCH_REQUEST = 'ADMIN_CONFIG_FETCH_REQUEST' as const; const ADMIN_CONFIG_FETCH_SUCCESS = 'ADMIN_CONFIG_FETCH_SUCCESS' as const; @@ -89,7 +89,7 @@ const updateConfig = (configs: Record[]) => }); }; -const updateSoapboxConfig = (data: Record) => +const updatePlFeConfig = (data: Record) => (dispatch: AppDispatch) => { const params = [{ group: ':pleroma', @@ -380,7 +380,7 @@ export { ADMIN_USER_INDEX_QUERY_SET, fetchConfig, updateConfig, - updateSoapboxConfig, + updatePlFeConfig, fetchReports, closeReport, fetchUsers, diff --git a/packages/pl-fe/src/actions/aliases.ts b/packages/pl-fe/src/actions/aliases.ts index 837f8d4f8..c0af413d2 100644 --- a/packages/pl-fe/src/actions/aliases.ts +++ b/packages/pl-fe/src/actions/aliases.ts @@ -1,15 +1,15 @@ import { defineMessages } from 'react-intl'; -import toast from 'soapbox/toast'; -import { isLoggedIn } from 'soapbox/utils/auth'; +import toast from 'pl-fe/toast'; +import { isLoggedIn } from 'pl-fe/utils/auth'; import { getClient } from '../api'; import { importFetchedAccounts } from './importer'; import type { Account as BaseAccount } from 'pl-api'; -import type { Account } from 'soapbox/normalizers'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { Account } from 'pl-fe/normalizers'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const ALIASES_FETCH_REQUEST = 'ALIASES_FETCH_REQUEST' as const; const ALIASES_FETCH_SUCCESS = 'ALIASES_FETCH_SUCCESS' as const; diff --git a/packages/pl-fe/src/actions/apps.ts b/packages/pl-fe/src/actions/apps.ts index 3e2b36c05..e9c509283 100644 --- a/packages/pl-fe/src/actions/apps.ts +++ b/packages/pl-fe/src/actions/apps.ts @@ -2,13 +2,13 @@ * Apps: manage OAuth applications. * Particularly useful for auth. * https://docs.joinmastodon.org/methods/apps/ - * @module soapbox/actions/apps - * @see module:soapbox/actions/auth + * @module pl-fe/actions/apps + * @see module:pl-fe/actions/auth */ import { PlApiClient, type CreateApplicationParams } from 'pl-api'; -import * as BuildConfig from 'soapbox/build-config'; +import * as BuildConfig from 'pl-fe/build-config'; import type { AnyAction } from 'redux'; diff --git a/packages/pl-fe/src/actions/auth.ts b/packages/pl-fe/src/actions/auth.ts index d6b4d2815..c57726e9d 100644 --- a/packages/pl-fe/src/actions/auth.ts +++ b/packages/pl-fe/src/actions/auth.ts @@ -1,37 +1,37 @@ /** * Auth: login & registration workflow. * This file contains abstractions over auth concepts. - * @module soapbox/actions/auth - * @see module:soapbox/actions/apps - * @see module:soapbox/actions/oauth - * @see module:soapbox/actions/security + * @module pl-fe/actions/auth + * @see module:pl-fe/actions/apps + * @see module:pl-fe/actions/oauth + * @see module:pl-fe/actions/security */ import { credentialAccountSchema, PlApiClient, type CreateAccountParams, type Token } from 'pl-api'; import { defineMessages } from 'react-intl'; -import { createAccount } from 'soapbox/actions/accounts'; -import { createApp } from 'soapbox/actions/apps'; -import { fetchMeSuccess, fetchMeFail } from 'soapbox/actions/me'; -import { obtainOAuthToken, revokeOAuthToken } from 'soapbox/actions/oauth'; -import { startOnboarding } from 'soapbox/actions/onboarding'; -import * as BuildConfig from 'soapbox/build-config'; -import { custom } from 'soapbox/custom'; -import { queryClient } from 'soapbox/queries/client'; -import { selectAccount } from 'soapbox/selectors'; -import { unsetSentryAccount } from 'soapbox/sentry'; -import KVStore from 'soapbox/storage/kv-store'; -import toast from 'soapbox/toast'; -import { getLoggedInAccount, parseBaseURL } from 'soapbox/utils/auth'; -import sourceCode from 'soapbox/utils/code'; -import { normalizeUsername } from 'soapbox/utils/input'; -import { getScopes } from 'soapbox/utils/scopes'; -import { isStandalone } from 'soapbox/utils/state'; +import { createAccount } from 'pl-fe/actions/accounts'; +import { createApp } from 'pl-fe/actions/apps'; +import { fetchMeSuccess, fetchMeFail } from 'pl-fe/actions/me'; +import { obtainOAuthToken, revokeOAuthToken } from 'pl-fe/actions/oauth'; +import { startOnboarding } from 'pl-fe/actions/onboarding'; +import * as BuildConfig from 'pl-fe/build-config'; +import { custom } from 'pl-fe/custom'; +import { queryClient } from 'pl-fe/queries/client'; +import { selectAccount } from 'pl-fe/selectors'; +import { unsetSentryAccount } from 'pl-fe/sentry'; +import KVStore from 'pl-fe/storage/kv-store'; +import toast from 'pl-fe/toast'; +import { getLoggedInAccount, parseBaseURL } from 'pl-fe/utils/auth'; +import sourceCode from 'pl-fe/utils/code'; +import { normalizeUsername } from 'pl-fe/utils/input'; +import { getScopes } from 'pl-fe/utils/scopes'; +import { isStandalone } from 'pl-fe/utils/state'; import { type PlfeResponse, getClient } from '../api'; import { importFetchedAccount } from './importer'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const SWITCH_ACCOUNT = 'SWITCH_ACCOUNT' as const; diff --git a/packages/pl-fe/src/actions/backups.ts b/packages/pl-fe/src/actions/backups.ts index 9651f50b9..4a3d85994 100644 --- a/packages/pl-fe/src/actions/backups.ts +++ b/packages/pl-fe/src/actions/backups.ts @@ -1,6 +1,6 @@ import { getClient } from '../api'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const BACKUPS_FETCH_REQUEST = 'BACKUPS_FETCH_REQUEST' as const; const BACKUPS_FETCH_SUCCESS = 'BACKUPS_FETCH_SUCCESS' as const; diff --git a/packages/pl-fe/src/actions/bookmarks.ts b/packages/pl-fe/src/actions/bookmarks.ts index bef80aedd..276e1b397 100644 --- a/packages/pl-fe/src/actions/bookmarks.ts +++ b/packages/pl-fe/src/actions/bookmarks.ts @@ -3,7 +3,7 @@ import { getClient } from '../api'; import { importFetchedStatuses } from './importer'; import type { PaginatedResponse, Status } from 'pl-api'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const BOOKMARKED_STATUSES_FETCH_REQUEST = 'BOOKMARKED_STATUSES_FETCH_REQUEST' as const; const BOOKMARKED_STATUSES_FETCH_SUCCESS = 'BOOKMARKED_STATUSES_FETCH_SUCCESS' as const; diff --git a/packages/pl-fe/src/actions/chats.ts b/packages/pl-fe/src/actions/chats.ts index 88c8485a4..84feba642 100644 --- a/packages/pl-fe/src/actions/chats.ts +++ b/packages/pl-fe/src/actions/chats.ts @@ -1,6 +1,6 @@ -import { getSettings, changeSetting } from 'soapbox/actions/settings'; +import { getSettings, changeSetting } from 'pl-fe/actions/settings'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const toggleMainWindow = () => (dispatch: AppDispatch, getState: () => RootState) => { diff --git a/packages/pl-fe/src/actions/circle.ts b/packages/pl-fe/src/actions/circle.ts index 178f079a5..fdc999153 100644 --- a/packages/pl-fe/src/actions/circle.ts +++ b/packages/pl-fe/src/actions/circle.ts @@ -1,9 +1,9 @@ // Loosely adapted from twitter-interaction-circles, licensed under MIT License // https://github.com/duiker101/twitter-interaction-circles -import { getClient } from 'soapbox/api'; +import { getClient } from 'pl-fe/api'; import type { PaginatedResponse, Status } from 'pl-api'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { AppDispatch, RootState } from 'pl-fe/store'; interface Interaction { acct: string; diff --git a/packages/pl-fe/src/actions/compose.test.ts b/packages/pl-fe/src/actions/compose.test.ts index 74fbde610..f3ea0e29f 100644 --- a/packages/pl-fe/src/actions/compose.test.ts +++ b/packages/pl-fe/src/actions/compose.test.ts @@ -1,8 +1,8 @@ import { OrderedSet as ImmutableOrderedSet } from 'immutable'; -import { buildInstance } from 'soapbox/jest/factory'; -import { mockStore, rootState } from 'soapbox/jest/test-helpers'; -import { ReducerCompose } from 'soapbox/reducers/compose'; +import { buildInstance } from 'pl-fe/jest/factory'; +import { mockStore, rootState } from 'pl-fe/jest/test-helpers'; +import { ReducerCompose } from 'pl-fe/reducers/compose'; import { uploadCompose, submitCompose } from './compose'; import { STATUS_CREATE_REQUEST } from './statuses'; diff --git a/packages/pl-fe/src/actions/compose.ts b/packages/pl-fe/src/actions/compose.ts index 55a1bfb4a..a0f9bae13 100644 --- a/packages/pl-fe/src/actions/compose.ts +++ b/packages/pl-fe/src/actions/compose.ts @@ -1,14 +1,14 @@ import throttle from 'lodash/throttle'; import { defineMessages, IntlShape } from 'react-intl'; -import { getClient } from 'soapbox/api'; -import { isNativeEmoji } from 'soapbox/features/emoji'; -import emojiSearch from 'soapbox/features/emoji/search'; -import { Language } from 'soapbox/features/preferences'; -import { selectAccount, selectOwnAccount, makeGetAccount } from 'soapbox/selectors'; -import { tagHistory } from 'soapbox/settings'; -import toast from 'soapbox/toast'; -import { isLoggedIn } from 'soapbox/utils/auth'; +import { getClient } from 'pl-fe/api'; +import { isNativeEmoji } from 'pl-fe/features/emoji'; +import emojiSearch from 'pl-fe/features/emoji/search'; +import { Language } from 'pl-fe/features/preferences'; +import { selectAccount, selectOwnAccount, makeGetAccount } from 'pl-fe/selectors'; +import { tagHistory } from 'pl-fe/settings'; +import toast from 'pl-fe/toast'; +import { isLoggedIn } from 'pl-fe/utils/auth'; import { chooseEmoji } from './emojis'; import { importFetchedAccounts } from './importer'; @@ -20,11 +20,11 @@ import { createStatus } from './statuses'; import type { EditorState } from 'lexical'; import type { Account as BaseAccount, BackendVersion, CreateStatusParams, Group, MediaAttachment, Status as BaseStatus, Tag, Poll, ScheduledStatus } from 'pl-api'; -import type { AutoSuggestion } from 'soapbox/components/autosuggest-input'; -import type { Emoji } from 'soapbox/features/emoji'; -import type { Account, Status } from 'soapbox/normalizers'; -import type { AppDispatch, RootState } from 'soapbox/store'; -import type { History } from 'soapbox/types/history'; +import type { AutoSuggestion } from 'pl-fe/components/autosuggest-input'; +import type { Emoji } from 'pl-fe/features/emoji'; +import type { Account, Status } from 'pl-fe/normalizers'; +import type { AppDispatch, RootState } from 'pl-fe/store'; +import type { History } from 'pl-fe/types/history'; let cancelFetchComposeSuggestions = new AbortController(); diff --git a/packages/pl-fe/src/actions/consumer-auth.ts b/packages/pl-fe/src/actions/consumer-auth.ts index 6284408a9..12442e21d 100644 --- a/packages/pl-fe/src/actions/consumer-auth.ts +++ b/packages/pl-fe/src/actions/consumer-auth.ts @@ -1,13 +1,13 @@ import queryString from 'query-string'; -import * as BuildConfig from 'soapbox/build-config'; -import { isURL } from 'soapbox/utils/auth'; -import sourceCode from 'soapbox/utils/code'; -import { getScopes } from 'soapbox/utils/scopes'; +import * as BuildConfig from 'pl-fe/build-config'; +import { isURL } from 'pl-fe/utils/auth'; +import sourceCode from 'pl-fe/utils/code'; +import { getScopes } from 'pl-fe/utils/scopes'; import { createApp } from './apps'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const createProviderApp = () => async(dispatch: AppDispatch, getState: () => RootState) => { diff --git a/packages/pl-fe/src/actions/conversations.ts b/packages/pl-fe/src/actions/conversations.ts index a0fe31145..3f4a26ba7 100644 --- a/packages/pl-fe/src/actions/conversations.ts +++ b/packages/pl-fe/src/actions/conversations.ts @@ -1,4 +1,4 @@ -import { isLoggedIn } from 'soapbox/utils/auth'; +import { isLoggedIn } from 'pl-fe/utils/auth'; import { getClient } from '../api'; @@ -9,7 +9,7 @@ import { } from './importer'; import type { Account, Conversation, PaginatedResponse, Status } from 'pl-api'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const CONVERSATIONS_MOUNT = 'CONVERSATIONS_MOUNT' as const; const CONVERSATIONS_UNMOUNT = 'CONVERSATIONS_UNMOUNT' as const; diff --git a/packages/pl-fe/src/actions/custom-emojis.ts b/packages/pl-fe/src/actions/custom-emojis.ts index 03d6965d8..f5733b8fc 100644 --- a/packages/pl-fe/src/actions/custom-emojis.ts +++ b/packages/pl-fe/src/actions/custom-emojis.ts @@ -1,7 +1,7 @@ import { getClient } from '../api'; import type { CustomEmoji } from 'pl-api'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const CUSTOM_EMOJIS_FETCH_REQUEST = 'CUSTOM_EMOJIS_FETCH_REQUEST' as const; const CUSTOM_EMOJIS_FETCH_SUCCESS = 'CUSTOM_EMOJIS_FETCH_SUCCESS' as const; diff --git a/packages/pl-fe/src/actions/directory.ts b/packages/pl-fe/src/actions/directory.ts index c02dcad74..14a5e8151 100644 --- a/packages/pl-fe/src/actions/directory.ts +++ b/packages/pl-fe/src/actions/directory.ts @@ -4,7 +4,7 @@ import { fetchRelationships } from './accounts'; import { importFetchedAccounts } from './importer'; import type { Account, ProfileDirectoryParams } from 'pl-api'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const DIRECTORY_FETCH_REQUEST = 'DIRECTORY_FETCH_REQUEST' as const; const DIRECTORY_FETCH_SUCCESS = 'DIRECTORY_FETCH_SUCCESS' as const; diff --git a/packages/pl-fe/src/actions/domain-blocks.ts b/packages/pl-fe/src/actions/domain-blocks.ts index a0d7361c1..8787c8227 100644 --- a/packages/pl-fe/src/actions/domain-blocks.ts +++ b/packages/pl-fe/src/actions/domain-blocks.ts @@ -1,12 +1,12 @@ -import { Entities } from 'soapbox/entity-store/entities'; -import { isLoggedIn } from 'soapbox/utils/auth'; +import { Entities } from 'pl-fe/entity-store/entities'; +import { isLoggedIn } from 'pl-fe/utils/auth'; import { getClient } from '../api'; import type { PaginatedResponse } from 'pl-api'; -import type { EntityStore } from 'soapbox/entity-store/types'; -import type { Account } from 'soapbox/normalizers'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { EntityStore } from 'pl-fe/entity-store/types'; +import type { Account } from 'pl-fe/normalizers'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const DOMAIN_BLOCK_REQUEST = 'DOMAIN_BLOCK_REQUEST' as const; const DOMAIN_BLOCK_SUCCESS = 'DOMAIN_BLOCK_SUCCESS' as const; diff --git a/packages/pl-fe/src/actions/draft-statuses.ts b/packages/pl-fe/src/actions/draft-statuses.ts index 5ff5ca8e0..09acdfae5 100644 --- a/packages/pl-fe/src/actions/draft-statuses.ts +++ b/packages/pl-fe/src/actions/draft-statuses.ts @@ -1,9 +1,9 @@ import { v4 as uuid } from 'uuid'; -import { makeGetAccount } from 'soapbox/selectors'; -import KVStore from 'soapbox/storage/kv-store'; +import { makeGetAccount } from 'pl-fe/selectors'; +import KVStore from 'pl-fe/storage/kv-store'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const DRAFT_STATUSES_FETCH_SUCCESS = 'DRAFT_STATUSES_FETCH_SUCCESS'; diff --git a/packages/pl-fe/src/actions/emoji-reacts.ts b/packages/pl-fe/src/actions/emoji-reacts.ts index a9930a6c1..66b6527c4 100644 --- a/packages/pl-fe/src/actions/emoji-reacts.ts +++ b/packages/pl-fe/src/actions/emoji-reacts.ts @@ -1,4 +1,4 @@ -import { isLoggedIn } from 'soapbox/utils/auth'; +import { isLoggedIn } from 'pl-fe/utils/auth'; import { getClient } from '../api'; @@ -6,7 +6,7 @@ import { importFetchedStatus } from './importer'; import { favourite, unfavourite } from './interactions'; import type { EmojiReaction, Status } from 'pl-api'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const EMOJI_REACT_REQUEST = 'EMOJI_REACT_REQUEST' as const; const EMOJI_REACT_SUCCESS = 'EMOJI_REACT_SUCCESS' as const; diff --git a/packages/pl-fe/src/actions/emojis.ts b/packages/pl-fe/src/actions/emojis.ts index 2a959fcc3..b4b949314 100644 --- a/packages/pl-fe/src/actions/emojis.ts +++ b/packages/pl-fe/src/actions/emojis.ts @@ -1,7 +1,7 @@ import { saveSettings } from './settings'; -import type { Emoji } from 'soapbox/features/emoji'; -import type { AppDispatch } from 'soapbox/store'; +import type { Emoji } from 'pl-fe/features/emoji'; +import type { AppDispatch } from 'pl-fe/store'; const EMOJI_CHOOSE = 'EMOJI_CHOOSE'; diff --git a/packages/pl-fe/src/actions/events.ts b/packages/pl-fe/src/actions/events.ts index 611d88438..3f7d07d71 100644 --- a/packages/pl-fe/src/actions/events.ts +++ b/packages/pl-fe/src/actions/events.ts @@ -1,7 +1,7 @@ import { defineMessages, IntlShape } from 'react-intl'; -import { getClient } from 'soapbox/api'; -import toast from 'soapbox/toast'; +import { getClient } from 'pl-fe/api'; +import toast from 'pl-fe/toast'; import { importFetchedAccounts, importFetchedStatus, importFetchedStatuses } from './importer'; import { uploadFile } from './media'; @@ -13,8 +13,8 @@ import { } from './statuses'; import type { Account, CreateEventParams, MediaAttachment, PaginatedResponse, Status } from 'pl-api'; -import type { MinifiedStatus } from 'soapbox/reducers/statuses'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { MinifiedStatus } from 'pl-fe/reducers/statuses'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const LOCATION_SEARCH_REQUEST = 'LOCATION_SEARCH_REQUEST' as const; const LOCATION_SEARCH_SUCCESS = 'LOCATION_SEARCH_SUCCESS' as const; diff --git a/packages/pl-fe/src/actions/export-data.ts b/packages/pl-fe/src/actions/export-data.ts index b3e68aa3e..f360ae167 100644 --- a/packages/pl-fe/src/actions/export-data.ts +++ b/packages/pl-fe/src/actions/export-data.ts @@ -1,11 +1,11 @@ import { defineMessages } from 'react-intl'; -import { getClient } from 'soapbox/api'; -import { normalizeAccount } from 'soapbox/normalizers'; -import toast from 'soapbox/toast'; +import { getClient } from 'pl-fe/api'; +import { normalizeAccount } from 'pl-fe/normalizers'; +import toast from 'pl-fe/toast'; import type { Account, PaginatedResponse } from 'pl-api'; -import type { RootState } from 'soapbox/store'; +import type { RootState } from 'pl-fe/store'; const EXPORT_FOLLOWS_REQUEST = 'EXPORT_FOLLOWS_REQUEST' as const; const EXPORT_FOLLOWS_SUCCESS = 'EXPORT_FOLLOWS_SUCCESS' as const; diff --git a/packages/pl-fe/src/actions/external-auth.ts b/packages/pl-fe/src/actions/external-auth.ts index b14cfc042..23c6d150c 100644 --- a/packages/pl-fe/src/actions/external-auth.ts +++ b/packages/pl-fe/src/actions/external-auth.ts @@ -1,22 +1,22 @@ /** * External Auth: workflow for logging in to remote servers. - * @module soapbox/actions/external_auth - * @see module:soapbox/actions/auth - * @see module:soapbox/actions/apps - * @see module:soapbox/actions/oauth + * @module pl-fe/actions/external_auth + * @see module:pl-fe/actions/auth + * @see module:pl-fe/actions/apps + * @see module:pl-fe/actions/oauth */ import { instanceSchema, PlApiClient, type Instance } from 'pl-api'; -import { createApp } from 'soapbox/actions/apps'; -import { authLoggedIn, verifyCredentials, switchAccount } from 'soapbox/actions/auth'; -import { obtainOAuthToken } from 'soapbox/actions/oauth'; -import { parseBaseURL } from 'soapbox/utils/auth'; -import sourceCode from 'soapbox/utils/code'; -import { getQuirks } from 'soapbox/utils/quirks'; -import { getInstanceScopes } from 'soapbox/utils/scopes'; +import { createApp } from 'pl-fe/actions/apps'; +import { authLoggedIn, verifyCredentials, switchAccount } from 'pl-fe/actions/auth'; +import { obtainOAuthToken } from 'pl-fe/actions/oauth'; +import { parseBaseURL } from 'pl-fe/utils/auth'; +import sourceCode from 'pl-fe/utils/code'; +import { getQuirks } from 'pl-fe/utils/quirks'; +import { getInstanceScopes } from 'pl-fe/utils/scopes'; -import type { AppDispatch } from 'soapbox/store'; +import type { AppDispatch } from 'pl-fe/store'; const fetchExternalInstance = (baseURL: string) => (new PlApiClient(baseURL)).instance.getInstance() diff --git a/packages/pl-fe/src/actions/familiar-followers.ts b/packages/pl-fe/src/actions/familiar-followers.ts index 1a8ee0a88..12bf81f83 100644 --- a/packages/pl-fe/src/actions/familiar-followers.ts +++ b/packages/pl-fe/src/actions/familiar-followers.ts @@ -1,4 +1,4 @@ -import { AppDispatch, RootState } from 'soapbox/store'; +import { AppDispatch, RootState } from 'pl-fe/store'; import { getClient } from '../api'; diff --git a/packages/pl-fe/src/actions/favourites.ts b/packages/pl-fe/src/actions/favourites.ts index 91829713a..958e6517b 100644 --- a/packages/pl-fe/src/actions/favourites.ts +++ b/packages/pl-fe/src/actions/favourites.ts @@ -1,11 +1,11 @@ -import { isLoggedIn } from 'soapbox/utils/auth'; +import { isLoggedIn } from 'pl-fe/utils/auth'; import { getClient } from '../api'; import { importFetchedStatuses } from './importer'; import type { PaginatedResponse, Status } from 'pl-api'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const FAVOURITED_STATUSES_FETCH_REQUEST = 'FAVOURITED_STATUSES_FETCH_REQUEST' as const; const FAVOURITED_STATUSES_FETCH_SUCCESS = 'FAVOURITED_STATUSES_FETCH_SUCCESS' as const; diff --git a/packages/pl-fe/src/actions/filters.ts b/packages/pl-fe/src/actions/filters.ts index 6e1183317..1499664ea 100644 --- a/packages/pl-fe/src/actions/filters.ts +++ b/packages/pl-fe/src/actions/filters.ts @@ -1,12 +1,12 @@ import { defineMessages } from 'react-intl'; -import toast from 'soapbox/toast'; -import { isLoggedIn } from 'soapbox/utils/auth'; +import toast from 'pl-fe/toast'; +import { isLoggedIn } from 'pl-fe/utils/auth'; import { getClient } from '../api'; import type { FilterContext } from 'pl-api'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const FILTERS_FETCH_REQUEST = 'FILTERS_FETCH_REQUEST' as const; const FILTERS_FETCH_SUCCESS = 'FILTERS_FETCH_SUCCESS' as const; diff --git a/packages/pl-fe/src/actions/groups.ts b/packages/pl-fe/src/actions/groups.ts index 99d11fbe3..ed201388a 100644 --- a/packages/pl-fe/src/actions/groups.ts +++ b/packages/pl-fe/src/actions/groups.ts @@ -3,7 +3,7 @@ import { getClient } from '../api'; import { importFetchedAccounts } from './importer'; import type { Account, PaginatedResponse } from 'pl-api'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const GROUP_BLOCKS_FETCH_REQUEST = 'GROUP_BLOCKS_FETCH_REQUEST' as const; const GROUP_BLOCKS_FETCH_SUCCESS = 'GROUP_BLOCKS_FETCH_SUCCESS' as const; diff --git a/packages/pl-fe/src/actions/history.ts b/packages/pl-fe/src/actions/history.ts index a32489dcd..733871b17 100644 --- a/packages/pl-fe/src/actions/history.ts +++ b/packages/pl-fe/src/actions/history.ts @@ -1,9 +1,9 @@ -import { getClient } from 'soapbox/api'; +import { getClient } from 'pl-fe/api'; import { importFetchedAccounts } from './importer'; import type { StatusEdit } from 'pl-api'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const HISTORY_FETCH_REQUEST = 'HISTORY_FETCH_REQUEST' as const; const HISTORY_FETCH_SUCCESS = 'HISTORY_FETCH_SUCCESS' as const; diff --git a/packages/pl-fe/src/actions/import-data.ts b/packages/pl-fe/src/actions/import-data.ts index b93896614..b5a01f72b 100644 --- a/packages/pl-fe/src/actions/import-data.ts +++ b/packages/pl-fe/src/actions/import-data.ts @@ -1,10 +1,10 @@ import { defineMessages } from 'react-intl'; -import toast from 'soapbox/toast'; +import toast from 'pl-fe/toast'; import { getClient } from '../api'; -import type { RootState } from 'soapbox/store'; +import type { RootState } from 'pl-fe/store'; const IMPORT_FOLLOWS_REQUEST = 'IMPORT_FOLLOWS_REQUEST' as const; const IMPORT_FOLLOWS_SUCCESS = 'IMPORT_FOLLOWS_SUCCESS' as const; diff --git a/packages/pl-fe/src/actions/importer/index.ts b/packages/pl-fe/src/actions/importer/index.ts index e30374b4b..169958c73 100644 --- a/packages/pl-fe/src/actions/importer/index.ts +++ b/packages/pl-fe/src/actions/importer/index.ts @@ -1,9 +1,9 @@ -import { importEntities } from 'soapbox/entity-store/actions'; -import { Entities } from 'soapbox/entity-store/entities'; -import { normalizeAccount, normalizeGroup } from 'soapbox/normalizers'; +import { importEntities } from 'pl-fe/entity-store/actions'; +import { Entities } from 'pl-fe/entity-store/entities'; +import { normalizeAccount, normalizeGroup } from 'pl-fe/normalizers'; import type { Account as BaseAccount, Group, Poll, Status as BaseStatus } from 'pl-api'; -import type { AppDispatch } from 'soapbox/store'; +import type { AppDispatch } from 'pl-fe/store'; const ACCOUNT_IMPORT = 'ACCOUNT_IMPORT'; const ACCOUNTS_IMPORT = 'ACCOUNTS_IMPORT'; diff --git a/packages/pl-fe/src/actions/instance.ts b/packages/pl-fe/src/actions/instance.ts index 79f354682..629db73f8 100644 --- a/packages/pl-fe/src/actions/instance.ts +++ b/packages/pl-fe/src/actions/instance.ts @@ -1,9 +1,9 @@ -import { getAuthUserUrl, getMeUrl } from 'soapbox/utils/auth'; +import { getAuthUserUrl, getMeUrl } from 'pl-fe/utils/auth'; import { getClient } from '../api'; import type { Instance } from 'pl-api'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const INSTANCE_FETCH_SUCCESS = 'INSTANCE_FETCH_SUCCESS' as const; const INSTANCE_FETCH_FAIL = 'INSTANCE_FETCH_FAIL' as const; diff --git a/packages/pl-fe/src/actions/interactions.ts b/packages/pl-fe/src/actions/interactions.ts index 2e8a6be11..151c41a87 100644 --- a/packages/pl-fe/src/actions/interactions.ts +++ b/packages/pl-fe/src/actions/interactions.ts @@ -1,7 +1,7 @@ import { defineMessages } from 'react-intl'; -import toast, { type IToastOptions } from 'soapbox/toast'; -import { isLoggedIn } from 'soapbox/utils/auth'; +import toast, { type IToastOptions } from 'pl-fe/toast'; +import { isLoggedIn } from 'pl-fe/utils/auth'; import { getClient } from '../api'; @@ -10,7 +10,7 @@ import { importFetchedAccounts, importFetchedStatus } from './importer'; import { openModal } from './modals'; import type { Account, EmojiReaction, PaginatedResponse, Status } from 'pl-api'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const REBLOG_REQUEST = 'REBLOG_REQUEST' as const; const REBLOG_SUCCESS = 'REBLOG_SUCCESS' as const; diff --git a/packages/pl-fe/src/actions/languages.ts b/packages/pl-fe/src/actions/languages.ts index 08255eff1..fe26a5345 100644 --- a/packages/pl-fe/src/actions/languages.ts +++ b/packages/pl-fe/src/actions/languages.ts @@ -1,6 +1,6 @@ import { saveSettings } from './settings'; -import type { AppDispatch } from 'soapbox/store'; +import type { AppDispatch } from 'pl-fe/store'; const LANGUAGE_USE = 'LANGUAGE_USE' as const; diff --git a/packages/pl-fe/src/actions/lists.ts b/packages/pl-fe/src/actions/lists.ts index 41d3bf159..df7ba4c0e 100644 --- a/packages/pl-fe/src/actions/lists.ts +++ b/packages/pl-fe/src/actions/lists.ts @@ -1,13 +1,13 @@ -import { selectAccount } from 'soapbox/selectors'; -import toast from 'soapbox/toast'; -import { isLoggedIn } from 'soapbox/utils/auth'; +import { selectAccount } from 'pl-fe/selectors'; +import toast from 'pl-fe/toast'; +import { isLoggedIn } from 'pl-fe/utils/auth'; import { getClient } from '../api'; import { importFetchedAccounts } from './importer'; import type { Account, List, PaginatedResponse } from 'pl-api'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const LIST_FETCH_REQUEST = 'LIST_FETCH_REQUEST' as const; const LIST_FETCH_SUCCESS = 'LIST_FETCH_SUCCESS' as const; diff --git a/packages/pl-fe/src/actions/markers.ts b/packages/pl-fe/src/actions/markers.ts index 9227e78f0..743a54744 100644 --- a/packages/pl-fe/src/actions/markers.ts +++ b/packages/pl-fe/src/actions/markers.ts @@ -1,7 +1,7 @@ import { getClient } from '../api'; import type { SaveMarkersParams } from 'pl-api'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const MARKER_FETCH_REQUEST = 'MARKER_FETCH_REQUEST' as const; const MARKER_FETCH_SUCCESS = 'MARKER_FETCH_SUCCESS' as const; diff --git a/packages/pl-fe/src/actions/me.test.ts b/packages/pl-fe/src/actions/me.test.ts index 63f22eac4..e5b229684 100644 --- a/packages/pl-fe/src/actions/me.test.ts +++ b/packages/pl-fe/src/actions/me.test.ts @@ -1,9 +1,9 @@ import { Map as ImmutableMap } from 'immutable'; -import { __stub } from 'soapbox/api'; -import { buildAccount } from 'soapbox/jest/factory'; -import { mockStore, rootState } from 'soapbox/jest/test-helpers'; -import { AuthUserRecord, ReducerRecord } from 'soapbox/reducers/auth'; +import { __stub } from 'pl-fe/api'; +import { buildAccount } from 'pl-fe/jest/factory'; +import { mockStore, rootState } from 'pl-fe/jest/test-helpers'; +import { AuthUserRecord, ReducerRecord } from 'pl-fe/reducers/auth'; import { fetchMe, patchMe } from './me'; diff --git a/packages/pl-fe/src/actions/me.ts b/packages/pl-fe/src/actions/me.ts index 769a0936f..25d5fe41d 100644 --- a/packages/pl-fe/src/actions/me.ts +++ b/packages/pl-fe/src/actions/me.ts @@ -1,7 +1,7 @@ -import { selectAccount } from 'soapbox/selectors'; -import { setSentryAccount } from 'soapbox/sentry'; -import KVStore from 'soapbox/storage/kv-store'; -import { getAuthUserId, getAuthUserUrl } from 'soapbox/utils/auth'; +import { selectAccount } from 'pl-fe/selectors'; +import { setSentryAccount } from 'pl-fe/sentry'; +import KVStore from 'pl-fe/storage/kv-store'; +import { getAuthUserId, getAuthUserUrl } from 'pl-fe/utils/auth'; import { getClient } from '../api'; @@ -9,7 +9,7 @@ import { loadCredentials } from './auth'; import { importFetchedAccount } from './importer'; import type { CredentialAccount, UpdateCredentialsParams } from 'pl-api'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const ME_FETCH_REQUEST = 'ME_FETCH_REQUEST' as const; const ME_FETCH_SUCCESS = 'ME_FETCH_SUCCESS' as const; diff --git a/packages/pl-fe/src/actions/media.ts b/packages/pl-fe/src/actions/media.ts index c7e53ffb1..7bfd4b293 100644 --- a/packages/pl-fe/src/actions/media.ts +++ b/packages/pl-fe/src/actions/media.ts @@ -1,14 +1,14 @@ import { defineMessages, type IntlShape } from 'react-intl'; -import toast from 'soapbox/toast'; -import { isLoggedIn } from 'soapbox/utils/auth'; -import { formatBytes, getVideoDuration } from 'soapbox/utils/media'; -import resizeImage from 'soapbox/utils/resize-image'; +import toast from 'pl-fe/toast'; +import { isLoggedIn } from 'pl-fe/utils/auth'; +import { formatBytes, getVideoDuration } from 'pl-fe/utils/media'; +import resizeImage from 'pl-fe/utils/resize-image'; import { getClient } from '../api'; import type { MediaAttachment, UploadMediaParams } from 'pl-api'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const messages = defineMessages({ exceededImageSizeLimit: { id: 'upload_error.image_size_limit', defaultMessage: 'Image exceeds the current file size limit ({limit})' }, diff --git a/packages/pl-fe/src/actions/mfa.ts b/packages/pl-fe/src/actions/mfa.ts index 77f23c083..dbdad8d8e 100644 --- a/packages/pl-fe/src/actions/mfa.ts +++ b/packages/pl-fe/src/actions/mfa.ts @@ -1,6 +1,6 @@ import { getClient } from '../api'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const MFA_FETCH_REQUEST = 'MFA_FETCH_REQUEST' as const; const MFA_FETCH_SUCCESS = 'MFA_FETCH_SUCCESS' as const; diff --git a/packages/pl-fe/src/actions/modals.ts b/packages/pl-fe/src/actions/modals.ts index 08ee77763..ea38dba6c 100644 --- a/packages/pl-fe/src/actions/modals.ts +++ b/packages/pl-fe/src/actions/modals.ts @@ -1,37 +1,37 @@ -import { AppDispatch } from 'soapbox/store'; +import { AppDispatch } from 'pl-fe/store'; -import type { ICryptoAddress } from 'soapbox/features/crypto-donate/components/crypto-address'; -import type { ModalType } from 'soapbox/features/ui/components/modal-root'; -import type { AccountModerationModalProps } from 'soapbox/features/ui/components/modals/account-moderation-modal/account-moderation-modal'; -import type { BoostModalProps } from 'soapbox/features/ui/components/modals/boost-modal'; -import type { CompareHistoryModalProps } from 'soapbox/features/ui/components/modals/compare-history-modal'; -import type { ComponentModalProps } from 'soapbox/features/ui/components/modals/component-modal'; -import type { ComposeModalProps } from 'soapbox/features/ui/components/modals/compose-modal'; -import type { ConfirmationModalProps } from 'soapbox/features/ui/components/modals/confirmation-modal'; -import type { DislikesModalProps } from 'soapbox/features/ui/components/modals/dislikes-modal'; -import type { EditAnnouncementModalProps } from 'soapbox/features/ui/components/modals/edit-announcement-modal'; -import type { EditBookmarkFolderModalProps } from 'soapbox/features/ui/components/modals/edit-bookmark-folder-modal'; -import type { EditDomainModalProps } from 'soapbox/features/ui/components/modals/edit-domain-modal'; -import type { EditFederationModalProps } from 'soapbox/features/ui/components/modals/edit-federation-modal'; -import type { EditRuleModalProps } from 'soapbox/features/ui/components/modals/edit-rule-modal'; -import type { EmbedModalProps } from 'soapbox/features/ui/components/modals/embed-modal'; -import type { EventMapModalProps } from 'soapbox/features/ui/components/modals/event-map-modal'; -import type { EventParticipantsModalProps } from 'soapbox/features/ui/components/modals/event-participants-modal'; -import type { FamiliarFollowersModalProps } from 'soapbox/features/ui/components/modals/familiar-followers-modal'; -import type { FavouritesModalProps } from 'soapbox/features/ui/components/modals/favourites-modal'; -import type { JoinEventModalProps } from 'soapbox/features/ui/components/modals/join-event-modal'; -import type { ListAdderModalProps } from 'soapbox/features/ui/components/modals/list-adder-modal'; -import type { ListEditorModalProps } from 'soapbox/features/ui/components/modals/list-editor-modal'; -import type { MediaModalProps } from 'soapbox/features/ui/components/modals/media-modal'; -import type { MentionsModalProps } from 'soapbox/features/ui/components/modals/mentions-modal'; -import type { MissingDescriptionModalProps } from 'soapbox/features/ui/components/modals/missing-description-modal'; -import type { ReactionsModalProps } from 'soapbox/features/ui/components/modals/reactions-modal'; -import type { ReblogsModalProps } from 'soapbox/features/ui/components/modals/reblogs-modal'; -import type { ReplyMentionsModalProps } from 'soapbox/features/ui/components/modals/reply-mentions-modal'; -import type { SelectBookmarkFolderModalProps } from 'soapbox/features/ui/components/modals/select-bookmark-folder-modal'; -import type { TextFieldModalProps } from 'soapbox/features/ui/components/modals/text-field-modal'; -import type { UnauthorizedModalProps } from 'soapbox/features/ui/components/modals/unauthorized-modal'; -import type { VideoModalProps } from 'soapbox/features/ui/components/modals/video-modal'; +import type { ICryptoAddress } from 'pl-fe/features/crypto-donate/components/crypto-address'; +import type { ModalType } from 'pl-fe/features/ui/components/modal-root'; +import type { AccountModerationModalProps } from 'pl-fe/features/ui/components/modals/account-moderation-modal/account-moderation-modal'; +import type { BoostModalProps } from 'pl-fe/features/ui/components/modals/boost-modal'; +import type { CompareHistoryModalProps } from 'pl-fe/features/ui/components/modals/compare-history-modal'; +import type { ComponentModalProps } from 'pl-fe/features/ui/components/modals/component-modal'; +import type { ComposeModalProps } from 'pl-fe/features/ui/components/modals/compose-modal'; +import type { ConfirmationModalProps } from 'pl-fe/features/ui/components/modals/confirmation-modal'; +import type { DislikesModalProps } from 'pl-fe/features/ui/components/modals/dislikes-modal'; +import type { EditAnnouncementModalProps } from 'pl-fe/features/ui/components/modals/edit-announcement-modal'; +import type { EditBookmarkFolderModalProps } from 'pl-fe/features/ui/components/modals/edit-bookmark-folder-modal'; +import type { EditDomainModalProps } from 'pl-fe/features/ui/components/modals/edit-domain-modal'; +import type { EditFederationModalProps } from 'pl-fe/features/ui/components/modals/edit-federation-modal'; +import type { EditRuleModalProps } from 'pl-fe/features/ui/components/modals/edit-rule-modal'; +import type { EmbedModalProps } from 'pl-fe/features/ui/components/modals/embed-modal'; +import type { EventMapModalProps } from 'pl-fe/features/ui/components/modals/event-map-modal'; +import type { EventParticipantsModalProps } from 'pl-fe/features/ui/components/modals/event-participants-modal'; +import type { FamiliarFollowersModalProps } from 'pl-fe/features/ui/components/modals/familiar-followers-modal'; +import type { FavouritesModalProps } from 'pl-fe/features/ui/components/modals/favourites-modal'; +import type { JoinEventModalProps } from 'pl-fe/features/ui/components/modals/join-event-modal'; +import type { ListAdderModalProps } from 'pl-fe/features/ui/components/modals/list-adder-modal'; +import type { ListEditorModalProps } from 'pl-fe/features/ui/components/modals/list-editor-modal'; +import type { MediaModalProps } from 'pl-fe/features/ui/components/modals/media-modal'; +import type { MentionsModalProps } from 'pl-fe/features/ui/components/modals/mentions-modal'; +import type { MissingDescriptionModalProps } from 'pl-fe/features/ui/components/modals/missing-description-modal'; +import type { ReactionsModalProps } from 'pl-fe/features/ui/components/modals/reactions-modal'; +import type { ReblogsModalProps } from 'pl-fe/features/ui/components/modals/reblogs-modal'; +import type { ReplyMentionsModalProps } from 'pl-fe/features/ui/components/modals/reply-mentions-modal'; +import type { SelectBookmarkFolderModalProps } from 'pl-fe/features/ui/components/modals/select-bookmark-folder-modal'; +import type { TextFieldModalProps } from 'pl-fe/features/ui/components/modals/text-field-modal'; +import type { UnauthorizedModalProps } from 'pl-fe/features/ui/components/modals/unauthorized-modal'; +import type { VideoModalProps } from 'pl-fe/features/ui/components/modals/video-modal'; const MODAL_OPEN = 'MODAL_OPEN' as const; const MODAL_CLOSE = 'MODAL_CLOSE' as const; diff --git a/packages/pl-fe/src/actions/moderation.tsx b/packages/pl-fe/src/actions/moderation.tsx index d0e85fe3f..4ce75364b 100644 --- a/packages/pl-fe/src/actions/moderation.tsx +++ b/packages/pl-fe/src/actions/moderation.tsx @@ -1,16 +1,16 @@ import React from 'react'; import { defineMessages, IntlShape } from 'react-intl'; -import { fetchAccountByUsername } from 'soapbox/actions/accounts'; -import { deactivateUser, deleteUser, deleteStatus, toggleStatusSensitivity } from 'soapbox/actions/admin'; -import { openModal } from 'soapbox/actions/modals'; -import OutlineBox from 'soapbox/components/outline-box'; -import { Stack, Text } from 'soapbox/components/ui'; -import AccountContainer from 'soapbox/containers/account-container'; -import { selectAccount } from 'soapbox/selectors'; -import toast from 'soapbox/toast'; +import { fetchAccountByUsername } from 'pl-fe/actions/accounts'; +import { deactivateUser, deleteUser, deleteStatus, toggleStatusSensitivity } from 'pl-fe/actions/admin'; +import { openModal } from 'pl-fe/actions/modals'; +import OutlineBox from 'pl-fe/components/outline-box'; +import { Stack, Text } from 'pl-fe/components/ui'; +import AccountContainer from 'pl-fe/containers/account-container'; +import { selectAccount } from 'pl-fe/selectors'; +import toast from 'pl-fe/toast'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const messages = defineMessages({ deactivateUserHeading: { id: 'confirmations.admin.deactivate_user.heading', defaultMessage: 'Deactivate @{acct}' }, diff --git a/packages/pl-fe/src/actions/mrf.ts b/packages/pl-fe/src/actions/mrf.ts index 509bdb8fc..daad6bf10 100644 --- a/packages/pl-fe/src/actions/mrf.ts +++ b/packages/pl-fe/src/actions/mrf.ts @@ -1,11 +1,11 @@ import { Set as ImmutableSet } from 'immutable'; -import ConfigDB from 'soapbox/utils/config-db'; +import ConfigDB from 'pl-fe/utils/config-db'; import { fetchConfig, updateConfig } from './admin'; -import type { MRFSimple } from 'soapbox/schemas/pleroma'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { MRFSimple } from 'pl-fe/schemas/pleroma'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const simplePolicyMerge = (simplePolicy: MRFSimple, host: string, restrictions: Record) => { const entries = Object.entries(simplePolicy).map(([key, hosts]) => { diff --git a/packages/pl-fe/src/actions/mutes.ts b/packages/pl-fe/src/actions/mutes.ts index c405a5661..9c39b87f7 100644 --- a/packages/pl-fe/src/actions/mutes.ts +++ b/packages/pl-fe/src/actions/mutes.ts @@ -1,7 +1,7 @@ import { openModal } from './modals'; -import type { Account } from 'soapbox/normalizers'; -import type { AppDispatch } from 'soapbox/store'; +import type { Account } from 'pl-fe/normalizers'; +import type { AppDispatch } from 'pl-fe/store'; const MUTES_INIT_MODAL = 'MUTES_INIT_MODAL'; const MUTES_TOGGLE_HIDE_NOTIFICATIONS = 'MUTES_TOGGLE_HIDE_NOTIFICATIONS'; diff --git a/packages/pl-fe/src/actions/notifications.test.ts b/packages/pl-fe/src/actions/notifications.test.ts index 0ead1491a..b64d34421 100644 --- a/packages/pl-fe/src/actions/notifications.test.ts +++ b/packages/pl-fe/src/actions/notifications.test.ts @@ -1,8 +1,8 @@ import { OrderedMap as ImmutableOrderedMap } from 'immutable'; -import { __stub } from 'soapbox/api'; -import { mockStore, rootState } from 'soapbox/jest/test-helpers'; -import { normalizeNotification } from 'soapbox/normalizers'; +import { __stub } from 'pl-fe/api'; +import { mockStore, rootState } from 'pl-fe/jest/test-helpers'; +import { normalizeNotification } from 'pl-fe/normalizers'; import { markReadNotifications } from './notifications'; diff --git a/packages/pl-fe/src/actions/notifications.ts b/packages/pl-fe/src/actions/notifications.ts index fe9c18759..a9ea39461 100644 --- a/packages/pl-fe/src/actions/notifications.ts +++ b/packages/pl-fe/src/actions/notifications.ts @@ -2,15 +2,15 @@ import IntlMessageFormat from 'intl-messageformat'; import 'intl-pluralrules'; import { defineMessages } from 'react-intl'; -import { getClient } from 'soapbox/api'; -import { getNotificationStatus } from 'soapbox/features/notifications/components/notification'; -import { normalizeNotification, normalizeNotifications, type Notification } from 'soapbox/normalizers'; -import { getFilters, regexFromFilters } from 'soapbox/selectors'; -import { isLoggedIn } from 'soapbox/utils/auth'; -import { compareId } from 'soapbox/utils/comparators'; -import { unescapeHTML } from 'soapbox/utils/html'; -import { EXCLUDE_TYPES, NOTIFICATION_TYPES } from 'soapbox/utils/notification'; -import { joinPublicPath } from 'soapbox/utils/static'; +import { getClient } from 'pl-fe/api'; +import { getNotificationStatus } from 'pl-fe/features/notifications/components/notification'; +import { normalizeNotification, normalizeNotifications, type Notification } from 'pl-fe/normalizers'; +import { getFilters, regexFromFilters } from 'pl-fe/selectors'; +import { isLoggedIn } from 'pl-fe/utils/auth'; +import { compareId } from 'pl-fe/utils/comparators'; +import { unescapeHTML } from 'pl-fe/utils/html'; +import { EXCLUDE_TYPES, NOTIFICATION_TYPES } from 'pl-fe/utils/notification'; +import { joinPublicPath } from 'pl-fe/utils/static'; import { fetchRelationships } from './accounts'; import { @@ -23,7 +23,7 @@ import { saveMarker } from './markers'; import { getSettings, saveSettings } from './settings'; import type { Account, Notification as BaseNotification, PaginatedResponse, Status } from 'pl-api'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const NOTIFICATIONS_UPDATE = 'NOTIFICATIONS_UPDATE' as const; const NOTIFICATIONS_UPDATE_NOOP = 'NOTIFICATIONS_UPDATE_NOOP' as const; diff --git a/packages/pl-fe/src/actions/oauth.ts b/packages/pl-fe/src/actions/oauth.ts index cffcd2446..652716b62 100644 --- a/packages/pl-fe/src/actions/oauth.ts +++ b/packages/pl-fe/src/actions/oauth.ts @@ -2,16 +2,16 @@ * OAuth: create and revoke tokens. * Tokens can be used by users and apps. * https://docs.joinmastodon.org/methods/apps/oauth/ - * @module soapbox/actions/oauth - * @see module:soapbox/actions/auth + * @module pl-fe/actions/oauth + * @see module:pl-fe/actions/auth */ import { PlApiClient, type GetTokenParams, type RevokeTokenParams } from 'pl-api'; -import * as BuildConfig from 'soapbox/build-config'; -import { getBaseURL } from 'soapbox/utils/state'; +import * as BuildConfig from 'pl-fe/build-config'; +import { getBaseURL } from 'pl-fe/utils/state'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const OAUTH_TOKEN_CREATE_REQUEST = 'OAUTH_TOKEN_CREATE_REQUEST' as const; const OAUTH_TOKEN_CREATE_SUCCESS = 'OAUTH_TOKEN_CREATE_SUCCESS' as const; diff --git a/packages/pl-fe/src/actions/onboarding.test.ts b/packages/pl-fe/src/actions/onboarding.test.ts index dc91f8a03..2d87ea7e5 100644 --- a/packages/pl-fe/src/actions/onboarding.test.ts +++ b/packages/pl-fe/src/actions/onboarding.test.ts @@ -1,4 +1,4 @@ -import { mockStore, mockWindowProperty, rootState } from 'soapbox/jest/test-helpers'; +import { mockStore, mockWindowProperty, rootState } from 'pl-fe/jest/test-helpers'; import { checkOnboardingStatus, startOnboarding, endOnboarding } from './onboarding'; diff --git a/packages/pl-fe/src/actions/pin-statuses.ts b/packages/pl-fe/src/actions/pin-statuses.ts index b9b880ad7..86b18e6b9 100644 --- a/packages/pl-fe/src/actions/pin-statuses.ts +++ b/packages/pl-fe/src/actions/pin-statuses.ts @@ -1,11 +1,11 @@ -import { isLoggedIn } from 'soapbox/utils/auth'; +import { isLoggedIn } from 'pl-fe/utils/auth'; import { getClient } from '../api'; import { importFetchedStatuses } from './importer'; import type { Status } from 'pl-api'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const PINNED_STATUSES_FETCH_REQUEST = 'PINNED_STATUSES_FETCH_REQUEST' as const; const PINNED_STATUSES_FETCH_SUCCESS = 'PINNED_STATUSES_FETCH_SUCCESS' as const; diff --git a/packages/pl-fe/src/actions/pl-fe.test.ts b/packages/pl-fe/src/actions/pl-fe.test.ts new file mode 100644 index 000000000..4c1aa4505 --- /dev/null +++ b/packages/pl-fe/src/actions/pl-fe.test.ts @@ -0,0 +1,21 @@ +import { rootState } from 'pl-fe/jest/test-helpers'; +import { RootState } from 'pl-fe/store'; + +import { getPlFeConfig } from './pl-fe'; + +const ASCII_HEART = '❤'; // '\u2764\uFE0F' +const RED_HEART_RGI = '❤️'; // '\u2764' + +describe('getPlFeConfig()', () => { + it('returns RGI heart on Pleroma > 2.3', () => { + const state = rootState.setIn(['instance', 'version'], '2.7.2 (compatible; Pleroma 2.3.0)') as RootState; + expect(getPlFeConfig(state).allowedEmoji.includes(RED_HEART_RGI)).toBe(true); + expect(getPlFeConfig(state).allowedEmoji.includes(ASCII_HEART)).toBe(false); + }); + + it('returns an ASCII heart on Pleroma < 2.3', () => { + const state = rootState.setIn(['instance', 'version'], '2.7.2 (compatible; Pleroma 2.0.0)') as RootState; + expect(getPlFeConfig(state).allowedEmoji.includes(ASCII_HEART)).toBe(true); + expect(getPlFeConfig(state).allowedEmoji.includes(RED_HEART_RGI)).toBe(false); + }); +}); diff --git a/packages/pl-fe/src/actions/pl-fe.ts b/packages/pl-fe/src/actions/pl-fe.ts new file mode 100644 index 000000000..cd02fade4 --- /dev/null +++ b/packages/pl-fe/src/actions/pl-fe.ts @@ -0,0 +1,109 @@ +import { createSelector } from 'reselect'; + +import { getHost } from 'pl-fe/actions/instance'; +import { normalizePlFeConfig } from 'pl-fe/normalizers'; +import KVStore from 'pl-fe/storage/kv-store'; + +import { getClient, staticFetch } from '../api'; + +import type { AppDispatch, RootState } from 'pl-fe/store'; +import type { APIEntity } from 'pl-fe/types/entities'; + +const PLFE_CONFIG_REQUEST_SUCCESS = 'PLFE_CONFIG_REQUEST_SUCCESS' as const; +const PLFE_CONFIG_REQUEST_FAIL = 'PLFE_CONFIG_REQUEST_FAIL' as const; + +const PLFE_CONFIG_REMEMBER_SUCCESS = 'PLFE_CONFIG_REMEMBER_SUCCESS' as const; + +const getPlFeConfig = createSelector([ + (state: RootState) => state.plfe, + (state: RootState) => state.auth.client.features, +], (plfe, features) => { + // Do some additional normalization with the state + return normalizePlFeConfig(plfe); +}); + +const rememberPlFeConfig = (host: string | null) => + (dispatch: AppDispatch) => { + return KVStore.getItemOrError(`plfe_config:${host}`).then(plFeConfig => { + dispatch({ type: PLFE_CONFIG_REMEMBER_SUCCESS, host, plFeConfig }); + return plFeConfig; + }).catch(() => {}); + }; + +const fetchFrontendConfigurations = () => + (dispatch: AppDispatch, getState: () => RootState) => + getClient(getState).instance.getFrontendConfigurations(); + +/** Conditionally fetches pl-fe config depending on backend features */ +const fetchPlFeConfig = (host: string | null) => + (dispatch: AppDispatch, getState: () => RootState) => { + const features = getState().auth.client.features; + + if (features.frontendConfigurations) { + return dispatch(fetchFrontendConfigurations()).then(data => { + if (data.pl_fe) { + dispatch(importPlFeConfig(data.pl_fe, host)); + return data.pl_fe; + } else { + return dispatch(fetchPlFeJson(host)); + } + }); + } else { + return dispatch(fetchPlFeJson(host)); + } + }; + +/** Tries to remember the config from browser storage before fetching it */ +const loadPlFeConfig = () => + (dispatch: AppDispatch, getState: () => RootState) => { + const host = getHost(getState()); + + return dispatch(rememberPlFeConfig(host)).then(() => + dispatch(fetchPlFeConfig(host)), + ); + }; + +const fetchPlFeJson = (host: string | null) => + (dispatch: AppDispatch) => + staticFetch('/instance/pl-fe.json').then(({ json: data }) => { + if (!isObject(data)) throw 'pl-fe.json failed'; + dispatch(importPlFeConfig(data, host)); + return data; + }).catch(error => { + dispatch(plFeConfigFail(error, host)); + }); + +const importPlFeConfig = (plFeConfig: APIEntity, host: string | null) => { + if (!plFeConfig.brandColor) { + plFeConfig.brandColor = '#0482d8'; + } + return { + type: PLFE_CONFIG_REQUEST_SUCCESS, + plFeConfig, + host, + }; +}; + +const plFeConfigFail = (error: unknown, host: string | null) => ({ + type: PLFE_CONFIG_REQUEST_FAIL, + error, + skipAlert: true, + host, +}); + +// https://stackoverflow.com/a/46663081 +const isObject = (o: any) => o instanceof Object && o.constructor === Object; + +export { + PLFE_CONFIG_REQUEST_SUCCESS, + PLFE_CONFIG_REQUEST_FAIL, + PLFE_CONFIG_REMEMBER_SUCCESS, + getPlFeConfig, + rememberPlFeConfig, + fetchFrontendConfigurations, + fetchPlFeConfig, + loadPlFeConfig, + fetchPlFeJson, + importPlFeConfig, + plFeConfigFail, +}; diff --git a/packages/pl-fe/src/actions/polls.ts b/packages/pl-fe/src/actions/polls.ts index eb1113451..f343be4ec 100644 --- a/packages/pl-fe/src/actions/polls.ts +++ b/packages/pl-fe/src/actions/polls.ts @@ -3,7 +3,7 @@ import { getClient } from '../api'; import { importFetchedPoll } from './importer'; import type { Poll } from 'pl-api'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const POLL_VOTE_REQUEST = 'POLL_VOTE_REQUEST' as const; const POLL_VOTE_SUCCESS = 'POLL_VOTE_SUCCESS' as const; diff --git a/packages/pl-fe/src/actions/preload.test.ts b/packages/pl-fe/src/actions/preload.test.ts index 8e4b30f5c..90bd7a131 100644 --- a/packages/pl-fe/src/actions/preload.test.ts +++ b/packages/pl-fe/src/actions/preload.test.ts @@ -1,7 +1,7 @@ import { Map as ImmutableMap } from 'immutable'; -import { __stub } from 'soapbox/api'; -import { mockStore } from 'soapbox/jest/test-helpers'; +import { __stub } from 'pl-fe/api'; +import { mockStore } from 'pl-fe/jest/test-helpers'; import { VERIFY_CREDENTIALS_REQUEST } from './auth'; import { ACCOUNTS_IMPORT } from './importer'; @@ -12,7 +12,7 @@ import { describe('preloadMastodon()', () => { it('creates the expected actions', async () => { - const data = await import('soapbox/__fixtures__/mastodon_initial_state.json'); + const data = await import('pl-fe/__fixtures__/mastodon_initial_state.json'); __stub(mock => { mock.onGet('/api/v1/accounts/verify_credentials') diff --git a/packages/pl-fe/src/actions/preload.ts b/packages/pl-fe/src/actions/preload.ts index 61f88fdd4..4b77263eb 100644 --- a/packages/pl-fe/src/actions/preload.ts +++ b/packages/pl-fe/src/actions/preload.ts @@ -3,7 +3,7 @@ import mapValues from 'lodash/mapValues'; import { verifyCredentials } from './auth'; import { importFetchedAccounts } from './importer'; -import type { AppDispatch } from 'soapbox/store'; +import type { AppDispatch } from 'pl-fe/store'; const PLEROMA_PRELOAD_IMPORT = 'PLEROMA_PRELOAD_IMPORT' as const; const MASTODON_PRELOAD_IMPORT = 'MASTODON_PRELOAD_IMPORT' as const; diff --git a/packages/pl-fe/src/actions/push-notifications/index.ts b/packages/pl-fe/src/actions/push-notifications/index.ts index 45110c389..6fe35b844 100644 --- a/packages/pl-fe/src/actions/push-notifications/index.ts +++ b/packages/pl-fe/src/actions/push-notifications/index.ts @@ -7,7 +7,7 @@ import { setAlerts, } from './setter'; -import type { AppDispatch } from 'soapbox/store'; +import type { AppDispatch } from 'pl-fe/store'; const changeAlerts = (path: Array, value: any) => (dispatch: AppDispatch) => { diff --git a/packages/pl-fe/src/actions/push-notifications/registerer.ts b/packages/pl-fe/src/actions/push-notifications/registerer.ts index 5cb82eefe..fa61047f6 100644 --- a/packages/pl-fe/src/actions/push-notifications/registerer.ts +++ b/packages/pl-fe/src/actions/push-notifications/registerer.ts @@ -1,12 +1,12 @@ -import { createPushSubscription, updatePushSubscription } from 'soapbox/actions/push-subscriptions'; -import { pushNotificationsSetting } from 'soapbox/settings'; -import { getVapidKey } from 'soapbox/utils/auth'; -import { decode as decodeBase64 } from 'soapbox/utils/base64'; +import { createPushSubscription, updatePushSubscription } from 'pl-fe/actions/push-subscriptions'; +import { pushNotificationsSetting } from 'pl-fe/settings'; +import { getVapidKey } from 'pl-fe/utils/auth'; +import { decode as decodeBase64 } from 'pl-fe/utils/base64'; import { setBrowserSupport, setSubscription, clearSubscription } from './setter'; -import type { AppDispatch, RootState } from 'soapbox/store'; -import type { Me } from 'soapbox/types/soapbox'; +import type { AppDispatch, RootState } from 'pl-fe/store'; +import type { Me } from 'pl-fe/types/pl-fe'; // Taken from https://www.npmjs.com/package/web-push const urlBase64ToUint8Array = (base64String: string) => { diff --git a/packages/pl-fe/src/actions/push-subscriptions.ts b/packages/pl-fe/src/actions/push-subscriptions.ts index 311a7517e..306fc5dfc 100644 --- a/packages/pl-fe/src/actions/push-subscriptions.ts +++ b/packages/pl-fe/src/actions/push-subscriptions.ts @@ -1,7 +1,7 @@ import { getClient } from '../api'; import type { CreatePushNotificationsSubscriptionParams, UpdatePushNotificationsSubscriptionParams } from 'pl-api'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const createPushSubscription = (params: CreatePushNotificationsSubscriptionParams) => (dispatch: AppDispatch, getState: () => RootState) => diff --git a/packages/pl-fe/src/actions/remote-timeline.ts b/packages/pl-fe/src/actions/remote-timeline.ts index ac1277aec..b518a7bfc 100644 --- a/packages/pl-fe/src/actions/remote-timeline.ts +++ b/packages/pl-fe/src/actions/remote-timeline.ts @@ -1,7 +1,7 @@ -import { getSettings, changeSetting } from 'soapbox/actions/settings'; +import { getSettings, changeSetting } from 'pl-fe/actions/settings'; import type { List as ImmutableList, OrderedSet as ImmutableOrderedSet } from 'immutable'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const getPinnedHosts = (state: RootState) => { const settings = getSettings(state); diff --git a/packages/pl-fe/src/actions/reports.ts b/packages/pl-fe/src/actions/reports.ts index 92a27519e..e7ded079a 100644 --- a/packages/pl-fe/src/actions/reports.ts +++ b/packages/pl-fe/src/actions/reports.ts @@ -2,8 +2,8 @@ import { getClient } from '../api'; import { openModal } from './modals'; -import type { Account, Status } from 'soapbox/normalizers'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { Account, Status } from 'pl-fe/normalizers'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const REPORT_INIT = 'REPORT_INIT' as const; const REPORT_CANCEL = 'REPORT_CANCEL' as const; diff --git a/packages/pl-fe/src/actions/scheduled-statuses.ts b/packages/pl-fe/src/actions/scheduled-statuses.ts index 6acc3b0d2..75da24ddf 100644 --- a/packages/pl-fe/src/actions/scheduled-statuses.ts +++ b/packages/pl-fe/src/actions/scheduled-statuses.ts @@ -1,7 +1,7 @@ import { getClient } from '../api'; import type { PaginatedResponse, ScheduledStatus } from 'pl-api'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const SCHEDULED_STATUSES_FETCH_REQUEST = 'SCHEDULED_STATUSES_FETCH_REQUEST' as const; const SCHEDULED_STATUSES_FETCH_SUCCESS = 'SCHEDULED_STATUSES_FETCH_SUCCESS' as const; diff --git a/packages/pl-fe/src/actions/search.ts b/packages/pl-fe/src/actions/search.ts index 6a03bb26d..d37c7f469 100644 --- a/packages/pl-fe/src/actions/search.ts +++ b/packages/pl-fe/src/actions/search.ts @@ -4,8 +4,8 @@ import { fetchRelationships } from './accounts'; import { importFetchedAccounts, importFetchedStatuses } from './importer'; import type { Search } from 'pl-api'; -import type { SearchFilter } from 'soapbox/reducers/search'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { SearchFilter } from 'pl-fe/reducers/search'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const SEARCH_CLEAR = 'SEARCH_CLEAR' as const; const SEARCH_SHOW = 'SEARCH_SHOW' as const; diff --git a/packages/pl-fe/src/actions/security.ts b/packages/pl-fe/src/actions/security.ts index 2e7984fc4..b296ee5c7 100644 --- a/packages/pl-fe/src/actions/security.ts +++ b/packages/pl-fe/src/actions/security.ts @@ -1,17 +1,17 @@ /** * Security: Pleroma-specific account management features. - * @module soapbox/actions/security - * @see module:soapbox/actions/auth + * @module pl-fe/actions/security + * @see module:pl-fe/actions/auth */ -import { getClient } from 'soapbox/api'; -import toast from 'soapbox/toast'; -import { getLoggedInAccount } from 'soapbox/utils/auth'; -import { normalizeUsername } from 'soapbox/utils/input'; +import { getClient } from 'pl-fe/api'; +import toast from 'pl-fe/toast'; +import { getLoggedInAccount } from 'pl-fe/utils/auth'; +import { normalizeUsername } from 'pl-fe/utils/input'; import { AUTH_LOGGED_OUT, messages } from './auth'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const FETCH_TOKENS_REQUEST = 'FETCH_TOKENS_REQUEST' as const; const FETCH_TOKENS_SUCCESS = 'FETCH_TOKENS_SUCCESS' as const; diff --git a/packages/pl-fe/src/actions/settings.ts b/packages/pl-fe/src/actions/settings.ts index ed60cb91b..9fcd7a717 100644 --- a/packages/pl-fe/src/actions/settings.ts +++ b/packages/pl-fe/src/actions/settings.ts @@ -2,15 +2,15 @@ import { Map as ImmutableMap, List as ImmutableList, OrderedSet as ImmutableOrde import { defineMessage } from 'react-intl'; import { createSelector } from 'reselect'; -import { patchMe } from 'soapbox/actions/me'; -import { getClient } from 'soapbox/api'; -import messages from 'soapbox/messages'; -import { makeGetAccount } from 'soapbox/selectors'; -import KVStore from 'soapbox/storage/kv-store'; -import toast from 'soapbox/toast'; -import { isLoggedIn } from 'soapbox/utils/auth'; +import { patchMe } from 'pl-fe/actions/me'; +import { getClient } from 'pl-fe/api'; +import messages from 'pl-fe/messages'; +import { makeGetAccount } from 'pl-fe/selectors'; +import KVStore from 'pl-fe/storage/kv-store'; +import toast from 'pl-fe/toast'; +import { isLoggedIn } from 'pl-fe/utils/auth'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const SETTING_CHANGE = 'SETTING_CHANGE' as const; const SETTING_SAVE = 'SETTING_SAVE' as const; @@ -133,9 +133,9 @@ const defaultSettings = ImmutableMap({ }); const getSettings = createSelector([ - (state: RootState) => state.soapbox.get('defaultSettings'), + (state: RootState) => state.plfe.get('defaultSettings'), (state: RootState) => state.settings, -], (soapboxSettings, settings) => defaultSettings.mergeDeep(soapboxSettings).mergeDeep(settings)); +], (plFeSettings, settings) => defaultSettings.mergeDeep(plFeSettings).mergeDeep(settings)); interface SettingChangeAction { type: typeof SETTING_CHANGE; diff --git a/packages/pl-fe/src/actions/soapbox.test.ts b/packages/pl-fe/src/actions/soapbox.test.ts deleted file mode 100644 index 1a698a36c..000000000 --- a/packages/pl-fe/src/actions/soapbox.test.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { rootState } from 'soapbox/jest/test-helpers'; -import { RootState } from 'soapbox/store'; - -import { getSoapboxConfig } from './soapbox'; - -const ASCII_HEART = '❤'; // '\u2764\uFE0F' -const RED_HEART_RGI = '❤️'; // '\u2764' - -describe('getSoapboxConfig()', () => { - it('returns RGI heart on Pleroma > 2.3', () => { - const state = rootState.setIn(['instance', 'version'], '2.7.2 (compatible; Pleroma 2.3.0)') as RootState; - expect(getSoapboxConfig(state).allowedEmoji.includes(RED_HEART_RGI)).toBe(true); - expect(getSoapboxConfig(state).allowedEmoji.includes(ASCII_HEART)).toBe(false); - }); - - it('returns an ASCII heart on Pleroma < 2.3', () => { - const state = rootState.setIn(['instance', 'version'], '2.7.2 (compatible; Pleroma 2.0.0)') as RootState; - expect(getSoapboxConfig(state).allowedEmoji.includes(ASCII_HEART)).toBe(true); - expect(getSoapboxConfig(state).allowedEmoji.includes(RED_HEART_RGI)).toBe(false); - }); -}); diff --git a/packages/pl-fe/src/actions/soapbox.ts b/packages/pl-fe/src/actions/soapbox.ts deleted file mode 100644 index 37862c324..000000000 --- a/packages/pl-fe/src/actions/soapbox.ts +++ /dev/null @@ -1,109 +0,0 @@ -import { createSelector } from 'reselect'; - -import { getHost } from 'soapbox/actions/instance'; -import { normalizeSoapboxConfig } from 'soapbox/normalizers'; -import KVStore from 'soapbox/storage/kv-store'; - -import { getClient, staticFetch } from '../api'; - -import type { AppDispatch, RootState } from 'soapbox/store'; -import type { APIEntity } from 'soapbox/types/entities'; - -const SOAPBOX_CONFIG_REQUEST_SUCCESS = 'SOAPBOX_CONFIG_REQUEST_SUCCESS' as const; -const SOAPBOX_CONFIG_REQUEST_FAIL = 'SOAPBOX_CONFIG_REQUEST_FAIL' as const; - -const SOAPBOX_CONFIG_REMEMBER_SUCCESS = 'SOAPBOX_CONFIG_REMEMBER_SUCCESS' as const; - -const getSoapboxConfig = createSelector([ - (state: RootState) => state.soapbox, - (state: RootState) => state.auth.client.features, -], (soapbox, features) => { - // Do some additional normalization with the state - return normalizeSoapboxConfig(soapbox); -}); - -const rememberSoapboxConfig = (host: string | null) => - (dispatch: AppDispatch) => { - return KVStore.getItemOrError(`soapbox_config:${host}`).then(soapboxConfig => { - dispatch({ type: SOAPBOX_CONFIG_REMEMBER_SUCCESS, host, soapboxConfig }); - return soapboxConfig; - }).catch(() => {}); - }; - -const fetchFrontendConfigurations = () => - (dispatch: AppDispatch, getState: () => RootState) => - getClient(getState).instance.getFrontendConfigurations(); - -/** Conditionally fetches Soapbox config depending on backend features */ -const fetchSoapboxConfig = (host: string | null) => - (dispatch: AppDispatch, getState: () => RootState) => { - const features = getState().auth.client.features; - - if (features.frontendConfigurations) { - return dispatch(fetchFrontendConfigurations()).then(data => { - if (data.pl_fe) { - dispatch(importSoapboxConfig(data.pl_fe, host)); - return data.pl_fe; - } else { - return dispatch(fetchSoapboxJson(host)); - } - }); - } else { - return dispatch(fetchSoapboxJson(host)); - } - }; - -/** Tries to remember the config from browser storage before fetching it */ -const loadSoapboxConfig = () => - (dispatch: AppDispatch, getState: () => RootState) => { - const host = getHost(getState()); - - return dispatch(rememberSoapboxConfig(host)).then(() => - dispatch(fetchSoapboxConfig(host)), - ); - }; - -const fetchSoapboxJson = (host: string | null) => - (dispatch: AppDispatch) => - staticFetch('/instance/soapbox.json').then(({ json: data }) => { - if (!isObject(data)) throw 'soapbox.json failed'; - dispatch(importSoapboxConfig(data, host)); - return data; - }).catch(error => { - dispatch(soapboxConfigFail(error, host)); - }); - -const importSoapboxConfig = (soapboxConfig: APIEntity, host: string | null) => { - if (!soapboxConfig.brandColor) { - soapboxConfig.brandColor = '#0482d8'; - } - return { - type: SOAPBOX_CONFIG_REQUEST_SUCCESS, - soapboxConfig, - host, - }; -}; - -const soapboxConfigFail = (error: unknown, host: string | null) => ({ - type: SOAPBOX_CONFIG_REQUEST_FAIL, - error, - skipAlert: true, - host, -}); - -// https://stackoverflow.com/a/46663081 -const isObject = (o: any) => o instanceof Object && o.constructor === Object; - -export { - SOAPBOX_CONFIG_REQUEST_SUCCESS, - SOAPBOX_CONFIG_REQUEST_FAIL, - SOAPBOX_CONFIG_REMEMBER_SUCCESS, - getSoapboxConfig, - rememberSoapboxConfig, - fetchFrontendConfigurations, - fetchSoapboxConfig, - loadSoapboxConfig, - fetchSoapboxJson, - importSoapboxConfig, - soapboxConfigFail, -}; diff --git a/packages/pl-fe/src/actions/status-quotes.test.ts b/packages/pl-fe/src/actions/status-quotes.test.ts index 62b369280..7461d4d89 100644 --- a/packages/pl-fe/src/actions/status-quotes.test.ts +++ b/packages/pl-fe/src/actions/status-quotes.test.ts @@ -1,8 +1,8 @@ import { Map as ImmutableMap } from 'immutable'; -import { __stub } from 'soapbox/api'; -import { mockStore, rootState } from 'soapbox/jest/test-helpers'; -import { StatusListRecord } from 'soapbox/reducers/status-lists'; +import { __stub } from 'pl-fe/api'; +import { mockStore, rootState } from 'pl-fe/jest/test-helpers'; +import { StatusListRecord } from 'pl-fe/reducers/status-lists'; import { fetchStatusQuotes, expandStatusQuotes } from './status-quotes'; @@ -32,7 +32,7 @@ describe('fetchStatusQuotes()', () => { describe('with a successful API request', () => { beforeEach(async () => { - const quotes = await import('soapbox/__fixtures__/status-quotes.json'); + const quotes = await import('pl-fe/__fixtures__/status-quotes.json'); __stub((mock) => { mock.onGet(`/api/v1/pleroma/statuses/${statusId}/quotes`).reply(200, quotes, { @@ -104,7 +104,7 @@ describe('expandStatusQuotes()', () => { describe('with a successful API request', () => { beforeEach(async () => { - const quotes = await import('soapbox/__fixtures__/status-quotes.json'); + const quotes = await import('pl-fe/__fixtures__/status-quotes.json'); __stub((mock) => { mock.onGet('example').reply(200, quotes, { diff --git a/packages/pl-fe/src/actions/status-quotes.ts b/packages/pl-fe/src/actions/status-quotes.ts index d331e4fc9..b0669e409 100644 --- a/packages/pl-fe/src/actions/status-quotes.ts +++ b/packages/pl-fe/src/actions/status-quotes.ts @@ -3,7 +3,7 @@ import { getClient } from '../api'; import { importFetchedStatuses } from './importer'; import type { Status as BaseStatus, PaginatedResponse } from 'pl-api'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const STATUS_QUOTES_FETCH_REQUEST = 'STATUS_QUOTES_FETCH_REQUEST' as const; const STATUS_QUOTES_FETCH_SUCCESS = 'STATUS_QUOTES_FETCH_SUCCESS' as const; diff --git a/packages/pl-fe/src/actions/statuses.test.ts b/packages/pl-fe/src/actions/statuses.test.ts index ba2200480..e382d1fdc 100644 --- a/packages/pl-fe/src/actions/statuses.test.ts +++ b/packages/pl-fe/src/actions/statuses.test.ts @@ -1,15 +1,15 @@ import { fromJS, Map as ImmutableMap } from 'immutable'; -import { STATUSES_IMPORT } from 'soapbox/actions/importer'; -import { __stub } from 'soapbox/api'; -import { mockStore, rootState } from 'soapbox/jest/test-helpers'; -import { normalizeStatus } from 'soapbox/normalizers/status'; +import { STATUSES_IMPORT } from 'pl-fe/actions/importer'; +import { __stub } from 'pl-fe/api'; +import { mockStore, rootState } from 'pl-fe/jest/test-helpers'; +import { normalizeStatus } from 'pl-fe/normalizers/status'; import { deleteStatus, fetchContext } from './statuses'; describe('fetchContext()', () => { it('handles Mitra context', async () => { - const statuses = await import('soapbox/__fixtures__/mitra-context.json'); + const statuses = await import('pl-fe/__fixtures__/mitra-context.json'); __stub(mock => { mock.onGet('/api/v1/statuses/017ed505-5926-392f-256a-f86d5075df70/context') @@ -61,7 +61,7 @@ describe('deleteStatus()', () => { let status: any; beforeEach(async () => { - status = await import('soapbox/__fixtures__/pleroma-status-deleted.json'); + status = await import('pl-fe/__fixtures__/pleroma-status-deleted.json'); __stub((mock) => { mock.onDelete(`/api/v1/statuses/${statusId}`).reply(200, status); diff --git a/packages/pl-fe/src/actions/statuses.ts b/packages/pl-fe/src/actions/statuses.ts index 75330d60b..70a2c314f 100644 --- a/packages/pl-fe/src/actions/statuses.ts +++ b/packages/pl-fe/src/actions/statuses.ts @@ -1,5 +1,5 @@ -import { isLoggedIn } from 'soapbox/utils/auth'; -import { shouldHaveCard } from 'soapbox/utils/status'; +import { isLoggedIn } from 'pl-fe/utils/auth'; +import { shouldHaveCard } from 'pl-fe/utils/status'; import { getClient } from '../api'; @@ -11,9 +11,9 @@ import { deleteFromTimelines } from './timelines'; import type { CreateStatusParams, Status as BaseStatus } from 'pl-api'; import type { IntlShape } from 'react-intl'; -import type { Status } from 'soapbox/normalizers'; -import type { AppDispatch, RootState } from 'soapbox/store'; -import type { APIEntity } from 'soapbox/types/entities'; +import type { Status } from 'pl-fe/normalizers'; +import type { AppDispatch, RootState } from 'pl-fe/store'; +import type { APIEntity } from 'pl-fe/types/entities'; const STATUS_CREATE_REQUEST = 'STATUS_CREATE_REQUEST' as const; const STATUS_CREATE_SUCCESS = 'STATUS_CREATE_SUCCESS' as const; diff --git a/packages/pl-fe/src/actions/suggestions.ts b/packages/pl-fe/src/actions/suggestions.ts index 948af6494..8b3aaf31f 100644 --- a/packages/pl-fe/src/actions/suggestions.ts +++ b/packages/pl-fe/src/actions/suggestions.ts @@ -1,4 +1,4 @@ -import { isLoggedIn } from 'soapbox/utils/auth'; +import { isLoggedIn } from 'pl-fe/utils/auth'; import { getClient } from '../api'; @@ -6,7 +6,7 @@ import { fetchRelationships } from './accounts'; import { importFetchedAccounts } from './importer'; import { insertSuggestionsIntoTimeline } from './timelines'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const SUGGESTIONS_FETCH_REQUEST = 'SUGGESTIONS_FETCH_REQUEST' as const; const SUGGESTIONS_FETCH_SUCCESS = 'SUGGESTIONS_FETCH_SUCCESS' as const; diff --git a/packages/pl-fe/src/actions/tags.ts b/packages/pl-fe/src/actions/tags.ts index 4b787cb04..bb7c6a3b6 100644 --- a/packages/pl-fe/src/actions/tags.ts +++ b/packages/pl-fe/src/actions/tags.ts @@ -1,7 +1,7 @@ import { getClient } from '../api'; import type { PaginatedResponse, Tag } from 'pl-api'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const HASHTAG_FETCH_REQUEST = 'HASHTAG_FETCH_REQUEST' as const; const HASHTAG_FETCH_SUCCESS = 'HASHTAG_FETCH_SUCCESS' as const; diff --git a/packages/pl-fe/src/actions/timelines.ts b/packages/pl-fe/src/actions/timelines.ts index 8f7624a54..424b7d45e 100644 --- a/packages/pl-fe/src/actions/timelines.ts +++ b/packages/pl-fe/src/actions/timelines.ts @@ -1,14 +1,14 @@ import { Map as ImmutableMap } from 'immutable'; -import { getLocale, getSettings } from 'soapbox/actions/settings'; -import { shouldFilter } from 'soapbox/utils/timelines'; +import { getLocale, getSettings } from 'pl-fe/actions/settings'; +import { shouldFilter } from 'pl-fe/utils/timelines'; import { getClient } from '../api'; import { importFetchedStatus, importFetchedStatuses } from './importer'; import type { PaginatedResponse, Status as BaseStatus, PublicTimelineParams, HomeTimelineParams, ListTimelineParams, HashtagTimelineParams, GetAccountStatusesParams, GroupTimelineParams } from 'pl-api'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const TIMELINE_UPDATE = 'TIMELINE_UPDATE' as const; const TIMELINE_DELETE = 'TIMELINE_DELETE' as const; diff --git a/packages/pl-fe/src/actions/trending-statuses.ts b/packages/pl-fe/src/actions/trending-statuses.ts index fd1ac28f6..692f13241 100644 --- a/packages/pl-fe/src/actions/trending-statuses.ts +++ b/packages/pl-fe/src/actions/trending-statuses.ts @@ -2,7 +2,7 @@ import { getClient } from '../api'; import { importFetchedStatuses } from './importer'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const TRENDING_STATUSES_FETCH_REQUEST = 'TRENDING_STATUSES_FETCH_REQUEST' as const; const TRENDING_STATUSES_FETCH_SUCCESS = 'TRENDING_STATUSES_FETCH_SUCCESS' as const; diff --git a/packages/pl-fe/src/api/hooks/accounts/useAccount.ts b/packages/pl-fe/src/api/hooks/accounts/useAccount.ts index 5ea45bea2..f42a4aa1d 100644 --- a/packages/pl-fe/src/api/hooks/accounts/useAccount.ts +++ b/packages/pl-fe/src/api/hooks/accounts/useAccount.ts @@ -2,10 +2,10 @@ import { type Account as BaseAccount, accountSchema } from 'pl-api'; import { useEffect, useMemo } from 'react'; import { useHistory } from 'react-router-dom'; -import { Entities } from 'soapbox/entity-store/entities'; -import { useEntity } from 'soapbox/entity-store/hooks'; -import { useAppSelector, useClient, useFeatures, useLoggedIn } from 'soapbox/hooks'; -import { type Account, normalizeAccount } from 'soapbox/normalizers'; +import { Entities } from 'pl-fe/entity-store/entities'; +import { useEntity } from 'pl-fe/entity-store/hooks'; +import { useAppSelector, useClient, useFeatures, useLoggedIn } from 'pl-fe/hooks'; +import { type Account, normalizeAccount } from 'pl-fe/normalizers'; import { useRelationship } from './useRelationship'; diff --git a/packages/pl-fe/src/api/hooks/accounts/useAccountList.ts b/packages/pl-fe/src/api/hooks/accounts/useAccountList.ts index d87eea410..12e036c56 100644 --- a/packages/pl-fe/src/api/hooks/accounts/useAccountList.ts +++ b/packages/pl-fe/src/api/hooks/accounts/useAccountList.ts @@ -1,14 +1,14 @@ import { useInfiniteQuery } from '@tanstack/react-query'; -import { Entities } from 'soapbox/entity-store/entities'; -import { useClient } from 'soapbox/hooks'; -import { type Account, normalizeAccount } from 'soapbox/normalizers'; -import { flattenPages } from 'soapbox/utils/queries'; +import { Entities } from 'pl-fe/entity-store/entities'; +import { useClient } from 'pl-fe/hooks'; +import { type Account, normalizeAccount } from 'pl-fe/normalizers'; +import { flattenPages } from 'pl-fe/utils/queries'; import { useRelationships } from './useRelationships'; import type { PaginatedResponse, Account as BaseAccount } from 'pl-api'; -import type { EntityFn } from 'soapbox/entity-store/hooks/types'; +import type { EntityFn } from 'pl-fe/entity-store/hooks/types'; const useAccountList = (listKey: string[], entityFn: EntityFn) => { const getAccounts = async (pageParam?: Pick, 'next'>) => { diff --git a/packages/pl-fe/src/api/hooks/accounts/useAccountLookup.ts b/packages/pl-fe/src/api/hooks/accounts/useAccountLookup.ts index 5f403d23b..13905bf4d 100644 --- a/packages/pl-fe/src/api/hooks/accounts/useAccountLookup.ts +++ b/packages/pl-fe/src/api/hooks/accounts/useAccountLookup.ts @@ -2,10 +2,10 @@ import { accountSchema, type Account as BaseAccount } from 'pl-api'; import { useEffect } from 'react'; import { useHistory } from 'react-router-dom'; -import { Entities } from 'soapbox/entity-store/entities'; -import { useEntityLookup } from 'soapbox/entity-store/hooks'; -import { useClient, useFeatures, useLoggedIn } from 'soapbox/hooks'; -import { type Account, normalizeAccount } from 'soapbox/normalizers'; +import { Entities } from 'pl-fe/entity-store/entities'; +import { useEntityLookup } from 'pl-fe/entity-store/hooks'; +import { useClient, useFeatures, useLoggedIn } from 'pl-fe/hooks'; +import { type Account, normalizeAccount } from 'pl-fe/normalizers'; import { useRelationship } from './useRelationship'; diff --git a/packages/pl-fe/src/api/hooks/accounts/useFollow.ts b/packages/pl-fe/src/api/hooks/accounts/useFollow.ts index 88019c638..7d10889b2 100644 --- a/packages/pl-fe/src/api/hooks/accounts/useFollow.ts +++ b/packages/pl-fe/src/api/hooks/accounts/useFollow.ts @@ -1,7 +1,7 @@ -import { importEntities } from 'soapbox/entity-store/actions'; -import { Entities } from 'soapbox/entity-store/entities'; -import { useTransaction } from 'soapbox/entity-store/hooks'; -import { useAppDispatch, useClient, useLoggedIn } from 'soapbox/hooks'; +import { importEntities } from 'pl-fe/entity-store/actions'; +import { Entities } from 'pl-fe/entity-store/entities'; +import { useTransaction } from 'pl-fe/entity-store/hooks'; +import { useAppDispatch, useClient, useLoggedIn } from 'pl-fe/hooks'; interface FollowOpts { reblogs?: boolean; diff --git a/packages/pl-fe/src/api/hooks/accounts/useRelationship.ts b/packages/pl-fe/src/api/hooks/accounts/useRelationship.ts index 299c95458..21cafc382 100644 --- a/packages/pl-fe/src/api/hooks/accounts/useRelationship.ts +++ b/packages/pl-fe/src/api/hooks/accounts/useRelationship.ts @@ -1,9 +1,9 @@ import { type Relationship, relationshipSchema } from 'pl-api'; import { z } from 'zod'; -import { Entities } from 'soapbox/entity-store/entities'; -import { useEntity } from 'soapbox/entity-store/hooks'; -import { useClient } from 'soapbox/hooks'; +import { Entities } from 'pl-fe/entity-store/entities'; +import { useEntity } from 'pl-fe/entity-store/hooks'; +import { useClient } from 'pl-fe/hooks'; interface UseRelationshipOpts { enabled?: boolean; diff --git a/packages/pl-fe/src/api/hooks/accounts/useRelationships.ts b/packages/pl-fe/src/api/hooks/accounts/useRelationships.ts index cc3706a27..81925637b 100644 --- a/packages/pl-fe/src/api/hooks/accounts/useRelationships.ts +++ b/packages/pl-fe/src/api/hooks/accounts/useRelationships.ts @@ -1,8 +1,8 @@ import { type Relationship, relationshipSchema } from 'pl-api'; -import { Entities } from 'soapbox/entity-store/entities'; -import { useBatchedEntities } from 'soapbox/entity-store/hooks/useBatchedEntities'; -import { useClient, useLoggedIn } from 'soapbox/hooks'; +import { Entities } from 'pl-fe/entity-store/entities'; +import { useBatchedEntities } from 'pl-fe/entity-store/hooks/useBatchedEntities'; +import { useClient, useLoggedIn } from 'pl-fe/hooks'; const useRelationships = (listKey: string[], accountIds: string[]) => { const client = useClient(); diff --git a/packages/pl-fe/src/api/hooks/admin/useAnnouncements.ts b/packages/pl-fe/src/api/hooks/admin/useAnnouncements.ts index 4d535c00c..8cd36336b 100644 --- a/packages/pl-fe/src/api/hooks/admin/useAnnouncements.ts +++ b/packages/pl-fe/src/api/hooks/admin/useAnnouncements.ts @@ -1,8 +1,8 @@ import { useMutation, useQuery } from '@tanstack/react-query'; -import { useClient } from 'soapbox/hooks'; -import { queryClient } from 'soapbox/queries/client'; -import { adminAnnouncementSchema, type AdminAnnouncement } from 'soapbox/schemas'; +import { useClient } from 'pl-fe/hooks'; +import { queryClient } from 'pl-fe/queries/client'; +import { adminAnnouncementSchema, type AdminAnnouncement } from 'pl-fe/schemas'; import { useAnnouncements as useUserAnnouncements } from '../announcements'; diff --git a/packages/pl-fe/src/api/hooks/admin/useDomains.ts b/packages/pl-fe/src/api/hooks/admin/useDomains.ts index 7d2ab7727..f1e24377c 100644 --- a/packages/pl-fe/src/api/hooks/admin/useDomains.ts +++ b/packages/pl-fe/src/api/hooks/admin/useDomains.ts @@ -1,8 +1,8 @@ import { useMutation, useQuery } from '@tanstack/react-query'; -import { useClient } from 'soapbox/hooks'; -import { queryClient } from 'soapbox/queries/client'; -import { domainSchema, type Domain } from 'soapbox/schemas'; +import { useClient } from 'pl-fe/hooks'; +import { queryClient } from 'pl-fe/queries/client'; +import { domainSchema, type Domain } from 'pl-fe/schemas'; interface CreateDomainParams { domain: string; diff --git a/packages/pl-fe/src/api/hooks/admin/useModerationLog.ts b/packages/pl-fe/src/api/hooks/admin/useModerationLog.ts index 308425895..e43696c26 100644 --- a/packages/pl-fe/src/api/hooks/admin/useModerationLog.ts +++ b/packages/pl-fe/src/api/hooks/admin/useModerationLog.ts @@ -1,7 +1,7 @@ import { useInfiniteQuery } from '@tanstack/react-query'; -import { useClient } from 'soapbox/hooks'; -import { moderationLogEntrySchema, type ModerationLogEntry } from 'soapbox/schemas'; +import { useClient } from 'pl-fe/hooks'; +import { moderationLogEntrySchema, type ModerationLogEntry } from 'pl-fe/schemas'; interface ModerationLogResult { items: ModerationLogEntry[]; diff --git a/packages/pl-fe/src/api/hooks/admin/useRelays.ts b/packages/pl-fe/src/api/hooks/admin/useRelays.ts index 2981e4933..25967da17 100644 --- a/packages/pl-fe/src/api/hooks/admin/useRelays.ts +++ b/packages/pl-fe/src/api/hooks/admin/useRelays.ts @@ -1,8 +1,8 @@ import { useMutation, useQuery } from '@tanstack/react-query'; -import { useClient } from 'soapbox/hooks'; -import { queryClient } from 'soapbox/queries/client'; -import { relaySchema, type Relay } from 'soapbox/schemas'; +import { useClient } from 'pl-fe/hooks'; +import { queryClient } from 'pl-fe/queries/client'; +import { relaySchema, type Relay } from 'pl-fe/schemas'; const useRelays = () => { const client = useClient(); diff --git a/packages/pl-fe/src/api/hooks/admin/useRules.ts b/packages/pl-fe/src/api/hooks/admin/useRules.ts index a10f29b1e..72829046a 100644 --- a/packages/pl-fe/src/api/hooks/admin/useRules.ts +++ b/packages/pl-fe/src/api/hooks/admin/useRules.ts @@ -1,8 +1,8 @@ import { useMutation, useQuery } from '@tanstack/react-query'; -import { useClient } from 'soapbox/hooks'; -import { queryClient } from 'soapbox/queries/client'; -import { adminRuleSchema, type AdminRule } from 'soapbox/schemas'; +import { useClient } from 'pl-fe/hooks'; +import { queryClient } from 'pl-fe/queries/client'; +import { adminRuleSchema, type AdminRule } from 'pl-fe/schemas'; interface CreateRuleParams { priority?: number; diff --git a/packages/pl-fe/src/api/hooks/admin/useSuggest.ts b/packages/pl-fe/src/api/hooks/admin/useSuggest.ts index 286ec4548..465626478 100644 --- a/packages/pl-fe/src/api/hooks/admin/useSuggest.ts +++ b/packages/pl-fe/src/api/hooks/admin/useSuggest.ts @@ -1,9 +1,9 @@ -import { useTransaction } from 'soapbox/entity-store/hooks'; -import { EntityCallbacks } from 'soapbox/entity-store/hooks/types'; -import { useClient, useGetState } from 'soapbox/hooks'; -import { accountIdsToAccts } from 'soapbox/selectors'; +import { useTransaction } from 'pl-fe/entity-store/hooks'; +import { EntityCallbacks } from 'pl-fe/entity-store/hooks/types'; +import { useClient, useGetState } from 'pl-fe/hooks'; +import { accountIdsToAccts } from 'pl-fe/selectors'; -import type { Account } from 'soapbox/normalizers'; +import type { Account } from 'pl-fe/normalizers'; const useSuggest = () => { const client = useClient(); diff --git a/packages/pl-fe/src/api/hooks/admin/useVerify.ts b/packages/pl-fe/src/api/hooks/admin/useVerify.ts index f5dc1a6c7..22cd3ed02 100644 --- a/packages/pl-fe/src/api/hooks/admin/useVerify.ts +++ b/packages/pl-fe/src/api/hooks/admin/useVerify.ts @@ -1,9 +1,9 @@ -import { useTransaction } from 'soapbox/entity-store/hooks'; -import { EntityCallbacks } from 'soapbox/entity-store/hooks/types'; -import { useClient, useGetState } from 'soapbox/hooks'; -import { accountIdsToAccts } from 'soapbox/selectors'; +import { useTransaction } from 'pl-fe/entity-store/hooks'; +import { EntityCallbacks } from 'pl-fe/entity-store/hooks/types'; +import { useClient, useGetState } from 'pl-fe/hooks'; +import { accountIdsToAccts } from 'pl-fe/selectors'; -import type { Account } from 'soapbox/normalizers'; +import type { Account } from 'pl-fe/normalizers'; const useVerify = () => { const client = useClient(); diff --git a/packages/pl-fe/src/api/hooks/announcements/useAnnouncements.ts b/packages/pl-fe/src/api/hooks/announcements/useAnnouncements.ts index cd6c2091d..6edb5268b 100644 --- a/packages/pl-fe/src/api/hooks/announcements/useAnnouncements.ts +++ b/packages/pl-fe/src/api/hooks/announcements/useAnnouncements.ts @@ -1,9 +1,9 @@ import { useMutation, useQuery } from '@tanstack/react-query'; import { announcementReactionSchema, type AnnouncementReaction } from 'pl-api'; -import { useClient } from 'soapbox/hooks'; -import { type Announcement, normalizeAnnouncement } from 'soapbox/normalizers'; -import { queryClient } from 'soapbox/queries/client'; +import { useClient } from 'pl-fe/hooks'; +import { type Announcement, normalizeAnnouncement } from 'pl-fe/normalizers'; +import { queryClient } from 'pl-fe/queries/client'; const updateReaction = (reaction: AnnouncementReaction, count: number, me?: boolean, overwrite?: boolean) => announcementReactionSchema.parse({ ...reaction, diff --git a/packages/pl-fe/src/api/hooks/groups/useBlockGroupMember.ts b/packages/pl-fe/src/api/hooks/groups/useBlockGroupMember.ts index b780ad9d5..7628b4079 100644 --- a/packages/pl-fe/src/api/hooks/groups/useBlockGroupMember.ts +++ b/packages/pl-fe/src/api/hooks/groups/useBlockGroupMember.ts @@ -1,9 +1,9 @@ -import { Entities } from 'soapbox/entity-store/entities'; -import { useCreateEntity } from 'soapbox/entity-store/hooks'; -import { useClient } from 'soapbox/hooks'; +import { Entities } from 'pl-fe/entity-store/entities'; +import { useCreateEntity } from 'pl-fe/entity-store/hooks'; +import { useClient } from 'pl-fe/hooks'; import type { Group } from 'pl-api'; -import type { Account } from 'soapbox/normalizers'; +import type { Account } from 'pl-fe/normalizers'; const useBlockGroupMember = (group: Pick, account: Pick) => { const client = useClient(); diff --git a/packages/pl-fe/src/api/hooks/groups/useCreateGroup.ts b/packages/pl-fe/src/api/hooks/groups/useCreateGroup.ts index d711e8ee2..85b926f90 100644 --- a/packages/pl-fe/src/api/hooks/groups/useCreateGroup.ts +++ b/packages/pl-fe/src/api/hooks/groups/useCreateGroup.ts @@ -1,9 +1,9 @@ import { groupSchema, type Group as BaseGroup } from 'pl-api'; -import { Entities } from 'soapbox/entity-store/entities'; -import { useCreateEntity } from 'soapbox/entity-store/hooks'; -import { useClient } from 'soapbox/hooks'; -import { normalizeGroup, type Group } from 'soapbox/normalizers'; +import { Entities } from 'pl-fe/entity-store/entities'; +import { useCreateEntity } from 'pl-fe/entity-store/hooks'; +import { useClient } from 'pl-fe/hooks'; +import { normalizeGroup, type Group } from 'pl-fe/normalizers'; interface CreateGroupParams { display_name: string; diff --git a/packages/pl-fe/src/api/hooks/groups/useDeleteGroup.ts b/packages/pl-fe/src/api/hooks/groups/useDeleteGroup.ts index 149ba6441..61de6350f 100644 --- a/packages/pl-fe/src/api/hooks/groups/useDeleteGroup.ts +++ b/packages/pl-fe/src/api/hooks/groups/useDeleteGroup.ts @@ -1,6 +1,6 @@ -import { Entities } from 'soapbox/entity-store/entities'; -import { useDeleteEntity } from 'soapbox/entity-store/hooks'; -import { useClient } from 'soapbox/hooks'; +import { Entities } from 'pl-fe/entity-store/entities'; +import { useDeleteEntity } from 'pl-fe/entity-store/hooks'; +import { useClient } from 'pl-fe/hooks'; const useDeleteGroup = () => { const client = useClient(); diff --git a/packages/pl-fe/src/api/hooks/groups/useDeleteGroupStatus.ts b/packages/pl-fe/src/api/hooks/groups/useDeleteGroupStatus.ts index 03cf85f19..7185a6d10 100644 --- a/packages/pl-fe/src/api/hooks/groups/useDeleteGroupStatus.ts +++ b/packages/pl-fe/src/api/hooks/groups/useDeleteGroupStatus.ts @@ -1,6 +1,6 @@ -import { Entities } from 'soapbox/entity-store/entities'; -import { useDeleteEntity } from 'soapbox/entity-store/hooks'; -import { useClient } from 'soapbox/hooks'; +import { Entities } from 'pl-fe/entity-store/entities'; +import { useDeleteEntity } from 'pl-fe/entity-store/hooks'; +import { useClient } from 'pl-fe/hooks'; import type { Group } from 'pl-api'; diff --git a/packages/pl-fe/src/api/hooks/groups/useDemoteGroupMember.ts b/packages/pl-fe/src/api/hooks/groups/useDemoteGroupMember.ts index e8bc993e8..9af06816f 100644 --- a/packages/pl-fe/src/api/hooks/groups/useDemoteGroupMember.ts +++ b/packages/pl-fe/src/api/hooks/groups/useDemoteGroupMember.ts @@ -1,10 +1,10 @@ import { groupMemberSchema, type Group, type GroupMember as GroupMember, type GroupRole } from 'pl-api'; import { z } from 'zod'; -import { Entities } from 'soapbox/entity-store/entities'; -import { useCreateEntity } from 'soapbox/entity-store/hooks'; -import { useClient } from 'soapbox/hooks'; -import { normalizeGroupMember } from 'soapbox/normalizers'; +import { Entities } from 'pl-fe/entity-store/entities'; +import { useCreateEntity } from 'pl-fe/entity-store/hooks'; +import { useClient } from 'pl-fe/hooks'; +import { normalizeGroupMember } from 'pl-fe/normalizers'; const useDemoteGroupMember = (group: Pick, groupMember: Pick) => { const client = useClient(); diff --git a/packages/pl-fe/src/api/hooks/groups/useGroup.test.ts b/packages/pl-fe/src/api/hooks/groups/useGroup.test.ts index c063b332b..0f46a7f0a 100644 --- a/packages/pl-fe/src/api/hooks/groups/useGroup.test.ts +++ b/packages/pl-fe/src/api/hooks/groups/useGroup.test.ts @@ -1,6 +1,6 @@ -import { __stub } from 'soapbox/api'; -import { buildGroup } from 'soapbox/jest/factory'; -import { renderHook, waitFor } from 'soapbox/jest/test-helpers'; +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'; diff --git a/packages/pl-fe/src/api/hooks/groups/useGroup.ts b/packages/pl-fe/src/api/hooks/groups/useGroup.ts index 172dfefe3..bc82d9330 100644 --- a/packages/pl-fe/src/api/hooks/groups/useGroup.ts +++ b/packages/pl-fe/src/api/hooks/groups/useGroup.ts @@ -2,10 +2,10 @@ import { type Group as BaseGroup, groupSchema } from 'pl-api'; import { useEffect } from 'react'; import { useHistory } from 'react-router-dom'; -import { Entities } from 'soapbox/entity-store/entities'; -import { useEntity } from 'soapbox/entity-store/hooks'; -import { useClient } from 'soapbox/hooks'; -import { normalizeGroup, type Group } from 'soapbox/normalizers'; +import { Entities } from 'pl-fe/entity-store/entities'; +import { useEntity } from 'pl-fe/entity-store/hooks'; +import { useClient } from 'pl-fe/hooks'; +import { normalizeGroup, type Group } from 'pl-fe/normalizers'; import { useGroupRelationship } from './useGroupRelationship'; diff --git a/packages/pl-fe/src/api/hooks/groups/useGroupMedia.test.ts b/packages/pl-fe/src/api/hooks/groups/useGroupMedia.test.ts index e8612269f..e8b045445 100644 --- a/packages/pl-fe/src/api/hooks/groups/useGroupMedia.test.ts +++ b/packages/pl-fe/src/api/hooks/groups/useGroupMedia.test.ts @@ -1,6 +1,6 @@ -import { __stub } from 'soapbox/api'; -import { buildStatus } from 'soapbox/jest/factory'; -import { renderHook, waitFor } from 'soapbox/jest/test-helpers'; +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'; diff --git a/packages/pl-fe/src/api/hooks/groups/useGroupMedia.ts b/packages/pl-fe/src/api/hooks/groups/useGroupMedia.ts index eab72b766..09eccdfee 100644 --- a/packages/pl-fe/src/api/hooks/groups/useGroupMedia.ts +++ b/packages/pl-fe/src/api/hooks/groups/useGroupMedia.ts @@ -1,9 +1,9 @@ import { statusSchema } from 'pl-api'; -import { Entities } from 'soapbox/entity-store/entities'; -import { useEntities } from 'soapbox/entity-store/hooks'; -import { useClient } from 'soapbox/hooks'; -import { normalizeStatus } from 'soapbox/normalizers'; +import { Entities } from 'pl-fe/entity-store/entities'; +import { useEntities } from 'pl-fe/entity-store/hooks'; +import { useClient } from 'pl-fe/hooks'; +import { normalizeStatus } from 'pl-fe/normalizers'; const useGroupMedia = (groupId: string) => { const client = useClient(); diff --git a/packages/pl-fe/src/api/hooks/groups/useGroupMembers.test.ts b/packages/pl-fe/src/api/hooks/groups/useGroupMembers.test.ts index 8483f0b63..317862a81 100644 --- a/packages/pl-fe/src/api/hooks/groups/useGroupMembers.test.ts +++ b/packages/pl-fe/src/api/hooks/groups/useGroupMembers.test.ts @@ -1,8 +1,8 @@ import { GroupRoles } from 'pl-api'; -import { __stub } from 'soapbox/api'; -import { buildGroupMember } from 'soapbox/jest/factory'; -import { renderHook, waitFor } from 'soapbox/jest/test-helpers'; +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'; diff --git a/packages/pl-fe/src/api/hooks/groups/useGroupMembers.ts b/packages/pl-fe/src/api/hooks/groups/useGroupMembers.ts index 4c977cb00..23fcc3a36 100644 --- a/packages/pl-fe/src/api/hooks/groups/useGroupMembers.ts +++ b/packages/pl-fe/src/api/hooks/groups/useGroupMembers.ts @@ -1,9 +1,9 @@ import { groupMemberSchema, type GroupMember as BaseGroupMember, type GroupRoles } from 'pl-api'; -import { Entities } from 'soapbox/entity-store/entities'; -import { useEntities } from 'soapbox/entity-store/hooks'; -import { useClient } from 'soapbox/hooks'; -import { normalizeGroupMember, type GroupMember } from 'soapbox/normalizers'; +import { Entities } from 'pl-fe/entity-store/entities'; +import { useEntities } from 'pl-fe/entity-store/hooks'; +import { useClient } from 'pl-fe/hooks'; +import { normalizeGroupMember, type GroupMember } from 'pl-fe/normalizers'; const useGroupMembers = (groupId: string, role: GroupRoles) => { const client = useClient(); diff --git a/packages/pl-fe/src/api/hooks/groups/useGroupMembershipRequests.ts b/packages/pl-fe/src/api/hooks/groups/useGroupMembershipRequests.ts index b46126aeb..49958f3c0 100644 --- a/packages/pl-fe/src/api/hooks/groups/useGroupMembershipRequests.ts +++ b/packages/pl-fe/src/api/hooks/groups/useGroupMembershipRequests.ts @@ -1,13 +1,13 @@ import { accountSchema, GroupRoles } from 'pl-api'; -import { Entities } from 'soapbox/entity-store/entities'; -import { useDismissEntity, useEntities } from 'soapbox/entity-store/hooks'; -import { useClient } from 'soapbox/hooks'; -import { normalizeAccount } from 'soapbox/normalizers'; +import { Entities } from 'pl-fe/entity-store/entities'; +import { useDismissEntity, useEntities } from 'pl-fe/entity-store/hooks'; +import { useClient } from 'pl-fe/hooks'; +import { normalizeAccount } from 'pl-fe/normalizers'; import { useGroupRelationship } from './useGroupRelationship'; -import type { ExpandedEntitiesPath } from 'soapbox/entity-store/hooks/types'; +import type { ExpandedEntitiesPath } from 'pl-fe/entity-store/hooks/types'; const useGroupMembershipRequests = (groupId: string) => { const client = useClient(); diff --git a/packages/pl-fe/src/api/hooks/groups/useGroupRelationship.ts b/packages/pl-fe/src/api/hooks/groups/useGroupRelationship.ts index d4d76e514..f71083fa9 100644 --- a/packages/pl-fe/src/api/hooks/groups/useGroupRelationship.ts +++ b/packages/pl-fe/src/api/hooks/groups/useGroupRelationship.ts @@ -1,9 +1,9 @@ import { type GroupRelationship, groupRelationshipSchema } from 'pl-api'; import { z } from 'zod'; -import { Entities } from 'soapbox/entity-store/entities'; -import { useEntity } from 'soapbox/entity-store/hooks'; -import { useClient } from 'soapbox/hooks'; +import { Entities } from 'pl-fe/entity-store/entities'; +import { useEntity } from 'pl-fe/entity-store/hooks'; +import { useClient } from 'pl-fe/hooks'; const useGroupRelationship = (groupId: string | undefined) => { const client = useClient(); diff --git a/packages/pl-fe/src/api/hooks/groups/useGroupRelationships.ts b/packages/pl-fe/src/api/hooks/groups/useGroupRelationships.ts index 204879f87..61d8498eb 100644 --- a/packages/pl-fe/src/api/hooks/groups/useGroupRelationships.ts +++ b/packages/pl-fe/src/api/hooks/groups/useGroupRelationships.ts @@ -1,8 +1,8 @@ import { type GroupRelationship, groupRelationshipSchema } from 'pl-api'; -import { Entities } from 'soapbox/entity-store/entities'; -import { useBatchedEntities } from 'soapbox/entity-store/hooks/useBatchedEntities'; -import { useClient, useLoggedIn } from 'soapbox/hooks'; +import { Entities } from 'pl-fe/entity-store/entities'; +import { useBatchedEntities } from 'pl-fe/entity-store/hooks/useBatchedEntities'; +import { useClient, useLoggedIn } from 'pl-fe/hooks'; const useGroupRelationships = (listKey: string[], groupIds: string[]) => { const client = useClient(); diff --git a/packages/pl-fe/src/api/hooks/groups/useGroups.test.ts b/packages/pl-fe/src/api/hooks/groups/useGroups.test.ts index efca8c490..0f0c8a7ec 100644 --- a/packages/pl-fe/src/api/hooks/groups/useGroups.test.ts +++ b/packages/pl-fe/src/api/hooks/groups/useGroups.test.ts @@ -1,7 +1,7 @@ -import { __stub } from 'soapbox/api'; -import { buildGroup } from 'soapbox/jest/factory'; -import { renderHook, waitFor } from 'soapbox/jest/test-helpers'; -import { instanceSchema } from 'soapbox/schemas'; +import { __stub } from 'pl-fe/api'; +import { buildGroup } from 'pl-fe/jest/factory'; +import { renderHook, waitFor } from 'pl-fe/jest/test-helpers'; +import { instanceSchema } from 'pl-fe/schemas'; import { useGroups } from './useGroups'; diff --git a/packages/pl-fe/src/api/hooks/groups/useGroups.ts b/packages/pl-fe/src/api/hooks/groups/useGroups.ts index 97d9ed0a9..e7e4f2e14 100644 --- a/packages/pl-fe/src/api/hooks/groups/useGroups.ts +++ b/packages/pl-fe/src/api/hooks/groups/useGroups.ts @@ -1,10 +1,10 @@ import { groupSchema, type Group as BaseGroup } from 'pl-api'; -import { Entities } from 'soapbox/entity-store/entities'; -import { useEntities } from 'soapbox/entity-store/hooks'; -import { useClient } from 'soapbox/hooks'; -import { useFeatures } from 'soapbox/hooks/useFeatures'; -import { normalizeGroup, type Group } from 'soapbox/normalizers'; +import { Entities } from 'pl-fe/entity-store/entities'; +import { useEntities } from 'pl-fe/entity-store/hooks'; +import { useClient } from 'pl-fe/hooks'; +import { useFeatures } from 'pl-fe/hooks/useFeatures'; +import { normalizeGroup, type Group } from 'pl-fe/normalizers'; import { useGroupRelationships } from './useGroupRelationships'; diff --git a/packages/pl-fe/src/api/hooks/groups/useJoinGroup.ts b/packages/pl-fe/src/api/hooks/groups/useJoinGroup.ts index 9d10613ab..3378515b4 100644 --- a/packages/pl-fe/src/api/hooks/groups/useJoinGroup.ts +++ b/packages/pl-fe/src/api/hooks/groups/useJoinGroup.ts @@ -1,6 +1,6 @@ -import { Entities } from 'soapbox/entity-store/entities'; -import { useCreateEntity } from 'soapbox/entity-store/hooks'; -import { useClient } from 'soapbox/hooks'; +import { Entities } from 'pl-fe/entity-store/entities'; +import { useCreateEntity } from 'pl-fe/entity-store/hooks'; +import { useClient } from 'pl-fe/hooks'; import { useGroups } from './useGroups'; diff --git a/packages/pl-fe/src/api/hooks/groups/useLeaveGroup.ts b/packages/pl-fe/src/api/hooks/groups/useLeaveGroup.ts index 587badcff..12afead8d 100644 --- a/packages/pl-fe/src/api/hooks/groups/useLeaveGroup.ts +++ b/packages/pl-fe/src/api/hooks/groups/useLeaveGroup.ts @@ -1,6 +1,6 @@ -import { Entities } from 'soapbox/entity-store/entities'; -import { useCreateEntity } from 'soapbox/entity-store/hooks'; -import { useClient } from 'soapbox/hooks'; +import { Entities } from 'pl-fe/entity-store/entities'; +import { useCreateEntity } from 'pl-fe/entity-store/hooks'; +import { useClient } from 'pl-fe/hooks'; import { useGroups } from './useGroups'; diff --git a/packages/pl-fe/src/api/hooks/groups/usePromoteGroupMember.ts b/packages/pl-fe/src/api/hooks/groups/usePromoteGroupMember.ts index a585cbfb9..18aeaeb2f 100644 --- a/packages/pl-fe/src/api/hooks/groups/usePromoteGroupMember.ts +++ b/packages/pl-fe/src/api/hooks/groups/usePromoteGroupMember.ts @@ -1,10 +1,10 @@ import { groupMemberSchema } from 'pl-api'; import { z } from 'zod'; -import { Entities } from 'soapbox/entity-store/entities'; -import { useCreateEntity } from 'soapbox/entity-store/hooks'; -import { useClient } from 'soapbox/hooks'; -import { normalizeGroupMember } from 'soapbox/normalizers'; +import { Entities } from 'pl-fe/entity-store/entities'; +import { useCreateEntity } from 'pl-fe/entity-store/hooks'; +import { useClient } from 'pl-fe/hooks'; +import { normalizeGroupMember } from 'pl-fe/normalizers'; 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/useUpdateGroup.ts index 4fe2d1bb5..605930e41 100644 --- a/packages/pl-fe/src/api/hooks/groups/useUpdateGroup.ts +++ b/packages/pl-fe/src/api/hooks/groups/useUpdateGroup.ts @@ -1,9 +1,9 @@ import { groupSchema } from 'pl-api'; -import { Entities } from 'soapbox/entity-store/entities'; -import { useCreateEntity } from 'soapbox/entity-store/hooks'; -import { useClient } from 'soapbox/hooks'; -import { normalizeGroup } from 'soapbox/normalizers'; +import { Entities } from 'pl-fe/entity-store/entities'; +import { useCreateEntity } from 'pl-fe/entity-store/hooks'; +import { useClient } from 'pl-fe/hooks'; +import { normalizeGroup } from 'pl-fe/normalizers'; interface UpdateGroupParams { display_name?: string; diff --git a/packages/pl-fe/src/api/hooks/instance/useTranslationLanguages.ts b/packages/pl-fe/src/api/hooks/instance/useTranslationLanguages.ts index a45c3f521..50e97522b 100644 --- a/packages/pl-fe/src/api/hooks/instance/useTranslationLanguages.ts +++ b/packages/pl-fe/src/api/hooks/instance/useTranslationLanguages.ts @@ -1,6 +1,6 @@ import { useQuery } from '@tanstack/react-query'; -import { useClient, useFeatures, useInstance, useLoggedIn } from 'soapbox/hooks'; +import { useClient, useFeatures, useInstance, useLoggedIn } from 'pl-fe/hooks'; 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/useInteractionPolicies.ts index d6d57afc0..d85b19c25 100644 --- a/packages/pl-fe/src/api/hooks/settings/useInteractionPolicies.ts +++ b/packages/pl-fe/src/api/hooks/settings/useInteractionPolicies.ts @@ -1,8 +1,8 @@ import { useMutation, useQuery } from '@tanstack/react-query'; import { type InteractionPolicies, interactionPoliciesSchema } from 'pl-api'; -import { useClient, useFeatures, useLoggedIn } from 'soapbox/hooks'; -import { queryClient } from 'soapbox/queries/client'; +import { useClient, useFeatures, useLoggedIn } from 'pl-fe/hooks'; +import { queryClient } from 'pl-fe/queries/client'; const emptySchema = interactionPoliciesSchema.parse({}); diff --git a/packages/pl-fe/src/api/hooks/statuses/useBookmarkFolder.ts b/packages/pl-fe/src/api/hooks/statuses/useBookmarkFolder.ts index f2a1ec54b..a0d6d363f 100644 --- a/packages/pl-fe/src/api/hooks/statuses/useBookmarkFolder.ts +++ b/packages/pl-fe/src/api/hooks/statuses/useBookmarkFolder.ts @@ -1,6 +1,6 @@ -import { Entities } from 'soapbox/entity-store/entities'; -import { selectEntity } from 'soapbox/entity-store/selectors'; -import { useAppSelector } from 'soapbox/hooks'; +import { Entities } from 'pl-fe/entity-store/entities'; +import { selectEntity } from 'pl-fe/entity-store/selectors'; +import { useAppSelector } from 'pl-fe/hooks'; import { useBookmarkFolders } from './useBookmarkFolders'; diff --git a/packages/pl-fe/src/api/hooks/statuses/useBookmarkFolders.ts b/packages/pl-fe/src/api/hooks/statuses/useBookmarkFolders.ts index 75597a4bb..da11b3e3c 100644 --- a/packages/pl-fe/src/api/hooks/statuses/useBookmarkFolders.ts +++ b/packages/pl-fe/src/api/hooks/statuses/useBookmarkFolders.ts @@ -1,9 +1,9 @@ import { bookmarkFolderSchema, type BookmarkFolder } from 'pl-api'; -import { Entities } from 'soapbox/entity-store/entities'; -import { useEntities } from 'soapbox/entity-store/hooks'; -import { useClient } from 'soapbox/hooks'; -import { useFeatures } from 'soapbox/hooks/useFeatures'; +import { Entities } from 'pl-fe/entity-store/entities'; +import { useEntities } from 'pl-fe/entity-store/hooks'; +import { useClient } from 'pl-fe/hooks'; +import { useFeatures } from 'pl-fe/hooks/useFeatures'; const useBookmarkFolders = () => { const client = useClient(); diff --git a/packages/pl-fe/src/api/hooks/statuses/useCreateBookmarkFolder.ts b/packages/pl-fe/src/api/hooks/statuses/useCreateBookmarkFolder.ts index 5490fe312..3cc7560af 100644 --- a/packages/pl-fe/src/api/hooks/statuses/useCreateBookmarkFolder.ts +++ b/packages/pl-fe/src/api/hooks/statuses/useCreateBookmarkFolder.ts @@ -1,8 +1,8 @@ import { bookmarkFolderSchema } from 'pl-api'; -import { Entities } from 'soapbox/entity-store/entities'; -import { useCreateEntity } from 'soapbox/entity-store/hooks'; -import { useClient } from 'soapbox/hooks'; +import { Entities } from 'pl-fe/entity-store/entities'; +import { useCreateEntity } from 'pl-fe/entity-store/hooks'; +import { useClient } from 'pl-fe/hooks'; interface CreateBookmarkFolderParams { name: string; diff --git a/packages/pl-fe/src/api/hooks/statuses/useDeleteBookmarkFolder.ts b/packages/pl-fe/src/api/hooks/statuses/useDeleteBookmarkFolder.ts index f5058438b..2aae3d3ae 100644 --- a/packages/pl-fe/src/api/hooks/statuses/useDeleteBookmarkFolder.ts +++ b/packages/pl-fe/src/api/hooks/statuses/useDeleteBookmarkFolder.ts @@ -1,6 +1,6 @@ -import { Entities } from 'soapbox/entity-store/entities'; -import { useDeleteEntity } from 'soapbox/entity-store/hooks'; -import { useClient } from 'soapbox/hooks'; +import { Entities } from 'pl-fe/entity-store/entities'; +import { useDeleteEntity } from 'pl-fe/entity-store/hooks'; +import { useClient } from 'pl-fe/hooks'; 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/useUpdateBookmarkFolder.ts index 4173195ca..270120968 100644 --- a/packages/pl-fe/src/api/hooks/statuses/useUpdateBookmarkFolder.ts +++ b/packages/pl-fe/src/api/hooks/statuses/useUpdateBookmarkFolder.ts @@ -1,8 +1,8 @@ import { bookmarkFolderSchema } from 'pl-api'; -import { Entities } from 'soapbox/entity-store/entities'; -import { useCreateEntity } from 'soapbox/entity-store/hooks'; -import { useClient } from 'soapbox/hooks'; +import { Entities } from 'pl-fe/entity-store/entities'; +import { useCreateEntity } from 'pl-fe/entity-store/hooks'; +import { useClient } from 'pl-fe/hooks'; interface UpdateBookmarkFolderParams { name: string; diff --git a/packages/pl-fe/src/api/hooks/streaming/useListStream.ts b/packages/pl-fe/src/api/hooks/streaming/useListStream.ts index 36f1fff06..9c027db03 100644 --- a/packages/pl-fe/src/api/hooks/streaming/useListStream.ts +++ b/packages/pl-fe/src/api/hooks/streaming/useListStream.ts @@ -1,4 +1,4 @@ -import { useLoggedIn } from 'soapbox/hooks'; +import { useLoggedIn } from 'pl-fe/hooks'; import { useTimelineStream } from './useTimelineStream'; diff --git a/packages/pl-fe/src/api/hooks/streaming/useTimelineStream.ts b/packages/pl-fe/src/api/hooks/streaming/useTimelineStream.ts index 6622f012f..97924198b 100644 --- a/packages/pl-fe/src/api/hooks/streaming/useTimelineStream.ts +++ b/packages/pl-fe/src/api/hooks/streaming/useTimelineStream.ts @@ -1,7 +1,7 @@ import { useEffect, useRef } from 'react'; -import { useAppSelector, useClient, useInstance } from 'soapbox/hooks'; -import { getAccessToken } from 'soapbox/utils/auth'; +import { useAppSelector, useClient, useInstance } from 'pl-fe/hooks'; +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/useUserStream.ts index 1a0ce4df7..dd8921007 100644 --- a/packages/pl-fe/src/api/hooks/streaming/useUserStream.ts +++ b/packages/pl-fe/src/api/hooks/streaming/useUserStream.ts @@ -2,27 +2,27 @@ import { announcementSchema, type Announcement, type AnnouncementReaction, type FollowRelationshipUpdate, type Relationship, type StreamingEvent } from 'pl-api'; import { useCallback } from 'react'; -import { updateConversations } from 'soapbox/actions/conversations'; -import { fetchFilters } from 'soapbox/actions/filters'; -import { updateNotificationsQueue } from 'soapbox/actions/notifications'; -import { getLocale, getSettings } from 'soapbox/actions/settings'; -import { updateStatus } from 'soapbox/actions/statuses'; -import { deleteFromTimelines, processTimelineUpdate } from 'soapbox/actions/timelines'; -import { useStatContext } from 'soapbox/contexts/stat-context'; -import { importEntities } from 'soapbox/entity-store/actions'; -import { Entities } from 'soapbox/entity-store/entities'; -import { selectEntity } from 'soapbox/entity-store/selectors'; -import { useAppDispatch, useLoggedIn } from 'soapbox/hooks'; -import messages from 'soapbox/messages'; -import { queryClient } from 'soapbox/queries/client'; -import { getUnreadChatsCount, updateChatListItem } from 'soapbox/utils/chats'; -import { play, soundCache } from 'soapbox/utils/sounds'; +import { updateConversations } from 'pl-fe/actions/conversations'; +import { fetchFilters } from 'pl-fe/actions/filters'; +import { updateNotificationsQueue } from 'pl-fe/actions/notifications'; +import { getLocale, getSettings } from 'pl-fe/actions/settings'; +import { updateStatus } from 'pl-fe/actions/statuses'; +import { deleteFromTimelines, processTimelineUpdate } from 'pl-fe/actions/timelines'; +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, useLoggedIn } from 'pl-fe/hooks'; +import messages from 'pl-fe/messages'; +import { queryClient } from 'pl-fe/queries/client'; +import { getUnreadChatsCount, updateChatListItem } from 'pl-fe/utils/chats'; +import { play, soundCache } from 'pl-fe/utils/sounds'; import { updateReactions } from '../announcements/useAnnouncements'; import { useTimelineStream } from './useTimelineStream'; -import type { AppDispatch, RootState } from 'soapbox/store'; +import type { AppDispatch, RootState } from 'pl-fe/store'; const updateAnnouncementReactions = ({ announcement_id: id, name }: AnnouncementReaction) => { queryClient.setQueryData(['announcements'], (prevResult: Announcement[]) => diff --git a/packages/pl-fe/src/api/hooks/trends/useTrendingLinks.ts b/packages/pl-fe/src/api/hooks/trends/useTrendingLinks.ts index dfb66d8e1..a2893ee2e 100644 --- a/packages/pl-fe/src/api/hooks/trends/useTrendingLinks.ts +++ b/packages/pl-fe/src/api/hooks/trends/useTrendingLinks.ts @@ -1,8 +1,8 @@ import { trendsLinkSchema } from 'pl-api'; -import { Entities } from 'soapbox/entity-store/entities'; -import { useEntities } from 'soapbox/entity-store/hooks'; -import { useClient, useFeatures } from 'soapbox/hooks'; +import { Entities } from 'pl-fe/entity-store/entities'; +import { useEntities } from 'pl-fe/entity-store/hooks'; +import { useClient, useFeatures } from 'pl-fe/hooks'; const useTrendingLinks = () => { const client = useClient(); diff --git a/packages/pl-fe/src/api/index.ts b/packages/pl-fe/src/api/index.ts index 104048a63..819ba870d 100644 --- a/packages/pl-fe/src/api/index.ts +++ b/packages/pl-fe/src/api/index.ts @@ -1,10 +1,10 @@ /** * API: HTTP client and utilities. - * @module soapbox/api + * @module pl-fe/api */ -import * as BuildConfig from 'soapbox/build-config'; -import { RootState } from 'soapbox/store'; -import { buildFullPath } from 'soapbox/utils/url'; +import * as BuildConfig from 'pl-fe/build-config'; +import { RootState } from 'pl-fe/store'; +import { buildFullPath } from 'pl-fe/utils/url'; type PlfeResponse = Response & { data: string; json: T }; diff --git a/packages/pl-fe/src/build-config-compiletime.ts b/packages/pl-fe/src/build-config-compiletime.ts index 0a197d16f..3e04b4cc9 100644 --- a/packages/pl-fe/src/build-config-compiletime.ts +++ b/packages/pl-fe/src/build-config-compiletime.ts @@ -1,6 +1,6 @@ /** * Build config: configuration set at build time. - * @module soapbox/build-config + * @module pl-fe/build-config */ // eslint-disable-next-line import/extensions @@ -34,7 +34,7 @@ const env = { SENTRY_DSN, }; -export type SoapboxEnv = typeof env; +export type PlFeEnv = typeof env; export default () => ({ data: env, diff --git a/packages/pl-fe/src/build-config.ts b/packages/pl-fe/src/build-config.ts index c742a1212..858037cb8 100644 --- a/packages/pl-fe/src/build-config.ts +++ b/packages/pl-fe/src/build-config.ts @@ -1,4 +1,4 @@ -import type { SoapboxEnv } from './build-config-compiletime'; +import type { PlFeEnv } from './build-config-compiletime'; export const { NODE_ENV, @@ -6,4 +6,4 @@ export const { FE_SUBDIRECTORY, FE_INSTANCE_SOURCE_DIR, SENTRY_DSN, -} = import.meta.compileTime('./build-config-compiletime.ts'); +} = import.meta.compileTime('./build-config-compiletime.ts'); diff --git a/packages/pl-fe/src/components/account-search.tsx b/packages/pl-fe/src/components/account-search.tsx index 2f0a807e2..aa15e7172 100644 --- a/packages/pl-fe/src/components/account-search.tsx +++ b/packages/pl-fe/src/components/account-search.tsx @@ -2,7 +2,7 @@ import clsx from 'clsx'; import React, { useState } from 'react'; import { defineMessages, useIntl } from 'react-intl'; -import AutosuggestAccountInput from 'soapbox/components/autosuggest-account-input'; +import AutosuggestAccountInput from 'pl-fe/components/autosuggest-account-input'; import SvgIcon from './ui/icon/svg-icon'; diff --git a/packages/pl-fe/src/components/account.test.tsx b/packages/pl-fe/src/components/account.test.tsx index 306ff21a8..7a3070030 100644 --- a/packages/pl-fe/src/components/account.test.tsx +++ b/packages/pl-fe/src/components/account.test.tsx @@ -1,7 +1,7 @@ import React from 'react'; -import { buildAccount } from 'soapbox/jest/factory'; -import { render, screen } from 'soapbox/jest/test-helpers'; +import { buildAccount } from 'pl-fe/jest/factory'; +import { render, screen } from 'pl-fe/jest/test-helpers'; import Account from './account'; diff --git a/packages/pl-fe/src/components/account.tsx b/packages/pl-fe/src/components/account.tsx index 0a8f8962e..faf44b617 100644 --- a/packages/pl-fe/src/components/account.tsx +++ b/packages/pl-fe/src/components/account.tsx @@ -2,19 +2,19 @@ import React, { useRef } from 'react'; import { defineMessages, useIntl, FormattedMessage } from 'react-intl'; import { Link, useHistory } from 'react-router-dom'; -import HoverRefWrapper from 'soapbox/components/hover-ref-wrapper'; -import VerificationBadge from 'soapbox/components/verification-badge'; -import ActionButton from 'soapbox/features/ui/components/action-button'; -import { useAppSelector } from 'soapbox/hooks'; -import { getAcct } from 'soapbox/utils/accounts'; -import { displayFqn } from 'soapbox/utils/state'; +import HoverRefWrapper from 'pl-fe/components/hover-ref-wrapper'; +import VerificationBadge from 'pl-fe/components/verification-badge'; +import ActionButton from 'pl-fe/features/ui/components/action-button'; +import { useAppSelector } from 'pl-fe/hooks'; +import { getAcct } from 'pl-fe/utils/accounts'; +import { displayFqn } from 'pl-fe/utils/state'; import Badge from './badge'; import RelativeTimestamp from './relative-timestamp'; import { Avatar, Emoji, HStack, Icon, IconButton, Stack, Text } from './ui'; -import type { Account as AccountSchema } from 'soapbox/normalizers'; -import type { StatusApprovalStatus } from 'soapbox/normalizers/status'; +import type { Account as AccountSchema } from 'pl-fe/normalizers'; +import type { StatusApprovalStatus } from 'pl-fe/normalizers/status'; interface IInstanceFavicon { account: Pick; diff --git a/packages/pl-fe/src/components/animated-number.tsx b/packages/pl-fe/src/components/animated-number.tsx index b8c50dfa9..fe7974f45 100644 --- a/packages/pl-fe/src/components/animated-number.tsx +++ b/packages/pl-fe/src/components/animated-number.tsx @@ -2,8 +2,8 @@ import React, { useEffect, useState } from 'react'; import { useIntl, type IntlShape } from 'react-intl'; import { TransitionMotion, spring } from 'react-motion'; -import { useSettings } from 'soapbox/hooks'; -import { isNumber, roundDown } from 'soapbox/utils/numbers'; +import { useSettings } from 'pl-fe/hooks'; +import { isNumber, roundDown } from 'pl-fe/utils/numbers'; const obfuscatedCount = (count: number): string => { if (count < 0) { diff --git a/packages/pl-fe/src/components/announcements/announcement-content.tsx b/packages/pl-fe/src/components/announcements/announcement-content.tsx index 035d03e83..13c071beb 100644 --- a/packages/pl-fe/src/components/announcements/announcement-content.tsx +++ b/packages/pl-fe/src/components/announcements/announcement-content.tsx @@ -1,10 +1,10 @@ import React, { useEffect, useRef } from 'react'; import { useHistory } from 'react-router-dom'; -import { getTextDirection } from 'soapbox/utils/rtl'; +import { getTextDirection } from 'pl-fe/utils/rtl'; import type { Mention as MentionEntity } from 'pl-api'; -import type { Announcement } from 'soapbox/normalizers'; +import type { Announcement } from 'pl-fe/normalizers'; interface IAnnouncementContent { announcement: Announcement; diff --git a/packages/pl-fe/src/components/announcements/announcement.tsx b/packages/pl-fe/src/components/announcements/announcement.tsx index 06b28543b..b61610783 100644 --- a/packages/pl-fe/src/components/announcements/announcement.tsx +++ b/packages/pl-fe/src/components/announcements/announcement.tsx @@ -1,16 +1,16 @@ import React from 'react'; import { FormattedDate } from 'react-intl'; -import { Stack, Text } from 'soapbox/components/ui'; -import { useFeatures } from 'soapbox/hooks'; -import { getTextDirection } from 'soapbox/utils/rtl'; +import { Stack, Text } from 'pl-fe/components/ui'; +import { useFeatures } from 'pl-fe/hooks'; +import { getTextDirection } from 'pl-fe/utils/rtl'; import AnnouncementContent from './announcement-content'; import ReactionsBar from './reactions-bar'; import type { Map as ImmutableMap } from 'immutable'; import type { CustomEmoji } from 'pl-api'; -import type { Announcement as AnnouncementEntity } from 'soapbox/normalizers'; +import type { Announcement as AnnouncementEntity } from 'pl-fe/normalizers'; interface IAnnouncement { announcement: AnnouncementEntity; diff --git a/packages/pl-fe/src/components/announcements/announcements-panel.tsx b/packages/pl-fe/src/components/announcements/announcements-panel.tsx index c98119aa5..83383941c 100644 --- a/packages/pl-fe/src/components/announcements/announcements-panel.tsx +++ b/packages/pl-fe/src/components/announcements/announcements-panel.tsx @@ -5,14 +5,14 @@ import { FormattedMessage } from 'react-intl'; import ReactSwipeableViews from 'react-swipeable-views'; import { createSelector } from 'reselect'; -import { useAnnouncements } from 'soapbox/api/hooks/announcements'; -import { Card, HStack, Widget } from 'soapbox/components/ui'; -import { useAppSelector } from 'soapbox/hooks'; +import { useAnnouncements } from 'pl-fe/api/hooks/announcements'; +import { Card, HStack, Widget } from 'pl-fe/components/ui'; +import { useAppSelector } from 'pl-fe/hooks'; import Announcement from './announcement'; import type { CustomEmoji } from 'pl-api'; -import type { RootState } from 'soapbox/store'; +import type { RootState } from 'pl-fe/store'; const customEmojiMap = createSelector([(state: RootState) => state.custom_emojis], items => items.reduce((map, emoji) => map.set(emoji.shortcode, emoji), ImmutableMap())); diff --git a/packages/pl-fe/src/components/announcements/emoji.tsx b/packages/pl-fe/src/components/announcements/emoji.tsx index 601363548..39b0d567c 100644 --- a/packages/pl-fe/src/components/announcements/emoji.tsx +++ b/packages/pl-fe/src/components/announcements/emoji.tsx @@ -1,8 +1,8 @@ import React from 'react'; -import unicodeMapping from 'soapbox/features/emoji/mapping'; -import { useSettings } from 'soapbox/hooks'; -import { joinPublicPath } from 'soapbox/utils/static'; +import unicodeMapping from 'pl-fe/features/emoji/mapping'; +import { useSettings } from 'pl-fe/hooks'; +import { joinPublicPath } from 'pl-fe/utils/static'; import type { Map as ImmutableMap } from 'immutable'; import type { CustomEmoji } from 'pl-api'; diff --git a/packages/pl-fe/src/components/announcements/reaction.tsx b/packages/pl-fe/src/components/announcements/reaction.tsx index bd9a7c008..45eee413c 100644 --- a/packages/pl-fe/src/components/announcements/reaction.tsx +++ b/packages/pl-fe/src/components/announcements/reaction.tsx @@ -1,9 +1,9 @@ import clsx from 'clsx'; import React, { useState } from 'react'; -import { useAnnouncements } from 'soapbox/api/hooks/announcements'; -import AnimatedNumber from 'soapbox/components/animated-number'; -import unicodeMapping from 'soapbox/features/emoji/mapping'; +import { useAnnouncements } from 'pl-fe/api/hooks/announcements'; +import AnimatedNumber from 'pl-fe/components/animated-number'; +import unicodeMapping from 'pl-fe/features/emoji/mapping'; import Emoji from './emoji'; diff --git a/packages/pl-fe/src/components/announcements/reactions-bar.tsx b/packages/pl-fe/src/components/announcements/reactions-bar.tsx index 03cf6e77b..5aee082ca 100644 --- a/packages/pl-fe/src/components/announcements/reactions-bar.tsx +++ b/packages/pl-fe/src/components/announcements/reactions-bar.tsx @@ -2,15 +2,15 @@ import clsx from 'clsx'; import React from 'react'; import { TransitionMotion, spring } from 'react-motion'; -import { useAnnouncements } from 'soapbox/api/hooks/announcements'; -import EmojiPickerDropdown from 'soapbox/features/emoji/containers/emoji-picker-dropdown-container'; -import { useSettings } from 'soapbox/hooks'; +import { useAnnouncements } from 'pl-fe/api/hooks/announcements'; +import EmojiPickerDropdown from 'pl-fe/features/emoji/containers/emoji-picker-dropdown-container'; +import { useSettings } from 'pl-fe/hooks'; import Reaction from './reaction'; import type { Map as ImmutableMap } from 'immutable'; import type { AnnouncementReaction, CustomEmoji } from 'pl-api'; -import type { Emoji, NativeEmoji } from 'soapbox/features/emoji'; +import type { Emoji, NativeEmoji } from 'pl-fe/features/emoji'; interface IReactionsBar { announcementId: string; diff --git a/packages/pl-fe/src/components/attachment-thumbs.tsx b/packages/pl-fe/src/components/attachment-thumbs.tsx index b5e48fe65..d17c68f4c 100644 --- a/packages/pl-fe/src/components/attachment-thumbs.tsx +++ b/packages/pl-fe/src/components/attachment-thumbs.tsx @@ -1,8 +1,8 @@ import React, { Suspense } from 'react'; -import { openModal } from 'soapbox/actions/modals'; -import { MediaGallery } from 'soapbox/features/ui/util/async-components'; -import { useAppDispatch } from 'soapbox/hooks'; +import { openModal } from 'pl-fe/actions/modals'; +import { MediaGallery } from 'pl-fe/features/ui/util/async-components'; +import { useAppDispatch } from 'pl-fe/hooks'; import type { MediaAttachment } from 'pl-api'; diff --git a/packages/pl-fe/src/components/authorize-reject-buttons.tsx b/packages/pl-fe/src/components/authorize-reject-buttons.tsx index 99ec58ada..8b512d4df 100644 --- a/packages/pl-fe/src/components/authorize-reject-buttons.tsx +++ b/packages/pl-fe/src/components/authorize-reject-buttons.tsx @@ -2,7 +2,7 @@ import clsx from 'clsx'; import React, { useEffect, useRef, useState } from 'react'; import { FormattedMessage } from 'react-intl'; -import { HStack, IconButton, Text } from 'soapbox/components/ui'; +import { HStack, IconButton, Text } from 'pl-fe/components/ui'; interface IAuthorizeRejectButtons { onAuthorize(): Promise | unknown; diff --git a/packages/pl-fe/src/components/autosuggest-account-input.tsx b/packages/pl-fe/src/components/autosuggest-account-input.tsx index 2f52b0787..90ef70f9e 100644 --- a/packages/pl-fe/src/components/autosuggest-account-input.tsx +++ b/packages/pl-fe/src/components/autosuggest-account-input.tsx @@ -2,12 +2,12 @@ import { OrderedSet as ImmutableOrderedSet } from 'immutable'; import throttle from 'lodash/throttle'; import React, { useState, useRef, useCallback, useEffect } from 'react'; -import { accountSearch } from 'soapbox/actions/accounts'; -import AutosuggestInput, { AutoSuggestion } from 'soapbox/components/autosuggest-input'; -import { useAppDispatch } from 'soapbox/hooks'; +import { accountSearch } from 'pl-fe/actions/accounts'; +import AutosuggestInput, { AutoSuggestion } from 'pl-fe/components/autosuggest-input'; +import { useAppDispatch } from 'pl-fe/hooks'; -import type { Menu } from 'soapbox/components/dropdown-menu'; -import type { InputThemes } from 'soapbox/components/ui/input/input'; +import type { Menu } from 'pl-fe/components/dropdown-menu'; +import type { InputThemes } from 'pl-fe/components/ui/input/input'; const noOp = () => { }; diff --git a/packages/pl-fe/src/components/autosuggest-emoji.test.tsx b/packages/pl-fe/src/components/autosuggest-emoji.test.tsx index 38e45a370..c18c07c4d 100644 --- a/packages/pl-fe/src/components/autosuggest-emoji.test.tsx +++ b/packages/pl-fe/src/components/autosuggest-emoji.test.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import { render, screen } from 'soapbox/jest/test-helpers'; +import { render, screen } from 'pl-fe/jest/test-helpers'; import AutosuggestEmoji from './autosuggest-emoji'; diff --git a/packages/pl-fe/src/components/autosuggest-emoji.tsx b/packages/pl-fe/src/components/autosuggest-emoji.tsx index e4dd3ae17..1779f1eb0 100644 --- a/packages/pl-fe/src/components/autosuggest-emoji.tsx +++ b/packages/pl-fe/src/components/autosuggest-emoji.tsx @@ -1,10 +1,10 @@ import React from 'react'; -import { isCustomEmoji } from 'soapbox/features/emoji'; -import unicodeMapping from 'soapbox/features/emoji/mapping'; -import { joinPublicPath } from 'soapbox/utils/static'; +import { isCustomEmoji } from 'pl-fe/features/emoji'; +import unicodeMapping from 'pl-fe/features/emoji/mapping'; +import { joinPublicPath } from 'pl-fe/utils/static'; -import type { Emoji } from 'soapbox/features/emoji'; +import type { Emoji } from 'pl-fe/features/emoji'; interface IAutosuggestEmoji { emoji: Emoji; diff --git a/packages/pl-fe/src/components/autosuggest-input.tsx b/packages/pl-fe/src/components/autosuggest-input.tsx index eb3e0eee1..4ce065837 100644 --- a/packages/pl-fe/src/components/autosuggest-input.tsx +++ b/packages/pl-fe/src/components/autosuggest-input.tsx @@ -3,15 +3,15 @@ import { List as ImmutableList } from 'immutable'; import React from 'react'; import ImmutablePureComponent from 'react-immutable-pure-component'; -import AutosuggestEmoji from 'soapbox/components/autosuggest-emoji'; -import Icon from 'soapbox/components/icon'; -import { Input, Portal } from 'soapbox/components/ui'; -import AutosuggestAccount from 'soapbox/features/compose/components/autosuggest-account'; -import { textAtCursorMatchesToken } from 'soapbox/utils/suggestions'; +import AutosuggestEmoji from 'pl-fe/components/autosuggest-emoji'; +import Icon from 'pl-fe/components/icon'; +import { Input, Portal } from 'pl-fe/components/ui'; +import AutosuggestAccount from 'pl-fe/features/compose/components/autosuggest-account'; +import { textAtCursorMatchesToken } from 'pl-fe/utils/suggestions'; -import type { Menu, MenuItem } from 'soapbox/components/dropdown-menu'; -import type { InputThemes } from 'soapbox/components/ui/input/input'; -import type { Emoji } from 'soapbox/features/emoji'; +import type { Menu, MenuItem } from 'pl-fe/components/dropdown-menu'; +import type { InputThemes } from 'pl-fe/components/ui/input/input'; +import type { Emoji } from 'pl-fe/features/emoji'; type AutoSuggestion = string | Emoji; diff --git a/packages/pl-fe/src/components/autosuggest-location.tsx b/packages/pl-fe/src/components/autosuggest-location.tsx index bee2d4400..0d384eaa2 100644 --- a/packages/pl-fe/src/components/autosuggest-location.tsx +++ b/packages/pl-fe/src/components/autosuggest-location.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import { useAppSelector } from 'soapbox/hooks'; +import { useAppSelector } from 'pl-fe/hooks'; import { HStack, Icon, Stack, Text } from './ui'; diff --git a/packages/pl-fe/src/components/avatar-stack.tsx b/packages/pl-fe/src/components/avatar-stack.tsx index b7c89eb91..7776fe6ff 100644 --- a/packages/pl-fe/src/components/avatar-stack.tsx +++ b/packages/pl-fe/src/components/avatar-stack.tsx @@ -2,11 +2,11 @@ import clsx from 'clsx'; import { List as ImmutableList, OrderedSet as ImmutableOrderedSet } from 'immutable'; import React from 'react'; -import { Avatar, HStack } from 'soapbox/components/ui'; -import { useAppSelector } from 'soapbox/hooks'; -import { makeGetAccount } from 'soapbox/selectors'; +import { Avatar, HStack } from 'pl-fe/components/ui'; +import { useAppSelector } from 'pl-fe/hooks'; +import { makeGetAccount } from 'pl-fe/selectors'; -import type { Account } from 'soapbox/normalizers'; +import type { Account } from 'pl-fe/normalizers'; const getAccount = makeGetAccount(); diff --git a/packages/pl-fe/src/components/badge.test.tsx b/packages/pl-fe/src/components/badge.test.tsx index 6204f7dcb..326619a18 100644 --- a/packages/pl-fe/src/components/badge.test.tsx +++ b/packages/pl-fe/src/components/badge.test.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import { render, screen } from 'soapbox/jest/test-helpers'; +import { render, screen } from 'pl-fe/jest/test-helpers'; import Badge from './badge'; diff --git a/packages/pl-fe/src/components/badge.tsx b/packages/pl-fe/src/components/badge.tsx index 74bb87973..f24cc90e2 100644 --- a/packages/pl-fe/src/components/badge.tsx +++ b/packages/pl-fe/src/components/badge.tsx @@ -1,7 +1,7 @@ import clsx from 'clsx'; import React, { useMemo } from 'react'; -import { hexToHsl } from 'soapbox/utils/theme'; +import { hexToHsl } from 'pl-fe/utils/theme'; interface IBadge { title: React.ReactNode; diff --git a/packages/pl-fe/src/components/big-card.tsx b/packages/pl-fe/src/components/big-card.tsx index 0f21e72d4..e21b0252d 100644 --- a/packages/pl-fe/src/components/big-card.tsx +++ b/packages/pl-fe/src/components/big-card.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import { Card, CardBody, Stack, Text } from 'soapbox/components/ui'; +import { Card, CardBody, Stack, Text } from 'pl-fe/components/ui'; interface IBigCard { title: React.ReactNode; diff --git a/packages/pl-fe/src/components/birthday-input.tsx b/packages/pl-fe/src/components/birthday-input.tsx index 8884c8507..56e7cc550 100644 --- a/packages/pl-fe/src/components/birthday-input.tsx +++ b/packages/pl-fe/src/components/birthday-input.tsx @@ -1,9 +1,9 @@ import React, { useMemo } from 'react'; import { defineMessages, useIntl } from 'react-intl'; -import IconButton from 'soapbox/components/icon-button'; -import { DatePicker } from 'soapbox/features/ui/util/async-components'; -import { useInstance, useFeatures } from 'soapbox/hooks'; +import IconButton from 'pl-fe/components/icon-button'; +import { DatePicker } from 'pl-fe/features/ui/util/async-components'; +import { useInstance, useFeatures } from 'pl-fe/hooks'; 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 c962b1834..6a486a317 100644 --- a/packages/pl-fe/src/components/birthday-panel.tsx +++ b/packages/pl-fe/src/components/birthday-panel.tsx @@ -2,10 +2,10 @@ import { OrderedSet as ImmutableOrderedSet } from 'immutable'; import React, { useRef } from 'react'; import { FormattedMessage } from 'react-intl'; -import { fetchBirthdayReminders } from 'soapbox/actions/accounts'; -import { Widget } from 'soapbox/components/ui'; -import AccountContainer from 'soapbox/containers/account-container'; -import { useAppDispatch, useAppSelector } from 'soapbox/hooks'; +import { fetchBirthdayReminders } from 'pl-fe/actions/accounts'; +import { Widget } from 'pl-fe/components/ui'; +import AccountContainer from 'pl-fe/containers/account-container'; +import { useAppDispatch, useAppSelector } from 'pl-fe/hooks'; 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 a2e53562a..ea36f375f 100644 --- a/packages/pl-fe/src/components/domain.tsx +++ b/packages/pl-fe/src/components/domain.tsx @@ -1,8 +1,8 @@ import React from 'react'; import { defineMessages, useIntl } from 'react-intl'; -import { unblockDomain } from 'soapbox/actions/domain-blocks'; -import { useAppDispatch } from 'soapbox/hooks'; +import { unblockDomain } from 'pl-fe/actions/domain-blocks'; +import { useAppDispatch } from 'pl-fe/hooks'; import { HStack, IconButton, Text } from './ui'; diff --git a/packages/pl-fe/src/components/dropdown-menu/dropdown-menu-item.tsx b/packages/pl-fe/src/components/dropdown-menu/dropdown-menu-item.tsx index d57f54f28..d08ba1588 100644 --- a/packages/pl-fe/src/components/dropdown-menu/dropdown-menu-item.tsx +++ b/packages/pl-fe/src/components/dropdown-menu/dropdown-menu-item.tsx @@ -2,7 +2,7 @@ import clsx from 'clsx'; import React, { useEffect, useRef } from 'react'; import { useHistory } from 'react-router-dom'; -import { userTouching } from 'soapbox/is-mobile'; +import { userTouching } from 'pl-fe/is-mobile'; import { Counter, Icon } from '../ui'; diff --git a/packages/pl-fe/src/components/dropdown-menu/dropdown-menu.tsx b/packages/pl-fe/src/components/dropdown-menu/dropdown-menu.tsx index d6c4784e8..2fd6fa076 100644 --- a/packages/pl-fe/src/components/dropdown-menu/dropdown-menu.tsx +++ b/packages/pl-fe/src/components/dropdown-menu/dropdown-menu.tsx @@ -5,9 +5,9 @@ import React, { useEffect, useMemo, useRef, useState } from 'react'; import { FormattedMessage } from 'react-intl'; import { useHistory } from 'react-router-dom'; -import { closeDropdownMenu as closeDropdownMenuRedux, openDropdownMenu } from 'soapbox/actions/dropdown-menu'; -import { useAppDispatch } from 'soapbox/hooks'; -import { userTouching } from 'soapbox/is-mobile'; +import { closeDropdownMenu as closeDropdownMenuRedux, openDropdownMenu } from 'pl-fe/actions/dropdown-menu'; +import { useAppDispatch } from 'pl-fe/hooks'; +import { userTouching } from 'pl-fe/is-mobile'; import { IconButton, Portal } from '../ui'; @@ -106,9 +106,9 @@ const DropdownMenu = (props: IDropdownMenu) => { unlistenHistory.current = undefined; } const { state } = history.location; - if (goBack && state && (state as any).soapboxDropdownKey && (state as any).soapboxDropdownKey === dropdownHistoryKey.current) { + if (goBack && state && (state as any).plFeDropdownKey && (state as any).plFeDropdownKey === dropdownHistoryKey.current) { history.goBack(); - (history.location.state as any).soapboxDropdownKey = undefined; + (history.location.state as any).plFeDropdownKey = undefined; } closeDropdownMenu(); @@ -239,10 +239,10 @@ const DropdownMenu = (props: IDropdownMenu) => { dropdownHistoryKey.current = Date.now(); - history.push(pathname, { ...(state as any), soapboxDropdownKey: dropdownHistoryKey.current }); + history.push(pathname, { ...(state as any), plFeDropdownKey: dropdownHistoryKey.current }); unlistenHistory.current = history.listen(({ state }, action) => { - if (!(state as any)?.soapboxDropdownKey) { + if (!(state as any)?.plFeDropdownKey) { handleClose(false); } else if (action === 'POP') { handleClose(false); diff --git a/packages/pl-fe/src/components/event-preview.tsx b/packages/pl-fe/src/components/event-preview.tsx index 5be64de05..c2899c93b 100644 --- a/packages/pl-fe/src/components/event-preview.tsx +++ b/packages/pl-fe/src/components/event-preview.tsx @@ -2,15 +2,15 @@ import clsx from 'clsx'; import React from 'react'; import { defineMessages, FormattedMessage, useIntl } from 'react-intl'; -import EventActionButton from 'soapbox/features/event/components/event-action-button'; -import EventDate from 'soapbox/features/event/components/event-date'; -import { useAppSelector } from 'soapbox/hooks'; +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'; import Icon from './icon'; import { Button, HStack, Stack, Text } from './ui'; import VerificationBadge from './verification-badge'; -import type { Status as StatusEntity } from 'soapbox/normalizers'; +import type { Status as StatusEntity } from 'pl-fe/normalizers'; const messages = defineMessages({ eventBanner: { id: 'event.banner', defaultMessage: 'Event banner' }, diff --git a/packages/pl-fe/src/components/extended-video-player.tsx b/packages/pl-fe/src/components/extended-video-player.tsx index b02382f7f..4ec02815b 100644 --- a/packages/pl-fe/src/components/extended-video-player.tsx +++ b/packages/pl-fe/src/components/extended-video-player.tsx @@ -1,6 +1,6 @@ import React, { useEffect, useRef } from 'react'; -import { isIOS } from 'soapbox/is-mobile'; +import { isIOS } from 'pl-fe/is-mobile'; interface IExtendedVideoPlayer { src: string; diff --git a/packages/pl-fe/src/components/fork-awesome-icon.tsx b/packages/pl-fe/src/components/fork-awesome-icon.tsx index be72ffb24..cdceef256 100644 --- a/packages/pl-fe/src/components/fork-awesome-icon.tsx +++ b/packages/pl-fe/src/components/fork-awesome-icon.tsx @@ -1,8 +1,8 @@ /** * ForkAwesomeIcon: renders a ForkAwesome icon. * Full list: https://forkaweso.me/Fork-Awesome/icons/ - * @module soapbox/components/fork_awesome_icon - * @see soapbox/components/icon + * @module pl-fe/components/fork_awesome_icon + * @see pl-fe/components/icon */ import clsx from 'clsx'; diff --git a/packages/pl-fe/src/components/gdpr-banner.tsx b/packages/pl-fe/src/components/gdpr-banner.tsx index 7a53ac3b1..676970483 100644 --- a/packages/pl-fe/src/components/gdpr-banner.tsx +++ b/packages/pl-fe/src/components/gdpr-banner.tsx @@ -2,8 +2,8 @@ import clsx from 'clsx'; import React, { useState } from 'react'; import { FormattedMessage } from 'react-intl'; -import { Banner, Button, HStack, Stack, Text } from 'soapbox/components/ui'; -import { useInstance, useSoapboxConfig } from 'soapbox/hooks'; +import { Banner, Button, HStack, Stack, Text } from 'pl-fe/components/ui'; +import { useInstance, usePlFeConfig } from 'pl-fe/hooks'; const acceptedGdpr = !!localStorage.getItem('plfe:gdpr'); @@ -14,7 +14,7 @@ const GdprBanner: React.FC = () => { const [slideout, setSlideout] = useState(false); const instance = useInstance(); - const { gdprUrl } = useSoapboxConfig(); + const { gdprUrl } = usePlFeConfig(); const handleAccept = () => { localStorage.setItem('plfe:gdpr', 'true'); diff --git a/packages/pl-fe/src/components/group-card.tsx b/packages/pl-fe/src/components/group-card.tsx index df92fc31a..a83254d95 100644 --- a/packages/pl-fe/src/components/group-card.tsx +++ b/packages/pl-fe/src/components/group-card.tsx @@ -1,14 +1,14 @@ import React from 'react'; -import GroupHeaderImage from 'soapbox/features/group/components/group-header-image'; -import GroupMemberCount from 'soapbox/features/group/components/group-member-count'; -import GroupPrivacy from 'soapbox/features/group/components/group-privacy'; -import GroupRelationship from 'soapbox/features/group/components/group-relationship'; +import GroupHeaderImage from 'pl-fe/features/group/components/group-header-image'; +import GroupMemberCount from 'pl-fe/features/group/components/group-member-count'; +import GroupPrivacy from 'pl-fe/features/group/components/group-privacy'; +import GroupRelationship from 'pl-fe/features/group/components/group-relationship'; import GroupAvatar from './groups/group-avatar'; import { HStack, Stack, Text } from './ui'; -import type { Group as GroupEntity } from 'soapbox/normalizers'; +import type { Group as GroupEntity } from 'pl-fe/normalizers'; interface IGroupCard { group: GroupEntity; diff --git a/packages/pl-fe/src/components/groups/popover/group-popover.tsx b/packages/pl-fe/src/components/groups/popover/group-popover.tsx index 62d833cf0..a6bb3b06d 100644 --- a/packages/pl-fe/src/components/groups/popover/group-popover.tsx +++ b/packages/pl-fe/src/components/groups/popover/group-popover.tsx @@ -2,13 +2,13 @@ import React from 'react'; import { defineMessages, useIntl } from 'react-intl'; import { Link, matchPath, useHistory } from 'react-router-dom'; -import { Button, Divider, HStack, Popover, Stack, Text } from 'soapbox/components/ui'; -import GroupMemberCount from 'soapbox/features/group/components/group-member-count'; -import GroupPrivacy from 'soapbox/features/group/components/group-privacy'; +import { Button, Divider, HStack, Popover, Stack, Text } from 'pl-fe/components/ui'; +import GroupMemberCount from 'pl-fe/features/group/components/group-member-count'; +import GroupPrivacy from 'pl-fe/features/group/components/group-privacy'; import GroupAvatar from '../group-avatar'; -import type { Group } from 'soapbox/normalizers'; +import type { Group } from 'pl-fe/normalizers'; interface IGroupPopoverContainer { children: React.ReactElement>; diff --git a/packages/pl-fe/src/components/helmet.tsx b/packages/pl-fe/src/components/helmet.tsx index 7ce54eaca..e75da6452 100644 --- a/packages/pl-fe/src/components/helmet.tsx +++ b/packages/pl-fe/src/components/helmet.tsx @@ -1,10 +1,10 @@ import React from 'react'; import { Helmet as ReactHelmet } from 'react-helmet'; -import { useStatContext } from 'soapbox/contexts/stat-context'; -import { useAppSelector, useInstance, useSettings } from 'soapbox/hooks'; -import { RootState } from 'soapbox/store'; -import FaviconService from 'soapbox/utils/favicon-service'; +import { useStatContext } from 'pl-fe/contexts/stat-context'; +import { useAppSelector, useInstance, useSettings } from 'pl-fe/hooks'; +import { RootState } from 'pl-fe/store'; +import FaviconService from 'pl-fe/utils/favicon-service'; FaviconService.initFaviconService(); diff --git a/packages/pl-fe/src/components/hover-ref-wrapper.tsx b/packages/pl-fe/src/components/hover-ref-wrapper.tsx index 1c35221f0..351694b9a 100644 --- a/packages/pl-fe/src/components/hover-ref-wrapper.tsx +++ b/packages/pl-fe/src/components/hover-ref-wrapper.tsx @@ -2,10 +2,10 @@ import clsx from 'clsx'; import debounce from 'lodash/debounce'; import React, { useRef } from 'react'; -import { fetchAccount } from 'soapbox/actions/accounts'; -import { openProfileHoverCard, closeProfileHoverCard } from 'soapbox/actions/profile-hover-card'; -import { useAppDispatch } from 'soapbox/hooks'; -import { isMobile } from 'soapbox/is-mobile'; +import { fetchAccount } from 'pl-fe/actions/accounts'; +import { openProfileHoverCard, closeProfileHoverCard } from 'pl-fe/actions/profile-hover-card'; +import { useAppDispatch } from 'pl-fe/hooks'; +import { isMobile } from 'pl-fe/is-mobile'; const showProfileHoverCard = debounce((dispatch, ref, accountId) => { dispatch(openProfileHoverCard(ref, accountId)); diff --git a/packages/pl-fe/src/components/hover-status-wrapper.tsx b/packages/pl-fe/src/components/hover-status-wrapper.tsx index 44e5016a0..f27cba03c 100644 --- a/packages/pl-fe/src/components/hover-status-wrapper.tsx +++ b/packages/pl-fe/src/components/hover-status-wrapper.tsx @@ -3,8 +3,8 @@ import debounce from 'lodash/debounce'; import React, { useRef } from 'react'; import { useDispatch } from 'react-redux'; -import { openStatusHoverCard, closeStatusHoverCard } from 'soapbox/actions/status-hover-card'; -import { isMobile } from 'soapbox/is-mobile'; +import { openStatusHoverCard, closeStatusHoverCard } from 'pl-fe/actions/status-hover-card'; +import { isMobile } from 'pl-fe/is-mobile'; const showStatusHoverCard = debounce((dispatch, ref, statusId) => { dispatch(openStatusHoverCard(ref, statusId)); diff --git a/packages/pl-fe/src/components/icon-button.tsx b/packages/pl-fe/src/components/icon-button.tsx index fab634aaa..f560bcbf8 100644 --- a/packages/pl-fe/src/components/icon-button.tsx +++ b/packages/pl-fe/src/components/icon-button.tsx @@ -1,7 +1,7 @@ import clsx from 'clsx'; import React from 'react'; -import Icon from 'soapbox/components/icon'; +import Icon from 'pl-fe/components/icon'; interface IIconButton extends Pick, 'className' | 'disabled' | 'onClick' | 'onKeyDown' | 'onKeyPress' | 'onKeyUp' | 'onMouseDown' | 'onMouseEnter' | 'onMouseLeave' | 'tabIndex' | 'title'> { active?: boolean; diff --git a/packages/pl-fe/src/components/icon-with-counter.tsx b/packages/pl-fe/src/components/icon-with-counter.tsx index 89bce555a..4b81bc274 100644 --- a/packages/pl-fe/src/components/icon-with-counter.tsx +++ b/packages/pl-fe/src/components/icon-with-counter.tsx @@ -1,7 +1,7 @@ import React from 'react'; -import Icon, { IIcon } from 'soapbox/components/icon'; -import { Counter } from 'soapbox/components/ui'; +import Icon, { IIcon } from 'pl-fe/components/icon'; +import { Counter } from 'pl-fe/components/ui'; interface IIconWithCounter extends React.HTMLAttributes { count: number; diff --git a/packages/pl-fe/src/components/icon.tsx b/packages/pl-fe/src/components/icon.tsx index 8c5ed7fdf..002c5b2dd 100644 --- a/packages/pl-fe/src/components/icon.tsx +++ b/packages/pl-fe/src/components/icon.tsx @@ -1,6 +1,6 @@ /** * Icon: abstract component to render SVG icons. - * @module soapbox/components/icon + * @module pl-fe/components/icon */ import clsx from 'clsx'; diff --git a/packages/pl-fe/src/components/load-gap.tsx b/packages/pl-fe/src/components/load-gap.tsx index 358712384..8e4a97dca 100644 --- a/packages/pl-fe/src/components/load-gap.tsx +++ b/packages/pl-fe/src/components/load-gap.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { defineMessages, useIntl } from 'react-intl'; -import Icon from 'soapbox/components/icon'; +import Icon from 'pl-fe/components/icon'; const messages = defineMessages({ load_more: { id: 'status.load_more', defaultMessage: 'Load more' }, diff --git a/packages/pl-fe/src/components/load-more.tsx b/packages/pl-fe/src/components/load-more.tsx index 1cedb49b1..1bf634be3 100644 --- a/packages/pl-fe/src/components/load-more.tsx +++ b/packages/pl-fe/src/components/load-more.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { FormattedMessage } from 'react-intl'; -import { Button } from 'soapbox/components/ui'; +import { Button } from 'pl-fe/components/ui'; interface ILoadMore { onClick: React.MouseEventHandler; diff --git a/packages/pl-fe/src/components/loading-screen.tsx b/packages/pl-fe/src/components/loading-screen.tsx index 35028658d..5a89465bf 100644 --- a/packages/pl-fe/src/components/loading-screen.tsx +++ b/packages/pl-fe/src/components/loading-screen.tsx @@ -1,7 +1,7 @@ import React from 'react'; -import LandingGradient from 'soapbox/components/landing-gradient'; -import { Spinner } from 'soapbox/components/ui'; +import LandingGradient from 'pl-fe/components/landing-gradient'; +import { Spinner } from 'pl-fe/components/ui'; /** Fullscreen loading indicator. */ const LoadingScreen: React.FC = () => ( diff --git a/packages/pl-fe/src/components/location-search.tsx b/packages/pl-fe/src/components/location-search.tsx index cff8daf93..cdce60fa4 100644 --- a/packages/pl-fe/src/components/location-search.tsx +++ b/packages/pl-fe/src/components/location-search.tsx @@ -4,10 +4,10 @@ import throttle from 'lodash/throttle'; import React, { useCallback, useEffect, useRef, useState } from 'react'; import { defineMessages, useIntl } from 'react-intl'; -import { locationSearch } from 'soapbox/actions/events'; -import AutosuggestInput, { AutoSuggestion } from 'soapbox/components/autosuggest-input'; -import Icon from 'soapbox/components/icon'; -import { useAppDispatch } from 'soapbox/hooks'; +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'; 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 634d6ba8c..354abf638 100644 --- a/packages/pl-fe/src/components/media-gallery.tsx +++ b/packages/pl-fe/src/components/media-gallery.tsx @@ -1,12 +1,12 @@ import clsx from 'clsx'; import React, { useState, useRef, useLayoutEffect } from 'react'; -import Blurhash from 'soapbox/components/blurhash'; -import Icon from 'soapbox/components/icon'; -import StillImage from 'soapbox/components/still-image'; -import { MIMETYPE_ICONS } from 'soapbox/components/upload'; -import { useSettings, useSoapboxConfig } from 'soapbox/hooks'; -import { truncateFilename } from 'soapbox/utils/media'; +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 { useSettings, usePlFeConfig } from 'pl-fe/hooks'; +import { truncateFilename } from 'pl-fe/utils/media'; import { isIOS } from '../is-mobile'; import { isPanoramic, isPortrait, isNonConformingRatio, minimumAspectRatio, maximumAspectRatio } from '../utils/media-aspect-ratio'; @@ -70,7 +70,7 @@ const Item: React.FC = ({ total, }) => { const { autoPlayGif } = useSettings(); - const { mediaPreview } = useSoapboxConfig(); + const { mediaPreview } = usePlFeConfig(); const handleMouseEnter: React.MouseEventHandler = ({ currentTarget: video }) => { if (hoverToPlay()) { diff --git a/packages/pl-fe/src/components/modal-root.tsx b/packages/pl-fe/src/components/modal-root.tsx index afb898e35..862d1f04c 100644 --- a/packages/pl-fe/src/components/modal-root.tsx +++ b/packages/pl-fe/src/components/modal-root.tsx @@ -4,16 +4,16 @@ import 'wicg-inert'; import { FormattedMessage, defineMessages, useIntl } from 'react-intl'; import { useHistory } from 'react-router-dom'; -import { cancelReplyCompose } from 'soapbox/actions/compose'; -import { saveDraftStatus } from 'soapbox/actions/draft-statuses'; -import { cancelEventCompose } from 'soapbox/actions/events'; -import { openModal, closeModal } from 'soapbox/actions/modals'; -import { useAppDispatch, useAppSelector, usePrevious } from 'soapbox/hooks'; -import { userTouching } from 'soapbox/is-mobile'; +import { cancelReplyCompose } from 'pl-fe/actions/compose'; +import { saveDraftStatus } from 'pl-fe/actions/draft-statuses'; +import { cancelEventCompose } from 'pl-fe/actions/events'; +import { openModal, closeModal } from 'pl-fe/actions/modals'; +import { useAppDispatch, useAppSelector, usePrevious } from 'pl-fe/hooks'; +import { userTouching } from 'pl-fe/is-mobile'; -import type { ModalType } from 'soapbox/features/ui/components/modal-root'; -import type { ReducerCompose } from 'soapbox/reducers/compose'; -import type { ReducerRecord as ReducerComposeEvent } from 'soapbox/reducers/compose-event'; +import type { ModalType } from 'pl-fe/features/ui/components/modal-root'; +import type { ReducerCompose } from 'pl-fe/reducers/compose'; +import type { ReducerRecord as ReducerComposeEvent } from 'pl-fe/reducers/compose-event'; const messages = defineMessages({ confirm: { id: 'confirmations.cancel.confirm', defaultMessage: 'Discard' }, @@ -148,9 +148,9 @@ const ModalRoot: React.FC = ({ children, onCancel, onClose, type }) const handleModalOpen = () => { modalHistoryKey.current = Date.now(); unlistenHistory.current = history.listen(({ state }, action) => { - if ((state as any)?.soapboxDropdownKey) { + if ((state as any)?.plFeDropdownKey) { return; - } else if (!(state as any)?.soapboxModalKey) { + } else if (!(state as any)?.plFeModalKey) { onClose(); } else if (action === 'POP') { handleOnClose(); @@ -165,15 +165,15 @@ const ModalRoot: React.FC = ({ children, onCancel, onClose, type }) unlistenHistory.current(); } const { state } = history.location; - if (state && (state as any).soapboxModalKey === modalHistoryKey.current) { + if (state && (state as any).plFeModalKey === modalHistoryKey.current) { history.goBack(); } }; const ensureHistoryBuffer = () => { const { pathname, state } = history.location; - if (!state || (state as any).soapboxModalKey !== modalHistoryKey.current) { - history.push(pathname, { ...(state as any), soapboxModalKey: modalHistoryKey.current }); + if (!state || (state as any).plFeModalKey !== modalHistoryKey.current) { + history.push(pathname, { ...(state as any), plFeModalKey: modalHistoryKey.current }); } }; diff --git a/packages/pl-fe/src/components/navlinks.tsx b/packages/pl-fe/src/components/navlinks.tsx index 448bfff2b..3005ae8b2 100644 --- a/packages/pl-fe/src/components/navlinks.tsx +++ b/packages/pl-fe/src/components/navlinks.tsx @@ -1,8 +1,8 @@ import React from 'react'; import { Link } from 'react-router-dom'; -import { Text } from 'soapbox/components/ui'; -import { useSettings, useSoapboxConfig } from 'soapbox/hooks'; +import { Text } from 'pl-fe/components/ui'; +import { useSettings, usePlFeConfig } from 'pl-fe/hooks'; interface INavlinks { type: string; @@ -10,7 +10,7 @@ interface INavlinks { const Navlinks: React.FC = ({ type }) => { const { locale } = useSettings(); - const { copyright, navlinks } = useSoapboxConfig(); + const { copyright, navlinks } = usePlFeConfig(); return (