Files
discord-decomp/sources/modules/guild_sidebar/native/BaseChannelItem.tsx
T
2026-07-28 01:06:53 +03:00

199 lines
12 KiB
TypeScript

/* Metro module 11846; source: modules/guild_sidebar/native/BaseChannelItem.tsx; dependencies: [31, 27, 10980, 4865, 33, 4501, 697, 4573, 478, 1305, 10957, 8554, 11847, 2] */
import Native from '../../../external/discord_common/js/packages/tokens/native.tsx'; /* Metro dependency 697 */
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactNativeModule from '../../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
import * as ReactModule from '../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
import * as JsxRuntimeModule from '../../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */
import * as CreateStylesModule from '../../../design/components/Styles/native/createStyles.tsx'; /* Metro dependency 4501 */
import * as TextModule from '../../../design/components/Text/native/Text.tsx'; /* Metro dependency 4573 */
import * as ReadStateConstantsModule from '../../read_states/ReadStateConstants.tsx'; /* Metro dependency 4865 */
import * as RedesignChannelListConstantsModule from '../../channel_list_v2/native/RedesignChannelListConstants.tsx'; /* Metro dependency 10980 */
function _fun90765(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#90765, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12032:6, offset: 0x020448db, size: 420 bytes, params: 8, frame: 21
const env0_0 = require;
const BaseChannelSubtitle2 = BaseChannelSubtitle;
const useChannelNameTextProps2 = useChannelNameTextProps;
const getChannelSubtitleTextProps2 = getChannelSubtitleTextProps;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_9 = (CreateStylesModule).createStyles(_fun90769);
(FileImportTrackerModule).fileFinishedImporting('modules/guild_sidebar/native/BaseChannelItem.tsx');
exports.default = BaseChannelItem;
exports.ChannelModes = {SELECTED: 'Selected', LOCKED: 'Locked', MUTED: 'Muted', RELEVANT: 'Relevant',
UNREAD_LESS_IMPORTANT: 'UnreadLessImportant', UNREAD_IMPORTANT: 'UnreadImportant', DEFAULT: 'Default'};
exports.BaseChannelSubtitle = BaseChannelSubtitle2;
exports.BaseChannelIcon = BaseChannelIcon;
exports.useChannelNameTextProps = useChannelNameTextProps2;
exports.getChannelSubtitleTextProps = getChannelSubtitleTextProps2;
exports.BaseChannelName = BaseChannelName;
function BaseChannelSubtitle({mode, subtitle}) { // fn#90766, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12032:1276, offset: 0x02044a7f, size: 133 bytes, params: 2, frame: 19
var r0;
var Text;
var value;
if (subtitle == null) {
r0 = null;
} else {
Text = (require(4573) /* metro dependency 4573: Text */).Text;
value = require(478) /* metro dependency 478: PlatformUtils */;
value = (
<Text
experimental_useNativeText={!value.isAndroid()}
lineClamp={1}
{...getChannelSubtitleTextProps(mode)}
>
{subtitle}
</Text>
);
r0 = value;
}
return r0;
}
function useChannelNameTextProps(a0) { // fn#90767, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12032:1477, offset: 0x02044b04, size: 156 bytes, params: 2, frame: 3
const UNREAD_IMPORTANT = env0_10.UNREAD_IMPORTANT;
return a0 === UNREAD_IMPORTANT || a0 === env0_10.RELEVANT ? {'variant': 'text-md/semibold',
'color': 'redesign-channel-name-text'} : a0 === env0_10.UNREAD_LESS_IMPORTANT ? {'variant': 'text-md/medium',
'color': 'redesign-channel-name-muted-text'} : a0 === env0_10.MUTED ? {'variant': 'text-md/medium',
'color': 'text-muted'} : a0 === env0_10.SELECTED ? {'variant': 'text-md/medium',
'color': 'redesign-channel-name-text'} : {'variant': 'text-md/medium',
'color': 'redesign-channel-name-muted-text'};
}
function getChannelSubtitleTextProps(a0) { // fn#90768, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12032:1922, offset: 0x02044ba0, size: 86 bytes, params: 2, frame: 3
var object2;
const UNREAD_IMPORTANT = env0_10.UNREAD_IMPORTANT;
if (a0 === UNREAD_IMPORTANT) {
object2 = {'variant': 'text-xs/medium', 'color': 'redesign-channel-name-text'};
} else if (a0 === env0_10.RELEVANT) {
object2 = {'variant': 'text-xs/medium', 'color': 'redesign-channel-name-text'};
} else if (a0 === env0_10.SELECTED) {
object2 = {'variant': 'text-xs/medium', 'color': 'redesign-channel-name-text'};
} else {
env0_10.MUTED;
object2 = {'variant': 'text-xs/medium', 'color': 'text-muted'};
}
return object2;
}
function _fun90769(a0) { // fn#90769, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12032:232, offset: 0x02044bf6, size: 425 bytes, params: 2, frame: 18
const object = {};
object.rowPaddingNoIcon = {paddingHorizontal: 6};
const object3 = {};
const CHANNEL_ITEM_RADIUS = (Native).modules.mobile.CHANNEL_ITEM_RADIUS;
object3.borderRadius = CHANNEL_ITEM_RADIUS;
const MOBILE_CHANNEL_ITEM_BACKGROUND_SELECTED = (Native).colors.MOBILE_CHANNEL_ITEM_BACKGROUND_SELECTED;
object3.backgroundColor = MOBILE_CHANNEL_ITEM_BACKGROUND_SELECTED;
object.rowSelected = object3;
const PX_8 = (Native).space.PX_8;
object.unreadIndicator = {left: -PX_8};
let MUTED = env0_10.MUTED;
const value2 = 1;
object.channelIcon = {'width': 16, 'height': 16, 'marginRight': 8, opacity: a0 !== MUTED ? value2 : 0.5};
MUTED = env0_10.MUTED;
object.redesignedChannelIcon = {marginRight: 8, opacity: a0 !== MUTED ? value2 : 0.5};
const CHANNEL_ICON = (Native).colors.CHANNEL_ICON;
object.channelIconNormal = {tintColor: CHANNEL_ICON};
const INTERACTIVE_TEXT_ACTIVE = (Native).colors.INTERACTIVE_TEXT_ACTIVE;
object.channelIconUnread = {tintColor: INTERACTIVE_TEXT_ACTIVE};
const ICON_MUTED = (Native).colors.ICON_MUTED;
object.channelIconMuted = {tintColor: ICON_MUTED};
object.channel = {'paddingHorizontal': 8, 'paddingVertical': 8, 'flexDirection': 'row', 'alignItems': 'center',
'position': 'relative'};
object.channelNameContainer = {'flex': 1, 'flexDirection': 'column', 'alignItems': 'stretch',
'justifyContent': 'center'};
MUTED = env0_10.MUTED;
object.channelName = {'flexGrow': 1, 'textAlign': 'left', lineHeight: CHANNEL_TITLE_LINE_HEIGHT,
opacity: a0 !== MUTED ? value2 : 0.5};
return object;
}
function BaseChannelItem(a0) { // fn#90770, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12032:2235, offset: 0x02044d9f, size: 407 bytes, params: 2, frame: 30
const icon = a0.icon;
const name = a0.name;
const mode = a0.mode;
const hideIcon = a0.hideIcon;
let disableHighlightOnPress = a0.disableHighlightOnPress;
disableHighlightOnPress = !(disableHighlightOnPress === undefined) && disableHighlightOnPress;
const channelInfo = a0.channelInfo;
const children = a0.children;
let unread = a0.unread;
unread = !(unread === undefined) && unread;
const object = {'icon': 0, 'name': 0, 'mode': 0, 'hideIcon': 0, 'disableHighlightOnPress': 0, 'channelInfo': 0,
'children': 0, 'unread': 0};
silentSetPrototypeOf(object, null, undefined);
const value = copyDataProperties({}, a0, object, undefined);
const styles = useStyles(mode);
const value3 = ReactModule.useMemo(_fun90771, [hideIcon, mode, styles]);
const value4 = !hideIcon;
return ((Component) => <Component {...value}><View style={value3}>{hideIcon ? value4 : ((Component) => <Component style={styles.unreadIndicator} unread={unread} resolvedUnreadSetting={mode === env0_10.UNREAD_LESS_IMPORTANT ? UnreadSetting.ONLY_MENTIONS : UnreadSetting.ALL_MESSAGES} />)(importDefault(10957) /* metro dependency 10957: StaticChannelIndicator */)}{hideIcon ? value4 : icon}{name}{channelInfo}</View>{children}</Component>)(disableHighlightOnPress ? importDefault(11847) /* metro dependency 11847: TouchableBackground */ : (require(8554) /* metro dependency 8554: native */).AnimatedPressableHighlight);
function _fun90771() { // fn#90771, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12032:2390, offset: 0x02044f36, size: 81 bytes, params: 1, frame: 4
const hideIconBinding = hideIcon;
const modeBinding = mode;
const SELECTED = env1_10.SELECTED;
return [styles.channel, hideIconBinding && styles.rowPaddingNoIcon, modeBinding === SELECTED && styles.rowSelected];
}
}
function BaseChannelIcon({disableColor, mode, source, IconComponent, style, isChannelLive}) { // fn#90772, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12032:2795, offset: 0x02044f87, size: 332 bytes, params: 2, frame: 26
var r0;
var value;
const styles = useStyles(mode);
const MUTED = env0_10.MUTED;
const value2 = mode === MUTED;
const UNREAD_IMPORTANT = env0_10.UNREAD_IMPORTANT;
const value3 = mode === UNREAD_IMPORTANT;
const SELECTED = env0_10.SELECTED;
const value4 = mode === SELECTED;
const items2 = [styles.channelIcon];
if (disableColor !== true) {
items2.push(value2 ? styles.channelIconMuted : value3 || value4 ? styles.channelIconUnread : styles.channelIconNormal);
}
if (style != null) {
items2.push(style);
}
if (IconComponent != null) {
value = 'status-positive';
value = (
<IconComponent
size="sm"
style={styles.redesignedChannelIcon}
color={isChannelLive ? value : value2 ? 'icon-muted' : value3 || value4 ? 'interactive-text-active' : 'channel-icon'}
/>
);
r0 = value;
} else {
const Icon = (require(1305) /* metro dependency 1305: native */).Icon;
r0 = (
<Icon
disableColor={disableColor}
size={(require(1305) /* metro dependency 1305: native */).Icon.Sizes.CUSTOM}
style={items2}
source={source}
/>
);
}
return r0;
}
function BaseChannelName({mode, name, subtitle, textStyle}) { // fn#90773, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12032:3436, offset: 0x020450d3, size: 216 bytes, params: 2, frame: 24
const styles = useStyles(mode);
const Text = (TextModule).Text;
const textProps = {experimental_useNativeText: true, ...useChannelNameTextProps(mode)};
textProps['lineClamp'] = 1;
textProps['style'] = [styles.channelName, textStyle];
return (
<View style={styles.channelNameContainer}>
<Text {...textProps}>
{name}
</Text>
<BaseChannelSubtitle mode={mode} subtitle={subtitle} />
</View>
);
}
}
global.__d(_fun90765, 11846, [31, 27, 10980, 4865, 33, 4501, 697, 4573, 478, 1305, 10957, 8554, 11847,
2]) /* metro module 11846, dependencies: [31, 27, 10980, 4865, 33, 4501, 697, 4573, 478, 1305, 10957, 8554, 11847, 2] */;