pl-fe: Remove unused exports
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
60a7865420
commit
b3db562a32
33 changed files with 13 additions and 220 deletions
|
@ -72,7 +72,6 @@ const useFollowers = (accountId: string | undefined) => {
|
|||
};
|
||||
|
||||
export {
|
||||
useAccountList,
|
||||
useBlocks,
|
||||
useMutes,
|
||||
useFollowing,
|
||||
|
|
|
@ -199,6 +199,5 @@ const RelativeTimestamp = injectIntl(class RelativeTimestamp extends React.Compo
|
|||
|
||||
export {
|
||||
dateFormatOptions,
|
||||
timeAgoString,
|
||||
RelativeTimestamp as default,
|
||||
};
|
||||
|
|
|
@ -110,4 +110,4 @@ const SensitiveContentOverlay = React.forwardRef<HTMLDivElement, ISensitiveConte
|
|||
);
|
||||
});
|
||||
|
||||
export { SensitiveContentOverlay as default, isMediaVisible, showOverlay };
|
||||
export { SensitiveContentOverlay as default, isMediaVisible };
|
||||
|
|
|
@ -60,4 +60,4 @@ const Avatar = (props: IAvatar) => {
|
|||
);
|
||||
};
|
||||
|
||||
export { Avatar as default, AVATAR_SIZE };
|
||||
export { Avatar as default };
|
||||
|
|
|
@ -101,7 +101,4 @@ const Button = React.forwardRef<HTMLButtonElement, IButton>(({
|
|||
return renderButton();
|
||||
});
|
||||
|
||||
export {
|
||||
Button as default,
|
||||
Button,
|
||||
};
|
||||
export { Button as default };
|
||||
|
|
|
@ -122,5 +122,4 @@ const Column = React.forwardRef<HTMLDivElement, IColumn>((props, ref): JSX.Eleme
|
|||
export {
|
||||
Column as default,
|
||||
Column,
|
||||
ColumnHeader,
|
||||
};
|
||||
|
|
|
@ -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<ISlider> = ({ 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 };
|
||||
|
|
|
@ -30,4 +30,4 @@ const StatProvider: React.FC<IStatProvider> = ({ children }) => {
|
|||
|
||||
const useStatContext = (): IStatContext => useContext(StatContext);
|
||||
|
||||
export { StatProvider, useStatContext, IStatContext };
|
||||
export { StatProvider, useStatContext };
|
||||
|
|
|
@ -62,7 +62,6 @@ const findEntity = <TEntity extends Entity>(
|
|||
|
||||
export {
|
||||
selectCache,
|
||||
selectList,
|
||||
selectListState,
|
||||
useListState,
|
||||
selectEntities,
|
||||
|
|
|
@ -88,4 +88,4 @@ const UploadButton: React.FC<IUploadButton> = ({
|
|||
);
|
||||
};
|
||||
|
||||
export { UploadButton as default, onlyImages };
|
||||
export { UploadButton as default };
|
||||
|
|
|
@ -20,7 +20,4 @@ const validateUrl = (url: string): boolean => {
|
|||
|
||||
const LinkPlugin = (): JSX.Element => <LexicalLinkPlugin validateUrl={validateUrl} />;
|
||||
|
||||
export {
|
||||
validateUrl,
|
||||
LinkPlugin as default,
|
||||
};
|
||||
export { LinkPlugin as default };
|
||||
|
|
|
@ -11,4 +11,4 @@ const getTitle = (ticker: string): string => {
|
|||
return typeof title === 'string' ? title : '';
|
||||
};
|
||||
|
||||
export { getTitle, coinDB as default };
|
||||
export { getTitle };
|
||||
|
|
|
@ -236,7 +236,6 @@ const EmojiPickerDropdown: React.FC<IEmojiPickerDropdown> = ({
|
|||
};
|
||||
|
||||
export {
|
||||
messages,
|
||||
type IEmojiPickerDropdown,
|
||||
EmojiPickerDropdown as default,
|
||||
type IEmojiPickerDropdown,
|
||||
};
|
||||
|
|
|
@ -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,
|
||||
};
|
||||
|
|
|
@ -71,16 +71,6 @@ const LabelInput: React.FC<ILabelInput> = ({ label, ...props }) => (
|
|||
</LabelInputContainer>
|
||||
);
|
||||
|
||||
interface ILabelTextarea {
|
||||
label?: React.ReactNode;
|
||||
}
|
||||
|
||||
const LabelTextarea: React.FC<ILabelTextarea> = ({ label, ...props }) => (
|
||||
<LabelInputContainer label={label}>
|
||||
<textarea {...props} />
|
||||
</LabelInputContainer>
|
||||
);
|
||||
|
||||
interface ISimpleInput {
|
||||
type: string;
|
||||
label?: React.ReactNode;
|
||||
|
@ -110,20 +100,6 @@ const SimpleInput: React.FC<ISimpleInput> = (props) => {
|
|||
);
|
||||
};
|
||||
|
||||
interface ICheckbox {
|
||||
label?: React.ReactNode;
|
||||
hint?: React.ReactNode;
|
||||
name?: string;
|
||||
checked?: boolean;
|
||||
disabled?: boolean;
|
||||
onChange?: React.ChangeEventHandler<HTMLInputElement>;
|
||||
required?: boolean;
|
||||
}
|
||||
|
||||
const Checkbox: React.FC<ICheckbox> = (props) => (
|
||||
<SimpleInput type='checkbox' {...props} />
|
||||
);
|
||||
|
||||
interface ISelectDropdown {
|
||||
className?: string;
|
||||
label?: React.ReactNode;
|
||||
|
@ -189,25 +165,6 @@ const Mutliselect: React.FC<IMultiselect> = (props) => {
|
|||
) : selectElem;
|
||||
};
|
||||
|
||||
interface ITextInput {
|
||||
name?: string;
|
||||
onChange?: React.ChangeEventHandler;
|
||||
label?: React.ReactNode;
|
||||
hint?: React.ReactNode;
|
||||
placeholder?: string;
|
||||
value?: string;
|
||||
autoComplete?: string;
|
||||
autoCorrect?: string;
|
||||
autoCapitalize?: string;
|
||||
pattern?: string;
|
||||
error?: boolean;
|
||||
required?: boolean;
|
||||
}
|
||||
|
||||
const TextInput: React.FC<ITextInput> = props => (
|
||||
<SimpleInput type='text' {...props} />
|
||||
);
|
||||
|
||||
const FileChooser : React.FC = (props) => (
|
||||
<SimpleInput type='file' {...props} />
|
||||
);
|
||||
|
@ -233,15 +190,6 @@ FileChooserLogo.defaultProps = {
|
|||
};
|
||||
|
||||
export {
|
||||
InputContainer,
|
||||
LabelInputContainer,
|
||||
LabelInput,
|
||||
LabelTextarea,
|
||||
SimpleInput,
|
||||
Checkbox,
|
||||
SelectDropdown,
|
||||
Mutliselect,
|
||||
TextInput,
|
||||
FileChooser,
|
||||
FileChooserLogo,
|
||||
};
|
||||
|
|
|
@ -13,8 +13,4 @@ const generateText = (length: number) => {
|
|||
// https://stackoverflow.com/a/7228322/8811886
|
||||
const randomIntFromInterval = (min: number, max: number) => Math.floor(Math.random() * (max - min + 1) + min);
|
||||
|
||||
export {
|
||||
PLACEHOLDER_CHAR,
|
||||
generateText,
|
||||
randomIntFromInterval,
|
||||
};
|
||||
export { generateText, randomIntFromInterval };
|
||||
|
|
|
@ -87,14 +87,6 @@ const getPointerPosition = (el: HTMLElement, event: MouseEvent & TouchEvent): Po
|
|||
};
|
||||
};
|
||||
|
||||
const fileNameFromURL = (str: string) => {
|
||||
const url = new URL(str);
|
||||
const pathname = url.pathname;
|
||||
const index = pathname.lastIndexOf('/');
|
||||
|
||||
return pathname.substring(index + 1);
|
||||
};
|
||||
|
||||
interface IVideo {
|
||||
preview?: string;
|
||||
src: string;
|
||||
|
@ -579,6 +571,5 @@ export {
|
|||
formatTime,
|
||||
findElementPosition,
|
||||
getPointerPosition,
|
||||
fileNameFromURL,
|
||||
Video as default,
|
||||
};
|
||||
|
|
|
@ -4,7 +4,6 @@ import {
|
|||
groupRelationshipSchema,
|
||||
groupSchema,
|
||||
instanceSchema,
|
||||
previewCardSchema,
|
||||
relationshipSchema,
|
||||
statusSchema,
|
||||
GroupRoles,
|
||||
|
@ -13,7 +12,6 @@ import {
|
|||
type GroupMember,
|
||||
type GroupRelationship,
|
||||
type Instance,
|
||||
type PreviewCard,
|
||||
type Relationship,
|
||||
type Status,
|
||||
} from 'pl-api';
|
||||
|
@ -30,11 +28,6 @@ const buildAccount = (props: PartialDeep<Account> = {}): Account =>
|
|||
url: `https://soapbox.test/users/${crypto.randomUUID()}`,
|
||||
}, props));
|
||||
|
||||
const buildCard = (props: PartialDeep<PreviewCard> = {}): PreviewCard =>
|
||||
v.parse(previewCardSchema, Object.assign({
|
||||
url: 'https://soapbox.test',
|
||||
}, props));
|
||||
|
||||
const buildGroup = (props: PartialDeep<Group> = {}): Group =>
|
||||
v.parse(groupSchema, Object.assign({
|
||||
id: crypto.randomUUID(),
|
||||
|
@ -72,7 +65,6 @@ const buildStatus = (props: PartialDeep<Status> = {}) =>
|
|||
|
||||
export {
|
||||
buildAccount,
|
||||
buildCard,
|
||||
buildGroup,
|
||||
buildGroupMember,
|
||||
buildGroupRelationship,
|
||||
|
|
|
@ -1,26 +1,9 @@
|
|||
import { instanceSchema } from 'pl-api';
|
||||
import * as v from 'valibot';
|
||||
|
||||
import alexJson from 'pl-fe/__fixtures__/pleroma-account.json';
|
||||
|
||||
import { buildAccount } from './factory';
|
||||
|
||||
/** Store with registrations open. */
|
||||
const storeOpen = { instance: v.parse(instanceSchema, { registrations: true }) };
|
||||
|
||||
/** Store with registrations closed. */
|
||||
const storeClosed = { instance: v.parse(instanceSchema, { registrations: false }) };
|
||||
|
||||
/** Store with a logged-in user. */
|
||||
const storeLoggedIn = {
|
||||
me: alexJson.id,
|
||||
accounts: {
|
||||
[alexJson.id]: buildAccount(alexJson as any),
|
||||
},
|
||||
};
|
||||
|
||||
export {
|
||||
storeOpen,
|
||||
storeClosed,
|
||||
storeLoggedIn,
|
||||
};
|
||||
|
|
|
@ -113,7 +113,6 @@ export {
|
|||
mockStore,
|
||||
applyActions,
|
||||
rootState,
|
||||
rootReducer,
|
||||
mockWindowProperty,
|
||||
createTestStore,
|
||||
queryClient,
|
||||
|
|
|
@ -221,7 +221,6 @@ const normalizePlFeConfig = (plFeConfig: Record<string, any>) => PlFeConfigRecor
|
|||
|
||||
export {
|
||||
PromoPanelItemRecord,
|
||||
PromoPanelRecord,
|
||||
FooterItemRecord,
|
||||
CryptoAddressRecord,
|
||||
PlFeConfigRecord,
|
||||
|
|
|
@ -365,6 +365,5 @@ const auth = (oldState: State = initialState, action: AnyAction) => {
|
|||
export {
|
||||
AuthUserRecord,
|
||||
ReducerRecord,
|
||||
localState,
|
||||
auth as default,
|
||||
};
|
||||
|
|
|
@ -605,7 +605,6 @@ const compose = (state = initialState, action: ComposeAction | EventsAction | In
|
|||
|
||||
export {
|
||||
ReducerCompose,
|
||||
statusToMentionsArray,
|
||||
statusToMentionsAccountIdsArray,
|
||||
initialState,
|
||||
compose as default,
|
||||
|
|
|
@ -218,8 +218,6 @@ const userLists = (state = ReducerRecord(), action: DirectoryAction | AnyAction)
|
|||
|
||||
export {
|
||||
ListRecord,
|
||||
ReactionRecord,
|
||||
ParticipationRequest,
|
||||
ReducerRecord,
|
||||
userLists as default,
|
||||
};
|
||||
|
|
|
@ -349,7 +349,6 @@ const makeGetStatusIds = () => createSelector([
|
|||
export {
|
||||
type RemoteInstance,
|
||||
selectAccount,
|
||||
selectAccounts,
|
||||
selectOwnAccount,
|
||||
makeGetAccount,
|
||||
getFilters,
|
||||
|
@ -363,7 +362,6 @@ export {
|
|||
makeGetReport,
|
||||
makeGetOtherAccounts,
|
||||
makeGetHosts,
|
||||
RemoteInstanceRecord,
|
||||
makeGetRemoteInstance,
|
||||
makeGetStatusIds,
|
||||
};
|
||||
|
|
|
@ -55,5 +55,4 @@ const tagHistory = new Settings('plfe_tag_history');
|
|||
export {
|
||||
pushNotificationsSetting,
|
||||
tagHistory,
|
||||
Settings as default,
|
||||
};
|
||||
|
|
|
@ -24,6 +24,5 @@ KVStore.getItemOrError = (key: string) => KVStore.getItem(key).then(value => {
|
|||
});
|
||||
|
||||
export {
|
||||
KVStore,
|
||||
KVStore as default,
|
||||
};
|
||||
|
|
|
@ -70,7 +70,6 @@ export {
|
|||
parseBaseURL,
|
||||
getLoggedInAccount,
|
||||
isLoggedIn,
|
||||
getUserToken,
|
||||
getAccessToken,
|
||||
getAuthUserId,
|
||||
getAuthUserUrl,
|
||||
|
|
|
@ -51,19 +51,6 @@ const rgbToHex = (r: number, g: number, b: number): string => {
|
|||
return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
|
||||
};
|
||||
|
||||
const getTextColor = (color: string): '#FFF' | '#333' => {
|
||||
const rgbColor = hexToRgb(color);
|
||||
|
||||
if (!rgbColor) {
|
||||
return '#333';
|
||||
}
|
||||
|
||||
const { r, g, b } = rgbColor;
|
||||
const luma = 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
||||
|
||||
return luma < 120 ? '#FFF' : '#333';
|
||||
};
|
||||
|
||||
const lighten = (hex: string, intensity: number): string => {
|
||||
const color = hexToRgb(`#${hex}`);
|
||||
|
||||
|
@ -124,6 +111,5 @@ const colors = (baseColor: string): TailwindColorObject => {
|
|||
|
||||
export {
|
||||
hexToRgb,
|
||||
getTextColor,
|
||||
colors as default,
|
||||
};
|
||||
|
|
|
@ -1,27 +1,3 @@
|
|||
import camelCase from 'lodash/camelCase';
|
||||
import startCase from 'lodash/startCase';
|
||||
|
||||
const toSentence = (arr: string[]) => arr
|
||||
.reduce(
|
||||
(prev, curr, i) => prev + curr + (i === arr.length - 2 ? ' and ' : ', '),
|
||||
'',
|
||||
)
|
||||
.slice(0, -2);
|
||||
|
||||
type Errors = {
|
||||
[key: string]: string[];
|
||||
}
|
||||
|
||||
const buildErrorMessage = (errors: Errors) => {
|
||||
const individualErrors = Object.keys(errors).map(
|
||||
(attribute) => `${startCase(camelCase(attribute))} ${toSentence(
|
||||
errors[attribute],
|
||||
)}`,
|
||||
);
|
||||
|
||||
return toSentence(individualErrors);
|
||||
};
|
||||
|
||||
const httpErrorMessages: { code: number; name: string; description: string }[] = [
|
||||
{
|
||||
code: 100,
|
||||
|
@ -206,4 +182,4 @@ const isNetworkError = (error: unknown): boolean =>
|
|||
&& error.name === 'TypeError'
|
||||
&& error.message.startsWith('Failed to fetch dynamically imported module: ');
|
||||
|
||||
export { buildErrorMessage, httpErrorMessages, isNetworkError };
|
||||
export { httpErrorMessages, isNetworkError };
|
||||
|
|
|
@ -56,4 +56,4 @@ const getTextDirection = (text: string, { fallback = 'ltr', confidence }: GetTex
|
|||
return isRtl(text, confidence) ? 'rtl' : 'ltr';
|
||||
};
|
||||
|
||||
export { getTextDirection, isRtl };
|
||||
export { getTextDirection };
|
||||
|
|
|
@ -68,7 +68,6 @@ const getStatusIdsFromLinksInContent = (content: string): string[] => {
|
|||
|
||||
export {
|
||||
defaultMediaVisibility,
|
||||
getFirstExternalLink,
|
||||
shouldHaveCard,
|
||||
hasIntegerMediaIds,
|
||||
textForScreenReader,
|
||||
|
|
|
@ -131,7 +131,6 @@ const hueShift = (hex: string, delta: number): string => {
|
|||
export {
|
||||
generateAccent,
|
||||
generateNeutral,
|
||||
colorsToCss,
|
||||
generateThemeCss,
|
||||
hexToHsl,
|
||||
hueShift,
|
||||
|
|
Loading…
Reference in a new issue