From c87bf7e6b8c2d6fd4c53878ea9e94f3a61acef72 Mon Sep 17 00:00:00 2001 From: wvffle Date: Sun, 24 Jul 2022 20:51:13 +0000 Subject: [PATCH] Queue component enhancements This commit provides following queue component enhancements: - Use a virtual list to render queue items. We now render ~25-30 items at once compared to `queue.length` items. (Fix #1471) - Faster queue opening and a smoother open animation. (Fix #1471) - Faster song enqueueing: When enqueueing a playlist or an album, we modify the state only once compared to `tracks.length` modifications before. - When opening the queue, current track is now already pre-scrolled and centered. This resolves an issue with big queues, where the track list was slowly scrolling to a random position. - Dragging a track onto the edge of the track list will now scroll the container. You reorder a track from the very top to the very bottom even when you have 3000 tracks in the queue! - Ability to use scroll wheel while reordering track items - Track reordering on mobile devices! Currently dragging to edge is disabled - Responsivity fixes - Allow click outside modal (Fix #1581) --- front/package.json | 20 +- front/src/App.vue | 2 +- front/src/components/Queue.vue | 264 +++++++++--------- front/src/components/QueueItem.vue | 69 +++++ front/src/components/audio/Player.vue | 10 +- front/src/components/semantic/Modal.vue | 4 +- front/src/components/vui/list/VirtualItem.vue | 18 ++ front/src/components/vui/list/VirtualList.vue | 233 ++++++++++++++++ front/src/composables/audio/usePlayOptions.ts | 7 +- front/src/composables/audio/usePlayer.ts | 2 +- front/src/composables/audio/useQueue.ts | 9 +- front/src/store/queue.ts | 59 ++-- front/src/style/components/_queue.scss | 53 ++++ front/src/types.ts | 13 + front/src/utils/time.ts | 4 +- front/yarn.lock | 65 ++--- yarn.lock | 4 - 17 files changed, 594 insertions(+), 242 deletions(-) create mode 100644 front/src/components/QueueItem.vue create mode 100644 front/src/components/vui/list/VirtualItem.vue create mode 100644 front/src/components/vui/list/VirtualList.vue delete mode 100644 yarn.lock diff --git a/front/package.json b/front/package.json index 359f84195..d2135afd7 100644 --- a/front/package.json +++ b/front/package.json @@ -18,27 +18,26 @@ "postinstall": "yarn run fix-fomantic-css" }, "dependencies": { - "@vue/runtime-core": "^3.2.37", + "@vue/runtime-core": "3.2.37", "@vueuse/core": "8.9.4", "@vueuse/integrations": "8.9.4", "axios": "0.27.2", "axios-auth-refresh": "3.3.1", "diff": "5.1.0", - "dompurify": "^2.3.8", + "dompurify": "2.3.8", "focus-trap": "6.9.4", "fomantic-ui-css": "2.8.8", "howler": "2.2.3", "js-logger": "1.6.1", "lodash-es": "4.17.21", "moment": "2.29.4", - "pinia": "^2.0.13", "qs": "6.11.0", "register-service-worker": "1.7.2", "sanitize-html": "2.7.1", "sass": "1.53.0", "showdown": "2.1.0", "text-clipper": "2.2.0", - "transliteration": "^2.3.5", + "transliteration": "2.3.5", "vue": "3.2.37", "vue-gettext": "2.1.12", "vue-plyr": "7.0.0", @@ -47,34 +46,35 @@ "vue-upload-component": "3.1.2", "vue3-gettext": "2.3.0", "vue3-lazyload": "0.3.5", + "vue3-virtual-scroll-list": "0.2.0", "vuedraggable": "4.1.0", "vuex": "4.0.2", "vuex-persistedstate": "4.1.0", "vuex-router-sync": "5.0.0" }, "devDependencies": { - "@types/dompurify": "^2.3.3", - "@types/howler": "^2.2.7", + "@types/dompurify": "2.3.3", + "@types/howler": "2.2.7", "@types/jest": "28.1.6", "@types/jquery": "3.5.14", "@types/lodash-es": "4.17.6", "@types/qs": "6.9.7", - "@types/semantic-ui": "^2.2.7", - "@types/showdown": "^2.0.0", + "@types/semantic-ui": "2.2.7", + "@types/showdown": "2.0.0", "@typescript-eslint/eslint-plugin": "5.30.7", "@vitejs/plugin-vue": "3.0.1", "@vue/compiler-sfc": "3.2.37", "@vue/eslint-config-standard": "7.0.0", "@vue/eslint-config-typescript": "11.0.0", "@vue/test-utils": "2.0.2", - "@vue/tsconfig": "^0.1.3", + "@vue/tsconfig": "0.1.3", "chai": "4.3.6", "easygettext": "2.17.0", "eslint": "8.20.0", "eslint-config-standard": "17.0.0", "eslint-plugin-html": "7.0.0", "eslint-plugin-import": "2.26.0", - "eslint-plugin-n": "^15.2.4", + "eslint-plugin-n": "15.2.4", "eslint-plugin-node": "11.1.0", "eslint-plugin-promise": "6.0.0", "eslint-plugin-vue": "9.2.0", diff --git a/front/src/App.vue b/front/src/App.vue index b01779074..34f88abe9 100644 --- a/front/src/App.vue +++ b/front/src/App.vue @@ -104,7 +104,7 @@ if (store.state.auth.authenticated) {