From 8fe9069278c66af3fc145b8ba28c19eb1ee604d3 Mon Sep 17 00:00:00 2001 From: Olivier Savignac Date: Wed, 12 Jun 2024 17:05:23 -0400 Subject: [PATCH] chore: add OBS Status icon, i18n notifications --- .editorconfig | 1 + .eslintrc.cjs | 8 +- .vscode/settings.json | 14 +- package.json | 2 +- src-electron/electron-preload.ts | 2 +- src/boot/axios.ts | 5 +- src/boot/i18n.ts | 11 - src/boot/obs.ts | 13 +- src/components/form-inputs/SelectInput.vue | 1 + src/components/form-inputs/TimeInput.vue | 41 +- src/components/form-inputs/ToggleInput.vue | 2 +- src/components/media/DownloadStatus.vue | 6 +- src/components/media/ObsStatus.vue | 194 +++++++ src/components/media/ScenePicker.vue | 4 +- src/components/media/SongPicker.vue | 2 +- src/defaults/settings.ts | 10 +- src/helpers/jw-media.ts | 586 +++++++++++---------- src/helpers/notifications.ts | 56 +- src/helpers/obs.ts | 114 ++-- src/i18n/en-US/index.json | 12 +- src/i18n/fr-CA/index.json | 8 +- src/layouts/MainLayout.vue | 36 +- src/pages/CongregationSelectorPage.vue | 2 +- src/pages/MediaCalendarPage.vue | 96 ++-- src/pages/MediaPlayerPage.vue | 6 +- src/pages/SetupWizard.vue | 6 + src/router/routes.ts | 4 +- src/stores/obs-state.ts | 3 +- yarn.lock | 8 +- 29 files changed, 710 insertions(+), 543 deletions(-) create mode 100644 src/components/media/ObsStatus.vue diff --git a/.editorconfig b/.editorconfig index 9d08a1a8..7846ea1d 100644 --- a/.editorconfig +++ b/.editorconfig @@ -7,3 +7,4 @@ indent_size = 2 end_of_line = lf insert_final_newline = true trim_trailing_whitespace = true +max_line_length = 80 diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 06316117..d19e69dc 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -36,14 +36,12 @@ module.exports = { // https://github.com/prettier/eslint-config-prettier#installation // usage with Prettier, provided by 'eslint-config-prettier'. + 'plugin:perfectionist/recommended-natural', 'prettier', - "plugin:perfectionist/recommended-natural", ], plugins: [ // required to apply rules which need type information - '@typescript-eslint', - 'perfectionist', // https://eslint.vuejs.org/user-guide/#why-doesn-t-it-work-on-vue-files // required to lint *.vue files @@ -52,6 +50,8 @@ module.exports = { // https://github.com/typescript-eslint/typescript-eslint/issues/389#issuecomment-509292674 // Prettier has not been included as plugin to avoid performance impact // add it as an extension for your IDE + 'perfectionist', + '@typescript-eslint', ], globals: { @@ -85,6 +85,6 @@ module.exports = { // allow debugger during development only 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off', - "perfectionist/sort-interfaces": "error", + 'perfectionist/sort-interfaces': 'error', }, }; diff --git a/.vscode/settings.json b/.vscode/settings.json index d8e4dee7..d2b83f48 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -11,6 +11,7 @@ "icns", "iscoweek", "jwlplaylist", + "jwpub", "Jwpub", "klaw", "langwritten", @@ -31,5 +32,16 @@ ], "i18n-ally.localesPaths": ["src/i18n"], "i18n-ally.sourceLanguage": "en-US", - "i18n-ally.keystyle": "flat" + "i18n-ally.keystyle": "flat", + + "prettier.useEditorConfig": false, + "prettier.useTabs": false, + "prettier.configPath": ".prettierrc", + + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.formatOnSave": true, + "notebook.formatOnSave.enabled": true, + "[typescript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + } } diff --git a/package.json b/package.json index f6353b87..fe2c9e9b 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "electron-builder": "^24.3.0", "electron-rebuild": "^3.2.9", "eslint": "^8.11.0", - "eslint-config-prettier": "^8.1.0", + "eslint-config-prettier": "^9.1.0", "eslint-plugin-perfectionist": "^2.10.0", "eslint-plugin-vue": "^9.0.0", "node-polyfill-webpack-plugin": "^3.0.0", diff --git a/src-electron/electron-preload.ts b/src-electron/electron-preload.ts index d44e8e08..b1466336 100644 --- a/src-electron/electron-preload.ts +++ b/src-electron/electron-preload.ts @@ -135,7 +135,7 @@ const isWritable = (filePath: fs.PathLike) => { fs.closeSync(fs.openSync(filePath, 'r+')); fileAccess = true; } catch (err) { - console.log('can not open file:' + filePath, 'error:' + err); + console.error('can not open file:' + filePath, 'error:' + err); } return fileAccess; }; diff --git a/src/boot/axios.ts b/src/boot/axios.ts index 38f33592..b13ad9a5 100644 --- a/src/boot/axios.ts +++ b/src/boot/axios.ts @@ -1,6 +1,5 @@ -import { boot } from 'quasar/wrappers'; -console.log('axios start'); import axios, { AxiosRequestConfig } from 'axios'; +import { boot } from 'quasar/wrappers'; export default boot(({ app }) => { app.config.globalProperties.$axios = axios; }); @@ -40,6 +39,4 @@ const getYeartext = async (lang: string, year?: number) => { return await get(urlWithParamsToString(url, params)); }; -console.log('axios end'); - export { get, getLanguages, getYeartext, urlWithParamsToString }; diff --git a/src/boot/i18n.ts b/src/boot/i18n.ts index 2a6970f8..1a1d9c52 100644 --- a/src/boot/i18n.ts +++ b/src/boot/i18n.ts @@ -1,22 +1,14 @@ -console.log('i18n start'); import { boot } from 'quasar/wrappers'; import messages from 'src/i18n'; import { createI18n } from 'vue-i18n'; export type MessageLanguages = keyof typeof messages; -// Type-define 'en-US' as the master schema for the resource export type MessageSchema = (typeof messages)['en-US']; -// See https://vue-i18n.intlify.dev/guide/advanced/typescript.html#global-resource-schema-type-definition /* eslint-disable @typescript-eslint/no-empty-interface */ declare module 'vue-i18n' { - // define the locale messages schema export interface DefineLocaleMessage extends MessageSchema {} - - // define the datetime format schema export interface DefineDateTimeFormat {} - - // define the number format schema export interface DefineNumberFormat {} } /* eslint-enable @typescript-eslint/no-empty-interface */ @@ -30,10 +22,7 @@ export default boot(({ app }) => { locale: 'en-US', messages, }); - - // Set i18n instance on app app.use(i18n); }); -console.log('i18n end'); export { i18n }; diff --git a/src/boot/obs.ts b/src/boot/obs.ts index 69dd2f19..7984add1 100644 --- a/src/boot/obs.ts +++ b/src/boot/obs.ts @@ -1,14 +1,3 @@ -console.log('obs start'); import OBSWebSocket from 'obs-websocket-js'; -import { QNotifyCreateOptions, QNotifyUpdateOptions } from 'quasar'; -import { Ref, ref } from 'vue'; const obsWebSocket = new OBSWebSocket(); -const obsNotification: Ref< - | (( - opts: QNotifyCreateOptions | string, - ) => (props?: QNotifyUpdateOptions | undefined) => void) - | null -> = ref(null); - -console.log('obs end'); -export { obsNotification, obsWebSocket }; +export { obsWebSocket }; diff --git a/src/components/form-inputs/SelectInput.vue b/src/components/form-inputs/SelectInput.vue index 571b0ac2..180cfd0e 100644 --- a/src/components/form-inputs/SelectInput.vue +++ b/src/components/form-inputs/SelectInput.vue @@ -17,6 +17,7 @@ map-options v-model="localValue" v-bind="{ label: label || undefined }" + spellcheck=false > diff --git a/src/components/form-inputs/TimeInput.vue b/src/components/form-inputs/TimeInput.vue index 4a47f23f..8bdba732 100644 --- a/src/components/form-inputs/TimeInput.vue +++ b/src/components/form-inputs/TimeInput.vue @@ -1,10 +1,33 @@