mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-05 06:16:05 +02:00
add dashboard widget
This commit is contained in:
+16
-5
@@ -8,6 +8,21 @@ import {
|
||||
DEFAULT_DASHBOARD_ICON
|
||||
} from '../shared/constants/dashboard';
|
||||
|
||||
function clonePanel(panel) {
|
||||
if (typeof panel === 'string' && panel) {
|
||||
return panel;
|
||||
}
|
||||
if (panel && typeof panel === 'object' && typeof panel.key === 'string' && panel.key) {
|
||||
return {
|
||||
key: panel.key,
|
||||
config: panel.config && typeof panel.config === 'object'
|
||||
? JSON.parse(JSON.stringify(panel.config))
|
||||
: {}
|
||||
};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function cloneRows(rows) {
|
||||
if (!Array.isArray(rows)) {
|
||||
return [];
|
||||
@@ -15,11 +30,7 @@ function cloneRows(rows) {
|
||||
return rows
|
||||
.map((row) => {
|
||||
const panels = Array.isArray(row?.panels)
|
||||
? row.panels
|
||||
.slice(0, 2)
|
||||
.map((panel) =>
|
||||
typeof panel === 'string' && panel ? panel : null
|
||||
)
|
||||
? row.panels.slice(0, 2).map(clonePanel)
|
||||
: [];
|
||||
if (!panels.length) {
|
||||
return null;
|
||||
|
||||
@@ -67,6 +67,9 @@ export const useGameLogStore = defineStore('GameLog', () => {
|
||||
|
||||
const lastResourceloadUrl = ref('');
|
||||
|
||||
// Latest entry ref for GameLog Widget to watch
|
||||
const latestGameLogEntry = ref(null);
|
||||
|
||||
watch(
|
||||
() => watchState.isLoggedIn,
|
||||
() => {
|
||||
@@ -355,6 +358,9 @@ export const useGameLogStore = defineStore('GameLog', () => {
|
||||
entry.isFriend = gameLogIsFriend(entry);
|
||||
entry.isFavorite = gameLogIsFavorite(entry);
|
||||
|
||||
// Update ref for GameLog Widget (independent data stream)
|
||||
latestGameLogEntry.value = entry;
|
||||
|
||||
// If the VIP friend filter is enabled, logs from other friends will be ignored.
|
||||
if (
|
||||
gameLogTable.value.vip &&
|
||||
@@ -461,6 +467,7 @@ export const useGameLogStore = defineStore('GameLog', () => {
|
||||
gameLogTableData,
|
||||
lastVideoUrl,
|
||||
lastResourceloadUrl,
|
||||
latestGameLogEntry,
|
||||
|
||||
clearNowPlaying,
|
||||
resetLastMediaUrls,
|
||||
|
||||
Reference in New Issue
Block a user