decord/source/modules/user_profile/hooks/useProfileTheme.tsx

106 lines
3.3 KiB
TypeScript
Raw Normal View History

// Module ID: 8343
// Function ID: 8344
2026-07-20 16:05:17 +00:00
// Name: useProfileTheme
// Dependencies: [32, 4628, 8344, 1074, 4571, 504, 575, 8249, 1091, 8345, 4488, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
// Module 8343 (useProfileTheme)
import initialize from "initialize" /* 504 */;
import shims from "shims" /* 575 */;
import useThemeDefault from "useTheme" /* 4571 */;
import useAvatarColor from "useAvatarColor" /* 8249 */;
import _slicedToArray from "module_32" /* 32 */;
import AccessibilityStore from "AccessibilityStore" /* 4628 */;
2026-07-23 10:11:24 +00:00
require = fn;
const useEffectiveThemeOverride = fn(8344).useEffectiveThemeOverride;
const ThemeTypes = fn(1074).ThemeTypes;
const size = fn(2);
let result = size.fileFinishedImporting("modules/user_profile/hooks/useProfileTheme.tsx");
2026-07-20 16:05:17 +00:00
export default function useProfileTheme(arg0) {
({ user, displayProfile, pendingAvatarSrc } = arg0);
({ pendingThemeColors, isPreview, forceUserTheme } = arg0);
2026-08-24 06:08:38 +00:00
const tmp2 = useThemeDefault();
2026-07-29 08:29:29 +00:00
const tmp3 = useEffectiveThemeOverride();
const items = [AccessibilityStore];
const stateFromStores = initialize.useStateFromStores(items, () => AccessibilityStore.syncProfileThemeWithUserTheme);
2026-07-29 08:29:29 +00:00
if (pendingAvatarSrc == null) {
2026-07-20 16:05:17 +00:00
let avatarURL;
2026-07-29 08:29:29 +00:00
if (user != null) {
2026-07-20 16:05:17 +00:00
let guildId;
2026-07-29 08:29:29 +00:00
if (displayProfile != null) {
2026-07-20 16:05:17 +00:00
guildId = displayProfile.guildId;
}
avatarURL = user.getAvatarURL(guildId, 80);
}
pendingAvatarSrc = avatarURL;
}
const result = shims.unsafe_getResolvedRawColor("PRIMARY_530", { saturation: 1 });
const tmp4Result = shims;
_slicedToArray(useAvatarColor.useAvatarColors(pendingAvatarSrc, result, false), 2);
2026-07-29 08:29:29 +00:00
if (null != tmp3) {
return tmp3;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
let canEditThemes;
if (displayProfile != null) {
canEditThemes = displayProfile.canEditThemes;
}
if (!canEditThemes) {
2026-07-20 16:05:17 +00:00
if (!isPreview) {
const obj2 = { theme: tmp2, primaryColor: null, secondaryColor: null };
return obj2;
2026-07-20 16:05:17 +00:00
}
}
let previewThemeColors;
2026-07-29 08:29:29 +00:00
if (displayProfile != null) {
2026-07-20 16:05:17 +00:00
previewThemeColors = displayProfile.getPreviewThemeColors(pendingThemeColors);
}
let first;
2026-07-29 08:29:29 +00:00
if (previewThemeColors != null) {
2026-07-20 16:05:17 +00:00
first = previewThemeColors[0];
}
2026-07-29 08:29:29 +00:00
if (first == null) {
first = tmp4(1091).hex2int(tmp10);
const tmp4Result8 = tmp4(1091);
2026-07-20 16:05:17 +00:00
}
let hex2intResult;
2026-07-29 08:29:29 +00:00
if (previewThemeColors != null) {
2026-07-20 16:05:17 +00:00
hex2intResult = previewThemeColors[1];
}
2026-07-29 08:29:29 +00:00
if (hex2intResult == null) {
hex2intResult = tmp4(1091).hex2int(tmp11);
const tmp4Result9 = tmp4(1091);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let tmp16 = tmp2;
2026-07-20 16:05:17 +00:00
if (!stateFromStores) {
2026-07-29 08:29:29 +00:00
tmp16 = tmp2;
2026-07-20 16:05:17 +00:00
if (!forceUserTheme) {
let profileTheme = tmp4(8345).getProfileTheme(first);
2026-07-29 08:29:29 +00:00
if (profileTheme == null) {
profileTheme = tmp2;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp16 = profileTheme;
const tmp4Result10 = tmp4(8345);
2026-07-20 16:05:17 +00:00
}
}
if (tmp16 !== ThemeTypes.ASH) {
let isThemeLightResult = tmp16 === tmp18.ASH;
2026-07-20 16:05:17 +00:00
if (isThemeLightResult) {
isThemeLightResult = tmp4(4488).isThemeLight(tmp2);
const tmp4Result11 = tmp4(4488);
2026-07-20 16:05:17 +00:00
}
let DARK = tmp16;
2026-07-20 16:05:17 +00:00
if (isThemeLightResult) {
DARK = tmp18.DARK;
2026-07-20 16:05:17 +00:00
}
} else {
DARK = tmp2;
const tmp4Result12 = tmp4(4488);
2026-07-20 16:05:17 +00:00
}
const obj3 = { theme: DARK, primaryColor: first, secondaryColor: hex2intResult };
return obj3;
2026-07-20 16:05:17 +00:00
}
const tmp4Result7 = useAvatarColor;
2026-07-20 16:05:17 +00:00
};