mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-07 14:56:06 +02:00
friendlog gamelog query data when navigating to pages
This commit is contained in:
+17
-2
@@ -2,6 +2,7 @@ import { computed, reactive, ref, watch } from 'vue';
|
|||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import { toast } from 'vue-sonner';
|
import { toast } from 'vue-sonner';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
compareByCreatedAtAscending,
|
compareByCreatedAtAscending,
|
||||||
@@ -54,6 +55,8 @@ export const useFriendStore = defineStore('Friend', () => {
|
|||||||
const modalStore = useModalStore();
|
const modalStore = useModalStore();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
friendNumber: 0
|
friendNumber: 0
|
||||||
});
|
});
|
||||||
@@ -89,9 +92,20 @@ export const useFriendStore = defineStore('Friend', () => {
|
|||||||
!(filter.value && row.type === 'Unfriend')
|
!(filter.value && row.type === 'Unfriend')
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
pageSizeLinked: true
|
pageSizeLinked: true,
|
||||||
|
loading: false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watch(
|
||||||
|
router.currentRoute,
|
||||||
|
(value) => {
|
||||||
|
if (value.name === 'friend-log') {
|
||||||
|
initFriendLogHistoryTable();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
);
|
||||||
|
|
||||||
const vipFriends = computed(() => {
|
const vipFriends = computed(() => {
|
||||||
return Array.from(friends.values())
|
return Array.from(friends.values())
|
||||||
.filter((f) => f.state === 'online' && f.isVIP)
|
.filter((f) => f.state === 'online' && f.isVIP)
|
||||||
@@ -1268,7 +1282,9 @@ export const useFriendStore = defineStore('Friend', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function initFriendLogHistoryTable() {
|
async function initFriendLogHistoryTable() {
|
||||||
|
friendLogTable.value.loading = true;
|
||||||
friendLogTable.value.data = await database.getFriendLogHistory();
|
friendLogTable.value.data = await database.getFriendLogHistory();
|
||||||
|
friendLogTable.value.loading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1598,7 +1614,6 @@ export const useFriendStore = defineStore('Friend', () => {
|
|||||||
isRefreshFriendsLoading.value = true;
|
isRefreshFriendsLoading.value = true;
|
||||||
watchState.isFriendsLoaded = false;
|
watchState.isFriendsLoaded = false;
|
||||||
friendLog = new Map();
|
friendLog = new Map();
|
||||||
await initFriendLogHistoryTable();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (await configRepository.getBool(`friendLogInit_${userId}`)) {
|
if (await configRepository.getBool(`friendLogInit_${userId}`)) {
|
||||||
|
|||||||
+16
-8
@@ -1,6 +1,7 @@
|
|||||||
import { reactive, ref, shallowRef, watch } from 'vue';
|
import { reactive, ref, shallowRef, watch } from 'vue';
|
||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import { toast } from 'vue-sonner';
|
import { toast } from 'vue-sonner';
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
|
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
@@ -54,6 +55,8 @@ export const useGameLogStore = defineStore('GameLog', () => {
|
|||||||
const sharedFeedStore = useSharedFeedStore();
|
const sharedFeedStore = useSharedFeedStore();
|
||||||
const modalStore = useModalStore();
|
const modalStore = useModalStore();
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
lastLocationAvatarList: new Map()
|
lastLocationAvatarList: new Map()
|
||||||
});
|
});
|
||||||
@@ -87,18 +90,22 @@ export const useGameLogStore = defineStore('GameLog', () => {
|
|||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => watchState.isLoggedIn,
|
() => watchState.isLoggedIn,
|
||||||
(isLoggedIn) => {
|
() => {
|
||||||
gameLogTableData.value = [];
|
gameLogTableData.value = [];
|
||||||
if (isLoggedIn) {
|
|
||||||
// wait for friends to load, silly but works
|
|
||||||
workerTimers.setTimeout(() => {
|
|
||||||
initGameLogTable();
|
|
||||||
}, 800);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{ flush: 'sync' }
|
{ flush: 'sync' }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
router.currentRoute,
|
||||||
|
(value) => {
|
||||||
|
if (value.name === 'game-log') {
|
||||||
|
initGameLogTable();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => watchState.isFavoritesLoaded,
|
() => watchState.isFavoritesLoaded,
|
||||||
(isFavoritesLoaded) => {
|
(isFavoritesLoaded) => {
|
||||||
@@ -1425,6 +1432,7 @@ export const useGameLogStore = defineStore('GameLog', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function initGameLogTable() {
|
async function initGameLogTable() {
|
||||||
|
gameLogTable.value.loading = true;
|
||||||
const rows = await database.lookupGameLogDatabase(
|
const rows = await database.lookupGameLogDatabase(
|
||||||
gameLogTable.value.filter,
|
gameLogTable.value.filter,
|
||||||
[]
|
[]
|
||||||
@@ -1434,6 +1442,7 @@ export const useGameLogStore = defineStore('GameLog', () => {
|
|||||||
row.isFavorite = gameLogIsFavorite(row);
|
row.isFavorite = gameLogIsFavorite(row);
|
||||||
}
|
}
|
||||||
gameLogTableData.value = rows;
|
gameLogTableData.value = rows;
|
||||||
|
gameLogTable.value.loading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -1445,7 +1454,6 @@ export const useGameLogStore = defineStore('GameLog', () => {
|
|||||||
lastVideoUrl,
|
lastVideoUrl,
|
||||||
lastResourceloadUrl,
|
lastResourceloadUrl,
|
||||||
|
|
||||||
initGameLogTable,
|
|
||||||
clearNowPlaying,
|
clearNowPlaying,
|
||||||
tryLoadPlayerList,
|
tryLoadPlayerList,
|
||||||
gameLogIsFriend,
|
gameLogIsFriend,
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
<div class="x-container" ref="friendLogRef">
|
<div class="x-container" ref="friendLogRef">
|
||||||
<DataTableLayout
|
<DataTableLayout
|
||||||
:table="table"
|
:table="table"
|
||||||
|
:loading="friendLogTable.loading"
|
||||||
:table-style="tableHeightStyle"
|
:table-style="tableHeightStyle"
|
||||||
:page-sizes="pageSizes"
|
:page-sizes="pageSizes"
|
||||||
:total-items="totalItems"
|
:total-items="totalItems"
|
||||||
|
|||||||
Reference in New Issue
Block a user