Skip to content
This repository has been archived by the owner on Oct 9, 2022. It is now read-only.

Commit

Permalink
chore: some refactors and cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
phanan committed Oct 25, 2019
1 parent f53d781 commit 847a444
Show file tree
Hide file tree
Showing 77 changed files with 142 additions and 179 deletions.
4 changes: 2 additions & 2 deletions js/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import './static-loader'
import Vue from 'vue'
import App from './app.vue'
import App from './app'
import { http } from './services'
import { VirtualScroller } from 'vue-virtual-scroller/dist/vue-virtual-scroller'
import GlobalEvents from 'vue-global-events'
Expand All @@ -27,5 +27,5 @@ new Vue({
})

if (KOEL_ENV !== 'app' && 'serviceWorker' in navigator) {
navigator.serviceWorker.register('./sw.js').then(() => { console.log('Service Worker Registered') })
navigator.serviceWorker.register('./sw.js').then(() => console.log('Service Worker Registered'))
}
2 changes: 1 addition & 1 deletion js/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default {
Overlay,
LoginForm,
EventListeners,
SupportKoel: () => import('@/components/meta/support-koel.vue')
SupportKoel: () => import('@/components/meta/support-koel')
},
data () {
Expand Down
2 changes: 1 addition & 1 deletion js/components/album/info.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default {
},
components: {
TrackList: () => import('./track-list.vue')
TrackList: () => import('./track-list')
},
data: () => ({
Expand Down
2 changes: 1 addition & 1 deletion js/components/album/track-list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default {
},
components: {
TrackListItem: () => import('./track-list-item.vue')
TrackListItem: () => import('./track-list-item')
}
}
</script>
4 changes: 2 additions & 2 deletions js/components/layout/app-header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import { event, app } from '@/utils'
export default {
components: {
SearchForm: () => import('@/components/ui/search-form.vue'),
UserBadge: () => import('@/components/user/badge.vue')
SearchForm: () => import('@/components/ui/search-form'),
UserBadge: () => import('@/components/user/badge')
},
data: () => ({
Expand Down
8 changes: 4 additions & 4 deletions js/components/layout/main-wrapper/extra-panel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ EXTRA_PANEL_TABS.DEFAULT = EXTRA_PANEL_TABS.LYRICS
export default {
components: {
LyricsPane: () => import('@/components/ui/lyrics-pane.vue'),
ArtistInfo: () => import('@/components/artist/info.vue'),
AlbumInfo: () => import('@/components/album/info.vue'),
YouTubeVideoList: () => import('@/components/ui/youtube-video-list.vue')
LyricsPane: () => import('@/components/ui/lyrics-pane'),
ArtistInfo: () => import('@/components/artist/info'),
AlbumInfo: () => import('@/components/album/info'),
YouTubeVideoList: () => import('@/components/ui/youtube-video-list')
},
data: () => ({
Expand Down
8 changes: 4 additions & 4 deletions js/components/layout/main-wrapper/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
<script>
export default {
components: {
Sidebar: () => import('@/components/layout/main-wrapper/sidebar.vue'),
MainContent: () => import('@/components/layout/main-wrapper/main-content.vue'),
ExtraPanel: () => import('@/components/layout/main-wrapper/extra-panel.vue'),
ModalWrapper: () => import('@/components/layout/modal-wrapper.vue')
Sidebar: () => import('@/components/layout/main-wrapper/sidebar'),
MainContent: () => import('@/components/layout/main-wrapper/main-content'),
ExtraPanel: () => import('@/components/layout/main-wrapper/extra-panel'),
ModalWrapper: () => import('@/components/layout/modal-wrapper')
}
}
</script>
Expand Down
2 changes: 1 addition & 1 deletion js/components/layout/main-wrapper/sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default {
views,
components: {
PlaylistList: () => import('@/components/playlist/sidebar-list.vue')
PlaylistList: () => import('@/components/playlist/sidebar-list')
},
data: () => ({
Expand Down
12 changes: 6 additions & 6 deletions js/components/layout/modal-wrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import { event } from '@/utils'
export default {
components: {
CreateSmartPlaylistForm: () => import('@/components/playlist/smart-playlist/create-form.vue'),
EditSmartPlaylistForm: () => import('@/components/playlist/smart-playlist/edit-form.vue'),
AddUserForm: () => import('@/components/user/add-form.vue'),
EditUserForm: () => import('@/components/user/edit-form.vue'),
EditSongForm: () => import('@/components/song/edit-form.vue'),
AboutDialog: () => import('@/components/meta/about-dialog.vue')
CreateSmartPlaylistForm: () => import('@/components/playlist/smart-playlist/create-form'),
EditSmartPlaylistForm: () => import('@/components/playlist/smart-playlist/edit-form'),
AddUserForm: () => import('@/components/user/add-form'),
EditUserForm: () => import('@/components/user/edit-form'),
EditSongForm: () => import('@/components/song/edit-form'),
AboutDialog: () => import('@/components/meta/about-dialog')
},
data: () => ({
Expand Down
2 changes: 1 addition & 1 deletion js/components/playlist/create-new-context-menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { event } from '@/utils'
export default {
components: {
BaseContextMenu: () => import('@/components/ui/context-menu.vue')
BaseContextMenu: () => import('@/components/ui/context-menu')
},
methods: {
Expand Down
2 changes: 1 addition & 1 deletion js/components/playlist/item-context-menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { event } from '@/utils'
export default {
components: {
BaseContextMenu: () => import('@/components/ui/context-menu.vue')
BaseContextMenu: () => import('@/components/ui/context-menu')
},
props: {
Expand Down
4 changes: 2 additions & 2 deletions js/components/playlist/sidebar-item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ const VALID_PLAYLIST_TYPES = ['playlist', 'favorites', 'recently-played']
export default {
components: {
ContextMenu: () => import('@/components/playlist/item-context-menu.vue'),
NameEditor: () => import('@/components/playlist/name-editor.vue')
ContextMenu: () => import('@/components/playlist/item-context-menu'),
NameEditor: () => import('@/components/playlist/name-editor')
},
props: {
Expand Down
4 changes: 2 additions & 2 deletions js/components/playlist/sidebar-list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ import router from '@/router'
export default {
components: {
PlaylistItem: () => import('@/components/playlist/sidebar-item.vue'),
ContextMenu: () => import('@/components/playlist/create-new-context-menu.vue')
PlaylistItem: () => import('@/components/playlist/sidebar-item'),
ContextMenu: () => import('@/components/playlist/create-new-context-menu')
},
data: () => ({
Expand Down
6 changes: 3 additions & 3 deletions js/components/playlist/smart-playlist/edit-form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ import { playlistStore } from '@/stores'
export default {
components: {
FormBase: () => import('./form-base.vue'),
RuleGroup: () => import('@/components/playlist/smart-playlist/rule-group.vue'),
SoundBar: () => import('@/components/ui/sound-bar.vue')
FormBase: () => import('./form-base'),
RuleGroup: () => import('@/components/playlist/smart-playlist/rule-group'),
SoundBar: () => import('@/components/ui/sound-bar')
},
props: {
Expand Down
4 changes: 2 additions & 2 deletions js/components/screens/album-list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ export default {
mixins: [infiniteScroll],
components: {
AlbumCard: () => import('@/components/album/card.vue'),
ViewModeSwitch: () => import('@/components/ui/view-mode-switch.vue')
AlbumCard: () => import('@/components/album/card'),
ViewModeSwitch: () => import('@/components/ui/view-mode-switch')
},
data: () => ({
Expand Down
4 changes: 2 additions & 2 deletions js/components/screens/artist-list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import infiniteScroll from '@/mixins/infinite-scroll'
export default {
mixins: [infiniteScroll],
components: {
ArtistCard: () => import('@/components/artist/card.vue'),
ViewModeSwitch: () => import('@/components/ui/view-mode-switch.vue')
ArtistCard: () => import('@/components/artist/card'),
ViewModeSwitch: () => import('@/components/ui/view-mode-switch')
},
data: () => ({
Expand Down
2 changes: 1 addition & 1 deletion js/components/song/context-menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default {
mixins: [songMenuMethods],
components: {
BaseContextMenu: () => import('@/components/ui/context-menu.vue')
BaseContextMenu: () => import('@/components/ui/context-menu')
},
data: () => ({
Expand Down
4 changes: 2 additions & 2 deletions js/components/song/list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ import { playlistStore, queueStore, songStore, favoriteStore } from '@/stores'
import { playback } from '@/services'
import router from '@/router'
const songItem = () => import('@/components/song/item.vue')
const songItem = () => import('@/components/song/item')
const VALID_SONG_LIST_TYPES = ['all-songs', 'queue', 'playlist', 'favorites', 'recently-played', 'artist', 'album']
export default {
Expand All @@ -81,7 +81,7 @@ export default {
components: {
songItem,
ContextMenu: () => import('@/components/song/context-menu.vue')
ContextMenu: () => import('@/components/song/context-menu')
},
data: () => ({
Expand Down
2 changes: 1 addition & 1 deletion js/components/ui/lyrics-pane.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default {
},
components: {
TextZoomer: () => import('@/components/ui/text-zoomer.vue')
TextZoomer: () => import('@/components/ui/text-zoomer')
},
data: () => ({
Expand Down
2 changes: 1 addition & 1 deletion js/components/ui/overlay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { event } from '@/utils'
export default {
components: {
SoundBar: () => import('@/components/ui/sound-bar.vue')
SoundBar: () => import('@/components/ui/sound-bar')
},
data: () => ({
Expand Down
6 changes: 3 additions & 3 deletions js/mixins/has-song-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import { event } from '@/utils'

export default {
components: {
SongList: () => import('@/components/song/list.vue'),
SongListControls: () => import('@/components/song/list-controls.vue'),
ControlsToggler: () => import('@/components/song/list-controls-toggler.vue')
SongList: () => import('@/components/song/list'),
SongListControls: () => import('@/components/song/list-controls'),
ControlsToggler: () => import('@/components/song/list-controls-toggler')
},

data: () => ({
Expand Down
2 changes: 1 addition & 1 deletion js/mixins/infinite-scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
export default {
components: {
ToTopButton: () => import('@/components/ui/to-top-button.vue')
ToTopButton: () => import('@/components/ui/to-top-button')
},

data: () => ({
Expand Down
2 changes: 1 addition & 1 deletion js/remote/app.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import './static-loader'
import Vue from 'vue'
import { http } from '@/services'
import App from './app.vue'
import App from './app'

new Vue({
el: '#app',
Expand Down
2 changes: 1 addition & 1 deletion js/remote/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
import { socket, ls } from '@/services'
import { userStore } from '@/stores'
import { event } from '@/utils'
import loginForm from '@/components/auth/login-form.vue'
import loginForm from '@/components/auth/login-form'
let volumeSlider
const MAX_RETRIES = 10
Expand Down
32 changes: 6 additions & 26 deletions js/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { loadMainView } from './utils'
import { artistStore, albumStore, songStore, queueStore, playlistStore, userStore } from './stores'
import { playback } from './services'
import { views } from '@/config'
import { use } from '@/utils'

export default {
routes: {
Expand All @@ -19,40 +20,19 @@ export default {
'/youtube': () => loadMainView(views.YOUTUBE),
'/visualizer': () => loadMainView(views.VISUALIZER),
'/profile': () => loadMainView(views.PROFILE),
'/album/(\\d+)': id => use(albumStore.byId(~~id), album => loadMainView(views.ALBUM, album)),
'/artist/(\\d+)': id => use(artistStore.byId(~~id), artist => loadMainView(views.ARTIST, artist)),
'/playlist/(\\d+)': id => use(playlistStore.byId(~~id), playlist => loadMainView(views.PLAYLIST, playlist)),

'/album/(\\d+)': id => {
const album = albumStore.byId(~~id)
if (album) {
loadMainView(views.ALBUM, album)
}
},

'/artist/(\\d+)': id => {
const artist = artistStore.byId(~~id)
if (artist) {
loadMainView(views.ARTIST, artist)
}
},

'/playlist/(\\d+)': id => {
const playlist = playlistStore.byId(~~id)
if (playlist) {
loadMainView(views.PLAYLIST, playlist)
}
},

'/song/([a-z0-9]{32})': id => {
const song = songStore.byId(id)
if (!song) return

'/song/([a-z0-9]{32})': id => use(songStore.byId(id), song => {
if (isMobile.apple.device) {
// Mobile Safari doesn't allow autoplay, so we just queue.
queueStore.queue(song)
loadMainView(views.QUEUE)
} else {
playback.queueAndPlay(song)
}
}
})
},

init () {
Expand Down
2 changes: 1 addition & 1 deletion js/tests/components/album/info.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import AlbumInfo from '@/components/album/info.vue'
import AlbumInfo from '@/components/album/info'
import factory from '@/tests/factory'

describe('components/album/info', () => {
Expand Down
2 changes: 1 addition & 1 deletion js/tests/components/album/track-list-item.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Component from '@/components/album/track-list-item.vue'
import Component from '@/components/album/track-list-item'
import { sharedStore, songStore, queueStore } from '@/stores'
import { playback, ls } from '@/services'
import factory from '@/tests/factory'
Expand Down
4 changes: 2 additions & 2 deletions js/tests/components/album/track-list.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Component from '@/components/album/track-list.vue'
import TrackListItem from '@/components/album/track-list-item.vue'
import Component from '@/components/album/track-list'
import TrackListItem from '@/components/album/track-list-item'
import factory from '@/tests/factory'

describe('components/album/track-list', () => {
Expand Down
2 changes: 1 addition & 1 deletion js/tests/components/artist/card.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Component from '@/components/artist/card.vue'
import Component from '@/components/artist/card'
import Thumbnail from '@/components/ui/album-artist-thumbnail'
import factory from '@/tests/factory'
import { playback, download } from '@/services'
Expand Down
2 changes: 1 addition & 1 deletion js/tests/components/artist/info.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Component from '@/components/artist/info.vue'
import Component from '@/components/artist/info'
import factory from '@/tests/factory'

describe('components/artist/info', () => {
Expand Down
2 changes: 1 addition & 1 deletion js/tests/components/auth/login-form.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Component from '@/components/auth/login-form.vue'
import Component from '@/components/auth/login-form'
import { userStore } from '@/stores'
import { mock } from '@/tests/__helpers__'

Expand Down
2 changes: 1 addition & 1 deletion js/tests/components/layout/app-header.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Component from '@/components/layout/app-header.vue'
import Component from '@/components/layout/app-header'
import { event } from '@/utils'
import { mock } from '@/tests/__helpers__'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import each from 'jest-each'
import Component from '@/components/layout/main-wrapper/extra-panel.vue'
import Component from '@/components/layout/main-wrapper/extra-panel'
import factory from '@/tests/factory'
import { event } from '@/utils'
import { songInfo } from '@/services'
Expand Down
2 changes: 1 addition & 1 deletion js/tests/components/layout/main-wrapper/index.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Component from '@/components/layout/main-wrapper/index.vue'
import Component from '@/components/layout/main-wrapper/index'

describe('component/layout/main-wrapper/index', () => {
it('renders properly', async done => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Component from '@/components/layout/main-wrapper/main-content.vue'
import Component from '@/components/layout/main-wrapper/main-content'
import { event } from '@/utils'
import factory from '@/tests/factory'

Expand Down
2 changes: 1 addition & 1 deletion js/tests/components/layout/main-wrapper/sidebar.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Component from '@/components/layout/main-wrapper/sidebar.vue'
import Component from '@/components/layout/main-wrapper/sidebar'
import { sharedStore } from '@/stores'
import factory from '@/tests/factory'

Expand Down
2 changes: 1 addition & 1 deletion js/tests/components/playlist/name-editor.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Component from '@/components/playlist/name-editor.vue'
import Component from '@/components/playlist/name-editor'
import factory from '@/tests/factory'
import { playlistStore } from '@/stores'
import { mock } from '@/tests/__helpers__'
Expand Down
Loading

0 comments on commit 847a444

Please sign in to comment.