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

108 lines
3.3 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 9007
// Function ID: 9008
2026-07-20 16:05:17 +00:00
// Name: useProfileTheme
2026-08-24 06:08:38 +00:00
// Dependencies: [32, 4669, 9008, 676, 4314, 589, 711, 8384, 688, 8461, 1363, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-08-24 06:08:38 +00:00
// Module 9007 (useProfileTheme)
import initialize from "initialize" /* 589 */;
import useThemeDefault from "useTheme" /* 4314 */;
import closure_3 from "_slicedToArray" /* 32 */;
import closure_4 from "maybeApplyNoTextColorForLightCustomTheme" /* 4669 */;
import { useEffectiveThemeOverride } from "useProfileThemeOverrideStore" /* 9008 */;
import { ThemeTypes } from "ME" /* 676 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
let result = require("set").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();
2026-08-24 06:08:38 +00:00
let obj = initialize;
const items = [closure_4];
2026-07-29 08:29:29 +00:00
const stateFromStores = obj.useStateFromStores(items, () => obj.syncProfileThemeWithUserTheme);
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;
}
2026-07-29 08:29:29 +00:00
let tmp4Result = tmp4(711);
const result = tmp4Result.unsafe_getResolvedRawColor("PRIMARY_530", { saturation: 1 });
2026-08-24 06:08:38 +00:00
tmp4Result = tmp4(8384);
2026-07-29 08:29:29 +00:00
callback(tmp4Result.useAvatarColors(pendingAvatarSrc, result, false), 2);
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) {
2026-07-29 08:29:29 +00:00
obj = { theme: null, primaryColor: null, secondaryColor: null };
obj[0] = tmp2;
2026-07-20 16:05:17 +00:00
return obj;
}
}
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(688).hex2int(tmp10);
const tmp4Result1 = tmp4(688);
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(688).hex2int(tmp11);
const tmp4Result2 = tmp4(688);
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) {
2026-08-24 06:08:38 +00:00
let profileTheme = tmp4(8461).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;
2026-08-24 06:08:38 +00:00
const tmp4Result3 = tmp4(8461);
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
if (tmp16 !== ThemeTypes.DARK) {
let isThemeLightResult = tmp16 === tmp18.DARK;
2026-07-20 16:05:17 +00:00
if (isThemeLightResult) {
2026-08-11 06:20:06 +00:00
isThemeLightResult = tmp4(1363).isThemeLight(tmp2);
const tmp4Result4 = tmp4(1363);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let DARKER = tmp16;
2026-07-20 16:05:17 +00:00
if (isThemeLightResult) {
2026-07-29 08:29:29 +00:00
DARKER = tmp18.DARKER;
2026-07-20 16:05:17 +00:00
}
} else {
2026-07-29 08:29:29 +00:00
DARKER = tmp2;
2026-08-11 06:20:06 +00:00
const tmp4Result5 = tmp4(1363);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj = { theme: null, primaryColor: null, secondaryColor: null };
obj[0] = DARKER;
obj[1] = first;
obj[2] = hex2intResult;
2026-07-20 16:05:17 +00:00
return obj;
}
};