From 28e989f42a3ceb4dc98a3e8d6514fec684ed715b Mon Sep 17 00:00:00 2001 From: Maksim Sukharev Date: Tue, 28 Jan 2025 12:55:43 +0100 Subject: [PATCH] fix(sidebarStore): migrate to TS Signed-off-by: Maksim Sukharev --- src/App.vue | 2 +- src/components/CallView/Grid/Grid.vue | 2 +- .../RightSidebar/Participants/ParticipantsTab.vue | 2 +- src/components/RightSidebar/RightSidebar.vue | 2 +- src/components/RightSidebar/SharedItems/SharedItemsTab.vue | 2 +- src/components/TopBar/TopBar.vue | 2 +- src/composables/useViewer.js | 2 +- src/main.js | 2 +- src/stores/__tests__/sidebar.spec.js | 2 +- src/stores/breakoutRooms.ts | 2 +- src/stores/{sidebar.js => sidebar.ts} | 6 +++--- 11 files changed, 13 insertions(+), 13 deletions(-) rename src/stores/{sidebar.js => sidebar.ts} (79%) diff --git a/src/App.vue b/src/App.vue index ea3610c07d..e528fb871c 100644 --- a/src/App.vue +++ b/src/App.vue @@ -51,7 +51,7 @@ import { EventBus } from './services/EventBus.ts' import { leaveConversationSync } from './services/participantsService.js' import { useCallViewStore } from './stores/callView.js' import { useFederationStore } from './stores/federation.ts' -import { useSidebarStore } from './stores/sidebar.js' +import { useSidebarStore } from './stores/sidebar.ts' import { checkBrowser } from './utils/browserCheck.ts' import { signalingKill } from './utils/webrtc/index.js' diff --git a/src/components/CallView/Grid/Grid.vue b/src/components/CallView/Grid/Grid.vue index 4140c80d57..410f2a3d85 100644 --- a/src/components/CallView/Grid/Grid.vue +++ b/src/components/CallView/Grid/Grid.vue @@ -163,7 +163,7 @@ import VideoVue from '../shared/VideoVue.vue' import { placeholderImage, placeholderModel, placeholderName, placeholderSharedData } from './gridPlaceholders.ts' import { PARTICIPANT, ATTENDEE } from '../../../constants.js' import { useCallViewStore } from '../../../stores/callView.js' -import { useSidebarStore } from '../../../stores/sidebar.js' +import { useSidebarStore } from '../../../stores/sidebar.ts' // Max number of videos per page. `0`, the default value, means no cap const videosCap = parseInt(loadState('spreed', 'grid_videos_limit'), 10) || 0 diff --git a/src/components/RightSidebar/Participants/ParticipantsTab.vue b/src/components/RightSidebar/Participants/ParticipantsTab.vue index 6c7f66d18d..e4749d8e62 100644 --- a/src/components/RightSidebar/Participants/ParticipantsTab.vue +++ b/src/components/RightSidebar/Participants/ParticipantsTab.vue @@ -89,7 +89,7 @@ import { getTalkConfig, hasTalkFeature } from '../../../services/CapabilitiesMan import { autocompleteQuery } from '../../../services/coreService.ts' import { EventBus } from '../../../services/EventBus.ts' import { addParticipant } from '../../../services/participantsService.js' -import { useSidebarStore } from '../../../stores/sidebar.js' +import { useSidebarStore } from '../../../stores/sidebar.ts' import CancelableRequest from '../../../utils/cancelableRequest.js' const isFederationEnabled = getTalkConfig('local', 'federation', 'enabled') diff --git a/src/components/RightSidebar/RightSidebar.vue b/src/components/RightSidebar/RightSidebar.vue index 17f044ad6a..3e1776ea17 100644 --- a/src/components/RightSidebar/RightSidebar.vue +++ b/src/components/RightSidebar/RightSidebar.vue @@ -156,7 +156,7 @@ import SetGuestUsername from '../SetGuestUsername.vue' import { CONVERSATION, WEBINAR, PARTICIPANT } from '../../constants.js' import { hasTalkFeature } from '../../services/CapabilitiesManager.ts' -import { useSidebarStore } from '../../stores/sidebar.js' +import { useSidebarStore } from '../../stores/sidebar.ts' export default { name: 'RightSidebar', diff --git a/src/components/RightSidebar/SharedItems/SharedItemsTab.vue b/src/components/RightSidebar/SharedItems/SharedItemsTab.vue index 48be79cb88..6b6166f7d3 100644 --- a/src/components/RightSidebar/SharedItems/SharedItemsTab.vue +++ b/src/components/RightSidebar/SharedItems/SharedItemsTab.vue @@ -101,7 +101,7 @@ import { CONVERSATION } from '../../../constants.js' import { hasTalkFeature } from '../../../services/CapabilitiesManager.ts' import { EventBus } from '../../../services/EventBus.ts' import { useSharedItemsStore } from '../../../stores/sharedItems.js' -import { useSidebarStore } from '../../../stores/sidebar.js' +import { useSidebarStore } from '../../../stores/sidebar.ts' export default { diff --git a/src/components/TopBar/TopBar.vue b/src/components/TopBar/TopBar.vue index b260f5b4bd..af5cb0f3f5 100644 --- a/src/components/TopBar/TopBar.vue +++ b/src/components/TopBar/TopBar.vue @@ -130,7 +130,7 @@ import { useGetParticipants } from '../../composables/useGetParticipants.js' import { AVATAR, CONVERSATION } from '../../constants.js' import { getTalkConfig } from '../../services/CapabilitiesManager.ts' import { useGroupwareStore } from '../../stores/groupware.ts' -import { useSidebarStore } from '../../stores/sidebar.js' +import { useSidebarStore } from '../../stores/sidebar.ts' import { getStatusMessage } from '../../utils/userStatus.ts' import { localCallParticipantModel, localMediaModel } from '../../utils/webrtc/index.js' diff --git a/src/composables/useViewer.js b/src/composables/useViewer.js index 87bb73bdd6..d1a395d09a 100644 --- a/src/composables/useViewer.js +++ b/src/composables/useViewer.js @@ -7,7 +7,7 @@ import { nextTick, ref } from 'vue' import { useIsInCall } from './useIsInCall.js' import { useCallViewStore } from '../stores/callView.js' -import { useSidebarStore } from '../stores/sidebar.js' +import { useSidebarStore } from '../stores/sidebar.ts' /** * @callback OpenViewer diff --git a/src/main.js b/src/main.js index b3e9db0320..1cacc174fb 100644 --- a/src/main.js +++ b/src/main.js @@ -18,7 +18,7 @@ import './init.js' import router from './router/router.js' import { SettingsAPI } from './services/SettingsAPI.ts' import store from './store/index.js' -import { useSidebarStore } from './stores/sidebar.js' +import { useSidebarStore } from './stores/sidebar.ts' // Leaflet icon patch import 'leaflet/dist/leaflet.css' diff --git a/src/stores/__tests__/sidebar.spec.js b/src/stores/__tests__/sidebar.spec.js index a47a48f854..1a52ba94a7 100644 --- a/src/stores/__tests__/sidebar.spec.js +++ b/src/stores/__tests__/sidebar.spec.js @@ -7,7 +7,7 @@ import { setActivePinia, createPinia } from 'pinia' import { emit } from '@nextcloud/event-bus' import BrowserStorage from '../../services/BrowserStorage.js' -import { useSidebarStore } from '../sidebar.js' +import { useSidebarStore } from '../sidebar.ts' jest.mock('@nextcloud/event-bus', () => ({ emit: jest.fn(), diff --git a/src/stores/breakoutRooms.ts b/src/stores/breakoutRooms.ts index 41d7401e8f..7818987434 100644 --- a/src/stores/breakoutRooms.ts +++ b/src/stores/breakoutRooms.ts @@ -9,7 +9,7 @@ import Vue from 'vue' import { showError } from '@nextcloud/dialogs' import { t } from '@nextcloud/l10n' -import { useSidebarStore } from './sidebar.js' +import { useSidebarStore } from './sidebar.ts' import { configureBreakoutRooms, deleteBreakoutRooms, diff --git a/src/stores/sidebar.js b/src/stores/sidebar.ts similarity index 79% rename from src/stores/sidebar.js rename to src/stores/sidebar.ts index dd10d3c81a..e9d563b271 100644 --- a/src/stores/sidebar.js +++ b/src/stores/sidebar.ts @@ -14,9 +14,9 @@ export const useSidebarStore = defineStore('sidebar', { }), actions: { - showSidebar({ activeTab, cache = true } = {}) { + showSidebar({ activeTab = '', cache = true }: { activeTab?: string, cache?: boolean } = {}) { this.show = true - if (activeTab && typeof activeTab === 'string') { + if (activeTab) { emit('spreed:select-active-sidebar-tab', activeTab) } if (cache) { @@ -24,7 +24,7 @@ export const useSidebarStore = defineStore('sidebar', { } }, - hideSidebar({ cache = true } = {}) { + hideSidebar({ cache = true }: { cache?: boolean } = {}) { this.show = false if (cache) { BrowserStorage.setItem('sidebarOpen', 'false')