Migrate to external library for interacting with API

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak
2024-08-04 16:09:52 +02:00
parent 963ffb3d45
commit 4dfdfcccd3
137 changed files with 1136 additions and 2094 deletions

View File

@ -16,7 +16,6 @@ interface IAutosuggestAccountInput {
onSelected: (accountId: string) => void;
autoFocus?: boolean;
value: string;
limit?: number;
className?: string;
autoSelect?: boolean;
menu?: Menu;
@ -28,7 +27,6 @@ const AutosuggestAccountInput: React.FC<IAutosuggestAccountInput> = ({
onChange,
onSelected,
value = '',
limit = 4,
...rest
}) => {
const dispatch = useAppDispatch();
@ -45,15 +43,13 @@ const AutosuggestAccountInput: React.FC<IAutosuggestAccountInput> = ({
};
const handleAccountSearch = useCallback(throttle((q) => {
const params = { q, limit, resolve: false };
dispatch(accountSearch(params, controller.current.signal))
dispatch(accountSearch(q, controller.current.signal))
.then((accounts: { id: string }[]) => {
const accountIds = accounts.map(account => account.id);
setAccountIds(ImmutableOrderedSet(accountIds));
})
.catch(noOp);
}, 900, { leading: true, trailing: true }), [limit]);
}, 900, { leading: true, trailing: true }), []);
const handleChange: React.ChangeEventHandler<HTMLInputElement> = e => {
refreshCancelToken();

View File

@ -4,7 +4,7 @@ import React, { useRef, useEffect } from 'react';
interface IBlurhash {
/** Hash to render */
hash: string | null | undefined;
/** Width of the blurred region in pixels. Defaults to 32. */
/** Width of the blurred region in pixels. Defaults to 32. */
width?: number;
/** Height of the blurred region in pixels. Defaults to width. */
height?: number;

View File

@ -25,7 +25,7 @@ const PollFooter: React.FC<IPollFooter> = ({ poll, showResults, selected }): JSX
const dispatch = useAppDispatch();
const intl = useIntl();
const handleVote = () => dispatch(vote(poll.id, Object.keys(selected)));
const handleVote = () => dispatch(vote(poll.id, Object.keys(selected) as any as number[]));
const handleRefresh: React.EventHandler<React.MouseEvent> = (e) => {
dispatch(fetchPoll(poll.id));

View File

@ -38,7 +38,7 @@ const Poll: React.FC<IPoll> = ({ id, status }): JSX.Element | null => {
ap_id: status?.url,
}));
const handleVote = (selectedId: number) => dispatch(vote(id, [String(selectedId)]));
const handleVote = (selectedId: number) => dispatch(vote(id, [selectedId]));
const toggleOption = (value: number) => {
if (isLoggedIn) {

View File

@ -130,7 +130,7 @@ const SidebarNavigation = () => {
);
}
if (features.directTimeline || features.conversations) {
if (features.conversations) {
return (
<SidebarNavigationLink
to='/messages'

View File

@ -35,7 +35,7 @@ const ThumbNavigation: React.FC = (): JSX.Element => {
);
}
if (features.directTimeline || features.conversations) {
if (features.conversations) {
return (
<ThumbNavigationLink
src={require('@tabler/icons/outline/mail.svg')}