mirror of
https://github.com/mgerb/go-discord-bot
synced 2026-01-12 01:52:49 +00:00
typescript conversion
This commit is contained in:
@@ -3,9 +3,23 @@ import axios from 'axios';
|
||||
|
||||
import './Downloader.scss';
|
||||
|
||||
export default class Downloader extends React.Component {
|
||||
interface Props {
|
||||
|
||||
constructor(props) {
|
||||
}
|
||||
|
||||
interface State {
|
||||
fileType: string;
|
||||
url: string;
|
||||
message: string;
|
||||
downloadLink: string;
|
||||
downLoadFileName: string;
|
||||
dataLoading: boolean;
|
||||
dataLoaded: boolean;
|
||||
}
|
||||
|
||||
export class Downloader extends React.Component<Props, State> {
|
||||
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
fileType: "mp3",
|
||||
@@ -2,7 +2,16 @@ import React from 'react';
|
||||
|
||||
import './Home.scss';
|
||||
|
||||
export default class Home extends React.Component {
|
||||
interface Props {
|
||||
|
||||
}
|
||||
|
||||
interface State {
|
||||
|
||||
}
|
||||
|
||||
export class Home extends React.Component<Props, State> {
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div className="Home">
|
||||
@@ -1,7 +1,15 @@
|
||||
import React from 'react';
|
||||
import './NotFound.scss';
|
||||
|
||||
export default class Default extends React.Component {
|
||||
interface Props {
|
||||
|
||||
}
|
||||
|
||||
interface State {
|
||||
|
||||
}
|
||||
|
||||
export class NotFound extends React.Component<Props, State> {
|
||||
render() {
|
||||
return (
|
||||
<div className="NotFound">
|
||||
10
client/app/pages/Pubg/Pubg.tsx
Normal file
10
client/app/pages/Pubg/Pubg.tsx
Normal file
@@ -0,0 +1,10 @@
|
||||
import React from 'react';
|
||||
|
||||
export class Pubg extends React.Component<any, any> {
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div>test 123</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,23 @@ import axios from 'axios';
|
||||
|
||||
import './SoundList.scss';
|
||||
|
||||
export default class SoundList extends React.Component {
|
||||
interface Props {
|
||||
|
||||
}
|
||||
|
||||
interface State {
|
||||
showAudioControls: boolean[];
|
||||
soundList: {
|
||||
extension: string;
|
||||
name: string;
|
||||
prefix: string;
|
||||
}[];
|
||||
}
|
||||
|
||||
export class SoundList extends React.Component<Props, State> {
|
||||
|
||||
private soundListCache: any;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.state = {
|
||||
@@ -34,7 +49,7 @@ export default class SoundList extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
checkExtension(extension) {
|
||||
checkExtension(extension: string) {
|
||||
switch(extension) {
|
||||
case "wav":
|
||||
return true;
|
||||
@@ -47,7 +62,7 @@ export default class SoundList extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
handleShowAudio(index) {
|
||||
handleShowAudio(index: any) {
|
||||
let temp = this.state.showAudioControls;
|
||||
temp[index] = true;
|
||||
|
||||
@@ -77,7 +92,7 @@ export default class SoundList extends React.Component {
|
||||
|
||||
{this.checkExtension(sound.extension) && this.state.showAudioControls[index] ?
|
||||
<audio controls src={"/public/sounds/" + sound.name + "." + sound.extension}
|
||||
type={"audio/" + sound.extension}
|
||||
itemType={"audio/" + sound.extension}
|
||||
style={{width: "100px"}}/>
|
||||
: <i className="fa fa-play link" aria-hidden="true" onClick={() => this.handleShowAudio(index)}/> }
|
||||
</div>
|
||||
@@ -1,15 +1,29 @@
|
||||
import React from 'react';
|
||||
import Dropzone from 'react-dropzone';
|
||||
import axios from 'axios';
|
||||
import axios, { AxiosRequestConfig } from 'axios';
|
||||
|
||||
import SoundList from './SoundList.component';
|
||||
import { SoundList } from './SoundList.component';
|
||||
|
||||
import './Soundboard.scss';
|
||||
|
||||
let self;
|
||||
let self: any;
|
||||
|
||||
export default class Soundboard extends React.Component {
|
||||
interface Props {
|
||||
|
||||
}
|
||||
|
||||
interface State {
|
||||
percentCompleted: number;
|
||||
password: string;
|
||||
uploaded: boolean;
|
||||
uploadError: string;
|
||||
}
|
||||
|
||||
export class Soundboard extends React.Component<Props, State> {
|
||||
|
||||
private config: AxiosRequestConfig;
|
||||
public refs: any;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.state = {
|
||||
@@ -35,13 +49,13 @@ export default class Soundboard extends React.Component {
|
||||
};
|
||||
}
|
||||
|
||||
onDrop(acceptedFiles) {
|
||||
onDrop(acceptedFiles: any) {
|
||||
if (acceptedFiles.length > 0) {
|
||||
self.uploadFile(acceptedFiles[0]);
|
||||
}
|
||||
}
|
||||
|
||||
uploadFile(file) {
|
||||
uploadFile(file: any) {
|
||||
let formData = new FormData();
|
||||
formData.append("name", file.name);
|
||||
formData.append("file", file);
|
||||
@@ -68,7 +82,7 @@ export default class Soundboard extends React.Component {
|
||||
});
|
||||
}
|
||||
|
||||
passwordOnChange(event) {
|
||||
passwordOnChange(event: any) {
|
||||
this.setState({
|
||||
password: event.target.value,
|
||||
});
|
||||
Reference in New Issue
Block a user