Skip to content

Commit

Permalink
dependencies: bump (major)
Browse files Browse the repository at this point in the history
  • Loading branch information
jesec committed May 17, 2021
1 parent 1058f0a commit 4cbfc4d
Show file tree
Hide file tree
Showing 30 changed files with 2,387 additions and 3,380 deletions.
7 changes: 4 additions & 3 deletions client/src/javascript/components/general/ListViewport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import {observer} from 'mobx-react';
import {OverlayScrollbarsComponent} from 'overlayscrollbars-react';
import {useWindowSize} from 'react-use';

import ConfigStore from '@client/stores/ConfigStore';

import type {FixedSizeListProps, ListChildComponentProps} from 'react-window';

import ConfigStore from '@client/stores/ConfigStore';

const Overflow = forwardRef<HTMLDivElement, ComponentProps<'div'>>((props: ComponentProps<'div'>, ref) => {
const {children, className, onScroll} = props;
Expand All @@ -27,14 +28,14 @@ const Overflow = forwardRef<HTMLDivElement, ComponentProps<'div'>>((props: Compo
refCallback(viewport);

if (onScroll) {
viewport.addEventListener('scroll', (e) => onScroll((e as unknown) as UIEvent<HTMLDivElement>), {
viewport.addEventListener('scroll', (e) => onScroll(e as unknown as UIEvent<HTMLDivElement>), {
passive: true,
});
}

return () => {
if (onScroll) {
viewport.removeEventListener('scroll', (e) => onScroll((e as unknown) as UIEvent<HTMLDivElement>));
viewport.removeEventListener('scroll', (e) => onScroll(e as unknown as UIEvent<HTMLDivElement>));
}
};
}, [onScroll, ref]);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import {FC, memo} from 'react';

import {Error, Spinner, Start, Stop} from '@client/ui/icons';

import type {TorrentStatus} from '@shared/constants/torrentStatusMap';

import {Error, Spinner, Start, Stop} from '@client/ui/icons';

const STATUS_ICON_MAP: Partial<Record<TorrentStatus, JSX.Element>> = {
error: <Error />,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,32 +25,30 @@ const DirectoryTree: FC<DirectoryTreeProps> = (props: DirectoryTreeProps) => {
directories != null
? Object.keys(directories)
.sort((a, b) => a.localeCompare(b))
.map(
(directoryName, index): ReactNode => {
const subSelectedItems = itemsTree.directories && itemsTree.directories[directoryName];
.map((directoryName, index): ReactNode => {
const subSelectedItems = itemsTree.directories && itemsTree.directories[directoryName];

const id = `${index}${childDepth}${directoryName}`;
const isSelected = (subSelectedItems && subSelectedItems.isSelected) || false;
const id = `${index}${childDepth}${directoryName}`;
const isSelected = (subSelectedItems && subSelectedItems.isSelected) || false;

if (subSelectedItems == null) {
return null;
}
if (subSelectedItems == null) {
return null;
}

return (
<DirectoryTreeNode
depth={childDepth}
directoryName={directoryName}
hash={hash}
id={id}
isSelected={isSelected}
key={id}
itemsTree={subSelectedItems}
onItemSelect={onItemSelect}
path={path}
/>
);
},
)
return (
<DirectoryTreeNode
depth={childDepth}
directoryName={directoryName}
hash={hash}
id={id}
isSelected={isSelected}
key={id}
itemsTree={subSelectedItems}
onItemSelect={onItemSelect}
path={path}
/>
);
})
: [];

const fileList: ReactNode =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const FilesystemBrowserTextbox = forwardRef<HTMLInputElement, FilesystemBrowserT
};

const handleDocumentClick = (e: Event): void => {
if (!formRowRef.current?.contains((e.target as unknown) as Node)) {
if (!formRowRef.current?.contains(e.target as unknown as Node)) {
closeDirectoryList();
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const TagSelect: FC<TagSelectProps> = ({defaultValue, placeholder, id, label, on

useEffect(() => {
const handleDocumentClick = (e: Event) => {
if (!formRowRef.current?.contains((e.target as unknown) as Node)) {
if (!formRowRef.current?.contains(e.target as unknown as Node)) {
setIsOpen(false);
}
};
Expand Down
15 changes: 2 additions & 13 deletions client/src/javascript/components/modals/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,8 @@ interface ModalProps {
}

const Modal: FC<ModalProps> = (props: ModalProps) => {
const {
alignment,
size,
orientation,
tabsInBody,
inverse,
initialTabId,
className,
content,
heading,
tabs,
actions,
} = props;
const {alignment, size, orientation, tabsInBody, inverse, initialTabId, className, content, heading, tabs, actions} =
props;

const contentWrapperClasses = classnames(
'modal__content__wrapper',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,8 @@ const AddTorrentsByFile: FC = () => {
const formData = formRef.current?.getFormData();
setIsAddingTorrents(true);

const {
destination,
start,
tags,
isBasePath,
isCompleted,
isSequential,
} = formData as Partial<AddTorrentsByFileFormData>;
const {destination, start, tags, isBasePath, isCompleted, isSequential} =
formData as Partial<AddTorrentsByFileFormData>;

const filesData: Array<string> = [];
filesRef.current.forEach((file) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import {observer} from 'mobx-react';
import {Trans, useLingui} from '@lingui/react';

import {Close, Edit} from '@client/ui/icons';
import FeedStore from '@client/stores/FeedStore';

import type {Feed} from '@shared/types/Feed';

import FeedStore from '@client/stores/FeedStore';

interface FeedListProps {
currentFeed: Feed | null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ const FeedsTab: FC = () => {
className="inverse"
onChange={({event, formData}) => {
const validatedField = (event.target as HTMLInputElement).name as ValidatedField;
const feedForm = (formData as unknown) as FeedFormData;
const feedForm = formData as unknown as FeedFormData;

setErrors({
...errors,
[validatedField]: validateField(validatedField, feedForm[validatedField]),
});
}}
onSubmit={async () => {
const feedForm = (formRef.current?.getFormData() as unknown) as FeedFormData;
const feedForm = formRef.current?.getFormData() as unknown as FeedFormData;
if (formRef.current == null || feedForm == null) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import SettingStore from '@client/stores/SettingStore';
import ToggleList from '@client/components/general/ToggleList';
import TorrentContextMenuActions from '@client/constants/TorrentContextMenuActions';

import type {TorrentContextMenuAction} from '@client/constants/TorrentContextMenuActions';

import defaultFloodSettings from '@shared/constants/defaultFloodSettings';

import type {TorrentContextMenuAction} from '@client/constants/TorrentContextMenuActions';

import type {FloodSettings} from '@shared/types/FloodSettings';

interface TorrentContextMenuActionsListProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ import {observer} from 'mobx-react';
import sortedIndex from 'lodash/sortedIndex';
import {Trans, useLingui} from '@lingui/react';

import type {I18n} from '@lingui/core';

import ClientActions from '@client/actions/ClientActions';
import {Limits} from '@client/ui/icons';
import SettingStore from '@client/stores/SettingStore';

import type {TransferDirection} from '@shared/types/TransferData';

import Dropdown from '../general/form-elements/Dropdown';
import Size from '../general/Size';
import Tooltip from '../general/Tooltip';

import type {I18n} from '@lingui/core';

import type {TransferDirection} from '@shared/types/TransferData';

import type {DropdownItem} from '../general/form-elements/Dropdown';

const HumanReadableSpeed: FC<{bytes: number}> = ({bytes}: {bytes: number}) =>
Expand Down
9 changes: 4 additions & 5 deletions client/src/javascript/components/torrent-list/TorrentList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import {reaction} from 'mobx';
import {Trans} from '@lingui/react';
import {useEvent} from 'react-use';

import type {FixedSizeList, ListChildComponentProps} from 'react-window';

import {Button} from '@client/ui';
import {Files} from '@client/ui/icons';
import ClientStatusStore from '@client/stores/ClientStatusStore';
Expand All @@ -14,11 +12,8 @@ import SettingStore from '@client/stores/SettingStore';
import TorrentFilterStore from '@client/stores/TorrentFilterStore';
import TorrentStore from '@client/stores/TorrentStore';
import UIActions from '@client/actions/UIActions';

import SortDirections from '@client/constants/SortDirections';

import type {TorrentListColumn} from '@client/constants/TorrentListColumns';

import defaultFloodSettings from '@shared/constants/defaultFloodSettings';

import ContextMenuMountPoint from '../general/ContextMenuMountPoint';
Expand All @@ -27,6 +22,10 @@ import TableHeading from './TableHeading';
import TorrentListDropzone from './TorrentListDropzone';
import TorrentListRow from './TorrentListRow';

import type {TorrentListColumn} from '@client/constants/TorrentListColumns';

import type {FixedSizeList, ListChildComponentProps} from 'react-window';

const TorrentListRowRenderer: FC<ListChildComponentProps> = observer(({index, style}) => (
<TorrentListRow hash={TorrentStore.filteredTorrents[index].hash} style={style} />
));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import {createRef, FC, MutableRefObject} from 'react';
import {observer} from 'mobx-react';

import type {TorrentProperties} from '@shared/types/Torrent';

import {Checkmark} from '@client/ui/icons';
import ConfigStore from '@client/stores/ConfigStore';
import TorrentActions from '@client/actions/TorrentActions';
import TorrentContextMenuActions from '@client/constants/TorrentContextMenuActions';
import TorrentStore from '@client/stores/TorrentStore';
import UIActions from '@client/actions/UIActions';

import PriorityMeter from '../general/PriorityMeter';

import type {ContextMenuItem} from '@client/stores/UIStore';

import PriorityMeter from '../general/PriorityMeter';
import type {TorrentProperties} from '@shared/types/Torrent';

const getLastSelectedTorrent = (): string => TorrentStore.selectedTorrents[TorrentStore.selectedTorrents.length - 1];

Expand Down
10 changes: 5 additions & 5 deletions client/src/javascript/components/torrent-list/TorrentListRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ const displayContextMenu = (hash: string, event: KeyboardEvent | MouseEvent | To
event.preventDefault();
}

const mouseClientX = ((event as unknown) as MouseEvent).clientX;
const mouseClientY = ((event as unknown) as MouseEvent).clientY;
const touchClientX = ((event as unknown) as TouchEvent).touches?.[0].clientX;
const touchClientY = ((event as unknown) as TouchEvent).touches?.[0].clientY;
const mouseClientX = (event as unknown as MouseEvent).clientX;
const mouseClientY = (event as unknown as MouseEvent).clientY;
const touchClientX = (event as unknown as TouchEvent).touches?.[0].clientX;
const touchClientY = (event as unknown as TouchEvent).touches?.[0].clientY;

if (!TorrentStore.selectedTorrents.includes(hash)) {
UIActions.handleTorrentClick({hash, event});
Expand Down Expand Up @@ -92,7 +92,7 @@ const TorrentListRow: FC<TorrentListRowProps> = observer(({hash, style}: Torrent
const {onTouchStart, onTouchEnd} = useLongPress((e) => {
const curRowLocation = rowRef.current?.getBoundingClientRect().top;
if (e != null && curRowLocation != null && Math.abs(curRowLocation - rowLocation) < 25) {
displayContextMenu(hash, (e as unknown) as TouchEvent);
displayContextMenu(hash, e as unknown as TouchEvent);
}
});

Expand Down
6 changes: 3 additions & 3 deletions client/src/javascript/i18n/languages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import detectLocale from '@client/util/detectLocale';
import Languages from '@client/constants/Languages';
import SettingStore from '@client/stores/SettingStore';

import type {Language} from '@client/constants/Languages';
import type {LocaleConfig} from '@client/util/detectLocale';

// eslint-disable-next-line import/no-webpack-loader-syntax
import {messages as EN} from '@lingui/loader!./strings/en.json?raw-lingui';

import type {Language} from '@client/constants/Languages';
import type {LocaleConfig} from '@client/util/detectLocale';

const messagesCache: Partial<Record<Exclude<Language, 'auto'>, Record<string, string[]>>> = {en: EN};

i18n.loadLocaleData('en', {plurals: plurals.en});
Expand Down
8 changes: 5 additions & 3 deletions client/src/javascript/ui/components/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@ const Select: FC<SelectProps> = ({
const [isOpen, setIsOpen] = useState<boolean>(false);
const [selectedID, setSelectedID] = useState<string | number>(
defaultID ??
((children as ReactNodeArray)?.find(
(child) => (child as ReactElement<SelectItemProps>)?.props?.id != null,
) as ReactElement<SelectItemProps>)?.props.id ??
(
(children as ReactNodeArray)?.find(
(child) => (child as ReactElement<SelectItemProps>)?.props?.id != null,
) as ReactElement<SelectItemProps>
)?.props.id ??
'',
);

Expand Down
Loading

0 comments on commit 4cbfc4d

Please sign in to comment.