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

301 lines
12 KiB
TypeScript
Raw Normal View History

2026-09-02 09:53:35 +00:00
// Module ID: 16792
// Function ID: 16793
2026-07-20 16:05:17 +00:00
// Name: renderItemJSX
2026-09-02 09:53:35 +00:00
// Dependencies: [19, 17, 1995, 7390, 1908, 4702, 21, 4478, 709, 16793, 6195, 586, 4935, 16794, 5076, 16795, 16797, 6012, 16798, 16800, 9946, 16801, 16807, 16808, 16810, 15926, 4474, 1233, 1492, 16796, 7804, 2]
2026-07-20 16:05:17 +00:00
2026-09-02 09:53:35 +00:00
// Module 16792 (renderItemJSX)
import ThemesDefault from "Themes" /* 709 */;
import getSystemLocale from "getSystemLocale" /* 1233 */;
import GuildIconSizesDefault from "GuildIconSizes" /* 6012 */;
import sortByMatchScore from "sortByMatchScore" /* 9946 */;
import renderCategoryItem from "renderCategoryItem" /* 15926 */;
import getLayoutStyleDefault from "getLayoutStyle" /* 16793 */;
import itemsDefault from "items" /* 16794 */;
import renderChannelWrapperDefault from "renderChannelWrapper" /* 16795 */;
import _modDef16797 from "module_16797" /* 16797 */;
import ChannelContentDefault from "ChannelContent" /* 16798 */;
import renderChannelBadgeDefault from "renderChannelBadge" /* 16800 */;
import _modDef16801 from "module_16801" /* 16801 */;
import _modDef16807 from "module_16807" /* 16807 */;
import handleVoiceOrStageChannelConnectPressDefault from "handleVoiceOrStageChannelConnectPress" /* 16808 */;
import userDefault from "user" /* 16810 */;
2026-08-24 06:08:38 +00:00
import importAllResult from "noop" /* 19 */;
import { View } from "get ActivityIndicator" /* 17 */;
2026-09-02 09:53:35 +00:00
import closure_5 from "_getSystemLocale" /* 1995 */;
import closure_6 from "updateGuildUnreadSentinel" /* 7390 */;
import closure_7 from "createGuildRecordFromRust" /* 1908 */;
2026-09-01 10:26:29 +00:00
import { UnreadSetting } from "ReadStateTypes" /* 4702 */;
2026-08-24 06:08:38 +00:00
import jsxProd from "jsxProd" /* 21 */;
2026-09-01 10:26:29 +00:00
import createCacheKey from "createCacheKey" /* 4478 */;
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-09-02 09:53:35 +00:00
} else if (tmp13(9946).AutocompleterResultTypes.TEXT_CHANNEL === type) {
2026-07-29 08:29:29 +00:00
obj = { channel: null, navigationReplace: true, showGuildBadgeIcon: true };
obj[0] = result.record;
2026-09-02 09:53:35 +00:00
return callback(_modDef16801, obj);
} else if (tmp13(9946).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-09-02 09:53:35 +00:00
return callback(_modDef16807, obj1);
} else if (tmp13(9946).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-09-02 09:53:35 +00:00
} else if (tmp13(9946).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-09-02 09:53:35 +00:00
} else if (tmp13(9946).AutocompleterResultTypes.HEADER === type) {
2026-08-31 15:47:37 +00:00
const obj4 = { name: null, styles: null };
2026-07-29 08:29:29 +00:00
obj4[0] = result.record.text;
obj4[1] = tmp;
2026-09-02 09:53:35 +00:00
return tmp13(15926).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-09-01 10:26:29 +00:00
return callback(tmp13(4474).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-09-02 09:53:35 +00:00
let obj = guild(586);
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-09-01 10:26:29 +00:00
obj1 = guild(4935);
2026-07-20 16:05:17 +00:00
const fontScale = obj1.useFontScale();
2026-09-02 09:53:35 +00:00
let obj2 = guild(586);
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-09-02 09:53:35 +00:00
const items4 = [callback(_modDef16797, 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-09-02 09:53:35 +00:00
return tmp7(callback(guild(5076).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-09-02 09:53:35 +00:00
obj = { style: tmp.categoryWrapper, children: renderCategoryItem.renderCategoryItem({ name, onPress, note, noteAlignment: "end", styles: categoryStyles }) };
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;
let stateFromStores;
2026-08-31 15:47:37 +00:00
c7 = undefined;
closure_8 = 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();
2026-08-31 15:47:37 +00:00
const items = [c7];
2026-07-23 10:11:24 +00:00
stateFromStores = history(toggleExpandedHistory[11]).useStateFromStores(items, () => {
2026-07-29 08:29:29 +00:00
if (null != str) {
2026-08-31 15:47:37 +00:00
const guild = _undefined.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-08-31 15:47:37 +00:00
const items1 = [history, unreads, categoryStyles];
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-31 15:47:37 +00:00
return closure_1_15({ result: tmp3, categoryStyles });
2026-07-20 16:05:17 +00:00
}, items1);
const someResult = unreads.some((type) => type.type === history(toggleExpandedHistory[20]).AutocompleterResultTypes.VOICE_CHANNEL);
2026-08-31 15:47:37 +00:00
c7 = 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-08-31 15:47:37 +00:00
const intl3 = history(toggleExpandedHistory[27]).intl;
obj[0] = intl3.string(history(toggleExpandedHistory[27]).t["Xmh+5e"]);
2026-07-29 08:29:29 +00:00
obj = { variant: "text-xs/semibold", color: "text-brand", children: null };
2026-08-31 15:47:37 +00:00
const intl4 = history(toggleExpandedHistory[27]).intl;
2026-07-20 16:05:17 +00:00
const string = intl4.string;
2026-08-31 15:47:37 +00:00
let t2 = history(toggleExpandedHistory[27]).t;
2026-07-20 16:05:17 +00:00
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) {
2026-08-31 15:47:37 +00:00
const intl2 = history(toggleExpandedHistory[27]).intl;
let t = history(toggleExpandedHistory[27]).t;
2026-07-29 08:29:29 +00:00
t = { guildName: null };
t[0] = tmp17;
2026-08-31 15:47:37 +00:00
intl2.formatToPlainString(c7 ? t["+DrQVp"] : t["+lFj35"], t);
const tmp9 = c7 ? t["+DrQVp"] : t["+lFj35"];
2026-07-20 16:05:17 +00:00
} else {
2026-08-31 15:47:37 +00:00
const intl = history(toggleExpandedHistory[27]).intl;
t = history(toggleExpandedHistory[27]).t;
2026-08-24 06:08:38 +00:00
obj1 = { name: null };
2026-08-31 15:47:37 +00:00
obj1[0] = intl.string(c7 ? t.C5viSQ : t.ieCAhD);
2026-07-29 08:29:29 +00:00
return tmp(tmp2, obj1);
2026-07-20 16:05:17 +00:00
}
}, items2);
2026-08-31 15:47:37 +00:00
let tmp9 = unreads(toggleExpandedHistory[9])();
closure_8 = tmp9;
2026-07-23 10:11:24 +00:00
const obj2 = history(toggleExpandedHistory[11]);
2026-07-29 08:29:29 +00:00
const tmp2 = toggleExpandedHistory;
2026-08-31 15:47:37 +00:00
const tmp5 = unreads;
2026-07-29 08:29:29 +00:00
fontScale = history(toggleExpandedHistory[12]).useFontScale();
2026-08-31 15:47:37 +00:00
const items3 = [fontScale, history, unreads, tmp9];
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-08-31 15:47:37 +00:00
tmp6 = unreads(tmp6[29])(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-08-31 15:47:37 +00:00
diff = unreads(tmp6[29])(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;
2026-08-31 15:47:37 +00:00
obj[3] = tmp9.category.height;
2026-07-29 08:29:29 +00:00
obj[4] = callback2;
obj[5] = callback;
obj[6] = callback1;
2026-08-31 15:47:37 +00:00
const items4 = [tmp12, unreads.length];
2026-07-29 08:29:29 +00:00
obj[7] = items4;
obj[10] = closure_12;
2026-08-31 15:47:37 +00:00
obj[11] = unreads(toggleExpandedHistory[28])().height;
2026-07-29 08:29:29 +00:00
if (str == null) {
str = "default";
2026-07-20 16:05:17 +00:00
}
2026-08-31 15:47:37 +00:00
let tmp13Result = tmp13(tmp5(tmp2[30]), obj, str);
const tmp5Result = tmp5(tmp2[30]);
2026-07-20 16:05:17 +00:00
} else {
2026-08-31 15:47:37 +00:00
tmp13Result = null;
2026-07-20 16:05:17 +00:00
}
2026-08-31 15:47:37 +00:00
obj[1] = tmp13Result;
return fontScale(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;
let ref;
2026-08-31 15:47:37 +00:00
importAllResult = undefined;
2026-07-29 08:29:29 +00:00
let fontScale;
2026-07-20 16:05:17 +00:00
const tmp = callback3();
2026-08-31 15:47:37 +00:00
let obj = results(ref[25]);
2026-07-29 08:29:29 +00:00
categoryStyles = obj.useCategoryStyles();
2026-08-31 15:47:37 +00:00
const items = [results, categoryStyles];
const callback = importAllResult.useCallback((arg0, arg1) => closure_1_15({ result: results[arg1], categoryStyles }), items);
ref = importAllResult.useRef(null);
2026-07-20 16:05:17 +00:00
const items1 = [results.query];
2026-08-31 15:47:37 +00:00
const effect = importAllResult.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-31 15:47:37 +00:00
const tmp8 = categoryStyles(ref[9])();
importAllResult = tmp8;
fontScale = results(ref[12]).useFontScale();
const items2 = [fontScale, results, tmp8];
2026-07-29 08:29:29 +00:00
obj = { style: tmp.listContainer, children: null };
2026-08-31 15:47:37 +00:00
let tmp11Result = 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;
2026-08-31 15:47:37 +00:00
obj[4] = tmp8.category.height;
obj[5] = tmp10;
2026-07-29 08:29:29 +00:00
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-31 15:47:37 +00:00
obj[11] = categoryStyles(ref[28])().height;
tmp11Result = tmp11(categoryStyles(ref[30]), obj);
2026-07-20 16:05:17 +00:00
}
2026-08-31 15:47:37 +00:00
obj[1] = tmp11Result;
return closure_9(fontScale, 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;