Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/05xxx/module_5051.js (118.4 MB)
116 lines
4.5 KiB
TypeScript
116 lines
4.5 KiB
TypeScript
// Module ID: 10970
|
|
// Function ID: 10971
|
|
// Name: BadgeProgressSection
|
|
// Dependencies: [19, 17, 21, 4866, 576, 10871, 4862, 1115, 10856, 2]
|
|
// Exports: default
|
|
|
|
// Module 10970 (BadgeProgressSection)
|
|
import nativeDefault from "native" /* 576 */;
|
|
import util from "util" /* 1115 */;
|
|
import Text_Text from "Text/Text" /* 4862 */;
|
|
import BadgeArtImageDefault from "BadgeArtImage" /* 10856 */;
|
|
import BadgeDetailsUtils from "BadgeDetailsUtils" /* 10871 */;
|
|
import noop from "module_19" /* 19 */;
|
|
|
|
require = fn;
|
|
const View = fn(17).View;
|
|
const jsxProd = fn(21);
|
|
({ jsx: closure_4, jsxs: hasOwnProperty } = jsxProd);
|
|
const createStyles = fn(4866);
|
|
let obj2 = { section: { gap: nativeDefault.space.PX_12 }, row: null, content: null, track: null, fill: null };
|
|
let obj3 = { gap: nativeDefault.space.PX_12 };
|
|
obj2.row = { flexDirection: "row", alignItems: "center", gap: nativeDefault.space.PX_16 };
|
|
let obj4 = { flexDirection: "row", alignItems: "center", gap: nativeDefault.space.PX_16 };
|
|
obj2.content = { flex: 1, gap: nativeDefault.space.PX_8 };
|
|
let obj5 = { flex: 1, gap: nativeDefault.space.PX_8 };
|
|
obj2.track = { height: 8, borderRadius: nativeDefault.radii.round, backgroundColor: nativeDefault.colors.BACKGROUND_MOD_STRONG, overflow: "hidden" };
|
|
let obj6 = { height: 8, borderRadius: nativeDefault.radii.round, backgroundColor: nativeDefault.colors.BACKGROUND_MOD_STRONG, overflow: "hidden" };
|
|
obj2.fill = { height: 8, borderRadius: nativeDefault.radii.round, backgroundColor: nativeDefault.colors.BACKGROUND_BRAND };
|
|
let closure_6 = createStyles.createStyles(obj2);
|
|
const size = fn(2);
|
|
const result = size.fileFinishedImporting("modules/badges/native/BadgeProgressSection.tsx");
|
|
|
|
export default function BadgeProgressSection(arg0) {
|
|
({ badge, viewerBadge } = arg0);
|
|
const tmp = closure_6();
|
|
const badgeProgressDisplay = BadgeDetailsUtils.getBadgeProgressDisplay(badge, viewerBadge);
|
|
({ progress, threshold, currentArtUrl, nextArtUrl, helperText } = badgeProgressDisplay);
|
|
let num = 0;
|
|
if (null != threshold) {
|
|
let num2;
|
|
if (progress != null) {
|
|
num2 = progress.current;
|
|
}
|
|
if (num2 == null) {
|
|
num2 = 0;
|
|
}
|
|
let num3;
|
|
if (progress != null) {
|
|
num3 = progress.floor;
|
|
}
|
|
if (num3 == null) {
|
|
num3 = 0;
|
|
}
|
|
const diff = threshold - num3;
|
|
let num5 = 1;
|
|
if (diff > 0) {
|
|
const _Math = Math;
|
|
const _Math2 = Math;
|
|
num5 = Math.min(Math.max((num2 - num3) / diff, 0), 1);
|
|
}
|
|
num = num5;
|
|
}
|
|
const obj2 = { style: tmp.section, children: null };
|
|
const obj3 = { variant: "text-sm/medium", color: "text-default", children: null };
|
|
const intl = tmp2(1115).intl;
|
|
obj3.children = intl.string(util.t["2m/g2c"]);
|
|
const items = [React4(Text_Text.Text, obj3), ];
|
|
const obj4 = { style: tmp.row, children: null };
|
|
let tmp9Result = null != currentArtUrl;
|
|
if (tmp9Result) {
|
|
const obj5 = { url: currentArtUrl, height: 48 };
|
|
tmp9Result = tmp9(BadgeArtImageDefault, obj5);
|
|
}
|
|
const items1 = [tmp9Result, , ];
|
|
const obj6 = { style: tmp.content, children: null };
|
|
let tmp9Result4 = null != helperText;
|
|
if (tmp9Result4) {
|
|
const obj7 = { variant: "text-sm/medium", "aria-hidden": null != threshold, children: helperText };
|
|
tmp9Result4 = tmp9(tmp2(4862).Text, obj7);
|
|
}
|
|
const items2 = [tmp9Result4, ];
|
|
let tmp9Result5 = null != threshold;
|
|
if (tmp9Result5) {
|
|
const obj8 = { style: tmp.track, accessible: true, accessibilityRole: "progressbar", accessibilityLabel: null, accessibilityValue: null, children: null };
|
|
if (helperText == null) {
|
|
const intl2 = tmp2(1115).intl;
|
|
helperText = intl2.string(tmp2(1115).t.Uwhb1l);
|
|
}
|
|
obj8.accessibilityLabel = helperText;
|
|
const obj9 = { text: null };
|
|
const _Intl = Intl;
|
|
const numberFormat = new Intl.NumberFormat(tmp2(1115).intl.currentLocale, { style: "percent" });
|
|
obj9.text = numberFormat.format(num);
|
|
obj8.accessibilityValue = obj9;
|
|
const obj10 = { style: null };
|
|
const items3 = [tmp.fill, ];
|
|
const obj11 = { width: `${100 * num}%` };
|
|
items3[1] = obj11;
|
|
obj10.style = items3;
|
|
obj8.children = tmp9(tmp8, obj10);
|
|
tmp9Result5 = tmp9(tmp8, obj8);
|
|
}
|
|
items2[1] = tmp9Result5;
|
|
obj6.children = items2;
|
|
items1[1] = hasOwnProperty(View, obj6);
|
|
let tmp9Result6 = null != nextArtUrl;
|
|
if (tmp9Result6) {
|
|
const obj12 = { url: nextArtUrl, height: 48 };
|
|
tmp9Result6 = tmp9(BadgeArtImageDefault, obj12);
|
|
}
|
|
items1[2] = tmp9Result6;
|
|
obj4.children = items1;
|
|
items[1] = hasOwnProperty(View, obj4);
|
|
obj2.children = items;
|
|
return hasOwnProperty(View, obj2);
|
|
};
|