From 79c841d9d89ca9174af7a0a58079dde6c7a655c7 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 5 Jul 2021 23:31:13 +0100 Subject: [PATCH] centered loading circle, pastel theme --- .vscode/launch.json | 12 ++++++++++++ src/js/Admin/Functions.js | 2 +- src/js/Maths/PieChart.js | 22 +++++++++++++++------- src/js/MusicTools.js | 17 ++++++----------- src/js/Playlist/New.js | 2 +- src/js/Playlist/PlaylistsList.js | 18 ++++++++++++------ src/js/Playlist/View/Edit.js | 15 ++++++++------- src/js/Settings/ChangePassword.js | 2 +- src/js/Settings/LastFM.js | 2 +- src/js/Settings/SpotifyLink.js | 4 ++-- src/js/Tag/TagList.js | 10 +++++----- src/js/Tag/View.js | 5 +++-- src/js/Theme.js | 13 +++++++++---- src/js/Util/circularProgress.js | 19 +++++++++++++++++++ 14 files changed, 95 insertions(+), 48 deletions(-) create mode 100644 src/js/Util/circularProgress.js diff --git a/.vscode/launch.json b/.vscode/launch.json index d384ab4..cbd20d3 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -19,6 +19,18 @@ "--no-debugger" ], "jinja": true + }, + { + "command": "npm run devbuild", + "name": "Js: Build Dev", + "request": "launch", + "type": "node-terminal" + }, + { + "command": "npm run build", + "name": "Js: Build Release", + "request": "launch", + "type": "node-terminal" } ] } \ No newline at end of file diff --git a/src/js/Admin/Functions.js b/src/js/Admin/Functions.js index f0c8611..0451fc1 100644 --- a/src/js/Admin/Functions.js +++ b/src/js/Admin/Functions.js @@ -54,7 +54,7 @@ class Functions extends Component { Admin Functions - + {/* RUN ALL PLAYLISTS BUTTON */} diff --git a/src/js/Maths/PieChart.js b/src/js/Maths/PieChart.js index 685848f..74c8bc9 100644 --- a/src/js/Maths/PieChart.js +++ b/src/js/Maths/PieChart.js @@ -3,13 +3,21 @@ import { Chart, ArcElement, DoughnutController, Legend, Title, Tooltip } from 'c Chart.register(ArcElement, DoughnutController, Legend, Title, Tooltip); -var pieColours = ['rgb(55, 61, 255)', //blue -'rgb(255, 55, 61)', //red -'rgb(7, 211, 4)', //green -'rgb(228, 242, 31)', //yellow -'rgb(31, 242, 221)', //light blue -'rgb(242, 31, 235)', //pink -'rgb(242, 164, 31)']; +// var pieColours = ['rgb(55, 61, 255)', //blue +// 'rgb(255, 55, 61)', //red +// 'rgb(7, 211, 4)', //green +// 'rgb(228, 242, 31)', //yellow +// 'rgb(31, 242, 221)', //light blue +// 'rgb(242, 31, 235)', //pink +// 'rgb(242, 164, 31)']; + +var pieColours = ['rgb(144, 127, 164)', + 'rgb(166, 214, 214)', + 'rgb(237, 237, 208)', + 'rgb(252, 209, 209)', + 'rgb(222, 137, 113)', + 'rgb(59, 83, 96)' +]; /** * Pie chart component using Chart.js diff --git a/src/js/MusicTools.js b/src/js/MusicTools.js index 3cc59a1..79916c7 100644 --- a/src/js/MusicTools.js +++ b/src/js/MusicTools.js @@ -2,21 +2,20 @@ import React, { Component } from "react"; import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom"; import NotFound from "./Error/NotFound.js"; - -import showMessage from "./Toast.js" +import Progress from "./Util/circularProgress.js"; +import showMessage from "./Toast.js"; import GlobalTheme from './Theme.js'; -import { Typography, CircularProgress } from '@material-ui/core'; import { ThemeProvider } from '@material-ui/core/styles'; -import {AppBar, Toolbar, IconButton, Drawer, List, Divider, ListItem, ListItemIcon, ListItemText} from '@material-ui/core'; +import {AppBar, Toolbar, IconButton, Drawer, List, Divider, ListItem, ListItemIcon, ListItemText, Typography} from '@material-ui/core'; import MenuIcon from '@material-ui/icons/Menu'; - import ChevronLeftIcon from '@material-ui/icons/ChevronLeft'; import HomeIcon from '@material-ui/icons/Home'; -import { Build, PieChart, QueueMusic, ExitToApp, AccountCircle, KeyboardBackspace, GroupWork } from '@material-ui/icons' + +import { Build, QueueMusic, ExitToApp, AccountCircle, KeyboardBackspace, GroupWork } from '@material-ui/icons' const axios = require('axios'); @@ -177,7 +176,7 @@ class MusicTools extends Component {
- }> + }> @@ -196,8 +195,4 @@ class MusicTools extends Component { } -function LoadingMessage(props) { - return ; -} - export default MusicTools; \ No newline at end of file diff --git a/src/js/Playlist/New.js b/src/js/Playlist/New.js index fb14206..7564246 100644 --- a/src/js/Playlist/New.js +++ b/src/js/Playlist/New.js @@ -155,7 +155,7 @@ class NewPlaylist extends Component { {/* SUBMIT BUTTON */} - +
diff --git a/src/js/Playlist/PlaylistsList.js b/src/js/Playlist/PlaylistsList.js index 30d3179..ad76615 100644 --- a/src/js/Playlist/PlaylistsList.js +++ b/src/js/Playlist/PlaylistsList.js @@ -1,11 +1,10 @@ import React, { Component } from "react"; import { Link } from "react-router-dom"; -import { Button, ButtonGroup, Typography, Card, Grid, CircularProgress } from '@material-ui/core'; -import CardActions from '@material-ui/core/CardActions'; -import CardContent from '@material-ui/core/CardContent'; +import { Button, ButtonGroup, Typography, Card, CardActions, CardContent, Grid } from '@material-ui/core'; const axios = require('axios'); import showMessage from "../Toast.js" +import Progress from "../Util/circularProgress.js"; /** * Top-level object for hosting playlist card grid with new/run all buttons @@ -124,7 +123,7 @@ class PlaylistsView extends Component { handleDeletePlaylist={this.handleDeletePlaylist} handleRunAll={this.handleRunAll}/>; - return this.state.isLoading ? : grid; + return this.state.isLoading ? : grid; } } @@ -140,7 +139,7 @@ function PlaylistGrid(props){ direction="row" justify="flex-start" alignItems="flex-start" - style={{padding: '24px'}}> + style={{padding: 24}}> {/* BUTTON BLOCK (NEW/RUN ALL) */} @@ -183,12 +182,19 @@ function PlaylistCard(props){ { props.playlist.name } + + {"lastfm_stat_percent" in props.playlist && + props.playlist.lastfm_stat_percent != null && + + { Math.round(props.playlist.lastfm_stat_percent) }% + + } {/* BUTTONS */} {/* VIEW */} diff --git a/src/js/Playlist/View/Edit.js b/src/js/Playlist/View/Edit.js index 8691835..7912b17 100644 --- a/src/js/Playlist/View/Edit.js +++ b/src/js/Playlist/View/Edit.js @@ -1,12 +1,13 @@ import React, { Component } from "react"; const axios = require('axios'); -import { Card, Button, CircularProgress, FormControl, TextField, InputLabel, Select, FormControlLabel, +import { Card, Button, FormControl, TextField, InputLabel, Select, FormControlLabel, CardActions, CardContent, Typography, Grid, MenuItem, Switch } from '@material-ui/core'; import { Delete } from '@material-ui/icons'; import { makeStyles } from '@material-ui/core/styles'; import showMessage from "../../Toast.js"; +import Progress from "../../Util/circularProgress.js"; var thisMonth = [ 'january', @@ -467,7 +468,7 @@ export class Edit extends Component{ {/* SHUFFLE */} + } labelPlacement="bottom" label="Shuffle"/> @@ -475,7 +476,7 @@ export class Edit extends Component{ {/* RECOMMENDATIONS */} + } labelPlacement="bottom" label="Recommendations"/> @@ -483,7 +484,7 @@ export class Edit extends Component{ {/* LIBRARY TRACKS */} + } labelPlacement="bottom" label="Library Tracks"/> @@ -556,7 +557,7 @@ export class Edit extends Component{ {/* THIS MONTH */} + } label="This Month" labelPlacement="bottom" @@ -565,7 +566,7 @@ export class Edit extends Component{ {/* LAST MONTH */} + } label="Last Month" labelPlacement="bottom" @@ -608,7 +609,7 @@ export class Edit extends Component{ ); - return this.state.isLoading ? : table; + return this.state.isLoading ? : table; } } diff --git a/src/js/Settings/ChangePassword.js b/src/js/Settings/ChangePassword.js index faff285..d2ae4a0 100644 --- a/src/js/Settings/ChangePassword.js +++ b/src/js/Settings/ChangePassword.js @@ -140,7 +140,7 @@ class ChangePassword extends Component { {/* SUBMIT BUTTON */} - + diff --git a/src/js/Settings/LastFM.js b/src/js/Settings/LastFM.js index 8e99b81..95584c7 100644 --- a/src/js/Settings/LastFM.js +++ b/src/js/Settings/LastFM.js @@ -107,7 +107,7 @@ class LastFM extends Component { {/* SUBMIT BUTTON */} - + diff --git a/src/js/Settings/SpotifyLink.js b/src/js/Settings/SpotifyLink.js index 2f0adcc..fe63cf5 100644 --- a/src/js/Settings/SpotifyLink.js +++ b/src/js/Settings/SpotifyLink.js @@ -65,7 +65,7 @@ class SpotifyLink extends Component { * @returns Button component */ function AuthButton(props) { - return ; + return ; } /** @@ -74,7 +74,7 @@ function AuthButton(props) { * @returns Button component */ function DeAuthButton(props) { - return ; + return ; } export default SpotifyLink; \ No newline at end of file diff --git a/src/js/Tag/TagList.js b/src/js/Tag/TagList.js index 947f392..0e9196a 100644 --- a/src/js/Tag/TagList.js +++ b/src/js/Tag/TagList.js @@ -1,11 +1,11 @@ import React, { Component } from "react"; import { Link } from "react-router-dom"; -import { Button, ButtonGroup, Typography, Card, Grid, CircularProgress } from '@material-ui/core'; -import CardActions from '@material-ui/core/CardActions'; -import CardContent from '@material-ui/core/CardContent'; +import { Button, ButtonGroup, Typography, Card, CardActions, CardContent, Grid } from '@material-ui/core'; + const axios = require('axios'); import showMessage from "../Toast.js" +import Progress from "../Util/circularProgress.js" /** * Tag card list component @@ -67,7 +67,7 @@ class TagList extends Component { const grid = ; - return this.state.isLoading ? : grid; + return this.state.isLoading ? : grid; } } @@ -135,7 +135,7 @@ function TagCard(props){ {/* VIEW BUTTON */} diff --git a/src/js/Tag/View.js b/src/js/Tag/View.js index 67fbe11..bc6bc09 100644 --- a/src/js/Tag/View.js +++ b/src/js/Tag/View.js @@ -1,11 +1,12 @@ import React, { Component } from "react"; const axios = require('axios'); -import { Card, Button, CircularProgress, CardActions, CardContent, FormControl, InputLabel, Select, Typography, Grid, TextField, MenuItem, FormControlLabel, Switch } from '@material-ui/core'; +import { Card, Button, CardActions, CardContent, FormControl, InputLabel, Select, Typography, Grid, TextField, MenuItem, FormControlLabel, Switch } from '@material-ui/core'; import { Delete } from '@material-ui/icons'; import { makeStyles } from '@material-ui/core/styles'; import showMessage from "../Toast.js"; +import Progress from "../Util/circularProgress.js" const BarChart = React.lazy(() => import("../Maths/BarChart")) const PieChart = React.lazy(() => import("../Maths/PieChart")) @@ -438,7 +439,7 @@ class TagView extends Component{ ); - return this.state.isLoading ? : table; + return this.state.isLoading ? : table; } } diff --git a/src/js/Theme.js b/src/js/Theme.js index c8780f7..d581157 100644 --- a/src/js/Theme.js +++ b/src/js/Theme.js @@ -23,15 +23,20 @@ let GlobalTheme = createMuiTheme({ }, palette: { type: 'dark', + // https://colorhunt.co/palette/907fa4a58faaa6d6d6ededd0 primary: { - main: '#1976d2', + main: '#907FA4', }, secondary: { - main: '#dc004e', + main: '#A6D6D6', }, + // https://colorhunt.co/palette/de89717b6079a7d0cdffe9d6 error: { - main: '#f44336' - } + main: '#DE8971' + }, + info: { + main: "#A7D0CD" + }, }, status: { danger: 'orange', diff --git a/src/js/Util/circularProgress.js b/src/js/Util/circularProgress.js new file mode 100644 index 0000000..f22f87d --- /dev/null +++ b/src/js/Util/circularProgress.js @@ -0,0 +1,19 @@ +import React from "react"; +import { Grid, CircularProgress } from '@material-ui/core'; + +function Progress (props) { + return ( + + + + + + ); +} + +Progress.defaultProps = { + padding: 36, + colWidth: 12, +} + +export default Progress; \ No newline at end of file