decord/source/modules/hub/HubProgressBarUtils.tsx

103 lines
3.3 KiB
TypeScript
Raw Normal View History

2026-08-05 07:35:12 +00:00
// Module ID: 11908
// Function ID: 11909
2026-07-29 08:29:29 +00:00
// Name: getHubProgressTitleForStep
2026-08-05 07:35:12 +00:00
// Dependencies: [19, 1340, 4949, 8971, 676, 589, 1306, 1236, 1351, 1384, 2]
2026-07-20 16:05:17 +00:00
// Exports: getHubProgressTitleForStep, getNextHubProgressStep, useHubProgressBarCompletedSteps
2026-08-05 07:35:12 +00:00
// Module 11908 (getHubProgressTitleForStep)
2026-07-29 08:29:29 +00:00
import noop from "noop";
import handleConnectionClosedOrResumed from "handleConnectionClosedOrResumed";
import set from "set";
2026-07-23 10:11:24 +00:00
import { HUB_PROGRESS_STEP_ORDER } from "items";
import { PlatformTypes } from "ME";
2026-07-21 06:55:02 +00:00
2026-07-29 08:29:29 +00:00
const require = arg1;
const result = require("set").fileFinishedImporting("modules/hub/HubProgressBarUtils.tsx");
export const getHubProgressTitleForStep = function getHubProgressTitleForStep(nextHubProgressStep) {
if (require(1306) /* create */.HubProgressStep.JOIN_GUILD === nextHubProgressStep) {
const intl3 = tmp(1236).intl;
return intl3.string(tmp(1236).t.iNR25n);
} else if (tmp(1306).HubProgressStep.INVITE_USER === nextHubProgressStep) {
const intl2 = tmp(1236).intl;
return intl2.string(tmp(1236).t["3NlTYU"]);
} else if (tmp(1306).HubProgressStep.CONTACT_SYNC === nextHubProgressStep) {
const intl = tmp(1236).intl;
return intl.string(tmp(1236).t.HFvFte);
} else if (tmp(1306).HubProgressStep.NO_PROGRESS === nextHubProgressStep) {
return null;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
tmp(1351).assertNever(nextHubProgressStep);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
};
export const useHubProgressBarCompletedSteps = function useHubProgressBarCompletedSteps(guild) {
let id;
if (guild != null) {
id = guild.id;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let memo = id;
const items = [handleConnectionClosedOrResumed];
const stateFromStores = memo(stateFromStores1[5]).useStateFromStores(items, () => {
2026-07-20 16:05:17 +00:00
let num = 0;
2026-07-29 08:29:29 +00:00
if (null != memo) {
2026-07-23 10:11:24 +00:00
const guilds = outer1_3.settings.guilds;
2026-07-29 08:29:29 +00:00
let num2;
if (guilds != null) {
if (guilds.guilds[tmp] != null) {
num2 = tmp3.hubProgress;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
if (num2 == null) {
num2 = 0;
2026-07-20 16:05:17 +00:00
}
num = num2;
}
return num;
});
2026-07-29 08:29:29 +00:00
stateFromStores1 = stateFromStores;
2026-07-20 16:05:17 +00:00
const items1 = [stateFromStores];
2026-07-29 08:29:29 +00:00
memo = React.useMemo(() => (function convertHubProgressFlagSetToSet(stateFromStores1) {
2026-07-20 16:05:17 +00:00
const set = new Set();
2026-07-29 08:29:29 +00:00
for (const item10013 of closure_5) {
let tmp2 = callback;
let tmp3 = table;
let tmp = item10013;
let obj2 = callback(table[9]);
if (obj2.hasFlag(arg0, item10013)) {
let tmp4 = item10013;
let addResult = set.add(tmp);
}
continue;
2026-07-20 16:05:17 +00:00
}
return set;
2026-07-29 08:29:29 +00:00
})(stateFromStores1), items1);
const obj = memo(stateFromStores1[5]);
const items2 = [set];
stateFromStores1 = memo(stateFromStores1[5]).useStateFromStores(items2, () => null != localAccount.getLocalAccount(constants.CONTACTS));
const items3 = [memo, stateFromStores1];
2026-07-20 16:05:17 +00:00
return React.useMemo(() => {
2026-07-29 08:29:29 +00:00
if (stateFromStores1) {
2026-07-20 16:05:17 +00:00
const _Set = Set;
2026-07-29 08:29:29 +00:00
const set = new Set(memo);
set.add(memo(stateFromStores1[6]).HubProgressStep.CONTACT_SYNC);
2026-07-20 16:05:17 +00:00
return set;
} else {
2026-07-29 08:29:29 +00:00
return memo;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
}, items3);
2026-07-20 16:05:17 +00:00
};
export const getNextHubProgressStep = function getNextHubProgressStep(hubProgressBarCompletedSteps) {
2026-07-29 08:29:29 +00:00
for (const item10007 of HUB_PROGRESS_STEP_ORDER) {
let tmp = item10007;
if (arg0.has(item10007)) {
continue;
} else {
let tmp2 = item10007;
let tmp3 = obj;
obj.return();
return tmp;
2026-07-20 16:05:17 +00:00
}
}
return null;
};