decord/source/modules/launchpad/native/LaunchPadSearchResults.tsx

310 lines
13 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 16324
// Function ID: 16325
2026-07-20 16:05:17 +00:00
// Name: renderItemJSX
2026-08-25 06:04:03 +00:00
// Dependencies: [19, 17, 1996, 7242, 1910, 4590, 21, 4380, 712, 16325, 6066, 589, 4821, 16326, 4949, 16327, 16329, 5885, 16330, 16332, 7452, 16333, 16339, 16340, 16342, 15463, 4376, 1367, 1236, 1494, 16328, 8159, 2]
2026-07-20 16:05:17 +00:00
2026-08-25 06:04:03 +00:00
// Module 16324 (renderItemJSX)
2026-08-24 06:08:38 +00:00
import ThemesDefault from "Themes" /* 712 */;
import getSystemLocale from "getSystemLocale" /* 1236 */;
import useIsMobileVisualRefreshExperimentEnabledDefault from "useIsMobileVisualRefreshExperimentEnabled" /* 1367 */;
2026-08-25 06:04:03 +00:00
import GuildIconSizesDefault from "GuildIconSizes" /* 5885 */;
import sortByMatchScore from "sortByMatchScore" /* 7452 */;
import renderCategoryItem from "renderCategoryItem" /* 15463 */;
import getLayoutStyleDefault from "getLayoutStyle" /* 16325 */;
import itemsDefault from "items" /* 16326 */;
import renderChannelWrapperDefault from "renderChannelWrapper" /* 16327 */;
import _modDef16329 from "module_16329" /* 16329 */;
import ChannelContentDefault from "ChannelContent" /* 16330 */;
import renderChannelBadgeDefault from "renderChannelBadge" /* 16332 */;
import _modDef16333 from "module_16333" /* 16333 */;
import _modDef16339 from "module_16339" /* 16339 */;
import handleVoiceOrStageChannelConnectPressDefault from "handleVoiceOrStageChannelConnectPress" /* 16340 */;
import userDefault from "user" /* 16342 */;
2026-08-24 06:08:38 +00:00
import importAllResult from "noop" /* 19 */;
import { View } from "get ActivityIndicator" /* 17 */;
2026-08-25 06:04:03 +00:00
import closure_5 from "_getSystemLocale" /* 1996 */;
import closure_6 from "updateGuildUnreadSentinel" /* 7242 */;
2026-08-24 06:08:38 +00:00
import closure_7 from "createGuildRecordFromRust" /* 1910 */;
2026-08-25 06:04:03 +00:00
import { UnreadSetting } from "ReadStateTypes" /* 4590 */;
2026-08-24 06:08:38 +00:00
import jsxProd from "jsxProd" /* 21 */;
2026-08-25 06:04:03 +00:00
import createCacheKey from "createCacheKey" /* 4380 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-20 16:05:17 +00:00
function renderItemJSX(result) {
result = result.result;
if (null == result) {
return null;
} else {
const type = result.type;
2026-08-24 06:08:38 +00:00
if (sortByMatchScore.AutocompleterResultTypes.GUILD === type) {
2026-07-29 08:29:29 +00:00
let obj = { guild: null };
obj[0] = result.record;
2026-07-20 16:05:17 +00:00
return callback(closure_14, obj);
2026-08-25 06:04:03 +00:00
} else if (tmp14(7452).AutocompleterResultTypes.TEXT_CHANNEL === type) {
2026-07-29 08:29:29 +00:00
obj = { channel: null, navigationReplace: true, showGuildBadgeIcon: true };
obj[0] = result.record;
2026-08-25 06:04:03 +00:00
return callback(_modDef16333, obj);
} else if (tmp14(7452).AutocompleterResultTypes.GROUP_DM === type) {
2026-08-24 06:08:38 +00:00
obj1 = { channel: null, navigationReplace: true };
2026-07-29 08:29:29 +00:00
obj1[0] = result.record;
2026-08-25 06:04:03 +00:00
return callback(_modDef16339, obj1);
} else if (tmp14(7452).AutocompleterResultTypes.VOICE_CHANNEL === type) {
2026-07-29 08:29:29 +00:00
const obj2 = { channel: null };
obj2[0] = result.record;
2026-08-24 06:08:38 +00:00
return callback(handleVoiceOrStageChannelConnectPressDefault, obj2);
2026-08-25 06:04:03 +00:00
} else if (tmp14(7452).AutocompleterResultTypes.USER === type) {
2026-07-29 08:29:29 +00:00
({ record: obj4[0], comparator: obj4[1] } = result);
2026-08-24 06:08:38 +00:00
return callback(userDefault, { user: null, comparator: null });
2026-08-25 06:04:03 +00:00
} else if (tmp14(7452).AutocompleterResultTypes.HEADER === type) {
2026-07-29 08:29:29 +00:00
const obj4 = { name: null, styles: null, isRefreshEnabled: null };
obj4[0] = result.record.text;
obj4[1] = tmp;
obj4[2] = tmp2;
2026-08-25 06:04:03 +00:00
return tmp14(15463).renderCategoryItem(obj4);
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
obj = { variant: "text-sm/semibold", children: null };
obj[1] = result.type;
2026-08-25 06:04:03 +00:00
return callback(tmp14(4376).Text, obj);
2026-07-20 16:05:17 +00:00
}
}
}
function renderSearchResultsSection() {
2026-07-29 08:29:29 +00:00
const obj = { name: null };
2026-08-24 06:08:38 +00:00
const intl = getSystemLocale.intl;
obj[0] = intl.string(getSystemLocale.t["zkoeq/"]);
2026-07-29 08:29:29 +00:00
return callback(closure_16, obj);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let c3 = importAllResult;
({ jsx: c9, Fragment: c10, jsxs: unpackModuleId } = jsxProd);
2026-07-20 16:05:17 +00:00
let closure_12 = { bottom: 24 };
2026-07-29 08:29:29 +00:00
let obj = { listContainer: { minHeight: 16 }, list: { flex: -1, marginTop: 8 }, guildIcon: null, categoryWrapper: null, pressable: null, pressableUnderlayColor: null };
2026-08-24 06:08:38 +00:00
obj = { borderRadius: ThemesDefault.radii.sm };
2026-07-29 08:29:29 +00:00
obj[2] = obj;
2026-08-24 06:08:38 +00:00
createCacheKey = { backgroundColor: ThemesDefault.colors.BACKGROUND_BASE_LOW };
2026-07-29 08:29:29 +00:00
obj[3] = createCacheKey;
obj[4] = { flex: 1 };
2026-08-24 06:08:38 +00:00
obj[5] = { backgroundColor: ThemesDefault.colors.INTERACTIVE_BACKGROUND_ACTIVE };
2026-07-29 08:29:29 +00:00
let closure_13 = createCacheKey.createStyles(obj);
2026-07-20 16:05:17 +00:00
let closure_14 = importAllResult.memo((guild) => {
guild = guild.guild;
const tmp = callback3();
2026-08-24 06:08:38 +00:00
const tmp2 = getLayoutStyleDefault();
2026-07-20 16:05:17 +00:00
const items = [guild.id];
const callback = importAllResult.useCallback(() => {
2026-08-24 06:08:38 +00:00
guild(closure_1_2[10]).transitionToGuild(guild.id);
2026-07-20 16:05:17 +00:00
}, items);
2026-07-29 08:29:29 +00:00
let obj = guild(589);
2026-08-24 06:08:38 +00:00
const items1 = [closure_6];
const stateFromStoresObject = obj.useStateFromStoresObject(items1, () => ({ unread: closure_1_6.hasUnread(guild.id), mentionCount: closure_1_6.getMentionCount(guild.id), isMentionLowImportance: closure_1_6.getIsMentionLowImportance(guild.id) }));
2026-07-20 16:05:17 +00:00
({ unread, mentionCount, isMentionLowImportance } = stateFromStoresObject);
2026-08-25 06:04:03 +00:00
obj1 = guild(4821);
2026-07-20 16:05:17 +00:00
const fontScale = obj1.useFontScale();
2026-07-29 08:29:29 +00:00
let obj2 = guild(589);
2026-08-24 06:08:38 +00:00
const items2 = [closure_5];
2026-07-29 08:29:29 +00:00
const stateFromStores = obj2.useStateFromStores(items2, () => locale.locale);
obj = { onPress: callback, underlayColor: tmp.pressableUnderlayColor.backgroundColor, style: items3, children: null };
2026-07-23 10:11:24 +00:00
items3 = [tmp.pressable, { borderRadius: tmp2.container.borderRadius }];
2026-07-29 08:29:29 +00:00
obj = { children: null };
2026-08-24 06:08:38 +00:00
const tmp7 = itemsDefault;
2026-07-20 16:05:17 +00:00
obj1 = { unread, resolvedUnreadSetting: UnreadSetting.ALL_MESSAGES };
2026-08-25 06:04:03 +00:00
const items4 = [callback(_modDef16329, obj1), , ];
2026-07-20 16:05:17 +00:00
obj2 = { size: tmp2.icon.guildIconSize, guild, style: items5 };
2026-07-23 10:11:24 +00:00
items5 = [tmp.guildIcon, tmp2.icon.margin];
2026-08-24 06:08:38 +00:00
items4[1] = callback(GuildIconSizesDefault, obj2);
2026-07-29 08:29:29 +00:00
const obj3 = { name: guild.name, mentionBadge: null };
2026-08-24 06:08:38 +00:00
const tmp8 = renderChannelWrapperDefault;
obj3[1] = renderChannelBadgeDefault({ mentionCount, locale: stateFromStores, isMentionLowImportance });
items4[2] = ChannelContentDefault(obj3);
2026-07-29 08:29:29 +00:00
obj[0] = items4;
obj[3] = tmp8(callback2(closure_10, obj), { fontScale });
2026-08-25 06:04:03 +00:00
return tmp7(callback(guild(4949).PressableHighlight, obj));
2026-07-20 16:05:17 +00:00
});
2026-07-29 08:29:29 +00:00
let closure_16 = importAllResult.memo((arg0) => {
2026-07-20 16:05:17 +00:00
({ name, onPress, note } = arg0);
2026-08-24 06:08:38 +00:00
let obj = renderCategoryItem;
2026-07-20 16:05:17 +00:00
const categoryStyles = obj.useCategoryStyles();
const tmp = callback3();
2026-08-24 06:08:38 +00:00
const tmp3 = useIsMobileVisualRefreshExperimentEnabledDefault("WrappedCategoryItem");
obj = { style: tmp.categoryWrapper, children: renderCategoryItem.renderCategoryItem({ name, onPress, note, styles: categoryStyles, isRefreshEnabled: tmp3 }) };
2026-07-20 16:05:17 +00:00
return callback(View, obj);
});
2026-08-24 06:08:38 +00:00
let obj2 = { backgroundColor: ThemesDefault.colors.INTERACTIVE_BACKGROUND_ACTIVE };
2026-07-20 16:05:17 +00:00
const memoResult = importAllResult.memo(function InitialResultsInner(history) {
history = history.history;
const unreads = history.unreads;
const toggleExpandedHistory = history.toggleExpandedHistory;
const expandedHistory = history.expandedHistory;
2026-07-29 08:29:29 +00:00
let str = history.selectedGuildId;
let categoryStyles;
2026-08-24 06:08:38 +00:00
closure_6 = undefined;
2026-07-29 08:29:29 +00:00
let stateFromStores;
2026-08-24 06:08:38 +00:00
c8 = undefined;
closure_9 = undefined;
2026-07-29 08:29:29 +00:00
let fontScale;
2026-07-20 16:05:17 +00:00
const tmp = callback3();
2026-07-23 10:11:24 +00:00
let obj = history(toggleExpandedHistory[25]);
2026-07-29 08:29:29 +00:00
categoryStyles = obj.useCategoryStyles();
const tmp5 = unreads(toggleExpandedHistory[27])("InitialResults");
2026-08-24 06:08:38 +00:00
closure_6 = tmp5;
2026-07-23 10:11:24 +00:00
const items = [stateFromStores];
stateFromStores = history(toggleExpandedHistory[11]).useStateFromStores(items, () => {
2026-07-29 08:29:29 +00:00
if (null != str) {
const guild = stateFromStores.getGuild(tmp);
2026-07-20 16:05:17 +00:00
let name;
2026-07-29 08:29:29 +00:00
if (guild != null) {
2026-07-20 16:05:17 +00:00
name = guild.name;
}
return name;
}
});
2026-07-29 08:29:29 +00:00
const items1 = [history, unreads, categoryStyles, tmp5];
2026-07-23 10:11:24 +00:00
const callback = expandedHistory.useCallback((arg0, arg1) => {
2026-07-20 16:05:17 +00:00
if (0 === arg0) {
let tmp3 = history[arg1];
} else {
tmp3 = unreads[arg1];
}
2026-08-24 06:08:38 +00:00
return closure_1_15({ result: tmp3, categoryStyles, isRefreshEnabled: closure_6 });
2026-07-20 16:05:17 +00:00
}, items1);
const someResult = unreads.some((type) => type.type === history(toggleExpandedHistory[20]).AutocompleterResultTypes.VOICE_CHANNEL);
2026-07-29 08:29:29 +00:00
c8 = someResult;
2026-07-20 16:05:17 +00:00
const items2 = [toggleExpandedHistory, expandedHistory, stateFromStores, someResult];
2026-07-23 10:11:24 +00:00
const callback1 = expandedHistory.useCallback((arg0) => {
2026-07-20 16:05:17 +00:00
if (0 === arg0) {
2026-07-29 08:29:29 +00:00
let obj = { name: null, note: null, onPress: null };
2026-07-20 16:05:17 +00:00
const intl3 = history(toggleExpandedHistory[28]).intl;
2026-07-29 08:29:29 +00:00
obj[0] = intl3.string(history(toggleExpandedHistory[28]).t["Xmh+5e"]);
obj = { variant: "text-xs/semibold", color: "text-brand", children: null };
2026-07-20 16:05:17 +00:00
const intl4 = history(toggleExpandedHistory[28]).intl;
const string = intl4.string;
let t2 = history(toggleExpandedHistory[28]).t;
if (expandedHistory) {
2026-07-23 10:11:24 +00:00
t2 = string(t2["3BdvgI"]);
2026-07-29 08:29:29 +00:00
obj[2] = t2;
let tmp14 = obj;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
obj[2] = string(t2["/XSoJ+"]);
tmp14 = obj;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[1] = tmp(history(toggleExpandedHistory[26]).Text, tmp14);
obj[2] = toggleExpandedHistory;
} else if (null != stateFromStores) {
const intl2 = history(toggleExpandedHistory[28]).intl;
let t = history(toggleExpandedHistory[28]).t;
t = { guildName: null };
t[0] = tmp17;
intl2.formatToPlainString(c8 ? t["+DrQVp"] : t["+lFj35"], t);
const tmp9 = c8 ? t["+DrQVp"] : t["+lFj35"];
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
const intl = history(toggleExpandedHistory[28]).intl;
t = history(toggleExpandedHistory[28]).t;
2026-08-24 06:08:38 +00:00
obj1 = { name: null };
2026-07-29 08:29:29 +00:00
obj1[0] = intl.string(c8 ? t.C5viSQ : t.ieCAhD);
return tmp(tmp2, obj1);
2026-07-20 16:05:17 +00:00
}
}, items2);
2026-07-29 08:29:29 +00:00
const tmp10 = unreads(toggleExpandedHistory[9])();
2026-08-24 06:08:38 +00:00
closure_9 = tmp10;
2026-07-23 10:11:24 +00:00
const obj2 = history(toggleExpandedHistory[11]);
2026-07-29 08:29:29 +00:00
const tmp2 = toggleExpandedHistory;
const tmp4 = unreads;
fontScale = history(toggleExpandedHistory[12]).useFontScale();
const items3 = [fontScale, history, unreads, tmp10];
2026-07-23 10:11:24 +00:00
const callback2 = expandedHistory.useCallback((arg0, arg1) => {
2026-07-20 16:05:17 +00:00
if (null == arg1) {
return 0;
} else {
if (0 === arg0) {
let tmp3 = history[arg1];
} else {
tmp3 = unreads[arg1];
}
2026-07-29 08:29:29 +00:00
let tmp6 = toggleExpandedHistory;
2026-07-20 16:05:17 +00:00
if (tmp3.type === history(toggleExpandedHistory[20]).AutocompleterResultTypes.VOICE_CHANNEL) {
2026-07-29 08:29:29 +00:00
tmp6 = unreads(tmp6[30])(fontScale);
2026-08-24 06:08:38 +00:00
let diff = tmp6 + voiceUsers.voiceUsers.height - 2;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
diff = unreads(tmp6[30])(fontScale);
2026-07-20 16:05:17 +00:00
}
}
}, items3);
if (!expandedHistory) {
const _Math = Math;
Math.max(5 - unreads.length, 2);
}
2026-07-29 08:29:29 +00:00
obj = { style: tmp.listContainer, children: null };
2026-07-20 16:05:17 +00:00
if (history.length > 0) {
2026-07-29 08:29:29 +00:00
obj = { optimizeListItemRender: true, batchesToRender: 6, style: null, sectionSize: null, itemSize: null, renderItem: null, renderSection: null, sections: null, sectionFooterSize: 8, footerSize: 8, scrollIndicatorInsets: null, chunkBase: null, keyboardShouldPersistTaps: "always" };
obj[2] = tmp.list;
obj[3] = tmp10.category.height;
obj[4] = callback2;
obj[5] = callback;
obj[6] = callback1;
const items4 = [tmp13, unreads.length];
obj[7] = items4;
obj[10] = closure_12;
obj[11] = unreads(toggleExpandedHistory[29])().height;
if (str == null) {
str = "default";
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let tmp14Result = tmp14(tmp4(tmp2[31]), obj, str);
const tmp4Result = tmp4(tmp2[31]);
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
tmp14Result = null;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[1] = tmp14Result;
2026-08-24 06:08:38 +00:00
return closure_9(str, obj);
2026-07-20 16:05:17 +00:00
});
const memoResult1 = importAllResult.memo(function SearchResultsInner(results) {
results = results.results;
2026-07-29 08:29:29 +00:00
let categoryStyles;
2026-08-24 06:08:38 +00:00
dependencyMap = undefined;
2026-07-29 08:29:29 +00:00
let ref;
2026-08-24 06:08:38 +00:00
closure_4 = undefined;
2026-07-29 08:29:29 +00:00
let fontScale;
2026-07-20 16:05:17 +00:00
const tmp = callback3();
2026-08-25 06:04:03 +00:00
let obj = results(15463);
2026-07-29 08:29:29 +00:00
categoryStyles = obj.useCategoryStyles();
2026-08-11 06:20:06 +00:00
const tmp5 = categoryStyles(1367)("SearchResults");
2026-07-29 08:29:29 +00:00
dependencyMap = tmp5;
const items = [results, categoryStyles, tmp5];
2026-08-24 06:08:38 +00:00
const callback = ref.useCallback((arg0, arg1) => closure_1_15({ result: results[arg1], categoryStyles, isRefreshEnabled: closure_2 }), items);
2026-07-23 10:11:24 +00:00
ref = ref.useRef(null);
2026-07-20 16:05:17 +00:00
const items1 = [results.query];
2026-07-23 10:11:24 +00:00
const effect = ref.useEffect(() => {
2026-07-20 16:05:17 +00:00
const current = ref.current;
2026-07-29 08:29:29 +00:00
if (current != null) {
const scrollToTop = current.scrollToTop;
if (scrollToTop != null) {
scrollToTop(false);
}
2026-07-20 16:05:17 +00:00
}
}, items1);
2026-08-25 06:04:03 +00:00
const tmp9 = categoryStyles(16325)();
2026-08-24 06:08:38 +00:00
closure_4 = tmp9;
2026-08-25 06:04:03 +00:00
fontScale = results(4821).useFontScale();
2026-07-29 08:29:29 +00:00
const items2 = [fontScale, results, tmp9];
obj = { style: tmp.listContainer, children: null };
let tmp12Result = null;
2026-07-20 16:05:17 +00:00
if (results.length > 0) {
2026-07-29 08:29:29 +00:00
obj = { ref: null, optimizeListItemRender: true, batchesToRender: 6, style: null, sectionSize: null, itemSize: null, renderSection: null, renderItem: null, sections: null, footerSize: 16, scrollIndicatorInsets: null, chunkBase: null, keyboardShouldPersistTaps: "always" };
obj[0] = ref;
obj[3] = tmp.list;
obj[4] = tmp9.category.height;
obj[5] = tmp11;
obj[6] = renderSearchResultsSection;
obj[7] = callback;
2026-07-20 16:05:17 +00:00
const items3 = [results.length];
2026-07-29 08:29:29 +00:00
obj[8] = items3;
obj[10] = closure_12;
2026-08-15 05:55:55 +00:00
obj[11] = categoryStyles(1494)().height;
2026-08-25 06:04:03 +00:00
tmp12Result = tmp12(categoryStyles(8159), obj);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[1] = tmp12Result;
2026-08-24 06:08:38 +00:00
return closure_9(closure_4, obj);
2026-07-20 16:05:17 +00:00
});
2026-08-24 06:08:38 +00:00
let result = require("set").fileFinishedImporting("modules/launchpad/native/LaunchPadSearchResults.tsx");
2026-07-20 16:05:17 +00:00
export const InitialResults = memoResult;
export const SearchResults = memoResult1;