add dashboard widget

This commit is contained in:
pa
2026-03-13 13:43:13 +09:00
parent 0135d9bb29
commit 1ffb2c8b95
12 changed files with 711 additions and 46 deletions
+16 -5
View File
@@ -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;
+7
View File
@@ -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,