@@ -24,10 +24,10 @@
+ {{ i18n.ts.startMessaging }}
+ {{ i18n.ts.manageGroups }}
- {{ i18n.ts.startMessaging }}
- {{ i18n.ts.manageGroups }}
-
+
@@ -60,6 +60,10 @@ const router = useRouter();
let messages = $ref([]);
let connection = $ref(null);
+const tabs = ['dms', 'groups'];
+let tab = $ref(tabs[0]);
+watch($$(tab), () => (syncSlide(tabs.indexOf(tab))));
+
const dmsPagination = {
endpoint: 'messaging/history' as const,
limit: 15,
@@ -75,10 +79,6 @@ const groupsPagination = {
},
};
-const tabs = ['dms', 'groups'];
-let tab = $ref(tabs[0]);
-watch($$(tab), () => (syncSlide(tabs.indexOf(tab))));
-
const headerActions = $computed(() => []);
const headerTabs = $computed(() => [{
@@ -96,21 +96,6 @@ definePageMetadata({
icon: 'fas fa-comments',
});
-let swiperRef = null;
-
-function setSwiperRef(swiper) {
- swiperRef = swiper;
- syncSlide(tabs.indexOf(tab));
-}
-
-function onSlideChange() {
- tab = tabs[swiperRef.activeIndex];
-}
-
-function syncSlide(index) {
- swiperRef.slideTo(index);
-}
-
function onMessage(message) {
if (message.recipientId) {
messages = messages.filter(m => !(
@@ -184,6 +169,21 @@ onUnmounted(() => {
if (connection) connection.dispose();
});
+let swiperRef = null;
+
+function setSwiperRef(swiper) {
+ swiperRef = swiper;
+ syncSlide(tabs.indexOf(tab));
+}
+
+function onSlideChange() {
+ tab = tabs[swiperRef.activeIndex];
+}
+
+function syncSlide(index) {
+ swiperRef.slideTo(index);
+}
+