From d9ef5a9b6b83fbc59a51a0c5a97e1c156b2e008d Mon Sep 17 00:00:00 2001 From: Kasper Seweryn Date: Mon, 18 Apr 2022 00:43:58 +0200 Subject: [PATCH] Cleanup a lot of stuff I've replaced `lodash` with `lodash-es`, so it can be tree-shaken `~/modules` is a directory with application modules that run before app is mounted. Useful for configuration, web socket connection, and other stuff `~/composables` is a directory with our custom composables. Much like `~/utils` but each util is in its own file --- TRANSLATORS.rst | 2 +- front/.eslintrc.js | 2 + front/index.html | 6 +- front/package.json | 11 +- front/scripts/i18n-compile.sh | 2 +- front/scripts/i18n-extract.sh | 2 +- .../i18n-populate-contextualized-strings.sh | 2 +- front/src/App.vue | 583 +++++------------- front/src/AppOld.vue | 460 ++++++++++++++ front/src/components.d.ts | 3 +- front/src/components/About.vue | 44 +- front/src/components/AboutPod.vue | 42 +- front/src/components/Home.vue | 26 +- front/src/components/Pagination.vue | 12 +- front/src/components/Queue.vue | 6 +- front/src/components/SetInstanceModal.vue | 4 +- front/src/components/Sidebar.vue | 39 +- front/src/components/admin/SettingsGroup.vue | 4 +- .../components/admin/SignupFormBuilder.vue | 10 +- front/src/components/audio/ChannelCard.vue | 2 +- front/src/components/audio/ChannelEntries.vue | 4 +- front/src/components/audio/ChannelSeries.vue | 4 +- front/src/components/audio/ChannelsWidget.vue | 4 +- front/src/components/audio/EmbedWizard.vue | 4 +- front/src/components/audio/Player.vue | 14 +- front/src/components/audio/Search.vue | 4 +- front/src/components/audio/SearchBar.vue | 6 +- front/src/components/audio/track/Table.vue | 6 +- front/src/components/audio/track/Widget.vue | 4 +- front/src/components/auth/ApplicationForm.vue | 4 +- front/src/components/auth/Authorize.vue | 4 +- front/src/components/auth/Plugin.vue | 4 +- front/src/components/channels/UploadModal.vue | 2 +- front/src/components/common/Duration.vue | 2 +- front/src/components/common/UserMenu.vue | 25 +- front/src/components/common/UserModal.vue | 12 +- front/src/components/favorites/List.vue | 4 +- .../components/federation/LibraryWidget.vue | 4 +- front/src/components/library/AlbumBase.vue | 4 +- front/src/components/library/AlbumDetail.vue | 2 +- front/src/components/library/ArtistBase.vue | 4 +- front/src/components/library/Artists.vue | 2 +- front/src/components/library/EditForm.vue | 14 +- front/src/components/library/EditList.vue | 4 +- front/src/components/library/FileUpload.vue | 6 +- .../components/library/FileUploadWidget.vue | 2 +- front/src/components/library/Home.vue | 2 +- front/src/components/library/Podcasts.vue | 2 +- front/src/components/library/Radios.vue | 2 +- front/src/components/library/TagsSelector.vue | 4 +- front/src/components/library/TrackBase.vue | 12 +- .../src/components/library/radios/Builder.vue | 6 +- .../src/components/library/radios/Filter.vue | 4 +- front/src/components/manage/ChannelsTable.vue | 8 +- .../components/manage/library/AlbumsTable.vue | 8 +- .../manage/library/ArtistsTable.vue | 8 +- .../manage/library/EditsCardList.vue | 8 +- .../manage/library/LibrariesTable.vue | 8 +- .../components/manage/library/TagsTable.vue | 8 +- .../components/manage/library/TracksTable.vue | 8 +- .../manage/library/UploadsTable.vue | 8 +- .../manage/moderation/AccountsTable.vue | 8 +- .../manage/moderation/DomainsTable.vue | 8 +- .../manage/moderation/InstancePolicyForm.vue | 14 +- .../manage/users/InvitationsTable.vue | 6 +- .../components/manage/users/UsersTable.vue | 8 +- front/src/components/mixins/Themes.vue | 25 - .../moderation/ReportCategoryDropdown.vue | 3 +- .../components/playlists/PlaylistModal.vue | 4 +- front/src/components/playlists/Widget.vue | 4 +- front/src/components/radios/Button.vue | 4 +- front/src/composables/updateQueryString.ts | 9 + front/src/composables/useTheme.ts | 12 + front/src/composables/useThemeList.ts | 24 + front/src/composables/useWebSocketHandler.ts | 15 + front/src/{embed/embed.js => embed.ts} | 1 - front/src/embed/EmbedFrame.vue | 4 +- front/src/{jquery.js => jquery.ts} | 0 front/src/locales.js | 129 ---- front/src/locales.ts | 129 ++++ front/src/{logging.js => logging.ts} | 0 front/src/main.js | 199 ------ front/src/main.ts | 35 ++ front/src/modules/axios.ts | 109 ++++ front/src/modules/directives.ts | 24 + front/src/{filters.js => modules/filters.ts} | 73 +-- .../globalComponents.ts} | 45 +- front/src/modules/instance.ts | 40 ++ front/src/modules/internalLinks.ts | 13 + front/src/modules/locale.ts | 65 ++ .../src/{semantic.js => modules/semantic.ts} | 0 front/src/modules/serviceWorker.ts | 45 ++ front/src/modules/webSocket.ts | 28 + front/src/modules/window.ts | 16 + front/src/registerServiceWorker.js | 46 -- front/src/router/{index.js => index.ts} | 0 front/src/store/auth.js | 3 +- front/src/store/{index.js => index.ts} | 6 +- front/src/store/instance.js | 26 +- front/src/store/moderation.js | 4 +- front/src/store/queue.js | 4 +- front/src/store/ui.js | 14 - front/src/types.ts | 78 +++ front/src/utils.js | 59 -- front/src/utils/index.ts | 63 ++ front/src/utils/time.js | 31 - front/src/utils/time.ts | 28 + front/src/utils/url.js | 11 - .../src/views/admin/library/UploadDetail.vue | 2 +- .../views/admin/moderation/AccountsDetail.vue | 2 - front/src/views/admin/moderation/Base.vue | 4 +- .../views/admin/moderation/DomainsDetail.vue | 10 +- .../views/admin/moderation/ReportsList.vue | 6 +- .../views/admin/moderation/RequestsList.vue | 6 +- front/src/views/content/Home.vue | 2 +- .../views/content/libraries/FilesTable.vue | 8 +- front/src/views/content/libraries/Quota.vue | 2 +- front/tests/unit/specs/store/queue.spec.js | 2 - front/tsconfig.json | 9 + front/{vite.config.js => vite.config.ts} | 15 +- front/yarn.lock | 203 ++---- 121 files changed, 1801 insertions(+), 1449 deletions(-) create mode 100644 front/src/AppOld.vue delete mode 100644 front/src/components/mixins/Themes.vue create mode 100644 front/src/composables/updateQueryString.ts create mode 100644 front/src/composables/useTheme.ts create mode 100644 front/src/composables/useThemeList.ts create mode 100644 front/src/composables/useWebSocketHandler.ts rename front/src/{embed/embed.js => embed.ts} (99%) rename front/src/{jquery.js => jquery.ts} (100%) delete mode 100644 front/src/locales.js create mode 100644 front/src/locales.ts rename front/src/{logging.js => logging.ts} (100%) delete mode 100644 front/src/main.js create mode 100644 front/src/main.ts create mode 100644 front/src/modules/axios.ts create mode 100644 front/src/modules/directives.ts rename front/src/{filters.js => modules/filters.ts} (63%) rename front/src/{components/globals.js => modules/globalComponents.ts} (56%) create mode 100644 front/src/modules/instance.ts create mode 100644 front/src/modules/internalLinks.ts create mode 100644 front/src/modules/locale.ts rename front/src/{semantic.js => modules/semantic.ts} (100%) create mode 100644 front/src/modules/serviceWorker.ts create mode 100644 front/src/modules/webSocket.ts create mode 100644 front/src/modules/window.ts delete mode 100644 front/src/registerServiceWorker.js rename front/src/router/{index.js => index.ts} (100%) rename front/src/store/{index.js => index.ts} (95%) create mode 100644 front/src/types.ts delete mode 100644 front/src/utils.js create mode 100644 front/src/utils/index.ts delete mode 100644 front/src/utils/time.js create mode 100644 front/src/utils/time.ts delete mode 100644 front/src/utils/url.js rename front/{vite.config.js => vite.config.ts} (85%) diff --git a/TRANSLATORS.rst b/TRANSLATORS.rst index 7fea7e399..4a896408d 100644 --- a/TRANSLATORS.rst +++ b/TRANSLATORS.rst @@ -28,7 +28,7 @@ Submitting a new language 1. Pull the latest version of ``develop`` 2. Create a new branch, e.g ``git checkout -b translations-new-fr-ca`` -3. Add your new language code and name in ``front/src/locales.js``. Use the native language name, as it is what appears in the UI selector. +3. Add your new language code and name in ``front/src/locales.ts``. Use the native language name, as it is what appears in the UI selector. 4. Create the ``po`` file from template: .. code-block:: shell diff --git a/front/.eslintrc.js b/front/.eslintrc.js index 6173dd055..039099f69 100644 --- a/front/.eslintrc.js +++ b/front/.eslintrc.js @@ -24,6 +24,8 @@ module.exports = { 'vue/no-v-html': 'off', // TODO: tackle this properly 'vue/no-use-v-if-with-v-for': 'off', + '@typescript-eslint/ban-ts-comment': 'off', + 'no-undef': 'off', // TODO: Enable typescript rules later '@typescript-eslint/no-this-alias': 'off', '@typescript-eslint/no-empty-function': 'off' diff --git a/front/index.html b/front/index.html index ace99da15..2cee400cf 100644 --- a/front/index.html +++ b/front/index.html @@ -8,7 +8,6 @@ Funkwhale - diff --git a/front/src/components.d.ts b/front/src/components.d.ts index c96fdf834..a32e4b5ec 100644 --- a/front/src/components.d.ts +++ b/front/src/components.d.ts @@ -1,7 +1,6 @@ // generated by unplugin-vue-components // We suggest you to commit this file into source control // Read more: https://github.com/vuejs/vue-next/pull/3399 -import '@vue/runtime-core' declare module '@vue/runtime-core' { export interface GlobalComponents { @@ -161,4 +160,4 @@ declare module '@vue/runtime-core' { } } -export {} +export { } diff --git a/front/src/components/About.vue b/front/src/components/About.vue index 5ef16e57b..1a88bec48 100644 --- a/front/src/components/About.vue +++ b/front/src/components/About.vue @@ -250,9 +250,9 @@ diff --git a/front/src/components/moderation/ReportCategoryDropdown.vue b/front/src/components/moderation/ReportCategoryDropdown.vue index 4521f5b1c..886f15b52 100644 --- a/front/src/components/moderation/ReportCategoryDropdown.vue +++ b/front/src/components/moderation/ReportCategoryDropdown.vue @@ -26,7 +26,6 @@