Partial lint fix (#89)
This commit is contained in:
Generated
+7
-12
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "beatconnect_client",
|
||||
"version": "0.2.0",
|
||||
"version": "0.2.1",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@@ -6963,10 +6963,9 @@
|
||||
"integrity": "sha512-d4sze1JNC454Wdo2fkuyzCr6aHcbL6PGGuFAz0Li/NcOm1tCHGnWDRmJP85dh9IhQErTc2svWFEX5xHIOo//kQ=="
|
||||
},
|
||||
"handlebars": {
|
||||
"version": "4.5.1",
|
||||
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.5.1.tgz",
|
||||
"integrity": "sha512-C29UoFzHe9yM61lOsIlCE5/mQVGrnIOrOq7maQl76L7tYPCgC1og0Ajt6uWnX4ZTxBPnjw+CUvawphwCfJgUnA==",
|
||||
"dev": true,
|
||||
"version": "4.5.2",
|
||||
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.5.2.tgz",
|
||||
"integrity": "sha512-29Zxv/cynYB7mkT1rVWQnV7mGX6v7H/miQ6dbEpYTKq5eJBN7PsRB+ViYJlcT6JINTSu4dVB9kOqEun78h6Exg==",
|
||||
"requires": {
|
||||
"neo-async": "^2.6.0",
|
||||
"optimist": "^0.6.1",
|
||||
@@ -6977,8 +6976,7 @@
|
||||
"source-map": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
|
||||
"dev": true
|
||||
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -10172,7 +10170,6 @@
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz",
|
||||
"integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"minimist": "~0.0.1",
|
||||
"wordwrap": "~0.0.2"
|
||||
@@ -10181,14 +10178,12 @@
|
||||
"minimist": {
|
||||
"version": "0.0.10",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz",
|
||||
"integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=",
|
||||
"dev": true
|
||||
"integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8="
|
||||
},
|
||||
"wordwrap": {
|
||||
"version": "0.0.3",
|
||||
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz",
|
||||
"integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=",
|
||||
"dev": true
|
||||
"integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc="
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -10,6 +10,7 @@ const defaultProps = {
|
||||
minWidth: 890,
|
||||
show: false,
|
||||
darkTheme: true,
|
||||
// eslint-disable-next-line no-unneeded-ternary
|
||||
frame: process.env.ELECTRON_START_URL ? true : false,
|
||||
};
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ autoUpdater.on('update-not-available', () => {
|
||||
});
|
||||
|
||||
DownloadManager.register({
|
||||
downloadFolder: app.getPath('downloads') + '/beatconnect',
|
||||
downloadFolder: `${app.getPath('downloads')}/beatconnect`,
|
||||
});
|
||||
|
||||
const main = () => {
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
/* eslint-disable prefer-destructuring */
|
||||
/* eslint-disable no-console */
|
||||
module.exports = src => {
|
||||
src = src.trim();
|
||||
const lines = src.substr(src.indexOf('\n')).split('\n');
|
||||
const lines = src
|
||||
.trim()
|
||||
.substr(src.indexOf('\n'))
|
||||
.split('\n');
|
||||
let category = null;
|
||||
const data = {};
|
||||
|
||||
for (let i = 0; i < lines.length; ++i) {
|
||||
try {
|
||||
lines[i] = lines[i].trim();
|
||||
// eslint-disable-next-line no-continue
|
||||
if (lines[i] === '' || lines[i].indexOf('//') === 0) continue;
|
||||
|
||||
const categoryMatch = lines[i].match(/^\[(.*)\]$/);
|
||||
@@ -17,7 +22,7 @@ module.exports = src => {
|
||||
else data[category] = {};
|
||||
} else if (category === 'Events' || category === 'TimingPoints' || category === 'HitObjects') {
|
||||
if (category === 'Events' && (lines[i][0] === '_' || lines[i][0] === ' '))
|
||||
data[category][data.data[category].length - 1] += ',' + lines[i].substr(1);
|
||||
data[category][data.data[category].length - 1] += `,${lines[i].substr(1)}`;
|
||||
else data[category].push(lines[i].split(','));
|
||||
} else {
|
||||
const lineMatch = lines[i].match(/^(\S*?)\s*:\s*(.*)$/);
|
||||
|
||||
@@ -21,9 +21,9 @@ const osuSongsScan = songsDirectoryPath =>
|
||||
if (isDirExists) {
|
||||
const date = dirStats.mtimeMs;
|
||||
const assets = fs.readdirSync(beatmapPath);
|
||||
for (let i = 0; i < assets.length; i++) {
|
||||
if (assets[i].split('.').pop() === 'osu') {
|
||||
const data = fs.readFileSync(path.join(beatmapPath, assets[i]), 'utf8');
|
||||
for (let j = 0; j < assets.length; j++) {
|
||||
if (assets[j].split('.').pop() === 'osu') {
|
||||
const data = fs.readFileSync(path.join(beatmapPath, assets[j]), 'utf8');
|
||||
const { Metadata } = parser(data);
|
||||
if (!(typeof Metadata === 'undefined')) {
|
||||
const { BeatmapSetID, Title, Artist } = Metadata;
|
||||
|
||||
@@ -128,9 +128,9 @@ function readOsuDB(path) {
|
||||
for (let j = 0; j < 4; j++) {
|
||||
const unknownNumCount = buf.readInt32LE((offset += 4) - 4);
|
||||
for (let k = 0; k < unknownNumCount; k++) {
|
||||
if (buf[offset++] != 0x08) return reject(new Error('Invalid beatmap!'));
|
||||
if (buf[offset++] !== 0x08) return reject(new Error('Invalid beatmap!'));
|
||||
buf.readInt32LE((offset += 4) - 4);
|
||||
if (buf[offset++] != 0x0d) return reject(new Error('Invalid beatmap!'));
|
||||
if (buf[offset++] !== 0x0d) return reject(new Error('Invalid beatmap!'));
|
||||
buf.readDoubleLE((offset += 8) - 8);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,26 +84,6 @@ const Search = ({ classes, theme, lastSearch, isBusy, beatmapCount, skeletonBeat
|
||||
onBlur={() => execSearch()}
|
||||
/>
|
||||
<div className={classes.right} />
|
||||
{/* Advanced search panel WIP}
|
||||
{/* <ToggleContent
|
||||
toggle={(isShown, setIsShown) => (
|
||||
<div
|
||||
title='Advanced filters'
|
||||
style={{ margin: 'auto 15px' }}
|
||||
onClick={() => setIsShown(!isShown)}
|
||||
>
|
||||
{renderIcons('Filter', theme.style, isShown ? theme.palette.primary.accent : null)}
|
||||
</div>
|
||||
)}
|
||||
content={hide => (
|
||||
<Modal
|
||||
close={hide}
|
||||
>
|
||||
There is no spoon...
|
||||
<button onClick={hide}>Close</button>
|
||||
</Modal>
|
||||
)}
|
||||
/> */}
|
||||
<div
|
||||
className={classes.hideDownloaded}
|
||||
onClick={() => setSearch({ ...search, hideDownloaded: !search.hideDownloaded })}
|
||||
@@ -113,10 +93,6 @@ const Search = ({ classes, theme, lastSearch, isBusy, beatmapCount, skeletonBeat
|
||||
>
|
||||
{renderIcons('Verified', theme.style, search.hideDownloaded ? theme.palette.primary.accent : null)}
|
||||
</div>
|
||||
{/* <Toggle
|
||||
checked={search.hideDownloaded}
|
||||
onChange={e => setSearch({ ...search, hideDownloaded: e.target.checked })}
|
||||
/> */}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/* eslint-disable no-console */
|
||||
/* eslint-disable camelcase */
|
||||
import _ from 'underscore';
|
||||
import config from '../../../config';
|
||||
import store from '../../../store';
|
||||
@@ -5,8 +7,8 @@ import store from '../../../store';
|
||||
const askBeatconnect = (search, __, resetPage) => {
|
||||
const controller = new AbortController();
|
||||
let lastPage;
|
||||
const { query, status, mode, hideDownloaded } = search;
|
||||
let { page, lastScroll } = search;
|
||||
const { page, query, status, mode, hideDownloaded } = search;
|
||||
let { lastScroll } = search;
|
||||
if (resetPage && !page) lastScroll = 0;
|
||||
else lastScroll = undefined;
|
||||
const { searchResults, fetchingBeatmaps } = store.getState().main;
|
||||
@@ -21,7 +23,7 @@ const askBeatconnect = (search, __, resetPage) => {
|
||||
})
|
||||
.then(res => res.ok && res.json())
|
||||
.then(({ beatmaps, max_page, error, error_message }) => {
|
||||
if (error) throw new Error(error_message + ' For query ' + search);
|
||||
if (error) throw new Error(`${error_message} For query ${search}`);
|
||||
if (beatmaps.length === 0) lastPage = true;
|
||||
if (page > 0) beatmaps = _.union(prevBeatmaps, beatmaps);
|
||||
store.dispatch({ type: 'FETCHINGBEATMAPS', payload: { isFetching: false } });
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable camelcase */
|
||||
import React, { useEffect, useContext, memo, useState, useRef } from 'react';
|
||||
import _ from 'underscore';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import React from 'react';
|
||||
import start from '../../../Bot';
|
||||
import { connect } from 'react-redux';
|
||||
import Toggle from '../common/Toggle';
|
||||
import injectSheet from 'react-jss';
|
||||
import start from '../../../Bot';
|
||||
import Toggle from '../common/Toggle';
|
||||
|
||||
const styles = {
|
||||
Start: {
|
||||
@@ -14,18 +14,12 @@ const styles = {
|
||||
},
|
||||
};
|
||||
|
||||
const Start = ({ classes, connected, theme, irc, osuApi }) => {
|
||||
const Start = ({ classes, connected, irc, osuApi }) => {
|
||||
const notReady = !osuApi || !irc.username || !irc.password;
|
||||
|
||||
return (
|
||||
<div className={classes.Start}>
|
||||
<Toggle
|
||||
disabled={notReady}
|
||||
checked={connected}
|
||||
onChange={start}
|
||||
background={'#505050'}
|
||||
margin={'auto 10px auto 0'}
|
||||
/>
|
||||
<Toggle disabled={notReady} checked={connected} onChange={start} background="#505050" margin="auto 10px auto 0" />
|
||||
|
||||
<p>{connected ? (connected === 'connecting' ? 'Connecting to Bancho via IRC..' : 'Online') : 'Offline'}</p>
|
||||
{notReady ? (
|
||||
|
||||
@@ -7,19 +7,16 @@ const Cover = ({ url, width, height, paddingBottom, noFade }) => {
|
||||
cover.onload = () => isLoaded(url);
|
||||
|
||||
useEffect(() => {
|
||||
// isLoaded(false)
|
||||
if (loaded !== url) cover.setAttribute('src', url);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [url, loaded]);
|
||||
|
||||
const style = {
|
||||
opacity: noFade ? 1 : loaded ? 1 : 0,
|
||||
filter: noFade ? '' : `blur(${loaded ? 0 + 'px' : 10 + 'px'})`,
|
||||
filter: noFade ? '' : `blur(${loaded ? 0 : 10}px)`,
|
||||
transition: `all ${config.display.defaultTransitionDuration}`,
|
||||
width: width || '100%',
|
||||
height: height || null,
|
||||
paddingBottom: paddingBottom ? '15%' : 0,
|
||||
// margin: 'auto 0 auto 10px',
|
||||
backgroundPosition: 'center center',
|
||||
backgroundRepeat: 'no-repeat',
|
||||
backgroundSize: 'cover',
|
||||
|
||||
@@ -42,6 +42,7 @@ const DownloadBeatmapBtn = ({ classes, url, infos, autoDl, noStyle, pack, classN
|
||||
if (pack) {
|
||||
const beatmapsToDownload = pack.filter(beatmap => !history.contains(beatmap.id));
|
||||
pushMany(
|
||||
// eslint-disable-next-line camelcase
|
||||
beatmapsToDownload.map(({ unique_id, id, title, artist }) => ({
|
||||
url: `https://beatconnect.io/b/${id}/${unique_id}`,
|
||||
id,
|
||||
|
||||
@@ -63,7 +63,7 @@ const styles = {
|
||||
|
||||
const Tab = ({ classes, icon, title, onSelect }) => {
|
||||
return (
|
||||
<a data-radium="true" className={classes.a} onClick={onSelect}>
|
||||
<a data-radium="true" className={classes.a} onClick={onSelect} role="tab">
|
||||
<span className={`${classes.tooltiptext} tooltiptext`}>{title}</span>
|
||||
<span data-radium="true" className={classes.span}>
|
||||
<div className={`${classes.indicator} indicator`} />
|
||||
|
||||
@@ -131,7 +131,7 @@ const TasksControl = ({ classes, onSelect, theme }) => {
|
||||
data-radium="true"
|
||||
className={classes.a}
|
||||
onClick={onSelect}
|
||||
role="button"
|
||||
role="tab"
|
||||
style={{ visibility: active ? 'visible' : 'hidden' }}
|
||||
>
|
||||
<span className={`${classes.tooltiptext} tooltiptext`}>{renderContent()}</span>
|
||||
|
||||
@@ -82,7 +82,7 @@ const VolumeControl = ({ classes, onSelect, theme }) => {
|
||||
return renderIcons('VolumeHigh', theme.style);
|
||||
};
|
||||
return (
|
||||
<a data-radium="true" className={classes.a} onClick={onSelect}>
|
||||
<a data-radium="true" className={classes.a} onClick={onSelect} role="tab">
|
||||
<span className={`${classes.tooltiptext} tooltiptext`}>
|
||||
<Volume onChange={setVolumeValue} />
|
||||
</span>
|
||||
|
||||
Reference in New Issue
Block a user