decord/source/modules/game_mentions/hooks/useGameMentionData.tsx

79 lines
2.7 KiB
TypeScript
Raw Normal View History

// Module ID: 5188
// Function ID: 5189
// Name: useGameMentionData
// Dependencies: [1916, 5189, 1371, 5192, 504, 558, 2]
2026-08-05 07:35:12 +00:00
// Exports: getGameMentionData, useGameMentionData
// Module 5188 (useGameMentionData)
import discord_common_shallowEqualDefault from "discord_common/shallowEqual" /* 558 */;
import useGameProfileObscured from "useGameProfileObscured" /* 5192 */;
import GameStore from "GameStore" /* 1916 */;
import GameAutocompleteStore from "GameAutocompleteStore" /* 5189 */;
import UserStore from "UserStore" /* 1371 */;
2026-08-05 07:35:12 +00:00
const require = globalThis.__r;
require = fn;
const size = fn(2);
const result = size.fileFinishedImporting("modules/game_mentions/hooks/useGameMentionData.tsx");
2026-08-05 07:35:12 +00:00
2026-09-01 10:26:29 +00:00
export const getGameMentionData = function getGameMentionData(gameId) {
const currentUser = UserStore.getCurrentUser();
const game = GameStore.getGame(gameId);
const gameById = GameAutocompleteStore.getGameById(gameId);
2026-08-05 07:35:12 +00:00
if (null != game) {
let nsfwAllowed;
if (currentUser != null) {
nsfwAllowed = currentUser.nsfwAllowed;
}
if (!obj2.isGameProfileObscured(game, nsfwAllowed)) {
const obj4 = { gameId, gameName: null, gameIcon: null };
({ name: obj3.gameName, media } = game);
2026-08-05 07:35:12 +00:00
let icon;
if (media != null) {
icon = media.icon;
}
obj4.gameIcon = icon;
let tmp4 = obj4;
2026-08-05 07:35:12 +00:00
}
2026-08-24 06:08:38 +00:00
obj2 = useGameProfileObscured;
2026-08-05 07:35:12 +00:00
} else if (null != gameById) {
const obj = { gameId, gameName: null, gameIcon: null };
({ name: obj.gameName, icon: obj.gameIcon } = gameById);
2026-08-05 07:35:12 +00:00
tmp4 = obj;
}
return tmp4;
};
export const useGameMentionData = function useGameMentionData(gameId) {
_require = gameId;
const items = [GameStore, GameAutocompleteStore, UserStore];
2026-08-05 07:35:12 +00:00
const items1 = [gameId];
return require("initialize").useStateFromStores(items, () => {
const currentUser = UserStore.getCurrentUser();
const game = GameStore.getGame(closure_0);
const gameById = GameAutocompleteStore.getGameById(closure_0);
2026-08-05 07:35:12 +00:00
if (null != game) {
let nsfwAllowed;
if (currentUser != null) {
nsfwAllowed = currentUser.nsfwAllowed;
}
if (!obj2.isGameProfileObscured(game, nsfwAllowed)) {
const obj4 = { gameId: tmp, gameName: null, gameIcon: null };
({ name: obj3.gameName, media } = game);
2026-08-05 07:35:12 +00:00
let icon;
if (media != null) {
icon = media.icon;
}
obj4.gameIcon = icon;
let tmp5 = obj4;
2026-08-05 07:35:12 +00:00
}
obj2 = useGameProfileObscured;
2026-08-05 07:35:12 +00:00
} else if (null != gameById) {
const obj = { gameId: tmp, gameName: null, gameIcon: null };
({ name: obj.gameName, icon: obj.gameIcon } = gameById);
2026-08-05 07:35:12 +00:00
tmp5 = obj;
}
return tmp5;
}, items1, discord_common_shallowEqualDefault);
2026-08-05 07:35:12 +00:00
};