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

133 lines
5 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 14139
// Function ID: 14140
2026-08-03 11:20:01 +00:00
// Name: UserProfileBadgesEditButton
2026-08-25 06:04:03 +00:00
// Dependencies: [19, 17, 21, 4380, 712, 9670, 5834, 4347, 14140, 2009, 14142, 9671, 1236, 14136, 4376, 9662, 2]
2026-08-03 11:20:01 +00:00
// Exports: default
2026-08-25 06:04:03 +00:00
// Module 14139 (UserProfileBadgesEditButton)
2026-08-24 06:08:38 +00:00
import ThemesDefault from "Themes" /* 712 */;
import closure_3 from "noop" /* 19 */;
import get_ActivityIndicator from "get ActivityIndicator" /* 17 */;
import jsxProd from "jsxProd" /* 21 */;
2026-08-25 06:04:03 +00:00
import createCacheKey from "createCacheKey" /* 4380 */;
2026-08-03 11:20:01 +00:00
const require = arg1;
({ Image: c4, View: c5 } = get_ActivityIndicator);
2026-08-25 06:04:03 +00:00
({ jsx: closure_6, jsxs: error } = 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-25 06:04:03 +00:00
let closure_8 = createCacheKey.createStyles(createCacheKey);
2026-08-24 06:08:38 +00:00
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-25 06:04:03 +00:00
dependencyMap = undefined;
2026-08-24 06:08:38 +00:00
const tmp = callback2();
2026-08-03 11:20:01 +00:00
_require = tmp;
2026-08-25 06:04:03 +00:00
let obj = _require(9670);
2026-08-03 11:20:01 +00:00
const isBadgeManagementEnabled = obj.useIsBadgeManagementEnabled({ location: "UserProfileBadgesEditButton" });
2026-08-25 06:04:03 +00:00
analyticsLocations = analyticsLocations(5834)().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-25 06:04:03 +00:00
analyticsLocations(closure_2[7]).openLazy(lib(closure_2[9])(closure_2[8], closure_2.paths), "Hide Badges", {});
2026-08-03 11:20:01 +00:00
}, []);
if (isBadgeManagementEnabled) {
2026-08-25 06:04:03 +00:00
dependencyMap = tmp2(9671).getLegacyIconUrlByBadgeId(badges);
2026-08-13 07:00:46 +00:00
let length;
if (catalogBadges != null) {
length = catalogBadges.length;
}
if (length == null) {
length = badges.length;
}
2026-08-25 06:04:03 +00:00
const substr = badges.slice(0, tmp2(9671).MAX_DISPLAYED_PROFILE_BADGES);
2026-08-13 07:00:46 +00:00
let substr1;
if (catalogBadges != null) {
2026-08-25 06:04:03 +00:00
substr1 = catalogBadges.slice(0, tmp2(9671).MAX_DISPLAYED_PROFILE_BADGES);
2026-08-13 07:00:46 +00:00
}
if (substr1 == null) {
substr1 = null;
}
const _Math = Math;
2026-08-25 06:04:03 +00:00
const diff = length - Math.min(length, tmp2(9671).MAX_DISPLAYED_PROFILE_BADGES);
2026-08-13 07:00:46 +00:00
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;
2026-08-25 06:04:03 +00:00
const tmp2Result = tmp2(9671);
2026-08-13 07:00:46 +00:00
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-25 06:04:03 +00:00
obj[1] = callback(tmp2(4376).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-25 06:04:03 +00:00
let mapped1 = substr1.map((badge_id) => {
const value = closure_2.get(badge_id.badge_id);
if (null != value) {
let obj = { style: null, source: null };
obj[0] = lib.badge;
obj = { uri: null };
obj[0] = value;
obj[1] = obj;
let tmp6 = closure_1_6(closure_1_4, obj, badge_id.badge_id);
} else {
obj = { badge: null, size: 32, style: null };
obj[0] = badge_id;
obj[2] = lib.badge;
tmp6 = closure_1_6(analyticsLocations(closure_2[15]), obj, badge_id.badge_id);
2026-08-13 07:00:46 +00:00
}
2026-08-25 06:04:03 +00:00
return tmp6;
});
} else {
mapped1 = substr.map((id) => {
let obj = { style: lib.badge, source: null };
obj = { uri: lib(closure_2[11]).getProfileBadgeIconUrl(id) };
obj[1] = obj;
return closure_1_6(closure_1_4, obj, id.id);
2026-08-13 07:00:46 +00:00
});
}
const items = [mapped1, ];
2026-08-25 06:04:03 +00:00
let tmp15Result = diff > 0;
if (tmp15Result) {
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-25 06:04:03 +00:00
tmp15Result = tmp15(tmp2(4376).Text, obj3);
2026-08-13 07:00:46 +00:00
}
2026-08-25 06:04:03 +00:00
items[1] = tmp15Result;
2026-08-13 07:00:46 +00:00
obj2[2] = items;
2026-08-25 06:04:03 +00:00
obj[2] = closure_7(closure_5, obj2);
let tmp20;
2026-08-13 07:00:46 +00:00
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;
2026-08-25 06:04:03 +00:00
tmp20 = obj4;
2026-08-03 11:20:01 +00:00
}
2026-08-25 06:04:03 +00:00
obj[3] = tmp20;
2026-08-13 07:00:46 +00:00
obj[4] = tmp6;
2026-08-25 06:04:03 +00:00
return callback(tmp2(14136).UserProfileEditFormButton, obj);
2026-08-13 07:00:46 +00:00
} else {
return null;
2026-08-03 11:20:01 +00:00
}
};