decord/source/modules/user_profile/native/UserProfileBadgesEditButton.tsx

118 lines
4.4 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 14107
// Function ID: 14108
2026-08-03 11:20:01 +00:00
// Name: UserProfileBadgesEditButton
2026-08-24 06:08:38 +00:00
// Dependencies: [19, 17, 8968, 21, 4668, 712, 14092, 7177, 4346, 14108, 2008, 14112, 1236, 14104, 4739, 14109, 2]
2026-08-03 11:20:01 +00:00
// Exports: default
2026-08-24 06:08:38 +00:00
// Module 14107 (UserProfileBadgesEditButton)
import ThemesDefault from "Themes" /* 712 */;
import closure_3 from "noop" /* 19 */;
import get_ActivityIndicator from "get ActivityIndicator" /* 17 */;
import { getBadgeAssetFromCDN } from "USER_PROFILE_TOOLTIP_DELAY" /* 8968 */;
import jsxProd from "jsxProd" /* 21 */;
import createCacheKey from "createCacheKey" /* 4668 */;
2026-08-03 11:20:01 +00:00
const require = arg1;
({ Image: c4, View: c5 } = get_ActivityIndicator);
2026-08-24 06:08:38 +00:00
({ jsx: error, jsxs: closure_8 } = jsxProd);
2026-08-14 17:33:39 +00:00
createCacheKey = { content: null, badge: null, hideBadgesLink: null, overflowCount: null };
2026-08-24 06:08:38 +00:00
createCacheKey = { flexGrow: 1, flexShrink: 1, flexDirection: "row", alignItems: "center", gap: ThemesDefault.space.PX_4 };
2026-08-03 11:20:01 +00:00
createCacheKey[0] = createCacheKey;
createCacheKey[1] = { width: 32, height: 32 };
createCacheKey[2] = { marginLeft: "auto" };
2026-08-14 17:33:39 +00:00
createCacheKey[3] = { marginLeft: 2 };
2026-08-24 06:08:38 +00:00
let closure_9 = createCacheKey.createStyles(createCacheKey);
const result = require("set").fileFinishedImporting("modules/user_profile/native/UserProfileBadgesEditButton.tsx");
2026-08-03 11:20:01 +00:00
2026-08-13 07:00:46 +00:00
export default function UserProfileBadgesEditButton(arg0) {
({ badges, catalogBadges } = arg0);
2026-08-03 11:20:01 +00:00
let _require;
2026-08-14 17:33:39 +00:00
let analyticsLocations;
2026-08-24 06:08:38 +00:00
const tmp = callback2();
2026-08-03 11:20:01 +00:00
_require = tmp;
2026-08-24 06:08:38 +00:00
let obj = _require(14092);
2026-08-03 11:20:01 +00:00
const isBadgeManagementEnabled = obj.useIsBadgeManagementEnabled({ location: "UserProfileBadgesEditButton" });
2026-08-24 06:08:38 +00:00
analyticsLocations = analyticsLocations(7177)().analyticsLocations;
2026-08-14 17:33:39 +00:00
[][0] = analyticsLocations;
2026-08-03 11:20:01 +00:00
const callback = React.useCallback(() => {
2026-08-24 06:08:38 +00:00
analyticsLocations(paths[8]).openLazy(lib(paths[10])(paths[9], paths.paths), "Hide Badges", {});
2026-08-03 11:20:01 +00:00
}, []);
if (isBadgeManagementEnabled) {
2026-08-13 07:00:46 +00:00
let length;
if (catalogBadges != null) {
length = catalogBadges.length;
}
if (length == null) {
length = badges.length;
}
const substr = badges.slice(0, 6);
let substr1;
if (catalogBadges != null) {
substr1 = catalogBadges.slice(0, 6);
}
if (substr1 == null) {
substr1 = null;
}
const _Math = Math;
const diff = length - Math.min(length, 6);
let mapped;
if (substr1 != null) {
mapped = substr1.map((name) => name.name);
}
if (mapped == null) {
mapped = substr.map((description) => description.description);
}
const intl = tmp2(1236).intl;
obj = { badge_names: null, overflow_count: null };
obj[0] = mapped.join(", ");
obj[1] = diff;
obj = { label: null, labelTrailing: null, content: null, accessibilityValue: null, onPress: null };
const intl2 = tmp2(1236).intl;
obj[0] = intl2.string(tmp2(1236).t.l6w3Vj);
2026-08-24 06:08:38 +00:00
obj1 = { role: "button", variant: "text-sm/semibold", color: "text-link", style: null, onPress: null, children: null };
2026-08-13 07:00:46 +00:00
obj1[3] = tmp.hideBadgesLink;
obj1[4] = callback;
const intl3 = tmp2(1236).intl;
obj1[5] = intl3.string(tmp2(1236).t.XMDvpN);
2026-08-24 06:08:38 +00:00
obj[1] = callback(tmp2(4739).Text, obj1);
2026-08-13 07:00:46 +00:00
const obj2 = { style: null, "aria-hidden": true, children: null };
obj2[0] = tmp.content;
if (null != substr1) {
2026-08-24 06:08:38 +00:00
let mapped1 = substr1.map((badge) => closure_1_7(analyticsLocations(closure_1_2[15]), { badge, size: 32, style: lib.badge }, badge.badge_id));
2026-08-13 07:00:46 +00:00
} else {
mapped1 = substr.map((iconSrc) => {
2026-08-24 06:08:38 +00:00
const obj = { style: lib.badge, source: null };
2026-08-13 07:00:46 +00:00
iconSrc = iconSrc.iconSrc;
if (iconSrc == null) {
2026-08-24 06:08:38 +00:00
iconSrc = closure_1_6(iconSrc.icon);
2026-08-13 07:00:46 +00:00
}
obj[1] = { uri: iconSrc };
2026-08-24 06:08:38 +00:00
return closure_1_7(closure_1_4, obj, iconSrc.id);
2026-08-13 07:00:46 +00:00
});
}
const items = [mapped1, ];
let tmp13Result = diff > 0;
if (tmp13Result) {
2026-08-14 17:33:39 +00:00
const obj3 = { variant: "text-md/normal", color: "mobile-text-heading-primary", style: null, children: null };
obj3[2] = tmp.overflowCount;
2026-08-13 07:00:46 +00:00
const _HermesInternal = HermesInternal;
2026-08-14 17:33:39 +00:00
obj3[3] = "+" + diff;
2026-08-24 06:08:38 +00:00
tmp13Result = tmp13(tmp2(4739).Text, obj3);
2026-08-13 07:00:46 +00:00
}
items[1] = tmp13Result;
obj2[2] = items;
obj[2] = closure_8(closure_5, obj2);
let tmp18;
if (mapped.length > 0) {
2026-08-03 11:20:01 +00:00
const obj4 = { text: null };
2026-08-13 07:00:46 +00:00
obj4[0] = formatToPlainStringResult;
tmp18 = obj4;
2026-08-03 11:20:01 +00:00
}
2026-08-13 07:00:46 +00:00
obj[3] = tmp18;
obj[4] = tmp6;
2026-08-24 06:08:38 +00:00
return callback(tmp2(14104).UserProfileEditFormButton, obj);
2026-08-13 07:00:46 +00:00
} else {
return null;
2026-08-03 11:20:01 +00:00
}
};