Remove unused code

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak
2024-04-29 23:55:35 +02:00
parent 5fe108b6a5
commit 1d177831fe
6 changed files with 0 additions and 84 deletions

View File

@ -1,20 +0,0 @@
import React from 'react';
import Emoji from 'soapbox/components/ui/emoji/emoji';
interface IEmojiGraphic {
emoji: string;
}
/** Large emoji with a background for display purposes (eg breaking up a page). */
const EmojiGraphic: React.FC<IEmojiGraphic> = ({ emoji }) => {
return (
<div className='flex items-center justify-center'>
<div className='rounded-full bg-gray-100 p-8 dark:bg-gray-800'>
<Emoji className='h-24 w-24' emoji={emoji} />
</div>
</div>
);
};
export default EmojiGraphic;

View File

@ -1,7 +1,6 @@
export { useApi } from './useApi';
export { useAppDispatch } from './useAppDispatch';
export { useAppSelector } from './useAppSelector';
export { useBackend } from './useBackend';
export { useClickOutside } from './useClickOutside';
export { useCompose } from './useCompose';
export { useDebounce } from './useDebounce';
@ -13,10 +12,8 @@ export { useInstance } from './useInstance';
export { useLoading } from './useLoading';
export { useLocale } from './useLocale';
export { useLoggedIn } from './useLoggedIn';
export { useOnScreen } from './useOnScreen';
export { useOwnAccount } from './useOwnAccount';
export { usePrevious } from './usePrevious';
export { useRefEventHandler } from './useRefEventHandler';
export { useRegistrationStatus } from './useRegistrationStatus';
export { useSettings } from './useSettings';
export { useSoapboxConfig } from './useSoapboxConfig';

View File

@ -1,16 +0,0 @@
import { parseVersion } from 'soapbox/utils/features';
import { useInstance } from './useInstance';
/**
* Get the Backend version.
*
* @returns Backend
*/
const useBackend = () => {
const instance = useInstance();
return parseVersion(instance.version);
};
export { useBackend };

View File

@ -1,11 +0,0 @@
import { useState, useCallback } from 'react';
export function useForceUpdate(): () => void {
const [, setState] = useState(false);
const forceUpdate = useCallback(() => {
setState(prevState => !prevState);
}, []);
return forceUpdate;
}

View File

@ -1,25 +0,0 @@
import React, { useEffect, useMemo, useState } from 'react';
/** Detect whether a given element is on the screen. */
// https://stackoverflow.com/a/64892655
export const useOnScreen = <T>(ref: React.RefObject<T & Element>) => {
const [isIntersecting, setIntersecting] = useState(false);
const observer = useMemo(() => {
return new IntersectionObserver(
([entry]) => setIntersecting(entry.isIntersecting),
);
}, []);
useEffect(() => {
if (ref.current) {
observer.observe(ref.current);
}
return () => {
observer.disconnect();
};
}, [ref.current]);
return isIntersecting;
};

View File

@ -1,9 +0,0 @@
import { useRef } from 'react';
/** Hook that allows using useState values in event handlers. */
// https://stackoverflow.com/a/64770671/8811886
export const useRefEventHandler = (fn: (...params: any) => void) => {
const ref = useRef(fn);
ref.current = fn;
return ref;
};