Browse Source

[front] Latest.

Innocenty Enikeew 5 years ago
parent
commit
58efdaf45c

+ 2 - 2
front/build/asset-manifest.json

@@ -1,8 +1,8 @@
 {
   "main.css": "static/css/main.0bd5a7cb.css",
   "main.css.map": "static/css/main.0bd5a7cb.css.map",
-  "main.js": "static/js/main.ada69c17.js",
-  "main.js.map": "static/js/main.ada69c17.js.map",
+  "main.js": "static/js/main.708e6d35.js",
+  "main.js.map": "static/js/main.708e6d35.js.map",
   "static/media/chad-logo-256.png": "static/media/chad-logo-256.5fddd85c.png",
   "static/media/logo.svg": "static/media/logo.5d5d9eef.svg"
 }

+ 1 - 1
front/build/index.html

@@ -1 +1 @@
-<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><link rel="manifest" href="/manifest.json"><link rel="shortcut icon" href="/favicon.ico"><title>Chad Music</title><link href="/static/css/main.0bd5a7cb.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script type="text/javascript" src="/static/js/main.ada69c17.js"></script></body></html>
+<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><link rel="manifest" href="/manifest.json"><link rel="shortcut icon" href="/favicon.ico"><title>Chad Music</title><link href="/static/css/main.0bd5a7cb.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script type="text/javascript" src="/static/js/main.708e6d35.js"></script></body></html>

File diff suppressed because it is too large
+ 0 - 0
front/build/service-worker.js


File diff suppressed because it is too large
+ 0 - 0
front/build/static/js/main.708e6d35.js


File diff suppressed because it is too large
+ 0 - 0
front/build/static/js/main.708e6d35.js.map


File diff suppressed because it is too large
+ 0 - 0
front/build/static/js/main.ada69c17.js


File diff suppressed because it is too large
+ 0 - 0
front/build/static/js/main.ada69c17.js.map


+ 4 - 4
front/package-lock.json

@@ -9152,9 +9152,9 @@
       }
     },
     "react-input-autosize": {
-      "version": "2.2.1",
-      "resolved": "https://registry.npmjs.org/react-input-autosize/-/react-input-autosize-2.2.1.tgz",
-      "integrity": "sha512-3+K4CD13iE4lQQ2WlF8PuV5htfmTRLH6MDnfndHM6LuBRszuXnuyIfE7nhSKt8AzRBZ50bu0sAhkNMeS5pxQQA==",
+      "version": "2.2.2",
+      "resolved": "https://registry.npmjs.org/react-input-autosize/-/react-input-autosize-2.2.2.tgz",
+      "integrity": "sha512-jQJgYCA3S0j+cuOwzuCd1OjmBmnZLdqQdiLKRYrsMMzbjUrVDS5RvJUDwJqA7sKuksDuzFtm6hZGKFu7Mjk5aw==",
       "requires": {
         "prop-types": "15.6.1"
       }
@@ -9219,7 +9219,7 @@
       "requires": {
         "classnames": "2.2.5",
         "prop-types": "15.6.1",
-        "react-input-autosize": "2.2.1"
+        "react-input-autosize": "2.2.2"
       }
     },
     "react-sound": {

+ 19 - 6
front/src/Player.js

@@ -23,6 +23,7 @@ export default class Player extends Component {
       albumList: {key:'', albums: [], error: false, hasMore: false},
       filters: {},
       filter: '',
+      latest: false,
       sound: {url: '', playStatus: Sound.status.STOPPED},
       tracks: null,
       activeTrack: -1,
@@ -32,11 +33,11 @@ export default class Player extends Component {
     this.filterTimeout = null;
   }
   genAlbumListKey() {
-    const {filter, filters} = this.state
-    return `${filter}-${this.selects.map(({type}) => filters[type] ? filters[type].item : '').join('-')}`
+    const {filter, filters, latest} = this.state
+    return `${filter}-${this.selects.map(({type}) => filters[type] ? filters[type].item : '').join('-')}-${latest ? 'l' : '.'}`
   }
   loadAlbums = (page) => {
-    const {filter, filters} = this.state
+    const {filter, filters, latest} = this.state
     const limit  = 15;
     const offset = page * limit;
     const params = {filter, offset, limit:(limit+1)};
@@ -46,6 +47,8 @@ export default class Player extends Component {
         params[type] = filters[type].item;
       }
     }
+    if (latest) params['latest'] = 1;
+
     return fetch(`/api/cat/album?${getQueryString(params)}`, fetchOpts)
       .then(res => (res.ok ? res.json() : Promise.reject({message:res.statusText})))
       .then(data => {
@@ -65,8 +68,8 @@ export default class Player extends Component {
     this.loadAlbums(0)
   }
   componentDidUpdate(prevProps, prevState) {
-    const {filters} = this.state;
-    if (filters !== prevState.filters) {
+    const {filters, latest} = this.state;
+    if (filters !== prevState.filters || latest !== prevState.latest) {
       this.loadAlbums(0);
     }
     if (this.state.activeAlbum !== prevState.activeAlbum) {
@@ -112,6 +115,9 @@ export default class Player extends Component {
     }, 500);
     this.setState({filter})
   }
+  handleLatestChange = (e) => {
+    this.setState({latest: e.target.checked});
+  }
   handleControlPrev = () => {
     if (!Array.isArray(this.state.tracks)) {
       return;
@@ -248,6 +254,13 @@ export default class Player extends Component {
               placeholder="Search albums"
               onChange={this.handleFilterChange} />
           </div>
+          <div className="section">
+            <h3>Latest</h3>
+            <input className="Latest"
+              type="checkbox"
+              checked={this.state.latest}
+              onChange={this.handleLatestChange} />
+          </div>
         </div><br style={{clear:'both'}} />
         <Controls
           visible={true}
@@ -261,7 +274,7 @@ export default class Player extends Component {
           activeTrack={this.state.activeTrack}
           onActivateTrack={this.handleActivateTrack} />
         <AlbumList
-          title="Albums"
+          title={this.state.latest ? "Latest albums" : "Albums"}
           {...this.state.albumList}
           loadMore={this.loadAlbums}
           onPlayAlbum={this.handlePlayAlbum} />

Some files were not shown because too many files changed in this diff