Skip to content
This repository was archived by the owner on Nov 15, 2022. It is now read-only.

Commit 6567d8a

Browse files
committed
Fix warnings/errors
1 parent 0175c02 commit 6567d8a

File tree

7 files changed

+18
-16
lines changed

7 files changed

+18
-16
lines changed

src/clients/TwitchClientImpl.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import $ from 'jquery';
55

66
class TwitchClientImpl implements Twitch.Client {
77

8-
const baseRequest = {
8+
baseRequest = {
99
type: 'GET',
1010
dataType: 'json',
1111
beforeSend: function (xhr: JQuery.jqXHR<any>) {

src/components/App.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ import SearchBar from '../components/SearchBar'
77
import NavBar from '../components/NavBar'
88
import TabsContainer from '../components/TabsContainer'
99

10-
type AppState = {
10+
export type AppState = {
1111
activeTab?: string;
1212
user?: AppUser;
13+
videoid: number
1314
}
1415

1516
class App extends React.Component<{}, AppState> {
@@ -74,7 +75,6 @@ class App extends React.Component<{}, AppState> {
7475

7576

7677
render() {
77-
const user = this.state.user
7878
const loadUser = this.loadUser.bind(this)
7979
const videoClick = this.videoClick.bind(this)
8080
const headerClick = this.clickNavHeader.bind(this)

src/components/ClipsTab.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ type ClipsTabState = {
1919
class ClipsTab extends React.Component<ClipsTabProps, ClipsTabState> {
2020
twitchClient: Twitch.Client = TwitchClientFactory.getInstance();
2121

22-
loadClips(user: string) {
22+
loadClips(user: AppUser) {
2323
const callback = this.getClipsCallback.bind(this);
2424
this.twitchClient.getClips(user.id, callback);
2525
}
@@ -81,7 +81,6 @@ class ClipsTab extends React.Component<ClipsTabProps, ClipsTabState> {
8181
</div>
8282
)
8383
} else {
84-
const className = "tab" + (isActive ? " active" : "");
8584
const clipList = !clips ? "" : clips.map((clip: AppClip) =>
8685
<a data-id={clip.id} key={clip.id} className="clip" onClick={clipClick}>
8786
<img src={clip.thumbnail_url}/>

src/components/NavBar.tsx

+9-6
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import React from 'react';
22

33
import '../css/NavBar.css'
44

5-
import {AppState} from '../components/App'
65
import NavHeader from '../components/NavHeader'
6+
import type {AppState} from '../components/App'
77

88
type NavBarProps = {
99
headerClick: () => (event: React.MouseEvent<any, any>) => void;
@@ -19,31 +19,34 @@ class NavBar extends React.Component<NavBarProps, AppState> {
1919
const isClipsActive = activeTab === 'clips'
2020

2121
const className = user === null ? "hidden": ""
22-
const innerHTML = user === null ? "" :
23-
<div id="profile" key={user.id}>
22+
const userProfileDiv = user === null ? "" : (
23+
<div id="profile" key={user.id}>
2424
<img className="profileImage" src={user.profile_image_url}></img>
2525
<span>{user.display_name}</span>
2626
</div>
27+
)
28+
const navHeaderDiv = user === null ? "" :
2729
<div>
2830
<ul>
2931
<NavHeader isActive={isStreamActive} text="Stream" onClick={headerClick}/>
3032
<NavHeader isActive={isVideosActive} text="Videos" onClick={headerClick}/>
3133
<NavHeader isActive={isClipsActive} text="Clips" onClick={headerClick}/>
3234
</ul>
3335
</div>
34-
3536

3637
return (
3738
<div id="channelNavBar" className={className}>
38-
{innerHTML}
39+
{userProfileDiv}
40+
{navHeaderDiv}
3941
</div>
4042
)
4143
}
4244
}
4345

4446
NavBar.prototype.state = {
4547
activeTab: null,
46-
user: null
48+
user: null,
49+
videoid: null
4750
}
4851

4952
export default NavBar;

src/components/SearchBar.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import $ from 'jquery'
55
import '../css/SearchBar.css'
66

77
type SearchBarProps = {
8-
loadUser: () => (channel: string) => void
8+
loadUser: (channel: string) => void
99
}
1010

1111
class SearchBar extends React.Component<SearchBarProps, {}> {

src/components/TabsContainer.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ type TabsContainerState = {
1919
videoid: number
2020
}
2121

22-
class TabsContainer extends React.Component<{}, TabsContainerState> {
22+
class TabsContainer extends React.Component<TabsContainerProps, TabsContainerState> {
2323
streamTab: StreamTab
2424
videosTab: VideosTab
2525
clipsTab: ClipsTab

src/components/VideosTab.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ type VideosTabState = {
1515
}
1616

1717
class VideosTab extends React.Component<VideosTabProps, VideosTabState> {
18-
twitchClient: TwitchClient = TwitchClientFactory.getInstance()
18+
twitchClient: Twitch.Client = TwitchClientFactory.getInstance()
1919

2020
loadVideos(user: AppUser) {
2121
const callback = this.getVideosCallback.bind(this);
2222
this.twitchClient.getVideos(user.id, callback);
2323
}
2424

2525
getVideosCallback(getVideosResponse: Twitch.VideosResponse) {
26-
const twitchVideos: TwitchVideo[] = getVideosResponse.data
26+
const twitchVideos: Twitch.Video[] = getVideosResponse.data
2727
const videos: AppVideo[] = [];
28-
twitchVideos.forEach(function(twitchVideo: TwitchVideo) {
28+
twitchVideos.forEach(function(twitchVideo: Twitch.Video) {
2929
const now = new Date();
3030
const thumbnail_url= twitchVideo.thumbnail_url.replace("%{width}", "304").replace("%{height}", "171");
3131
const published_date = new Date(twitchVideo.published_at);

0 commit comments

Comments
 (0)