From b3db562a32cb64f36d994ab1883c3376b7c34b76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Wed, 23 Oct 2024 18:40:10 +0200 Subject: [PATCH] pl-fe: Remove unused exports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- .../src/api/hooks/accounts/useAccountList.ts | 1 - .../src/components/relative-timestamp.tsx | 1 - .../statuses/sensitive-content-overlay.tsx | 2 +- packages/pl-fe/src/components/ui/avatar.tsx | 2 +- .../pl-fe/src/components/ui/button/index.tsx | 5 +- packages/pl-fe/src/components/ui/column.tsx | 1 - packages/pl-fe/src/components/ui/slider.tsx | 54 +------------------ packages/pl-fe/src/contexts/stat-context.tsx | 2 +- packages/pl-fe/src/entity-store/selectors.ts | 1 - .../compose/components/upload-button.tsx | 2 +- .../compose/editor/plugins/link-plugin.tsx | 5 +- .../features/crypto-donate/utils/coin-db.ts | 2 +- .../components/emoji-picker-dropdown.tsx | 3 +- packages/pl-fe/src/features/emoji/data.ts | 5 +- packages/pl-fe/src/features/forms/index.tsx | 52 ------------------ .../pl-fe/src/features/placeholder/utils.ts | 6 +-- packages/pl-fe/src/features/video/index.tsx | 9 ---- packages/pl-fe/src/jest/factory.ts | 8 --- packages/pl-fe/src/jest/mock-stores.tsx | 17 ------ packages/pl-fe/src/jest/test-helpers.tsx | 1 - .../src/normalizers/pl-fe/pl-fe-config.ts | 1 - packages/pl-fe/src/reducers/auth.ts | 1 - packages/pl-fe/src/reducers/compose.ts | 1 - packages/pl-fe/src/reducers/user-lists.ts | 2 - packages/pl-fe/src/selectors/index.ts | 2 - packages/pl-fe/src/settings.ts | 1 - packages/pl-fe/src/storage/kv-store.ts | 1 - packages/pl-fe/src/utils/auth.ts | 1 - packages/pl-fe/src/utils/colors.ts | 14 ----- packages/pl-fe/src/utils/errors.ts | 26 +-------- packages/pl-fe/src/utils/rtl.ts | 2 +- packages/pl-fe/src/utils/status.ts | 1 - packages/pl-fe/src/utils/theme.ts | 1 - 33 files changed, 13 insertions(+), 220 deletions(-) diff --git a/packages/pl-fe/src/api/hooks/accounts/useAccountList.ts b/packages/pl-fe/src/api/hooks/accounts/useAccountList.ts index 558be5cb2..8f7931a89 100644 --- a/packages/pl-fe/src/api/hooks/accounts/useAccountList.ts +++ b/packages/pl-fe/src/api/hooks/accounts/useAccountList.ts @@ -72,7 +72,6 @@ const useFollowers = (accountId: string | undefined) => { }; export { - useAccountList, useBlocks, useMutes, useFollowing, diff --git a/packages/pl-fe/src/components/relative-timestamp.tsx b/packages/pl-fe/src/components/relative-timestamp.tsx index cd6c890c4..8329c4baa 100644 --- a/packages/pl-fe/src/components/relative-timestamp.tsx +++ b/packages/pl-fe/src/components/relative-timestamp.tsx @@ -199,6 +199,5 @@ const RelativeTimestamp = injectIntl(class RelativeTimestamp extends React.Compo export { dateFormatOptions, - timeAgoString, RelativeTimestamp as default, }; diff --git a/packages/pl-fe/src/components/statuses/sensitive-content-overlay.tsx b/packages/pl-fe/src/components/statuses/sensitive-content-overlay.tsx index 5fd218a89..9217b436d 100644 --- a/packages/pl-fe/src/components/statuses/sensitive-content-overlay.tsx +++ b/packages/pl-fe/src/components/statuses/sensitive-content-overlay.tsx @@ -110,4 +110,4 @@ const SensitiveContentOverlay = React.forwardRef { ); }; -export { Avatar as default, AVATAR_SIZE }; +export { Avatar as default }; diff --git a/packages/pl-fe/src/components/ui/button/index.tsx b/packages/pl-fe/src/components/ui/button/index.tsx index bf83c5bbf..e26c139e4 100644 --- a/packages/pl-fe/src/components/ui/button/index.tsx +++ b/packages/pl-fe/src/components/ui/button/index.tsx @@ -101,7 +101,4 @@ const Button = React.forwardRef(({ return renderButton(); }); -export { - Button as default, - Button, -}; +export { Button as default }; diff --git a/packages/pl-fe/src/components/ui/column.tsx b/packages/pl-fe/src/components/ui/column.tsx index 582660e88..3d76ad856 100644 --- a/packages/pl-fe/src/components/ui/column.tsx +++ b/packages/pl-fe/src/components/ui/column.tsx @@ -122,5 +122,4 @@ const Column = React.forwardRef((props, ref): JSX.Eleme export { Column as default, Column, - ColumnHeader, }; diff --git a/packages/pl-fe/src/components/ui/slider.tsx b/packages/pl-fe/src/components/ui/slider.tsx index 429c4a73e..4ab26fd2c 100644 --- a/packages/pl-fe/src/components/ui/slider.tsx +++ b/packages/pl-fe/src/components/ui/slider.tsx @@ -1,7 +1,7 @@ import throttle from 'lodash/throttle'; import React, { useRef } from 'react'; -type Point = { x: number; y: number }; +import { getPointerPosition } from 'pl-fe/features/video'; interface ISlider { /** Value between 0 and 1. */ @@ -68,56 +68,4 @@ const Slider: React.FC = ({ value, onChange }) => { ); }; -const findElementPosition = (el: HTMLElement) => { - let box; - - if (el.getBoundingClientRect && el.parentNode) { - box = el.getBoundingClientRect(); - } - - if (!box) { - return { - left: 0, - top: 0, - }; - } - - const docEl = document.documentElement; - const body = document.body; - - const clientLeft = docEl.clientLeft || body.clientLeft || 0; - const scrollLeft = window.pageXOffset || body.scrollLeft; - const left = (box.left + scrollLeft) - clientLeft; - - const clientTop = docEl.clientTop || body.clientTop || 0; - const scrollTop = window.pageYOffset || body.scrollTop; - const top = (box.top + scrollTop) - clientTop; - - return { - left: Math.round(left), - top: Math.round(top), - }; -}; - -const getPointerPosition = (el: HTMLElement, event: MouseEvent & TouchEvent): Point => { - const box = findElementPosition(el); - const boxW = el.offsetWidth; - const boxH = el.offsetHeight; - const boxY = box.top; - const boxX = box.left; - - let pageY = event.pageY; - let pageX = event.pageX; - - if (event.changedTouches) { - pageX = event.changedTouches[0].pageX; - pageY = event.changedTouches[0].pageY; - } - - return { - y: Math.max(0, Math.min(1, (pageY - boxY) / boxH)), - x: Math.max(0, Math.min(1, (pageX - boxX) / boxW)), - }; -}; - export { Slider as default }; diff --git a/packages/pl-fe/src/contexts/stat-context.tsx b/packages/pl-fe/src/contexts/stat-context.tsx index 3918bb6da..8245027db 100644 --- a/packages/pl-fe/src/contexts/stat-context.tsx +++ b/packages/pl-fe/src/contexts/stat-context.tsx @@ -30,4 +30,4 @@ const StatProvider: React.FC = ({ children }) => { const useStatContext = (): IStatContext => useContext(StatContext); -export { StatProvider, useStatContext, IStatContext }; +export { StatProvider, useStatContext }; diff --git a/packages/pl-fe/src/entity-store/selectors.ts b/packages/pl-fe/src/entity-store/selectors.ts index d9dcef8fd..23320017b 100644 --- a/packages/pl-fe/src/entity-store/selectors.ts +++ b/packages/pl-fe/src/entity-store/selectors.ts @@ -62,7 +62,6 @@ const findEntity = ( export { selectCache, - selectList, selectListState, useListState, selectEntities, diff --git a/packages/pl-fe/src/features/compose/components/upload-button.tsx b/packages/pl-fe/src/features/compose/components/upload-button.tsx index d8b7bcc18..f757cfed2 100644 --- a/packages/pl-fe/src/features/compose/components/upload-button.tsx +++ b/packages/pl-fe/src/features/compose/components/upload-button.tsx @@ -88,4 +88,4 @@ const UploadButton: React.FC = ({ ); }; -export { UploadButton as default, onlyImages }; +export { UploadButton as default }; diff --git a/packages/pl-fe/src/features/compose/editor/plugins/link-plugin.tsx b/packages/pl-fe/src/features/compose/editor/plugins/link-plugin.tsx index 27e6368ae..c5096e6a6 100644 --- a/packages/pl-fe/src/features/compose/editor/plugins/link-plugin.tsx +++ b/packages/pl-fe/src/features/compose/editor/plugins/link-plugin.tsx @@ -20,7 +20,4 @@ const validateUrl = (url: string): boolean => { const LinkPlugin = (): JSX.Element => ; -export { - validateUrl, - LinkPlugin as default, -}; +export { LinkPlugin as default }; diff --git a/packages/pl-fe/src/features/crypto-donate/utils/coin-db.ts b/packages/pl-fe/src/features/crypto-donate/utils/coin-db.ts index e08155dea..8e31b7ed1 100644 --- a/packages/pl-fe/src/features/crypto-donate/utils/coin-db.ts +++ b/packages/pl-fe/src/features/crypto-donate/utils/coin-db.ts @@ -11,4 +11,4 @@ const getTitle = (ticker: string): string => { return typeof title === 'string' ? title : ''; }; -export { getTitle, coinDB as default }; +export { getTitle }; diff --git a/packages/pl-fe/src/features/emoji/components/emoji-picker-dropdown.tsx b/packages/pl-fe/src/features/emoji/components/emoji-picker-dropdown.tsx index 9dd143ae0..12f824d48 100644 --- a/packages/pl-fe/src/features/emoji/components/emoji-picker-dropdown.tsx +++ b/packages/pl-fe/src/features/emoji/components/emoji-picker-dropdown.tsx @@ -236,7 +236,6 @@ const EmojiPickerDropdown: React.FC = ({ }; export { - messages, - type IEmojiPickerDropdown, EmojiPickerDropdown as default, + type IEmojiPickerDropdown, }; diff --git a/packages/pl-fe/src/features/emoji/data.ts b/packages/pl-fe/src/features/emoji/data.ts index a0a057e72..ad9fef2b7 100644 --- a/packages/pl-fe/src/features/emoji/data.ts +++ b/packages/pl-fe/src/features/emoji/data.ts @@ -45,15 +45,12 @@ interface EmojiData { } const emojiData = data as EmojiData; -const { categories, emojis, aliases, sheet } = emojiData; +const { emojis } = emojiData; export { type CustomEmoji, type Emoji, type EmojiData, - categories, emojis, - aliases, - sheet, emojiData as default, }; diff --git a/packages/pl-fe/src/features/forms/index.tsx b/packages/pl-fe/src/features/forms/index.tsx index 01174c076..4d2bc814a 100644 --- a/packages/pl-fe/src/features/forms/index.tsx +++ b/packages/pl-fe/src/features/forms/index.tsx @@ -71,16 +71,6 @@ const LabelInput: React.FC = ({ label, ...props }) => ( ); -interface ILabelTextarea { - label?: React.ReactNode; -} - -const LabelTextarea: React.FC = ({ label, ...props }) => ( - -