decord/source/modules/user_profile/hooks/useUserProfileActivityTabContent.tsx
github-actions ecf26fc058 chore: update source for alpha 347.2
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4823.js (118.4 MB)
2026-09-16 07:03:15 +00:00

124 lines
4.3 KiB
TypeScript

// Module ID: 13213
// Function ID: 13214
// Name: useUserProfileActivityTabContent
// Dependencies: [19, 8932, 4678, 5365, 4657, 7729, 1074, 3, 13214, 13187, 13189, 8471, 504, 2]
// Exports: default
// Module 13213 (useUserProfileActivityTabContent)
import LoggerDefault from "Logger" /* 3 */;
import ContentInventoryTypes from "ContentInventoryTypes" /* 8471 */;
import maybeFetchContentInventoryOutboxDefault from "maybeFetchContentInventoryOutbox" /* 13214 */;
import noop from "module_19" /* 19 */;
import ContentInventoryOutboxStore from "ContentInventoryOutboxStore" /* 8932 */;
import PresenceStore from "PresenceStore" /* 4678 */;
import SelfPresenceStore from "SelfPresenceStore" /* 5365 */;
import VoiceStateStore from "VoiceStateStore" /* 4657 */;
import UserProfileStore from "UserProfileStore" /* 7729 */;
require = fn;
const StatusTypes = fn(1074).StatusTypes;
let closure_10 = new LoggerDefault("useUserProfileActivityTabContent");
const size = fn(2);
const result = size.fileFinishedImporting("modules/user_profile/hooks/useUserProfileActivityTabContent.tsx");
export default function useUserProfileActivityTabContent(userId) {
userId = userId.userId;
recent = undefined;
let voiceChannel;
let voiceActivity;
closure_4 = undefined;
const items = [userId];
({ currentUserId, guildId } = userId);
const effect = voiceActivity.useEffect(() => {
const promise = maybeFetchContentInventoryOutboxDefault(userId);
if (promise != null) {
promise.catch((error) => {
logger.log("Failed to fetch content inventory outbox for " + userId + ":", error);
});
}
}, items);
const tmp2 = recent(voiceChannel[9])(userId);
({ live, recent } = tmp2);
const stream = tmp2.stream;
const tmp3 = recent(voiceChannel[10])({ userId, guildId });
voiceChannel = tmp3.voiceChannel;
voiceActivity = tmp3.voiceActivity;
const items1 = [recent];
const memo = voiceActivity.useMemo(() => recent.filter(ContentInventoryTypes.isRecentActivityEntry), items1);
const items2 = [closure_4];
closure_4 = tmp5;
const stateFromStores = userId(voiceChannel[12]).useStateFromStores(items2, () => ContentInventoryOutboxStore.isFetchingUserOutbox(userId));
const obj = userId(voiceChannel[12]);
const items3 = [SelfPresenceStore, PresenceStore];
const stateFromStores1 = userId(voiceChannel[12]).useStateFromStores(items3, () => {
if (closure_4) {
let status = SelfPresenceStore.getStatus();
} else {
status = PresenceStore.getStatus(userId);
}
return status === StatusTypes.OFFLINE || status === StatusTypes.INVISIBLE;
});
const obj2 = userId(voiceChannel[12]);
const items4 = [UserProfileStore];
const stateFromStores2 = userId(voiceChannel[12]).useStateFromStores(items4, () => {
const userProfile = UserProfileStore.getUserProfile(userId);
let _private;
if (userProfile != null) {
_private = userProfile.private;
}
return true === _private;
});
const obj3 = userId(voiceChannel[12]);
const items5 = [VoiceStateStore];
let found = live;
const stateFromStores3 = userId(voiceChannel[12]).useStateFromStores(items5, () => {
let isInChannelResult = null != voiceChannel;
if (isInChannelResult) {
isInChannelResult = VoiceStateStore.isInChannel(tmp.id);
}
return isInChannelResult;
});
if (null != voiceActivity) {
found = live.filter((item) => item !== voiceActivity);
}
let tmp9 = stateFromStores1;
if (!stateFromStores1) {
tmp9 = stateFromStores2;
}
if (tmp9) {
tmp9 = null != voiceChannel;
}
if (tmp9) {
tmp9 = stateFromStores3;
}
let tmp10 = !tmp9;
if (!tmp9) {
tmp10 = !stateFromStores1;
}
if (tmp10) {
let tmp11 = found.length > 0;
if (!tmp11) {
let tmp12 = !stateFromStores2;
if (!stateFromStores2) {
tmp12 = null != voiceChannel;
}
tmp11 = tmp12;
}
if (!tmp11) {
let tmp13 = !stateFromStores2;
if (!stateFromStores2) {
tmp13 = null != stream;
}
if (tmp13) {
let id;
if (voiceChannel != null) {
id = voiceChannel.id;
}
tmp13 = stream.channelId !== id;
}
tmp11 = tmp13;
}
tmp10 = tmp11;
}
return { recent: memo, isFetching: stateFromStores, isCurrentUser: userId === currentUserId, hasCurrentActivity: tmp10, hasRecentActivity: memo.length > 0 };
};