Skip to content

Commit a2b5b22

Browse files
author
NotValra
committed
Merge branch 'main' of https://github.com/NotValra/RoValra
2 parents ba84067 + b508c53 commit a2b5b22

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

src/content/features/groups/hiddenGroupGames.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ const createGameCard = (game, likeMap, playerMap, thumbnailCache) => {
119119
"a",
120120
"game-card-link",
121121
{
122-
href: `https://www.roblox.com/games/${game.rootPlace.id}`,
122+
href: `https://www.roblox.com/games/${game.rootPlace.id}/yippe`,
123123
style: { display: "flex", flexDirection: "column", height: "100%", justifyContent: "space-between" },
124124
},
125125
[el("div", null, {}, [el("div", "game-card-thumb-container", {}, [thumbnail]), el("div", "game-card-name game-name-title", { title: game.name, textContent: game.name })]), el("div", "game-card-info", { innerHTML: DOMPurify.sanitize(infoContent) })]

src/content/features/profile/hiddengames.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const ENDPOINTS = {
2929
VOTES_V1: (ids) => `/v1/games/votes?universeIds=${ids}`,
3030
GAMES_V1: (ids) => `/v1/games?universeIds=${ids}`,
3131

32-
GAME_LINK: (placeId) => `https://www.roblox.com/games/${placeId}`
32+
GAME_LINK: (placeId) => `https://www.roblox.com/games/${placeId}/unnamed` // adding an extra parameter after placeid adds support for btroblox's copy placeid context menu item
3333
};
3434

3535
const Api = {
@@ -162,7 +162,10 @@ const Api = {
162162
}
163163

164164
if (playerRes?.data) {
165-
playerRes.data.forEach(item => state.players.set(item.id, item.playing || 0));
165+
playerRes.data.forEach(item => {
166+
state.players.set(item.id, item.playing || 0);
167+
state.updated.set(item.id, item.updated || 0);
168+
});
166169
}
167170

168171
const newThumbnails = await fetchThumbnailsBatch(batch, 'GameIcon', '256x256');
@@ -277,7 +280,7 @@ const UI = {
277280
class HiddenGamesManager {
278281
constructor(allGames) {
279282
this.allGames = allGames;
280-
this.cache = { likes: new Map(), players: new Map(), thumbnails: new Map() };
283+
this.cache = { likes: new Map(), players: new Map(), updated: new Map(), thumbnails: new Map() };
281284
this.filters = { sort: 'default', order: 'desc' };
282285
this.processedGames = [];
283286
this.visibleCount = 0;
@@ -339,15 +342,17 @@ class HiddenGamesManager {
339342
this.elements.list.appendChild(createShimmerGrid(12, { width: '150px', height: '240px' }));
340343
this.visibleCount = 0;
341344

342-
if (['like-ratio', 'likes', 'dislikes', 'players'].includes(this.filters.sort)) {
345+
if (['default', 'like-ratio', 'likes', 'dislikes', 'players'].includes(this.filters.sort)) {
343346
await Api.enrichGameData(this.allGames, this.cache);
344347
}
345348

346349
const { sort, order } = this.filters;
347350
const orderMultiplier = order === 'desc' ? -1 : 1;
348351
let sorted = [...this.allGames];
349-
350-
if (sort === 'like-ratio') {
352+
353+
if (sort === 'default') {
354+
sorted.sort((a, b) =>(new Date(this.cache.updated.get(a.id) || 0) - new Date(this.cache.updated.get(b.id) || 0)) * orderMultiplier);
355+
} else if (sort === 'like-ratio') {
351356
sorted.sort((a, b) => ((this.cache.likes.get(a.id)?.ratio || 0) - (this.cache.likes.get(b.id)?.ratio || 0)) * orderMultiplier);
352357
} else if (sort === "likes") {
353358
sorted.sort((a, b) => ((this.cache.likes.get(a.id)?.upVotes || 0) - (this.cache.likes.get(b.id)?.upVotes || 0)) * orderMultiplier);

0 commit comments

Comments
 (0)