From 43795e6ffd48fba3f6bd1b1676245878573cf7be Mon Sep 17 00:00:00 2001 From: Phan An Date: Tue, 23 Apr 2024 23:01:27 +0200 Subject: [PATCH] chore: reformat code --- resources/assets/js/App.vue | 4 +- resources/assets/js/__tests__/UnitTestCase.ts | 55 ++++------ .../js/components/album/AlbumCard.spec.ts | 40 +++---- .../assets/js/components/album/AlbumCard.vue | 2 +- .../components/album/AlbumContextMenu.spec.ts | 24 ++--- .../js/components/album/AlbumInfo.spec.ts | 32 +++--- .../assets/js/components/album/AlbumInfo.vue | 2 +- .../js/components/album/AlbumTrackList.vue | 2 +- .../album/AlbumTrackListItem.spec.ts | 34 +++--- .../components/album/AlbumTrackListItem.vue | 2 +- .../__snapshots__/AlbumCard.spec.ts.snap | 2 +- .../AlbumContextMenu.spec.ts.snap | 2 +- .../js/components/artist/ArtistCard.spec.ts | 26 ++--- .../artist/ArtistContextMenu.spec.ts | 24 ++--- .../js/components/artist/ArtistInfo.spec.ts | 28 ++--- .../__snapshots__/ArtistCard.spec.ts.snap | 2 +- .../ArtistContextMenu.spec.ts.snap | 2 +- .../js/components/auth/ForgotPasswordForm.vue | 8 +- .../js/components/auth/LoginForm.spec.ts | 24 ++--- .../assets/js/components/auth/LoginForm.vue | 6 +- .../js/components/auth/ResetPasswordForm.vue | 2 +- .../auth/__snapshots__/LoginForm.spec.ts.snap | 8 +- .../components/auth/sso/GoogleLoginButton.vue | 4 +- .../invitation/AcceptInvitation.vue | 2 +- .../invitation/AcceptInvivation.spec.ts | 6 +- .../koel-plus/ActivateLicenseForm.spec.ts | 8 +- .../koel-plus/ActivateLicenseForm.vue | 2 +- .../components/koel-plus/BtnUpgradeToPlus.vue | 2 +- .../koel-plus/KoelPlusModal.spec.ts | 8 +- .../js/components/koel-plus/KoelPlusModal.vue | 6 +- .../app-footer/FooterExtraControls.spec.ts | 22 ++-- .../app-footer/FooterPlaybackControls.spec.ts | 46 ++++---- .../layout/app-footer/FooterSongInfo.vue | 4 +- .../__snapshots__/FooterSongInfo.spec.ts.snap | 2 +- .../js/components/layout/app-footer/index.vue | 2 +- .../layout/main-wrapper/MainContent.spec.ts | 36 +++---- .../extra-drawer/AboutKoelButton.vue | 2 +- .../extra-drawer/ExtraDrawer.spec.ts | 52 ++++----- .../main-wrapper/extra-drawer/ExtraDrawer.vue | 2 +- .../extra-drawer/ExtraDrawerButton.vue | 2 +- .../extra-drawer/LogoutButton.vue | 2 +- .../sidebar/PlaylistSidebarItem.vue | 7 +- .../main-wrapper/sidebar/QueueSidebarItem.vue | 8 +- .../layout/main-wrapper/sidebar/Sidebar.vue | 8 +- .../main-wrapper/sidebar/SidebarItem.spec.ts | 26 ++--- .../sidebar/SidebarManageSection.vue | 8 +- .../sidebar/SidebarPlaylistsSection.spec.ts | 22 ++-- .../sidebar/SidebarPlaylistsSection.vue | 2 +- .../sidebar/SidebarToggleButton.vue | 4 +- .../sidebar/SidebarYourMusicSection.vue | 12 +-- .../sidebar/YouTubeSidebarItem.vue | 2 +- .../js/components/meta/AboutKoelModal.spec.ts | 20 ++-- .../js/components/meta/AboutKoelModal.vue | 4 +- .../js/components/meta/CreditsBlock.vue | 4 +- .../js/components/meta/SupportKoel.spec.ts | 20 ++-- .../__snapshots__/AboutKoelModal.spec.ts.snap | 4 +- .../CreatePlaylistContextMenu.spec.ts | 12 +-- .../CreatePlaylistContextMenuButton.vue | 2 +- .../playlist/CreatePlaylistForm.vue | 2 +- .../playlist/InvitePlaylistCollaborators.vue | 4 +- .../PlaylistCollaborationModal.spec.ts | 6 +- .../playlist/PlaylistCollaborationModal.vue | 2 +- .../playlist/PlaylistCollaboratorList.spec.ts | 32 +++--- .../playlist/PlaylistCollaboratorList.vue | 2 +- .../PlaylistCollaboratorListItem.spec.ts | 32 +++--- .../playlist/PlaylistCollaboratorListItem.vue | 6 +- .../playlist/PlaylistCollaboratorsBadge.vue | 4 +- .../playlist/PlaylistContextMenu.spec.ts | 23 ++-- .../playlist/PlaylistContextMenu.vue | 4 +- .../PlaylistFolderContextMenu.spec.ts | 12 +-- .../CreateSmartPlaylistForm.vue | 5 +- .../smart-playlist/EditSmartPlaylistForm.vue | 7 +- .../smart-playlist/SmartPlaylistRuleGroup.vue | 4 +- .../EditableProfileAvatar.vue | 4 +- .../profile-preferences/Integrations.vue | 2 +- .../profile-preferences/LastfmIntegration.vue | 2 +- .../profile-preferences/ProfileForm.spec.ts | 8 +- .../profile-preferences/ProfileForm.vue | 4 +- .../profile-preferences/QRLogin.vue | 6 +- .../profile-preferences/ThemeCard.spec.ts | 16 +-- .../profile-preferences/ThemeCard.vue | 2 +- .../__snapshots__/QRLogin.spec.ts.snap | 2 +- .../__snapshots__/ThemeCard.spec.ts.snap | 2 +- .../screens/AlbumListScreen.spec.ts | 28 ++--- .../js/components/screens/AlbumScreen.spec.ts | 76 ++++++------- .../js/components/screens/AlbumScreen.vue | 10 +- .../components/screens/AllSongsScreen.spec.ts | 52 ++++----- .../js/components/screens/AllSongsScreen.vue | 5 +- .../screens/ArtistListScreen.spec.ts | 30 +++--- .../js/components/screens/ArtistScreen.vue | 16 +-- .../screens/FavoritesScreen.spec.ts | 18 ++-- .../js/components/screens/GenreListScreen.vue | 4 +- .../js/components/screens/GenreScreen.spec.ts | 70 ++++++------ .../js/components/screens/HomeScreen.spec.ts | 10 +- .../js/components/screens/HomeScreen.vue | 12 +-- .../components/screens/PlaylistScreen.spec.ts | 38 +++---- .../js/components/screens/PlaylistScreen.vue | 14 +-- .../js/components/screens/QueueScreen.spec.ts | 24 ++--- .../screens/RecentlyPlayedScreen.spec.ts | 32 +++--- .../js/components/screens/UploadScreen.vue | 2 +- .../components/screens/UserListScreen.spec.ts | 44 ++++---- .../__snapshots__/AllSongsScreen.spec.ts.snap | 6 +- .../__snapshots__/SettingsScreen.spec.ts.snap | 2 +- .../screens/home/ViewAllRecentSongsButton.vue | 4 +- .../search/AlbumExcerptResultsBlock.vue | 4 +- .../search/ArtistExcerptResultsBlock.vue | 4 +- .../screens/search/SearchExcerptsScreen.vue | 2 +- .../search/SongExcerptResultsBlock.vue | 4 +- .../js/components/song/AddToMenu.spec.ts | 34 +++--- .../assets/js/components/song/AddToMenu.vue | 2 +- .../js/components/song/EditSongForm.spec.ts | 38 +++---- .../js/components/song/EditSongForm.vue | 8 +- .../js/components/song/SongCard.spec.ts | 38 +++---- .../assets/js/components/song/SongCard.vue | 1 + .../components/song/SongContextMenu.spec.ts | 30 +++--- .../js/components/song/SongContextMenu.vue | 4 +- .../js/components/song/SongList.spec.ts | 64 +++++------ .../assets/js/components/song/SongList.vue | 4 +- .../components/song/SongListControls.spec.ts | 52 ++++----- .../js/components/song/SongListFilter.vue | 6 +- .../js/components/song/SongListItem.spec.ts | 30 +++--- .../js/components/song/SongListItem.vue | 2 +- .../js/components/song/SongListSorter.vue | 2 +- .../js/components/song/SongThumbnail.spec.ts | 28 ++--- .../__snapshots__/EditSongForm.spec.ts.snap | 28 ++--- .../js/components/ui/AlbumArtOverlay.spec.ts | 28 ++--- .../assets/js/components/ui/AlertBox.vue | 6 +- .../js/components/ui/AppleMusicButton.vue | 4 +- .../js/components/ui/ArtistAlbumCard.vue | 4 +- .../ui/ArtistAlbumThumbnail.spec.ts | 52 ++++----- .../js/components/ui/ArtistAlbumThumbnail.vue | 6 +- .../js/components/ui/BtnScrollToTop.vue | 2 +- .../assets/js/components/ui/DialogBox.vue | 4 +- .../assets/js/components/ui/ExternalMark.vue | 2 +- .../js/components/ui/FooterPlayButton.spec.ts | 22 ++-- .../js/components/ui/LyricsPane.spec.ts | 34 +++--- .../assets/js/components/ui/Magnifier.vue | 2 +- resources/assets/js/components/ui/Overlay.vue | 1 + .../js/components/ui/PlaylistThumbnail.vue | 6 +- .../assets/js/components/ui/ScreenHeader.vue | 2 +- .../assets/js/components/ui/SearchForm.vue | 6 +- .../js/components/ui/ThumbnailStack.vue | 2 +- .../js/components/ui/VirtualScroller.vue | 4 +- .../AppleMusicButton.spec.ts.snap | 2 +- .../__snapshots__/BtnScrollToTop.spec.ts.snap | 2 +- .../__snapshots__/ScreenHeader.spec.ts.snap | 2 +- .../ui/album-artist/AlbumOrArtistGrid.vue | 4 +- .../ui/album-artist/AlbumOrArtistInfo.vue | 2 +- .../album-artist/ExpandableContentBlock.vue | 4 +- .../js/components/ui/equalizer/Equalizer.vue | 6 +- .../components/ui/equalizer/EqualizerBand.vue | 2 +- .../js/components/ui/form/BtnGroup.spec.ts | 16 +-- .../assets/js/components/ui/form/CheckBox.vue | 2 +- .../assets/js/components/ui/form/FormRow.vue | 2 +- .../js/components/ui/form/PasswordField.vue | 4 +- .../js/components/ui/form/SelectBox.vue | 4 +- .../assets/js/components/ui/form/TextArea.vue | 2 +- .../js/components/ui/form/TextInput.vue | 2 +- .../form/__snapshots__/CheckBox.spec.ts.snap | 4 +- .../ui/message-toaster/MessageToast.spec.ts | 26 ++--- .../ui/message-toaster/MessageToast.vue | 2 +- .../ui/message-toaster/MessageToaster.vue | 2 +- .../ui/skeletons/ArtistAlbumCardSkeleton.vue | 2 +- .../ui/skeletons/GenreItemSkeleton.vue | 2 +- .../js/components/ui/tabs/TabButton.vue | 6 +- .../assets/js/components/ui/tabs/TabList.vue | 2 +- .../components/ui/upload/UploadItem.spec.ts | 44 ++++---- .../js/components/ui/upload/UploadItem.vue | 4 +- .../ui/youtube/YouTubeVideoItem.spec.ts | 26 ++--- .../ui/youtube/YouTubeVideoItem.vue | 4 +- .../YouTubeVideoItem.spec.ts.snap | 2 +- .../assets/js/components/user/AddUserForm.vue | 3 +- .../js/components/user/EditUserForm.vue | 3 +- .../js/components/user/InviteUserForm.vue | 2 +- .../assets/js/components/user/UserAvatar.vue | 2 +- .../js/components/user/UserCard.spec.ts | 18 ++-- .../assets/js/components/user/UserCard.vue | 4 +- .../js/components/utils/AppInitializer.vue | 4 +- .../components/utils/GlobalEventListeners.vue | 2 +- .../js/components/utils/ImageCropper.vue | 6 +- .../assets/js/composables/useErrorHandler.ts | 20 ++-- .../assets/js/composables/useFloatingUi.ts | 2 +- resources/assets/js/composables/useOverlay.ts | 2 +- resources/assets/js/composables/useUpload.ts | 2 +- resources/assets/js/config/routes.ts | 3 +- .../js/config/smart-playlist/inputTypes.ts | 10 +- .../js/remote/components/RemoteFooter.vue | 16 +-- .../assets/js/remote/components/Scanner.vue | 2 +- .../js/remote/components/SongDetails.vue | 4 +- .../js/remote/components/VolumeControl.vue | 2 +- resources/assets/js/router.ts | 56 +++++----- resources/assets/js/services/http.ts | 76 ++++++------- .../js/services/playbackService.spec.ts | 42 ++++---- .../assets/js/services/playbackService.ts | 102 +++++++++--------- resources/assets/js/services/volumeManager.ts | 2 +- resources/assets/js/stores/equalizerStore.ts | 6 +- resources/assets/js/stores/songStore.ts | 2 +- .../asteroid/scripts/ThreeSharedRenderer.ts | 2 +- .../js/visualizers/waveform/lib/SceneInit.ts | 2 +- 199 files changed, 1257 insertions(+), 1290 deletions(-) diff --git a/resources/assets/js/App.vue b/resources/assets/js/App.vue index c0dc4a5b..65ec87a3 100644 --- a/resources/assets/js/App.vue +++ b/resources/assets/js/App.vue @@ -30,7 +30,7 @@ - + - diff --git a/resources/assets/js/components/screens/search/AlbumExcerptResultsBlock.vue b/resources/assets/js/components/screens/search/AlbumExcerptResultsBlock.vue index 98b0b69d..847e7651 100644 --- a/resources/assets/js/components/screens/search/AlbumExcerptResultsBlock.vue +++ b/resources/assets/js/components/screens/search/AlbumExcerptResultsBlock.vue @@ -18,7 +18,7 @@ - - diff --git a/resources/assets/js/components/song/EditSongForm.spec.ts b/resources/assets/js/components/song/EditSongForm.spec.ts index 709e7279..23a3397e 100644 --- a/resources/assets/js/components/song/EditSongForm.spec.ts +++ b/resources/assets/js/components/song/EditSongForm.spec.ts @@ -12,25 +12,6 @@ import EditSongForm from './EditSongForm.vue' let songs: Song[] new class extends UnitTestCase { - private async renderComponent (_songs: Song | Song[], initialTab: EditSongFormTabName = 'details') { - songs = arrayify(_songs) - - const rendered = this.render(EditSongForm, { - global: { - provide: { - [ModalContextKey]: [ref({ - songs, - initialTab - })] - } - } - }) - - await this.tick() - - return rendered - } - protected test () { it('edits a single song', async () => { const updateMock = this.mock(songStore, 'update') @@ -122,4 +103,23 @@ new class extends UnitTestCase { expect(screen.getByTestId('displayed-album-name').textContent).toBe('IV') }) } + + private async renderComponent (_songs: Song | Song[], initialTab: EditSongFormTabName = 'details') { + songs = arrayify(_songs) + + const rendered = this.render(EditSongForm, { + global: { + provide: { + [ModalContextKey]: [ref({ + songs, + initialTab + })] + } + } + }) + + await this.tick() + + return rendered + } } diff --git a/resources/assets/js/components/song/EditSongForm.vue b/resources/assets/js/components/song/EditSongForm.vue index 0fff95bc..22b45707 100644 --- a/resources/assets/js/components/song/EditSongForm.vue +++ b/resources/assets/js/components/song/EditSongForm.vue @@ -1,18 +1,18 @@ diff --git a/resources/assets/js/components/song/SongListItem.spec.ts b/resources/assets/js/components/song/SongListItem.spec.ts index f4f30b6e..8a5e54ee 100644 --- a/resources/assets/js/components/song/SongListItem.spec.ts +++ b/resources/assets/js/components/song/SongListItem.spec.ts @@ -7,21 +7,6 @@ import SongListItem from './SongListItem.vue' let row: SongRow new class extends UnitTestCase { - private renderComponent (song?: Song) { - song = song ?? factory('song') - - row = { - song, - selected: false - } - - return this.render(SongListItem, { - props: { - item: row - } - }) - } - protected test () { it('renders', async () => { const song = factory('song', { @@ -45,4 +30,19 @@ new class extends UnitTestCase { expect(emitted().play).toBeTruthy() }) } + + private renderComponent (song?: Song) { + song = song ?? factory('song') + + row = { + song, + selected: false + } + + return this.render(SongListItem, { + props: { + item: row + } + }) + } } diff --git a/resources/assets/js/components/song/SongListItem.vue b/resources/assets/js/components/song/SongListItem.vue index 94b8766a..6bacfcb7 100644 --- a/resources/assets/js/components/song/SongListItem.vue +++ b/resources/assets/js/components/song/SongListItem.vue @@ -31,7 +31,7 @@ - {{ song.collaboration.fmt_added_at }} + {{ song.collaboration.fmt_added_at }} {{ fmtLength }} diff --git a/resources/assets/js/components/song/SongListSorter.vue b/resources/assets/js/components/song/SongListSorter.vue index 37211989..8debb493 100644 --- a/resources/assets/js/components/song/SongListSorter.vue +++ b/resources/assets/js/components/song/SongListSorter.vue @@ -1,6 +1,6 @@ - -