Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move components to TS #2 #438

Merged
merged 59 commits into from
Aug 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
487fc5c
Move loaders to TS
raphaelvigee Aug 4, 2019
5a9f607
Move VolumeControl to TS
raphaelvigee Aug 4, 2019
d65c2a5
Move player to TS
raphaelvigee Aug 5, 2019
90ccca4
Move Translations to TS
raphaelvigee Aug 5, 2019
808a787
Move tabs to TS
raphaelvigee Aug 5, 2019
f00c1b8
Move Splashscreen to TS
raphaelvigee Aug 5, 2019
88c6436
Move TrackContextMenu to TS
raphaelvigee Aug 5, 2019
bcae48e
Move ItemList to TS
raphaelvigee Aug 5, 2019
9f3f6f7
Move AlbumItem to TS
raphaelvigee Aug 5, 2019
ccc7641
Move lbumContextMenu to TS
raphaelvigee Aug 5, 2019
f3d7362
Move AlbumPanel to TS
raphaelvigee Aug 5, 2019
b6ac786
Move NavigationBar to TS
raphaelvigee Aug 5, 2019
0034e4c
Move Rating to TS
raphaelvigee Aug 5, 2019
6b0a403
Move TopCharts to TS
raphaelvigee Aug 5, 2019
4965f82
Move MenuItem to TS
raphaelvigee Aug 5, 2019
d584946
Move PlaylistContextMenu to TS
raphaelvigee Aug 5, 2019
39656f8
Move contextmenu & tracklistitem to TS
raphaelvigee Aug 5, 2019
aabf253
Move artistItem to TS
raphaelvigee Aug 5, 2019
b12c052
Move resultItem to TS
raphaelvigee Aug 5, 2019
e776514
Move searchbar to TS
raphaelvigee Aug 6, 2019
97674d8
Move CuratorItem to TS
raphaelvigee Aug 7, 2019
9dbf731
Move ArtistAlbums to TS
raphaelvigee Aug 7, 2019
76de499
Move ArtistsList to TS
raphaelvigee Aug 9, 2019
4cb6727
Move GenteItem to TS
raphaelvigee Aug 9, 2019
c91a52a
Move PlaylistItem to TS
raphaelvigee Aug 9, 2019
eadddbc
Move some more stuff to TS
raphaelvigee Aug 10, 2019
40b6cb6
Move AuthorizeProvider to TS
raphaelvigee Aug 15, 2019
b38649a
Move SongsPage to TS
raphaelvigee Aug 15, 2019
eee86f6
Move Sidebar & PlaylistProvider to TS
raphaelvigee Aug 15, 2019
f51a031
Move SidebarMenu to TS
raphaelvigee Aug 15, 2019
a5c16f0
Move Lyrics & LyricsMOdal to TS
raphaelvigee Aug 15, 2019
f965717
Move MusicKitProvider to TS
raphaelvigee Aug 15, 2019
ea16072
Move PageContent to TS
raphaelvigee Aug 15, 2019
c737bcc
Move RadioPage to TS
raphaelvigee Aug 15, 2019
9d30793
Move PlaylistSelectcor to TS
raphaelvigee Aug 15, 2019
29c4260
Move PlaylistPanel to TS
raphaelvigee Aug 15, 2019
b19cc0a
Move PlaylistPage to TS
raphaelvigee Aug 15, 2019
1783ca5
Move PlaylistsPage to TS & fix HOCs
raphaelvigee Aug 15, 2019
d350481
Move SentryBoundary to TS
raphaelvigee Aug 15, 2019
d65d1ab
Move GAProvider to TS
raphaelvigee Aug 15, 2019
8df1db1
Move LastfmProvider to TS
raphaelvigee Aug 15, 2019
46de869
Move Genres to TS
raphaelvigee Aug 15, 2019
cac7a48
Move GenrePage to TS
raphaelvigee Aug 15, 2019
ac2f5bf
Move ForYouPage to TS
raphaelvigee Aug 15, 2019
f96f026
Move BrowsePage to TS
raphaelvigee Aug 15, 2019
74efeab
Move AuthorizeButton to TS
raphaelvigee Aug 15, 2019
30f70ff
Move ArtistPage to TS
raphaelvigee Aug 15, 2019
def85d5
Move ArtistsPage to TS
raphaelvigee Aug 15, 2019
1b8a61e
Move AlbumsPage to TS
raphaelvigee Aug 15, 2019
ba07836
Move Settings to TS
raphaelvigee Aug 15, 2019
b204275
Move SearchPage to TS
raphaelvigee Aug 15, 2019
48d4fd3
Move RecentlyAdded to TS
raphaelvigee Aug 15, 2019
e87de68
Move Layout to TS
raphaelvigee Aug 15, 2019
eb3b350
MOve App to TS
raphaelvigee Aug 15, 2019
ff155f9
Move index to TS
raphaelvigee Aug 15, 2019
13ae907
Move AlbumPage to TS
raphaelvigee Aug 15, 2019
8194e52
Move remainig js to ts & disallow js
raphaelvigee Aug 15, 2019
8a3eaf4
Disable Interface starting with capitalized I
raphaelvigee Aug 16, 2019
10c8d8b
Prevent type copy/paste
raphaelvigee Aug 21, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,18 @@
"@sentry/browser": "^4.6.6",
"@symfony/webpack-encore": "^0.27.0",
"@types/classnames": "^2.2.7",
"@types/hoist-non-react-statics": "^3.3.1",
"@types/js-md5": "^0.4.2",
"@types/lodash": "^4.14.136",
"@types/mousetrap": "^1.6.3",
"@types/prop-types": "^15.7.1",
"@types/qs": "^6.5.3",
"@types/react": "^16.8.18",
"@types/react-dom": "^16.8.4",
"@types/react-router-dom": "^4.3.4",
"@types/react-s-alert": "^1.3.2",
"@types/react-virtualized": "^9.21.1",
"@types/webpack-env": "^1.14.0",
"axios": "^0.18.0",
"classnames": "^2.2.6",
"concurrently": "^4.1.0",
Expand Down
53 changes: 28 additions & 25 deletions src/app/components/App.jsx → src/app/components/App.tsx
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
import React, { useEffect } from 'react';
import { BrowserRouter as Router, Redirect, Route, Switch } from 'react-router-dom';
import HTML5Backend from 'react-dnd-html5-backend';
import { DragDropContext } from 'react-dnd';
import HTML5Backend from 'react-dnd-html5-backend';
import { RouteComponentProps } from 'react-router';
import { BrowserRouter as Router, Redirect, Route, Switch } from 'react-router-dom';
import Alert from 'react-s-alert';
import MusicKitProvider from './Providers/MusicKitProvider';
import AuthorizeProvider from './Providers/AuthorizeProvider';
import AlbumsPage from './Routes/Library/Albums/AlbumsPage';
import Layout from './Layout';
import ArtistPage from './Routes/Catalog/Artist/ArtistPage';
import ArtistsPage from './Routes/Library/Artists/ArtistsPage';
import PlaylistPage from './Routes/Playlist/PlaylistPage';
import SongsPage from './Routes/Library/Songs/SongsPage';
import PlaylistsPage from './Routes/Library/Playlists/PlaylistsPage';
import RecentlyAddedPage from './Routes/Library/RecentlyAdded/RecentlyAddedPage';
import ForYouPage from './Routes/Catalog/ForYou/ForYouPage';
import BrowsePage from './Routes/Catalog/Browse/BrowsePage';
import GenrePage from './Routes/Catalog/Browse/Genres/Genre/GenrePage';
import RadioPage from './Routes/Catalog/Radio/RadioPage';
import ConnectedMenu from './Common/ContextMenu/ContextMenu';
import LyricsModal from './Common/Player/Lyrics/LyricsModal';
import SearchPage from './Routes/Search/SearchPage';
import Layout from './Layout';
import AuthorizeProvider from './Providers/AuthorizeProvider';
import GoogleAnalyticsProvider from './Providers/GoogleAnalyticsProvider';
import SentryBoundary from './Providers/SentryBoundary';
import LastfmProvider from './Providers/LastfmProvider';
import ModalProvider, { ModalRenderer } from './Providers/ModalProvider';
import LyricsModalProvider from './Providers/LyricsModalProvider';
import QueueModalProvider from './Providers/QueueProvider';
import ModalProvider, { ModalRenderer } from './Providers/ModalProvider';
import MusicKitProvider from './Providers/MusicKitProvider';
import PlaylistsProvider from './Providers/PlaylistsProvider';
import QueueModalProvider from './Providers/QueueProvider';
import SentryBoundary from './Providers/SentryBoundary';
import AlbumPage from './Routes/Album/AlbumPage';
import ArtistPage from './Routes/Catalog/Artist/ArtistPage';
import BrowsePage from './Routes/Catalog/Browse/BrowsePage';
import GenrePage from './Routes/Catalog/Browse/Genres/Genre/GenrePage';
import ForYouPage from './Routes/Catalog/ForYou/ForYouPage';
import RadioPage from './Routes/Catalog/Radio/RadioPage';
import AlbumsPage from './Routes/Library/Albums/AlbumsPage';
import ArtistsPage from './Routes/Library/Artists/ArtistsPage';
import PlaylistsPage from './Routes/Library/Playlists/PlaylistsPage';
import RecentlyAddedPage from './Routes/Library/RecentlyAdded/RecentlyAddedPage';
import SongsPage from './Routes/Library/Songs/SongsPage';
import PlaylistPage from './Routes/Playlist/PlaylistPage';
import SearchPage from './Routes/Search/SearchPage';

function App() {
useEffect(() => {
Expand Down Expand Up @@ -60,28 +61,28 @@ function App() {
<Route
path={'/playlist/:id'}
exact
component={props => (
component={(props: RouteComponentProps) => (
<PlaylistPage key={props.location.pathname} {...props} />
)}
/>
<Route
path={'/me/playlist/:id'}
exact
component={props => (
component={(props: RouteComponentProps) => (
<PlaylistPage key={props.location.pathname} {...props} />
)}
/>
<Route
path={'/album/:id'}
exact
component={props => (
component={(props: RouteComponentProps) => (
<AlbumPage key={props.location.pathname} {...props} />
)}
/>
<Route
path={'/me/album/:id'}
exact
component={props => (
component={(props: RouteComponentProps) => (
<AlbumPage key={props.location.pathname} {...props} />
)}
/>
Expand All @@ -99,7 +100,9 @@ function App() {
match: {
params: { source, query },
},
}) => <SearchPage key={`${source}${query}`} />}
}: RouteComponentProps<{ source: string; query: string }>) => (
<SearchPage key={`${source}${query}`} />
)}
/>
<Redirect to={'/'} />
</Switch>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,34 @@
import cx from 'classnames';
import React from 'react';

import PropTypes from 'prop-types';
import { ConnectDragSource, DragSource, DragSourceConnector, DragSourceMonitor } from 'react-dnd';
import { RouteComponentProps } from 'react-router';
import { withRouter } from 'react-router-dom';
import { DragSource } from 'react-dnd';
import cx from 'classnames';
import classes from './AlbumItem.scss';
import AlbumPanel from '../AlbumPanel/AlbumPanel';
import DragDropType from '../../../utils/Constants/DragDropType';
import { useModal } from '../../Providers/ModalProvider';
import AlbumPanel from '../AlbumPanel/AlbumPanel';
import ContextMenuTrigger from '../ContextMenu/ContextMenuTrigger';
import AlbumContextMenu from '../ContextMenu/Types/Album/AlbumContextMenu';
import { useModal } from '../../Providers/ModalProvider';
import classes from './AlbumItem.scss';

interface AlbumItemProps extends RouteComponentProps {
navigate?: boolean;
album?: any;
id?: any;
size: number;
connectDragSource: ConnectDragSource;
isOver?: boolean;
}

function AlbumItem(props) {
const AlbumItem: React.FC<AlbumItemProps> = (props: AlbumItemProps) => {
const { push: pushModal } = useModal();

function handleOpen(replace) {
function handleOpen() {
const id = props.id || props.album.id;

if (props.navigate) {
props.history.push(`/me/album/${id}`);
} else {
replace(<AlbumPanel key={id} id={id} pseudoRoute />);
pushModal(<AlbumPanel key={id} id={id} pseudoRoute />);
}
}

Expand All @@ -35,7 +43,7 @@ function AlbumItem(props) {

return connectDragSource(
<div className={cx(classes.container, { [classes.droppable]: isOver })} style={{ width: size }}>
<div onClick={() => handleOpen(pushModal)}>
<div onClick={handleOpen}>
<ContextMenuTrigger holdToDisplay={-1} render={() => <AlbumContextMenu album={album} />}>
<div className={classes.imageContainer} style={{ width: size, height: size }}>
<img
Expand All @@ -60,16 +68,6 @@ function AlbumItem(props) {
</div>
</div>,
);
}

AlbumItem.propTypes = {
navigate: PropTypes.bool,
history: PropTypes.any.isRequired,
album: PropTypes.any,
id: PropTypes.any,
size: PropTypes.number.isRequired,
connectDragSource: PropTypes.func.isRequired,
isOver: PropTypes.bool,
};

AlbumItem.defaultProps = {
Expand All @@ -80,14 +78,14 @@ AlbumItem.defaultProps = {
};

const dndSpec = {
beginDrag(props) {
beginDrag(props: AlbumItemProps) {
return {
album: props.id || props.album.id,
};
},
};

function dndCollect(connect, monitor) {
function dndCollect(connect: DragSourceConnector, monitor: DragSourceMonitor) {
return {
connectDragSource: connect.dragSource(),
isDragging: monitor.isDragging(),
Expand Down
Loading