Skip to content

Commit

Permalink
Fix type errors related to react-table
Browse files Browse the repository at this point in the history
  • Loading branch information
nukeop committed Aug 30, 2022
1 parent 6717e74 commit 00bf008
Show file tree
Hide file tree
Showing 19 changed files with 2,797 additions and 2,729 deletions.
5,431 changes: 2,747 additions & 2,684 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@
"mousetrap": "^1.6.2",
"numeral": "^2.0.6",
"pitchfork-bnm": "^1.1.2",
"react": "^16.14.0",
"react": "16.14.0",
"react-base-table": "^1.9.2",
"react-beautiful-dnd": "^13.1.0",
"react-dom": "^16.14.0",
"react-dom": "16.14.0",
"react-fontawesome": "^1.6.1",
"react-full-screen": "^1.0.1",
"react-hifi": "^2.2.1",
Expand Down Expand Up @@ -128,4 +128,4 @@
"webpack-cli": "^4.9.2",
"webpack-dev-server": "^4.7.4"
}
}
}
6 changes: 3 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
"md5": "^2.2.1",
"megalodon": "^3.6.1",
"nodebrainz": "^2.1.1",
"react": "^16.14.0",
"react-dom": "^16.14.0",
"react": "16.14.0",
"react-dom": "16.14.0",
"redux": "^4.0.5",
"search-azlyrics": "0.0.3",
"ts-jest": "^27.1.3",
Expand All @@ -56,4 +56,4 @@
"typescript": "^4.2.4",
"ytdl-core": "^4.11.1"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { TdHTMLAttributes } from 'react';
import { CellProps } from 'react-table';

import { Playlist } from '@nuclear/core';
Expand All @@ -16,7 +16,7 @@ const ModificationDateCell: React.FC<CellProps<Playlist> & PlaylistsStrings & Pl
neverModified,
serverModifiedAt
}) => <td
{...cell.getCellProps()}
{...cell.getCellProps() as TdHTMLAttributes<HTMLTableCellElement>}
className={styles.modification_date_cell}
>
<div className={styles.modification_date_cell_content}>
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/lib/components/Playlists/Cells/SyncCell.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { TdHTMLAttributes } from 'react';
import { CellProps } from 'react-table';
import { Icon } from 'semantic-ui-react';

Expand All @@ -18,7 +18,7 @@ const SyncCell: React.FC<CellProps<PlaylistWithLoadingState> & PlaylistsStrings
onPlaylistDownload,
onPlaylistUpload
}) => <td
{...cell.getCellProps()}
{...cell.getCellProps() as TdHTMLAttributes<HTMLTableCellElement>}
className={styles.sync_cell}
>
<div className={styles.sync_cell_content}>
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/lib/components/Playlists/Cells/TitleCell.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { TdHTMLAttributes } from 'react';
import { CellProps } from 'react-table';

import { Playlist } from '@nuclear/core';
Expand All @@ -9,7 +9,7 @@ const TitleCell: React.FC<CellProps<Playlist>> =({
cell,
value
}) => <td
{...cell.getCellProps()}
{...cell.getCellProps() as TdHTMLAttributes<HTMLTableCellElement>}
className={styles.title_cell}
>
{value}
Expand Down
3 changes: 2 additions & 1 deletion packages/ui/lib/components/Playlists/Cells/TracksCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import { CellProps } from 'react-table';
import { Playlist } from '@nuclear/core';

import { PlaylistsStrings } from '..';
import { TdHTMLAttributes } from 'react';

const TracksCell: React.FC<CellProps<Playlist> & PlaylistsStrings> = ({
cell,
value,
tracksSingular,
tracksPlural
}) => <td
{...cell.getCellProps()}
{...cell.getCellProps() as TdHTMLAttributes<HTMLTableCellElement>}
>
{value}
{' '}
Expand Down
7 changes: 4 additions & 3 deletions packages/ui/lib/components/Playlists/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import ModificationDateCell from './Cells/ModificationDateCell';
import SyncCell from './Cells/SyncCell';
import artPlaceholder from '../../../resources/media/art_placeholder.png';
import styles from './styles.scss';
import { TableHTMLAttributes } from 'react';

export type PlaylistsStrings = {
tracksSingular: string;
Expand Down Expand Up @@ -90,15 +91,15 @@ const Playlists: React.FC<PlaylistsProps> = ({
} = useTable<PlaylistWithLoadingState>({ columns, data });

return <table
{...getTableProps()}
{...getTableProps() as TableHTMLAttributes<HTMLTableElement>}
className={styles.playlists_table}
>
<DragDropContext onDragEnd={onDragEnd}>
<Droppable droppableId='playlists'>
{(provided) => (
<tbody
ref={provided.innerRef}
{...getTableBodyProps()}
{...getTableBodyProps() as TableHTMLAttributes<HTMLTableSectionElement>}
{...provided.droppableProps}
>
{
Expand All @@ -116,7 +117,7 @@ const Playlists: React.FC<PlaylistsProps> = ({
ref={provided.innerRef}
className={cx({ [styles.is_dragging]: snapshot.isDragging })}
onClick={() => extra.onPlaylistClick(row.original.id)}
{...row.getRowProps()}
{...row.getRowProps() as TableHTMLAttributes<HTMLTableRowElement>}
{...provided.draggableProps}
{...provided.dragHandleProps}
>
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/lib/components/TrackPopup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export type TrackPopupProps = {
onPlayNext?: () => void;
onPlayNow?: () => void;
onAddToFavorites?: () => void;
onAddToPlaylist?: ({ name: string }) => void;
onAddToPlaylist?: ({ name }: { name: string }) => void;
onAddToDownloads?: () => void;
};

Expand Down
4 changes: 2 additions & 2 deletions packages/ui/lib/components/TrackTable/Cells/DeleteCell.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { TdHTMLAttributes } from 'react';
import cx from 'classnames';
import { CellProps } from 'react-table';

Expand All @@ -11,7 +11,7 @@ const DeleteCell: React.FC<CellProps<Track> & TrackTableExtraProps> = ({
cell,
row,
onDelete
}) => <td {...cell.getCellProps()} className={cx(styles.narrow, styles.delete_cell)}>
}) => <td {...cell.getCellProps() as TdHTMLAttributes<HTMLTableCellElement>} className={cx(styles.narrow, styles.delete_cell)}>
<Button
data-testid='delete-button'
basic
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/lib/components/TrackTable/Cells/FavoriteCell.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { TdHTMLAttributes } from 'react';
import cx from 'classnames';
import { CellProps } from 'react-table';

Expand All @@ -13,7 +13,7 @@ const FavoriteCell: React.FC<CellProps<Track> & TrackTableExtraProps> = ({
value,
onAddToFavorites,
onRemoveFromFavorites
}) => <td {...cell.getCellProps()} className={cx(styles.favorite_cell, styles.narrow)}>
}) => <td {...cell.getCellProps() as TdHTMLAttributes<HTMLTableCellElement>} className={cx(styles.favorite_cell, styles.narrow)}>
<Button
basic
borderless
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/lib/components/TrackTable/Cells/PositionCell.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { TdHTMLAttributes } from 'react';
import cx from 'classnames';
import { CellProps } from 'react-table';

Expand All @@ -12,7 +12,7 @@ const PositionCell: React.FC<CellProps<Track> & TrackTableExtraProps> = ({
row,
value,
onPlay
}) => <td {...cell.getCellProps()} className={cx(styles.position_cell, styles.narrow)}>
}) => <td {...cell.getCellProps() as TdHTMLAttributes<HTMLTableCellElement>} className={cx(styles.position_cell, styles.narrow)}>
<Button
circular
size='tiny'
Expand Down
6 changes: 3 additions & 3 deletions packages/ui/lib/components/TrackTable/Cells/SelectionCell.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/ban-ts-ignore */
import React from 'react';
/* eslint-disable @typescript-eslint/ban-ts-comment */
import React, { TdHTMLAttributes } from 'react';
import cx from 'classnames';
import { CellProps, UseRowSelectRowProps } from 'react-table';

Expand All @@ -10,7 +10,7 @@ import styles from '../styles.scss';
const SelectionCell: React.FC<CellProps<Track> & UseRowSelectRowProps<Track>> = ({
cell,
row
}) => <td {...cell.getCellProps()} className={cx(styles.select_cell, styles.narrow)}>
}) => <td {...cell.getCellProps() as TdHTMLAttributes<HTMLTableCellElement>} className={cx(styles.select_cell, styles.narrow)}>
{/* @ts-ignore */}
<Checkbox {...row.getToggleRowSelectedProps()}/>
</td>;
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/lib/components/TrackTable/Cells/ThumbnailCell.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { TdHTMLAttributes } from 'react';
import cx from 'classnames';
import { CellProps } from 'react-table';

Expand All @@ -14,7 +14,7 @@ export type ThumbnailCellClassnames = {
const ThumbnailCell: (classnames?: ThumbnailCellClassnames) => React.FC<CellProps<Track>> = (classnames = styles) => ({
cell,
value
}) => <td {...cell.getCellProps()} className={cx(classnames.thumbnail_cell, classnames.narrow)}>
}) => <td {...cell.getCellProps() as TdHTMLAttributes<HTMLTableCellElement>} className={cx(classnames.thumbnail_cell, classnames.narrow)}>
<img className={classnames.thumbnail} src={value} />
</td>;

Expand Down
4 changes: 2 additions & 2 deletions packages/ui/lib/components/TrackTable/Cells/TitleCell.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { TdHTMLAttributes } from 'react';
import { CellProps } from 'react-table';

import { Button, TrackPopup } from '../../..';
Expand All @@ -19,7 +19,7 @@ const TitleCell: React.FC<CellProps<Track> & TrackTableExtraProps> = ({
onAddToDownloads,
playlists,
popupActionStrings
}) => <td {...cell.getCellProps()} className={styles.title_cell}>
}) => <td {...cell.getCellProps() as TdHTMLAttributes<HTMLTableCellElement>} className={styles.title_cell}>
<span className={styles.title_cell_content}>
<span className={styles.title_cell_value}>
{value}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from 'react';
import React, { TdHTMLAttributes } from 'react';
import { CellProps } from 'react-table';

import { Track } from '../../../types';

const TrackTableCell: React.FC<CellProps<Track>> = ({
cell,
value
}) => <td {...cell.getCellProps()}>
}) => <td {...cell.getCellProps() as TdHTMLAttributes<HTMLTableCellElement>}>
{value}
</td>;

Expand Down
13 changes: 7 additions & 6 deletions packages/ui/lib/components/TrackTable/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable react/jsx-key */
import React, { useMemo } from 'react';
import React, { TableHTMLAttributes, useMemo } from 'react';
import cx from 'classnames';
import { useTable, Column, useRowSelect } from 'react-table';
import _, { isNumber, isString } from 'lodash';
Expand All @@ -19,6 +19,7 @@ import styles from './styles.scss';
import artPlaceholder from '../../../resources/media/art_placeholder.png';
import { Track } from '../../types';
import { formatDuration } from '../..';
import { ThHTMLAttributes } from 'react';

export type TrackTableProps = TrackTableExtraProps &
TrackTableHeaders &
Expand Down Expand Up @@ -129,14 +130,14 @@ const TrackTable: React.FC<TrackTableProps> = ({
prepareRow
} = table;

return <table {...getTableProps()} className={styles.track_table}>
return <table {...getTableProps() as TableHTMLAttributes<HTMLTableElement>} className={styles.track_table}>
<thead>
{
headerGroups.map(headerGroup => (
<tr {...headerGroup.getHeaderGroupProps()}>
<tr {...headerGroup.getHeaderGroupProps() as TableHTMLAttributes<HTMLTableRowElement>}>
{
headerGroup.headers.map(column => (
<th {...column.getHeaderProps()}>
<th {...column.getHeaderProps() as ThHTMLAttributes<HTMLTableCellElement>}>
{column.render('Header', extraProps)}
</th>
))
Expand All @@ -151,7 +152,7 @@ const TrackTable: React.FC<TrackTableProps> = ({

<tbody
ref={provided.innerRef}
{...getTableBodyProps()}
{...getTableBodyProps() as TableHTMLAttributes<HTMLTableSectionElement>}
{...provided.droppableProps}
>
{
Expand All @@ -168,7 +169,7 @@ const TrackTable: React.FC<TrackTableProps> = ({
<tr
ref={provided.innerRef}
className={cx({ [styles.is_dragging]: snapshot.isDragging })}
{...row.getRowProps()}
{...row.getRowProps() as TableHTMLAttributes<HTMLTableRowElement>}
{...provided.draggableProps}
{...provided.dragHandleProps}
>
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/lib/components/TrackTable/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export type TrackTableExtraProps = {
onAddToQueue?: (track: Track) => void;
onAddToFavorites?: (track: Track) => void;
onRemoveFromFavorites?: (track: Track) => void;
onAddToPlaylist?: (track: Track, { name: string }) => void;
onAddToPlaylist?: (track: Track, { name }: { name: string }) => void;
onAddToDownloads?: (track: Track) => void;
onDelete?: (track: Track, idx: number) => void;
playlists?: Array<{
Expand Down
14 changes: 8 additions & 6 deletions packages/ui/lib/components/VisualizerOverlay/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import styles from './styles.scss';
export type VisualizerOverlayProps = {
presets: string[];
selectedPreset: string;
onPresetChange: (e: SyntheticEvent, { value: string }) => void;
onPresetChange: (e: SyntheticEvent, { value }: { value: string }) => void;
onEnterFullscreen: React.MouseEventHandler;
exitFullscreenLabel?: string;
isFullscreen?: boolean;
Expand Down Expand Up @@ -37,11 +37,13 @@ const VisualizerOverlay: React.FC<VisualizerOverlayProps> = ({
{
isFullscreen
? <p>{exitFullscreenLabel}</p>
: <Button
basic
icon='expand'
onClick={onEnterFullscreen}
/>
: (
<Button
basic
icon='expand'
onClick={onEnterFullscreen}
/>
)
}
</div>;
};
Expand Down

0 comments on commit 00bf008

Please sign in to comment.