Migrate to external library for interacting with API
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
@ -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();
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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));
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -130,7 +130,7 @@ const SidebarNavigation = () => {
|
||||
);
|
||||
}
|
||||
|
||||
if (features.directTimeline || features.conversations) {
|
||||
if (features.conversations) {
|
||||
return (
|
||||
<SidebarNavigationLink
|
||||
to='/messages'
|
||||
|
||||
@ -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')}
|
||||
|
||||
Reference in New Issue
Block a user