decord/source/modules/guild_settings/native/GuildSettingsModalOfficialMessages.tsx

272 lines
14 KiB
TypeScript
Raw Normal View History

2026-07-23 10:11:24 +00:00
// Module ID: 16485
// Function ID: 128428
2026-07-20 16:05:17 +00:00
// Name: MessagePreview
2026-07-23 10:11:24 +00:00
// Dependencies: [57, 31, 27, 4122, 1838, 8439, 5126, 4123, 482, 33, 4130, 689, 1212, 14156, 10356, 14158, 4130, 1456, 566, 8438, 5087, 5788, 4098, 14820, 1934, 8360, 3991, 5165, 13569, 665, 4126, 8760, 3800, 5648, 666, 1273, 14171, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-07-23 10:11:24 +00:00
// Module 16485 (MessagePreview)
import _slicedToArray from "_slicedToArray";
import SegmentedControl from "SegmentedControl";
import get_ActivityIndicator from "TableRowInner";
import _isNativeReflectConstruct from "_isNativeReflectConstruct";
import closure_7 from "_createForOfIteratorHelperLoose";
import closure_8 from "_isNativeReflectConstruct";
import MESSAGE_GROUP_SPACING from "MESSAGE_GROUP_SPACING";
import { ThemeTypes } from "sum";
import jsxProd from "isGuildOfficialMessagesEnabled";
import _createForOfIteratorHelperLoose from "_createForOfIteratorHelperLoose";
import _createForOfIteratorHelperLoose from "_createForOfIteratorHelperLoose";
import _createForOfIteratorHelperLoose from "_createForOfIteratorHelperLoose";
import _createForOfIteratorHelperLoose from "_createForOfIteratorHelperLoose";
import _createForOfIteratorHelperLoose from "_createForOfIteratorHelperLoose";
let closure_10;
let closure_12;
let closure_13;
let closure_9;
const require = arg1;
2026-07-20 16:05:17 +00:00
function MessagePreview(theme) {
let animatedStyles;
let selectedColor;
({ animatedStyles, selectedColor } = theme);
2026-07-23 10:11:24 +00:00
const tmp = _createForOfIteratorHelperLoose();
2026-07-20 16:05:17 +00:00
const memo = React.useMemo(() => {
2026-07-23 10:11:24 +00:00
const obj = outer1_0(outer1_2[32]);
2026-07-20 16:05:17 +00:00
return obj.calendarFormat(new Date(), true);
}, []);
2026-07-23 10:11:24 +00:00
const internal = importDefault(689).internal;
2026-07-20 16:05:17 +00:00
let num = 1;
2026-07-23 10:11:24 +00:00
const semanticColor = internal.resolveSemanticColor(theme.theme, importDefault(689).colors.BACKGROUND_BASE_LOWER);
if (_isNativeReflectConstruct.desaturateUserColors) {
num = _isNativeReflectConstruct.saturation;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
let obj = require(5648) /* isGuildOfficialMessagesEnabled */;
2026-07-20 16:05:17 +00:00
const accessibleGuildOfficialTextColor = obj.getAccessibleGuildOfficialTextColor(selectedColor, semanticColor, num);
2026-07-23 10:11:24 +00:00
let obj2 = importDefault(666)(selectedColor);
2026-07-20 16:05:17 +00:00
const hexResult = accessibleGuildOfficialTextColor.hex();
const alphaResult = obj2.alpha(closure_10);
obj = { style: items, pointerEvents: "none" };
2026-07-23 10:11:24 +00:00
items = [tmp.chatContainer, , ];
2026-07-20 16:05:17 +00:00
({ borderStrong: arr[1], bgBaseLow: arr[2] } = animatedStyles);
obj = { style: items1 };
2026-07-23 10:11:24 +00:00
items1 = [tmp.chatContainerInner, { backgroundColor: obj2.alpha(closure_10).hex() }];
const obj1 = { source: importDefault(14171) };
const items2 = [callback(require(1273) /* Button */.Avatar, obj1), ];
2026-07-20 16:05:17 +00:00
obj2 = { style: tmp.chatContent };
const obj3 = { style: tmp.chatHeader };
2026-07-23 10:11:24 +00:00
const obj4 = { animated: true, style: animatedStyles.textStrong, variant: "text-md/semibold", lineClamp: 1 };
const intl = require(1212) /* getSystemLocale */.intl;
obj4.children = intl.string(require(1212) /* getSystemLocale */.t.cqpybK);
const items3 = [callback(require(4126) /* Text */.Text, obj4), ];
const obj5 = { animated: true, variant: "text-xs/medium" };
2026-07-20 16:05:17 +00:00
const items4 = [tmp.chatTimestamp, animatedStyles.textMuted];
2026-07-23 10:11:24 +00:00
obj5.style = items4;
obj5.children = memo;
items3[1] = callback(require(4126) /* Text */.Text, obj5);
2026-07-20 16:05:17 +00:00
obj3.children = items3;
2026-07-23 10:11:24 +00:00
const items5 = [callback2(View, obj3), ];
const obj6 = { animated: true, variant: "text-md/normal", style: { color: hexResult } };
const intl2 = require(1212) /* getSystemLocale */.intl;
obj6.children = intl2.string(require(1212) /* getSystemLocale */.t.Mi9Kbe);
items5[1] = callback(require(4126) /* Text */.Text, obj6);
2026-07-20 16:05:17 +00:00
obj2.children = items5;
2026-07-23 10:11:24 +00:00
items2[1] = callback2(View, obj2);
2026-07-20 16:05:17 +00:00
obj.children = items2;
2026-07-23 10:11:24 +00:00
obj.children = callback2(View, obj);
return callback(importDefault(3991).View, obj);
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
const View = get_ActivityIndicator.View;
({ DEFAULT_GUILD_OFFICIAL_COLOR: closure_9, GUILD_OFFICIAL_HIGHLIGHT_ALPHA: closure_10 } = MESSAGE_GROUP_SPACING);
({ jsx: closure_12, jsxs: closure_13 } = jsxProd);
_createForOfIteratorHelperLoose = {};
_createForOfIteratorHelperLoose = { gap: require("_createForOfIteratorHelperLoose").space.PX_8, height: "100%" };
_createForOfIteratorHelperLoose.container = _createForOfIteratorHelperLoose;
_createForOfIteratorHelperLoose.segmentedControlContainer = { gap: require("_createForOfIteratorHelperLoose").space.PX_16, alignItems: "center", paddingHorizontal: require("_createForOfIteratorHelperLoose").space.PX_16, marginBottom: require("_createForOfIteratorHelperLoose").space.PX_16 };
_createForOfIteratorHelperLoose.trailingColorContainer = { flexDirection: "row", alignItems: "center", justifyContent: "center" };
_createForOfIteratorHelperLoose.colorBlock = { marginHorizontal: 0, marginVertical: 0, marginRight: 8, minWidth: 24, height: 24, borderRadius: 3 };
let obj1 = { gap: require("_createForOfIteratorHelperLoose").space.PX_16, alignItems: "center", paddingHorizontal: require("_createForOfIteratorHelperLoose").space.PX_16, marginBottom: require("_createForOfIteratorHelperLoose").space.PX_16 };
_createForOfIteratorHelperLoose.chatSection = { paddingHorizontal: require("TABLE_ROW_HEIGHT").TABLE_ROW_PADDING, gap: require("_createForOfIteratorHelperLoose").space.PX_8 };
let obj2 = { paddingHorizontal: require("TABLE_ROW_HEIGHT").TABLE_ROW_PADDING, gap: require("_createForOfIteratorHelperLoose").space.PX_8 };
_createForOfIteratorHelperLoose.chatContainer = { paddingVertical: require("_createForOfIteratorHelperLoose").space.PX_24, borderRadius: require("_createForOfIteratorHelperLoose").radii.xl, borderWidth: get_ActivityIndicator.StyleSheet.hairlineWidth };
let obj3 = { paddingVertical: require("_createForOfIteratorHelperLoose").space.PX_24, borderRadius: require("_createForOfIteratorHelperLoose").radii.xl, borderWidth: get_ActivityIndicator.StyleSheet.hairlineWidth };
_createForOfIteratorHelperLoose.chatContainerInner = { flexDirection: "row", backgroundColor: require("_createForOfIteratorHelperLoose").colors.BACKGROUND_BASE_LOW, gap: require("_createForOfIteratorHelperLoose").space.PX_8 };
_createForOfIteratorHelperLoose.chatContent = { flex: 1 };
_createForOfIteratorHelperLoose.chatHeader = { flexDirection: "row", alignItems: "baseline", gap: 6 };
_createForOfIteratorHelperLoose.chatTimestamp = { marginTop: -8 };
_createForOfIteratorHelperLoose = _createForOfIteratorHelperLoose.createStyles(_createForOfIteratorHelperLoose);
let obj4 = { flexDirection: "row", backgroundColor: require("_createForOfIteratorHelperLoose").colors.BACKGROUND_BASE_LOW, gap: require("_createForOfIteratorHelperLoose").space.PX_8 };
let closure_15 = _createForOfIteratorHelperLoose.createAnimatedThemedStyles({ backgroundColor: require("_createForOfIteratorHelperLoose").colors.BACKGROUND_BASE_LOW });
let obj5 = { backgroundColor: require("_createForOfIteratorHelperLoose").colors.BACKGROUND_BASE_LOW };
let closure_16 = _createForOfIteratorHelperLoose.createAnimatedThemedStyles({ borderColor: require("_createForOfIteratorHelperLoose").colors.BORDER_STRONG });
_createForOfIteratorHelperLoose = { color: require("_createForOfIteratorHelperLoose").colors.TEXT_DEFAULT };
_createForOfIteratorHelperLoose = _createForOfIteratorHelperLoose.createAnimatedThemedStyles(_createForOfIteratorHelperLoose);
let obj6 = { borderColor: require("_createForOfIteratorHelperLoose").colors.BORDER_STRONG };
let closure_18 = _createForOfIteratorHelperLoose.createAnimatedThemedStyles({ color: require("_createForOfIteratorHelperLoose").colors.TEXT_MUTED });
2026-07-20 16:05:17 +00:00
let closure_19 = { code: "function GuildSettingsModalOfficialMessagesTsx1(){const{activeIndex}=this.__closure;return activeIndex.get();}" };
let closure_20 = { code: "function GuildSettingsModalOfficialMessagesTsx2(activeIndex){const{runOnJS,setCurrentThemeIndex}=this.__closure;runOnJS(setCurrentThemeIndex)(Math.round(activeIndex));}" };
2026-07-23 10:11:24 +00:00
const obj8 = { color: require("_createForOfIteratorHelperLoose").colors.TEXT_MUTED };
const result = require("get ActivityIndicator").fileFinishedImporting("modules/guild_settings/native/GuildSettingsModalOfficialMessages.tsx");
2026-07-20 16:05:17 +00:00
export default function GuildSettingsModalOfficialMessages(guildId) {
let guild;
let submitting;
guildId = guildId.guildId;
2026-07-23 10:11:24 +00:00
let officialMessageColor;
let stateFromStores;
let c6;
2026-07-20 16:05:17 +00:00
let closure_7;
2026-07-23 10:11:24 +00:00
let activeIndex;
const tmp = _createForOfIteratorHelperLoose();
let obj = guildId(submitting[17]);
2026-07-20 16:05:17 +00:00
const navigation = obj.useNavigation();
2026-07-23 10:11:24 +00:00
let obj1 = guildId(submitting[18]);
let items = [activeIndex];
2026-07-20 16:05:17 +00:00
const stateFromStoresObject = obj1.useStateFromStoresObject(items, () => ({ guild: activeIndex.getGuild(), submitting: activeIndex.isSubmitting(), hasChanges: activeIndex.hasChanges() }));
({ guild, submitting } = stateFromStoresObject);
const hasChanges = stateFromStoresObject.hasChanges;
2026-07-23 10:11:24 +00:00
officialMessageColor = undefined;
2026-07-20 16:05:17 +00:00
if (null != guild) {
officialMessageColor = guild.officialMessageColor;
}
if (null == officialMessageColor) {
officialMessageColor = closure_9;
}
2026-07-23 10:11:24 +00:00
let obj2 = guildId(submitting[18]);
2026-07-20 16:05:17 +00:00
const items1 = [closure_7];
const items2 = [guildId];
2026-07-23 10:11:24 +00:00
stateFromStores = obj2.useStateFromStores(items1, () => {
guild = guild.getGuild(guildId);
2026-07-20 16:05:17 +00:00
let officialMessageColor;
if (null != guild) {
officialMessageColor = guild.officialMessageColor;
}
if (null == officialMessageColor) {
2026-07-23 10:11:24 +00:00
officialMessageColor = outer1_9;
2026-07-20 16:05:17 +00:00
}
return officialMessageColor;
}, items2);
2026-07-23 10:11:24 +00:00
const tmp6 = hasChanges(officialMessageColor.useState(0), 2);
2026-07-20 16:05:17 +00:00
const first = tmp6[0];
2026-07-23 10:11:24 +00:00
c6 = tmp8;
2026-07-20 16:05:17 +00:00
const items3 = [guildId];
2026-07-23 10:11:24 +00:00
const effect = officialMessageColor.useEffect(() => () => {
navigation(submitting[19]).cancelChanges(outer1_0);
2026-07-20 16:05:17 +00:00
}, items3);
const items4 = [guildId, officialMessageColor, navigation, submitting, hasChanges];
2026-07-23 10:11:24 +00:00
const effect1 = officialMessageColor.useEffect(() => {
function handleSaveChanges() {
let obj = navigation(submitting[19]);
obj = { officialMessageColor: outer1_4 };
2026-07-20 16:05:17 +00:00
obj.saveGuild(handleSaveChanges, obj);
}
2026-07-23 10:11:24 +00:00
let obj = {};
2026-07-20 16:05:17 +00:00
let fn;
if (submitting) {
fn = () => null;
}
obj.headerLeft = fn;
if (submitting) {
2026-07-23 10:11:24 +00:00
let fn2 = () => outer2_12(guildId(submitting[20]).HeaderSubmittingIndicator, {});
2026-07-20 16:05:17 +00:00
} else if (hasChanges) {
fn2 = () => {
const obj = { onPress: handleSaveChanges };
2026-07-23 10:11:24 +00:00
const intl = guildId(submitting[12]).intl;
obj.text = intl.string(guildId(submitting[12]).t["R3BPH+"]);
return outer2_12(guildId(submitting[21]).HeaderActionButton, obj);
2026-07-20 16:05:17 +00:00
};
}
obj.headerRight = fn2;
navigation.setOptions(obj);
}, items4);
const items5 = [officialMessageColor, stateFromStores];
2026-07-23 10:11:24 +00:00
const callback = officialMessageColor.useCallback(() => {
2026-07-20 16:05:17 +00:00
let obj = navigation(submitting[22]);
obj = { color: officialMessageColor, defaultColor: stateFromStores };
const intl = guildId(submitting[12]).intl;
obj.confirmLabel = intl.string(guildId(submitting[12]).t.XqMe3N);
obj.onSelect = function onSelect(officialMessageColor) {
2026-07-23 10:11:24 +00:00
let obj = navigation(submitting[19]);
2026-07-20 16:05:17 +00:00
obj = { officialMessageColor };
obj.updateGuild(obj);
};
obj.openLazy(guildId(submitting[24])(submitting[23], submitting.paths), "RoleColorPicker", obj);
}, items5);
2026-07-23 10:11:24 +00:00
const tmp12 = hasChanges(officialMessageColor.useState(0), 2);
2026-07-20 16:05:17 +00:00
closure_7 = tmp12[1];
2026-07-23 10:11:24 +00:00
const callback1 = officialMessageColor.useCallback((nativeEvent) => {
2026-07-20 16:05:17 +00:00
guild(nativeEvent.nativeEvent.layout.width);
}, []);
2026-07-23 10:11:24 +00:00
const memo = officialMessageColor.useMemo(() => {
2026-07-20 16:05:17 +00:00
let obj = {};
const intl = guildId(submitting[12]).intl;
obj.label = intl.string(guildId(submitting[12]).t.K2sFfo);
2026-07-23 10:11:24 +00:00
obj.id = outer1_11.LIGHT;
obj.icon = outer1_12(guildId(submitting[13]).ThemeLightIcon, {});
2026-07-20 16:05:17 +00:00
obj.page = null;
const items = [obj, , ];
obj = {};
const intl2 = guildId(submitting[12]).intl;
obj.label = intl2.string(guildId(submitting[12]).t.b8Cei3);
2026-07-23 10:11:24 +00:00
obj.id = outer1_11.DARKER;
obj.icon = outer1_12(guildId(submitting[14]).ThemeDarkIcon, {});
2026-07-20 16:05:17 +00:00
obj.page = null;
items[1] = obj;
obj = {};
const intl3 = guildId(submitting[12]).intl;
obj.label = intl3.string(guildId(submitting[12]).t.pQwSpQ);
2026-07-23 10:11:24 +00:00
obj.id = outer1_11.MIDNIGHT;
obj.icon = outer1_12(guildId(submitting[15]).ThemeMidnightIcon, {});
2026-07-20 16:05:17 +00:00
obj.page = null;
items[2] = obj;
return items;
}, []);
2026-07-23 10:11:24 +00:00
let obj3 = guildId(submitting[25]);
2026-07-20 16:05:17 +00:00
const segmentedControlState = obj3.useSegmentedControlState({ items: memo, pageWidth: tmp12[0], defaultIndex: first });
2026-07-23 10:11:24 +00:00
activeIndex = segmentedControlState.activeIndex;
let obj4 = guildId(submitting[26]);
let fn = function k() {
2026-07-20 16:05:17 +00:00
return activeIndex.get();
};
fn.__closure = { activeIndex };
fn.__workletHash = 4687220686460;
fn.__initData = closure_19;
class B {
constructor(arg0) {
obj = guildId(submitting[26]);
2026-07-23 10:11:24 +00:00
runOnJSResult = obj.runOnJS(c6);
2026-07-20 16:05:17 +00:00
tmpResult = runOnJSResult(Math.round(guildId));
return;
}
}
2026-07-23 10:11:24 +00:00
obj = { runOnJS: guildId(submitting[26]).runOnJS, setCurrentThemeIndex: tmp8 };
2026-07-20 16:05:17 +00:00
B.__closure = obj;
B.__workletHash = 5332792853021;
B.__initData = closure_20;
const animatedReaction = obj4.useAnimatedReaction(fn, B);
2026-07-23 10:11:24 +00:00
obj = { bgBaseLow: callback3(activeIndex), borderStrong: callback4(activeIndex), textStrong: _createForOfIteratorHelperLoose(activeIndex), textMuted: callback5(activeIndex) };
2026-07-20 16:05:17 +00:00
obj1 = { style: tmp.container };
obj2 = {};
2026-07-23 10:11:24 +00:00
let intl = guildId(submitting[12]).intl;
obj2.label = intl.string(guildId(submitting[12]).t["2uQ6wZ"]);
2026-07-20 16:05:17 +00:00
obj2.onPress = callback;
obj2.arrow = true;
2026-07-23 10:11:24 +00:00
obj3 = { style: tmp.trailingColorContainer, children: callback(navigation(submitting[28]), obj4) };
2026-07-20 16:05:17 +00:00
obj4 = { color: officialMessageColor, style: tmp.colorBlock };
2026-07-23 10:11:24 +00:00
obj2.trailing = callback(stateFromStores, obj3);
obj2.subLabel = guildId(submitting[29]).int2hex(officialMessageColor);
const items6 = [callback(guildId(submitting[27]).TableRow, obj2), ];
2026-07-20 16:05:17 +00:00
const obj5 = { style: tmp.chatSection };
const obj6 = { variant: "heading-md/semibold" };
2026-07-23 10:11:24 +00:00
let intl2 = guildId(submitting[12]).intl;
obj6.children = intl2.string(guildId(submitting[12]).t.VI0jGW);
const items7 = [callback(guildId(submitting[30]).Text, obj6), , ];
2026-07-20 16:05:17 +00:00
const obj7 = { animatedStyles: obj, selectedColor: officialMessageColor, theme: memo[first].id };
2026-07-23 10:11:24 +00:00
items7[1] = callback(MessagePreview, obj7);
const obj12 = guildId(submitting[29]);
items7[2] = callback(stateFromStores, { style: tmp.segmentedControlContainer, onLayout: callback1, children: callback(guildId(submitting[31]).SegmentedControl, { variant: "experimental_Large", state: segmentedControlState }) });
2026-07-20 16:05:17 +00:00
obj5.children = items7;
2026-07-23 10:11:24 +00:00
items6[1] = callback2(stateFromStores, obj5);
2026-07-20 16:05:17 +00:00
obj1.children = items6;
2026-07-23 10:11:24 +00:00
return callback2(stateFromStores, obj1);
2026-07-20 16:05:17 +00:00
};