decord/source/modules/search/native/hooks/useSearchContext.tsx

82 lines
2.9 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 11515
// Function ID: 11516
2026-07-29 08:29:29 +00:00
// Name: useGuildSearchContext
2026-08-11 06:20:06 +00:00
// Dependencies: [19, 1391, 676, 38, 647, 2]
2026-07-29 08:29:29 +00:00
// Exports: getChannelDetailsSearchContext, useChannelDetailsSearchContext, useGuildChannelSearchContext, useGuildSearchContext
2026-07-20 16:05:17 +00:00
2026-08-24 06:08:38 +00:00
// Module 11515 (useGuildSearchContext)
import _modDef38 from "module_38" /* 38 */;
import closure_3 from "noop" /* 19 */;
import closure_4 from "ensureGuildLoaded" /* 1391 */;
import { SearchTypes } from "ME" /* 676 */;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("modules/search/native/hooks/useSearchContext.tsx");
2026-07-20 16:05:17 +00:00
export const useGuildSearchContext = function useGuildSearchContext(guildId) {
2026-08-24 06:08:38 +00:00
closure_0 = guildId;
2026-07-20 16:05:17 +00:00
const items = [guildId];
2026-08-24 06:08:38 +00:00
return React.useMemo(() => ({ type: closure_1_5.GUILD, guildId: closure_0 }), items);
2026-07-20 16:05:17 +00:00
};
export const useGuildChannelSearchContext = function useGuildChannelSearchContext(arg0, arg1) {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
closure_1 = arg1;
2026-07-20 16:05:17 +00:00
const items = [arg0, arg1];
2026-08-24 06:08:38 +00:00
return React.useMemo(() => ({ type: closure_1_5.GUILD_CHANNEL, guildId: closure_0, channelId: closure_1 }), items);
2026-07-20 16:05:17 +00:00
};
2026-07-29 08:29:29 +00:00
export const getChannelDetailsSearchContext = function getChannelDetailsSearchContext(id, guildId, isThreadResult) {
if (isThreadResult) {
2026-08-24 06:08:38 +00:00
_modDef38(null != guildId, "[useChannelDetailsSearchContext] Thread must have a guild id");
2026-07-29 08:29:29 +00:00
let obj = { type: null, guildId: null, channelId: null };
obj[0] = SearchTypes.THREAD;
obj[1] = guildId;
obj[2] = id;
} else if (null == guildId) {
obj = { type: null, channelId: null };
obj[0] = SearchTypes.CHANNEL;
obj[1] = id;
} else {
obj = { type: null, guildId: null, channelId: null };
obj[0] = SearchTypes.GUILD_CHANNEL;
obj[1] = guildId;
obj[2] = id;
}
return obj;
};
2026-07-20 16:05:17 +00:00
export const useChannelDetailsSearchContext = function useChannelDetailsSearchContext(channelId, guildId) {
2026-07-23 10:11:24 +00:00
const _require = channelId;
2026-08-24 06:08:38 +00:00
closure_1 = guildId;
const items = [closure_4];
2026-07-23 10:11:24 +00:00
stateFromStores = _require(stateFromStores[4]).useStateFromStores(items, () => {
2026-08-24 06:08:38 +00:00
const channel = closure_1_4.getChannel(closure_0);
2026-07-29 08:29:29 +00:00
let flag;
if (channel != null) {
flag = channel.isThread();
}
if (flag == null) {
flag = false;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return flag;
2026-07-20 16:05:17 +00:00
});
const items1 = [channelId, guildId, stateFromStores];
2026-07-29 08:29:29 +00:00
return React.useMemo(() => {
if (stateFromStores) {
guildId(stateFromStores[3])(null != tmp2, "[useChannelDetailsSearchContext] Thread must have a guild id");
let obj = { type: null, guildId: null, channelId: null };
2026-08-24 06:08:38 +00:00
obj[0] = closure_1_5.THREAD;
2026-07-29 08:29:29 +00:00
obj[1] = tmp2;
obj[2] = tmp;
} else if (null == tmp2) {
obj = { type: null, channelId: null };
2026-08-24 06:08:38 +00:00
obj[0] = closure_1_5.CHANNEL;
2026-07-29 08:29:29 +00:00
obj[1] = tmp;
} else {
obj = { type: null, guildId: null, channelId: null };
2026-08-24 06:08:38 +00:00
obj[0] = closure_1_5.GUILD_CHANNEL;
2026-07-29 08:29:29 +00:00
obj[1] = tmp2;
obj[2] = tmp;
}
return obj;
}, items1);
2026-07-20 16:05:17 +00:00
};