mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-05 22:36:05 +02:00
Fix group sidebar sort order
This commit is contained in:
@@ -7,7 +7,7 @@ const buildDir = path.join(rootDir, 'build');
|
|||||||
|
|
||||||
let version = '';
|
let version = '';
|
||||||
try {
|
try {
|
||||||
version = fs.readFileSync(versionFilePath, 'utf8').trim();
|
version = fs.readFileSync(versionFilePath, 'utf8').trim().replaceAll('.', '');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error reading Version file:', err);
|
console.error('Error reading Version file:', err);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
|
|||||||
@@ -1239,7 +1239,6 @@ export default class extends baseClass {
|
|||||||
instance: this.applyInstance(json)
|
instance: this.applyInstance(json)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
$app.groupInstances.sort(this.sortGroupInstancesByInGame);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -46,6 +46,10 @@
|
|||||||
groupInstances: {
|
groupInstances: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => []
|
default: () => []
|
||||||
|
},
|
||||||
|
groupOrder: {
|
||||||
|
type: Array,
|
||||||
|
default: () => []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@@ -76,7 +80,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return Array.from(groupMap.values());
|
return Array.from(groupMap.values()).sort(this.sortGroupInstancesByInGame);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -88,6 +92,20 @@
|
|||||||
},
|
},
|
||||||
getGroupId(group) {
|
getGroupId(group) {
|
||||||
return group[0]?.group?.groupId || '';
|
return group[0]?.group?.groupId || '';
|
||||||
|
},
|
||||||
|
sortGroupInstancesByInGame(a, b) {
|
||||||
|
var aIndex = this.groupOrder.indexOf(a[0]?.group?.id);
|
||||||
|
var bIndex = this.groupOrder.indexOf(b[0]?.group?.id);
|
||||||
|
if (aIndex === -1 && bIndex === -1) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (aIndex === -1) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (bIndex === -1) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return aIndex - bIndex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -290,4 +290,7 @@ mixin friendsListSidebar
|
|||||||
template(#label)
|
template(#label)
|
||||||
span {{ $t('side_panel.groups') }}
|
span {{ $t('side_panel.groups') }}
|
||||||
span(style='color: #909399; font-size: 12px; margin-left: 10px') ({{ groupInstances.length }})
|
span(style='color: #909399; font-size: 12px; margin-left: 10px') ({{ groupInstances.length }})
|
||||||
groups-sidebar(:group-instances='groupInstances' @show-group-dialog='showGroupDialog')
|
groups-sidebar(
|
||||||
|
:group-instances='groupInstances'
|
||||||
|
:group-order='inGameGroupOrder'
|
||||||
|
@show-group-dialog='showGroupDialog')
|
||||||
|
|||||||
Reference in New Issue
Block a user