decord/source/modules/threads/native/components/ThreadBrowserRowSubtext.tsx

302 lines
11 KiB
TypeScript
Raw Normal View History

2026-08-12 06:57:52 +00:00
// Module ID: 15859
// Function ID: 15860
2026-07-20 16:05:17 +00:00
// Name: MessageContent
2026-08-12 06:57:52 +00:00
// Dependencies: [19, 17, 4336, 1990, 1922, 5961, 676, 505, 21, 4344, 712, 589, 7280, 4782, 5271, 4340, 1236, 4189, 5967, 4572, 11, 1297, 8244, 8111, 4086, 2]
2026-07-20 16:05:17 +00:00
// Exports: ThreadSubtext
2026-08-12 06:57:52 +00:00
// Module 15859 (MessageContent)
2026-07-29 08:29:29 +00:00
import importAllResult from "useNullableMessageAuthor";
import { View } from "nameFromUser";
import maybeApplyNoTextColorForLightCustomTheme from "maybeApplyNoTextColorForLightCustomTheme";
import trackCommunicationDisabled from "trackCommunicationDisabled";
import mergeGuildAvatar from "mergeGuildAvatar";
import updateState from "updateState";
import jsxProd from "Button";
import createCacheKey from "createCacheKey";
2026-07-23 10:11:24 +00:00
2026-07-29 08:29:29 +00:00
let c10;
let c9;
let unpackModuleId;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-20 16:05:17 +00:00
function MessageContent(arg0) {
2026-07-29 08:29:29 +00:00
let c2;
let c3;
let c4;
2026-07-20 16:05:17 +00:00
let message;
let thread;
({ thread, message } = arg0);
2026-07-29 08:29:29 +00:00
let importDefault;
let dependencyMap;
c3 = undefined;
c4 = undefined;
let maybeApplyNoTextColorForLightCustomTheme;
2026-08-12 06:57:52 +00:00
let obj = message(5967);
2026-07-20 16:05:17 +00:00
const items = [message.author.id];
const subscribeGuildMembers = obj.useSubscribeGuildMembers({ [thread.guild_id]: items }, "ThreadBrowserRowSubtext");
2026-07-29 08:29:29 +00:00
let obj1 = message(589);
const items1 = [mergeGuildAvatar];
2026-07-20 16:05:17 +00:00
const stateFromStores = obj1.useStateFromStores(items1, () => {
2026-07-23 10:11:24 +00:00
let author = outer1_7.getUser(message.author.id);
2026-07-29 08:29:29 +00:00
if (author == null) {
2026-07-20 16:05:17 +00:00
author = message.author;
}
return author;
});
const tmp = callback3();
2026-07-29 08:29:29 +00:00
const items2 = [maybeApplyNoTextColorForLightCustomTheme];
importDefault = message(589).useStateFromStores(items2, () => roleStyle.roleStyle);
const obj3 = message(589);
2026-08-12 06:57:52 +00:00
({ nick: c2, colorString: c3, colorStrings: c4 } = importDefault(4572)(message));
let tmp4 = importDefault(4572)(message);
2026-07-29 08:29:29 +00:00
const extractTimestampResult = importDefault(11).extractTimestamp(message.id);
const obj4 = importDefault(11);
2026-08-12 06:57:52 +00:00
const timestampString = message(7280).getTimestampString(extractTimestampResult);
const obj5 = message(7280);
const timestampAccessibilityLabel = message(7280).getTimestampAccessibilityLabel(extractTimestampResult);
maybeApplyNoTextColorForLightCustomTheme = importDefault(4782)(thread.guild_id, stateFromStores.id);
2026-07-29 08:29:29 +00:00
obj = { user: stateFromStores, timestamp: timestampString, accessibilityLabel: timestampAccessibilityLabel, children: null };
obj = { lineClamp: 1, ellipsizeMode: "tail", lineBreakMode: "tail", style: tmp.subtextContent, variant: "text-sm/medium", color: "text-default", children: null };
const intl = message(1236).intl;
2026-07-20 16:05:17 +00:00
obj1 = {
usernameHook(arg0, arg1) {
2026-07-29 08:29:29 +00:00
let str = c2;
if (c2 == null) {
str = "";
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const obj = { nickname: str, usernameColor: null, roleColor: null, roleColors: null, shouldShowRoleDot: null };
2026-07-20 16:05:17 +00:00
let tmp4 = null;
2026-07-29 08:29:29 +00:00
if ("username" === closure_1) {
tmp4 = c3;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[1] = tmp4;
obj[2] = c3;
let tmp6 = null;
if (maybeApplyNoTextColorForLightCustomTheme) {
tmp6 = c4;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[3] = tmp6;
obj[4] = "dot" === closure_1 && null != c3;
2026-07-23 10:11:24 +00:00
return outer1_9(outer1_17, obj, arg1);
2026-07-20 16:05:17 +00:00
},
messageTextHook(arg0, arg1) {
2026-07-29 08:29:29 +00:00
const obj = { children: null };
obj[0] = callback(_undefined[22])(message, { formatInline: true, allowGameMentions: true }).content;
return outer1_9(message(_undefined[21]).LegacyText, obj, arg1);
2026-07-20 16:05:17 +00:00
}
};
2026-07-29 08:29:29 +00:00
obj[6] = intl.format(message(1236).t.M79KAH, obj1);
2026-08-12 06:57:52 +00:00
obj[3] = callback(message(4340).Text, obj);
2026-07-20 16:05:17 +00:00
return callback(SubstringRow, obj);
}
function SubstringRow(arg0) {
let accessibilityLabel;
let children;
let timestamp;
let user;
({ timestamp, accessibilityLabel } = arg0);
({ user, children } = arg0);
const tmp = callback3();
if (null == user) {
2026-07-29 08:29:29 +00:00
let obj = { style: null, children: null };
obj[0] = tmp.row;
obj = { style: null, accessibilityLabel: null, variant: "text-sm/medium", color: "text-muted", children: null };
obj[0] = tmp.timestamp;
obj[1] = accessibilityLabel;
obj[4] = ` ${timestamp}`;
2026-08-12 06:57:52 +00:00
obj[1] = callback(require(4340) /* Text */.Text, obj);
2026-07-29 08:29:29 +00:00
let tmp6 = callback(View, obj);
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
obj = { style: null, children: null };
obj[0] = tmp.row;
2026-07-20 16:05:17 +00:00
const items = [children, , ];
2026-07-29 08:29:29 +00:00
const obj1 = { style: null };
obj1[0] = tmp.dividerDot;
2026-07-20 16:05:17 +00:00
items[1] = callback(View, obj1);
2026-07-29 08:29:29 +00:00
const obj2 = { style: null, accessibilityLabel: null, variant: "text-sm/medium", color: "text-muted", children: null };
obj2[0] = tmp.timestamp;
obj2[1] = accessibilityLabel;
2026-07-20 16:05:17 +00:00
const _HermesInternal = HermesInternal;
2026-07-29 08:29:29 +00:00
obj2[4] = "" + timestamp;
2026-08-12 06:57:52 +00:00
items[2] = callback(require(4340) /* Text */.Text, obj2);
2026-07-29 08:29:29 +00:00
obj[1] = items;
tmp6 = callback2(View, obj);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp6;
2026-07-20 16:05:17 +00:00
}
function Username(usernameColor) {
let nickname;
let roleColor;
let roleColors;
let shouldShowRoleDot;
usernameColor = usernameColor.usernameColor;
({ roleColors, shouldShowRoleDot } = usernameColor);
2026-07-29 08:29:29 +00:00
let c1;
2026-07-20 16:05:17 +00:00
({ nickname, roleColor } = usernameColor);
const tmp = callback3();
2026-07-29 08:29:29 +00:00
c1 = tmp;
2026-07-23 10:11:24 +00:00
let items = [usernameColor, tmp];
2026-07-20 16:05:17 +00:00
const memo = importAllResult.useMemo(() => {
if (null != usernameColor) {
2026-07-29 08:29:29 +00:00
const items = [_undefined.username, ];
const obj = { color: null };
obj[0] = tmp;
2026-07-20 16:05:17 +00:00
items[1] = obj;
let username = items;
} else {
2026-07-29 08:29:29 +00:00
username = _undefined.username;
2026-07-20 16:05:17 +00:00
}
return username;
}, items);
2026-08-12 06:57:52 +00:00
let obj = usernameColor(8111);
2026-07-20 16:05:17 +00:00
const processColorStringsArray = obj.useProcessColorStringsArray(roleColors);
2026-07-29 08:29:29 +00:00
let tmp5 = !shouldShowRoleDot;
if (!shouldShowRoleDot) {
tmp5 = processColorStringsArray.length > 1;
2026-07-20 16:05:17 +00:00
}
if (shouldShowRoleDot) {
2026-07-29 08:29:29 +00:00
obj = { color: null, colors: null, size: "small" };
obj[0] = roleColor;
obj[1] = roleColors;
shouldShowRoleDot = callback(tmp3(1297).RoleDot, obj);
2026-07-20 16:05:17 +00:00
}
const items1 = [shouldShowRoleDot, ];
2026-07-29 08:29:29 +00:00
obj = { variant: "text-sm/semibold", color: "mobile-text-heading-primary", experimental_useNativeText: null, gradientColors: null, style: null, children: null };
2026-08-12 06:57:52 +00:00
obj[2] = !usernameColor(4086).isFabric();
2026-07-20 16:05:17 +00:00
let tmp10;
2026-07-29 08:29:29 +00:00
if (tmp5) {
2026-07-20 16:05:17 +00:00
tmp10 = processColorStringsArray;
}
2026-07-29 08:29:29 +00:00
const obj1 = { children: null };
obj[3] = tmp10;
obj[4] = memo;
obj[5] = nickname;
2026-08-12 06:57:52 +00:00
items1[1] = callback(usernameColor(4340).Text, obj);
2026-07-29 08:29:29 +00:00
obj1[0] = items1;
return closure_10(closure_11, obj1);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let c3 = importAllResult;
({ jsx: c9, jsxs: c10, Fragment: unpackModuleId } = jsxProd);
2026-07-23 10:11:24 +00:00
let items = [, ];
({ CHANNEL_NAME_CHANGE: arr[0], THREAD_STARTER_MESSAGE: arr[1] } = require("ME").MessageTypes);
2026-07-29 08:29:29 +00:00
let obj = { row: { flexDirection: "row" }, subtextContent: { lineHeight: 18, flexShrink: 1 }, timestamp: { lineHeight: 18 }, username: null, dividerDot: null };
obj = { fontSize: 14, lineHeight: 18, fontFamily: require("sum").Fonts.PRIMARY_SEMIBOLD, color: require("Themes").colors.TEXT_SUBTLE };
obj[3] = obj;
createCacheKey = { width: 4, height: 4, marginHorizontal: 4, borderRadius: 2, backgroundColor: require("Themes").colors.BACKGROUND_MOD_STRONG, alignSelf: "center" };
obj[4] = createCacheKey;
let closure_13 = createCacheKey.createStyles(obj);
2026-07-20 16:05:17 +00:00
let closure_14 = importAllResult.memo((thread) => {
thread = thread.thread;
const accessibilityLabel = thread.accessibilityLabel;
2026-07-29 08:29:29 +00:00
let stateFromStores;
let stateFromStores1;
let importAllResult;
let colorString;
let colorStrings;
let trackCommunicationDisabled;
let mergeGuildAvatar;
2026-07-23 10:11:24 +00:00
let obj = thread(stateFromStores1[11]);
2026-07-29 08:29:29 +00:00
let items = [mergeGuildAvatar];
stateFromStores = obj.useStateFromStores(items, () => ref.getUser(thread.ownerId));
2026-07-23 10:11:24 +00:00
let obj1 = thread(stateFromStores1[11]);
2026-07-29 08:29:29 +00:00
const items1 = [trackCommunicationDisabled];
2026-07-23 10:11:24 +00:00
stateFromStores1 = obj1.useStateFromStores(items1, () => member.getMember(thread.guild_id, thread.ownerId));
2026-07-20 16:05:17 +00:00
const tmp = callback3();
2026-07-29 08:29:29 +00:00
const items2 = [colorStrings];
importAllResult = thread(stateFromStores1[11]).useStateFromStores(items2, () => colorStrings.roleStyle);
colorString = undefined;
if (stateFromStores1 != null) {
2026-07-20 16:05:17 +00:00
colorString = stateFromStores1.colorString;
}
2026-07-29 08:29:29 +00:00
if (colorString == null) {
colorString = null;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
colorStrings = undefined;
if (stateFromStores1 != null) {
2026-07-20 16:05:17 +00:00
colorStrings = stateFromStores1.colorStrings;
}
2026-07-29 08:29:29 +00:00
if (colorStrings == null) {
colorStrings = null;
2026-07-20 16:05:17 +00:00
}
let id;
2026-07-23 10:11:24 +00:00
const obj3 = thread(stateFromStores1[11]);
2026-07-29 08:29:29 +00:00
if (stateFromStores != null) {
2026-07-20 16:05:17 +00:00
id = stateFromStores.id;
}
2026-07-29 08:29:29 +00:00
trackCommunicationDisabled = stateFromStores(stateFromStores1[13])(thread.guild_id, id);
mergeGuildAvatar = importAllResult.useRef(thread);
2026-07-23 10:11:24 +00:00
const effect = importAllResult.useEffect(() => {
2026-07-29 08:29:29 +00:00
mergeGuildAvatar.current = thread;
2026-07-20 16:05:17 +00:00
});
const items3 = [stateFromStores1, stateFromStores];
2026-07-23 10:11:24 +00:00
const effect1 = importAllResult.useEffect(() => {
2026-07-20 16:05:17 +00:00
if (null == stateFromStores) {
const current = ref.current;
const items = [current.ownerId];
const membersById = stateFromStores(stateFromStores1[14]).requestMembersById(current.guild_id, items);
const obj = stateFromStores(stateFromStores1[14]);
}
}, items3);
2026-07-29 08:29:29 +00:00
obj = { user: stateFromStores, timestamp: thread.timestamp, accessibilityLabel, children: null };
obj = { lineClamp: 1, ellipsizeMode: "tail", lineBreakMode: "tail", style: tmp.subtextContent, accessibilityLabel, variant: "text-sm/medium", color: "text-default", children: null };
const intl = tmp2(tmp3[16]).intl;
2026-07-20 16:05:17 +00:00
obj1 = {
usernameHook(arg0, arg1) {
2026-07-29 08:29:29 +00:00
let str;
if (stateFromStores1 != null) {
str = stateFromStores1.nick;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (str == null) {
let obj = stateFromStores(stateFromStores1[17]);
str = obj.getName(stateFromStores);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (str == null) {
str = "";
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj = { nickname: str, usernameColor: null, roleColor: null, roleColors: null, shouldShowRoleDot: null };
let tmp7 = null;
2026-07-20 16:05:17 +00:00
if ("username" === closure_3) {
2026-07-29 08:29:29 +00:00
tmp7 = colorString;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[1] = tmp7;
obj[2] = colorString;
2026-07-20 16:05:17 +00:00
let tmp9 = null;
2026-07-29 08:29:29 +00:00
if (trackCommunicationDisabled) {
tmp9 = colorStrings;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[3] = tmp9;
obj[4] = "dot" === closure_3 && null != colorString;
2026-07-23 10:11:24 +00:00
return outer1_9(outer1_17, obj, arg1);
2026-07-20 16:05:17 +00:00
}
};
2026-07-29 08:29:29 +00:00
obj[7] = intl.format(thread(stateFromStores1[16]).t.imPXd5, obj1);
obj[3] = callback(thread(stateFromStores1[15]).Text, obj);
2026-07-20 16:05:17 +00:00
return callback(SubstringRow, obj);
});
2026-07-29 08:29:29 +00:00
const result = require("maybeApplyNoTextColorForLightCustomTheme").fileFinishedImporting("modules/threads/native/components/ThreadBrowserRowSubtext.tsx");
2026-07-20 16:05:17 +00:00
export const ThreadSubtext = function ThreadSubtext(thread) {
thread = thread.thread;
2026-07-29 08:29:29 +00:00
let id;
id = thread.id;
let obj = id(589);
const items = [updateState];
2026-07-20 16:05:17 +00:00
const items1 = [id];
2026-07-23 10:11:24 +00:00
const stateFromStores = obj.useStateFromStores(items, () => outer1_8.getMostRecentMessage(id), items1);
2026-08-12 06:57:52 +00:00
const lastMessageTimestamp = id(7280).useLastMessageTimestamp(thread);
2026-07-20 16:05:17 +00:00
if (null != stateFromStores) {
if (!items.includes(stateFromStores.type)) {
if (!thread.isArchivedThread()) {
2026-07-29 08:29:29 +00:00
obj = { thread: null, message: null };
obj[0] = thread;
obj[1] = stateFromStores;
2026-07-20 16:05:17 +00:00
return callback(MessageContent, obj);
}
}
}
2026-08-12 06:57:52 +00:00
let tmpResult = tmp(7280);
2026-07-29 08:29:29 +00:00
const timestampString = tmpResult.getTimestampString(lastMessageTimestamp);
2026-08-12 06:57:52 +00:00
tmpResult = tmp(7280);
2026-07-29 08:29:29 +00:00
obj = { thread, timestamp: timestampString, accessibilityLabel: tmpResult.getTimestampAccessibilityLabel(lastMessageTimestamp) };
2026-07-20 16:05:17 +00:00
return callback(closure_14, obj);
};