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

368 lines
19 KiB
TypeScript

/* Metro module 14880; source: modules/icymi/native/ICYMIServerRecommendationRow.tsx; dependencies: [57, 5, 31, 27, 4502, 1867, 9569, 661, 33, 14815, 697, 566, 1423, 1418, 7599, 5475, 6819, 9580, 3857, 1244, 6593, 4573, 4578, 14854, 8671, 2] */
import Module00005 from '../../../by-id/module-00005.js'; /* Metro dependency 5 */
import Module00057 from '../../../by-id/module-00057.js'; /* Metro dependency 57 */
import GuildStore from '../../../stores/GuildStore.tsx'; /* Metro dependency 1867 */
import AccessibilityStore from '../../a11y/AccessibilityStore.tsx'; /* Metro dependency 4502 */
import GuildIcon from '../../guild/native/GuildIcon.tsx'; /* Metro dependency 6819 */
import ClipView from '../../../design/components/Icon/native/ClipView.tsx'; /* Metro dependency 7599 */
import ICYMIStore from '../ICYMIStore.tsx'; /* Metro dependency 9569 */
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 FluxModule from '../../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import * as ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */
import * as IndexNativeModule from '../../../intl/index.native.tsx'; /* Metro dependency 1244 */
import * as TextModule from '../../../design/components/Text/native/Text.tsx'; /* Metro dependency 4573 */
import * as ButtonNativeModule from '../../../design/components/Button/native/Button.native.tsx'; /* Metro dependency 4578 */
import * as GuildIconModule from '../../guild/native/GuildIcon.tsx'; /* Metro dependency 6819 */
import * as ClipViewModule from '../../../design/components/Icon/native/ClipView.tsx'; /* Metro dependency 7599 */
import * as CreateICYMIStylesModule from './createICYMIStyles.tsx'; /* Metro dependency 14815 */
function _fun112569(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#112569, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15077:6, offset: 0x023d285d, size: 381 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ConstantsModule;
const env0_10 = value.AnalyticsObjects;
const env0_11 = value.AnalyticsPages;
const env0_12 = value.AnalyticsSections;
const env0_13 = value.GuildFeatures;
value = require(33) /* metro dependency 33 */;
const env0_14 = value.jsx;
const env0_15 = value.jsxs;
const env0_16 = value.Fragment;
const env0_17 = (CreateICYMIStylesModule).createICYMIStyles(_fun112582);
(FileImportTrackerModule).fileFinishedImporting('modules/icymi/native/ICYMIServerRecommendationRow.tsx');
exports.ICYMIServerRecommendationRow = ICYMIServerRecommendationRow;
function CutoutGuildBanner_112570({guild}) { // fn#112570, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15077:1082, offset: 0x023d29da, size: 526 bytes, params: 2, frame: 27
const value3 = env0_17();
const useReducedMotion = (require(566) /* metro dependency 566: flux */).useStateFromStores([AccessibilityStore],
function() {
return AccessibilityStore.useReducedMotion;
});
const value4 = !useReducedMotion;
const r15 = guild.banner != null ? (importDefault(1423) /* metro dependency 1423: AvatarUtils */).getAnimatableSourceWithFallback(useReducedMotion ? value4 : guild.features.has(GuildFeatures.ANIMATED_BANNER),
_fun112572) : undefined;
const value7 = ReactModule.useMemo(_fun112573, [guild]);
object = {style: value3.bannerImage};
const CutoutShape = (ClipViewModule).CutoutShape;
const RoundedRect = CutoutShape.RoundedRect;
const clipView = (
<ClipView
cutouts={[{'shape': null, 'x': 8, 'y': 46, 'width': 56, 'height': 56, 'cornerRadius': 20,
shape: RoundedRect}]}
>
{
guild.banner != null
? ((Component) => <Component style={value3.bannerImage} source={r15} resizeMode="cover" />)(importDefault(5475) /* metro dependency 5475: FastImage */)
: (
<View style={[value3.bannerImage, value3.emptyBanner]} />
)
}
</ClipView>
);
const guildIcon = value3.guildIcon;
const GuildIconSizes = (GuildIconModule).GuildIconSizes;
const LARGE = GuildIconSizes.LARGE;
return (
<View {...object}>
{clipView}
<GuildIcon
style={guildIcon}
guild={value7}
size={LARGE}
animate={value4}
/>
</View>
);
function _fun112572(a0) { // fn#112572, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15077:1291, offset: 0x023d2be8, size: 71 bytes, params: 2, frame: 14
let value = environment.__proto__;
value = importDefault(1423) /* metro dependency 1423: AvatarUtils */;
const getGuildBannerSource = value.getGuildBannerSource;
const guildBinding = guild;
return Reflect.apply(getGuildBannerSource, value, [{id: guildBinding.id, banner: guildBinding.banner}, a0]);
}
function _fun112573() { // fn#112573, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15077:1375, offset: 0x023d2c2f, size: 45 bytes, params: 1, frame: 11
let value = environment.__proto__;
value = require(1418) /* metro dependency 1418: GuildRecordUtils */;
return value.fromClientDiscoverableGuild(guild);
}
}
function FeaturedServer_112574({guild}) { // fn#112574, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15077:1794, offset: 0x023d2c5c, size: 552 bytes, params: 2, frame: 30
const value2 = env0_17();
const value3 = (FluxModule).useStateFromStores([GuildStore], _fun112575);
const value5 = ReactModule.useCallback(Module00005(_fun112577), [guild.id]);
const [property, env0_1] = Module00057(ReactModule.useState(false), 2);
const featuredServerContainer = value2.featuredServerContainer;
const items2 = [
<CutoutGuildBanner_112570 guild={guild} />,
];
const featuredServerInnerContainer = value2.featuredServerInnerContainer;
const Text = (TextModule).Text;
items2[1] = (
<View style={featuredServerInnerContainer}>
<Text
maxFontSizeMultiplier={1}
lineClamp={1}
style={value2.featuredServerTitle}
variant="text-md/semibold"
color="mobile-text-heading-primary"
>
{guild.name}
</Text>
<Text
maxFontSizeMultiplier={1}
lineClamp={3}
variant="text-xs/normal"
color="text-default"
>
{guild.description}
</Text>
</View>
);
const buttonContainer = value2.buttonContainer;
const Button = (ButtonNativeModule).Button;
const intl = (IndexNativeModule).intl;
const string = intl.string;
const t = (IndexNativeModule).t;
items2[2] = (
<View style={buttonContainer}>
<Button
disabled={value3}
loading={property}
text={value3 ? Reflect.apply(string, intl, [t.cEnaWx]) : Reflect.apply(string, intl, [t.VJlc0S])}
size="sm"
onPress={value5}
grow
/>
</View>
);
return (
<View style={featuredServerContainer}>
{items2}
</View>
);
function _fun112575() { // fn#112575, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15077:1874, offset: 0x023d2e84, size: 38 bytes, params: 1, frame: 11
const value = environment.__proto__;
const guildStoreBinding = GuildStore;
const getGuild = guildStoreBinding.getGuild;
return Reflect.apply(getGuild, guildStoreBinding, [guild.id]) != null;
}
function* _fun112577() { // fn#112577, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15077:1922, offset: 0x023d2eb5, size: 525 bytes, params: 1, frame: 24
var environment;
var binding4;
var dehydrated;
var value11;
var transitionToGuildSync;
var object;
if (true) {
value = environment.__proto__;
importDefault(true);
var binding = env2_1;
var binding2 = env2_2;
binding(binding2[17]).itemInteracted('recommended_guilds', 'recommended_guilds', 'press_join_guild');
var value5 = binding(binding2[17]);
var feedItemActioned = value5.feedItemActioned;
var object4 = {};
var id = require.id;
object4.itemId = id;
object4.itemType = 'recommended_guilds';
object4.actionParameters = {'actionGestureType': 'press', 'actionTargetElement': 'item_container',
'actionIntentType': 'join', 'actionDestinationType': 'guild'};
Reflect.apply(feedItemActioned, value5, [object4]);
var value6 = binding(binding2[17]);
yield value6.gravityJoinGuild([require.id], 'recommended_guilds');
var value7 = undefined;
if (false) {
return value7;
}
if (value7) {
object4 = {};
object4.state = {analyticsSource: {page: env2_11.ICYMI, section: env2_12.ICYMI_RECOMMENDED_SERVERS,
object: env2_10.LIST_ITEM}};
binding = env2_1;
binding4 = env2_2;
binding(binding4[17]).addedRecommendedGuild();
dehydrated = binding(binding4[17]).fetchDehydrated({'isReloading': true, 'forceRefresh': true});
dehydrated.then(env2_4(_fun112579));
value11 = binding(binding4[20]);
transitionToGuildSync = value11.transitionToGuildSync;
id = require.id;
object = {};
copyDataProperties(object, object4, undefined);
yield Reflect.apply(transitionToGuildSync, value11, [id, object]);
if (false) {
return undefined;
}
importDefault(false);
} else {
importDefault(false);
binding = env2_1;
var binding3 = env2_2;
value = binding(binding3[18]);
var open = value.open;
binding = env2_0;
var intl = binding(binding3[19]).intl;
var string = intl.string;
var CG4Hks = binding(binding3[19]).t.CG4Hks;
Reflect.apply(open, value, [{key: 'RecommeendedServersRow', content: Reflect.apply(string, intl,
[CG4Hks])}]);
}
}
function* _fun112579() { // fn#112579, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15077:2614, offset: 0x023d30cd, size: 128 bytes, params: 1, frame: 15
if (true) {
value = environment.__proto__.__proto__.__proto__.__proto__;
var value3 = env4_1(env4_2[17]);
yield value3.reloadICYMITab();
if (false) {
return undefined;
}
var value6 = env4_1(env4_2[17]);
var getGuildChannelScores = value6.getGuildChannelScores;
yield Reflect.apply(getGuildChannelScores, value6, []);
if (false) {
return undefined;
}
env4_1(env4_2[17]).getRecommendedGuilds();
}
}
}
}
function RecommendedGuildsRow({discoverableGuilds}) { // fn#112580, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15077:3466, offset: 0x023d314d, size: 215 bytes, params: 2, frame: 19
var r0;
var space;
var PX_16;
var value;
const useCallback = ReactModule.useCallback;
const object = [discoverableGuilds];
if (discoverableGuilds.length === 0) {
r0 = null;
} else {
value = importDefault(8671) /* metro dependency 8671: FastestListAndroid */;
var valueProps = {sections: [discoverableGuilds.length]};
space = (importDefault(697) /* metro dependency 697: native */).space;
PX_16 = space.PX_16;
valueProps.insetStart = PX_16;
valueProps.renderItem = Reflect.apply(useCallback, ReactModule, [_fun112581, valueProps]);
valueProps.estimatedListSize = 'windowSize';
space = (importDefault(697) /* metro dependency 697: native */).space;
PX_16 = space.PX_16;
valueProps.itemSize = 200 + PX_16;
valueProps.horizontal = true;
valueProps.listId = 'recommended-servers-list';
valueProps.showsHorizontalScrollIndicator = false;
value = ((Component) => <Component {...valueProps} />)(value);
r0 = value;
}
return r0;
function _fun112581(a0, a1) { // fn#112581, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15077:3541, offset: 0x023d3224, size: 50 bytes, params: 3, frame: 14
var r0;
const property = discoverableGuilds[a1];
let value = null;
if (value == property) {
r0 = value;
} else {
value = environment.__proto__;
value = <FeaturedServer_112574 guild={property} />;
r0 = value;
}
return r0;
}
}
function _fun112582(a0) { // fn#112582, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15077:330, offset: 0x023d3256, size: 431 bytes, params: 2, frame: 16
const object = {};
const PX_24 = (importDefault(697) /* metro dependency 697: native */).space.PX_24;
object.container = {marginVertical: PX_24};
let PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
object.title = {marginBottom: PX_8, marginHorizontal: a0.margin};
const PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object.subtitle = {marginBottom: PX_16, marginHorizontal: a0.margin};
let PX_12 = (importDefault(697) /* metro dependency 697: native */).space.PX_12;
object.featuredServerInnerContainer = {marginHorizontal: PX_12, marginTop: 36};
const object5 = {position: 'absolute'};
PX_12 = (importDefault(697) /* metro dependency 697: native */).space.PX_12;
object5.bottom = PX_12;
PX_12 = (importDefault(697) /* metro dependency 697: native */).space.PX_12;
object5.left = PX_12;
PX_12 = (importDefault(697) /* metro dependency 697: native */).space.PX_12;
object5.right = PX_12;
object.buttonContainer = object5;
PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
object.featuredServerTitle = {marginBottom: PX_8};
object.guildIcon = {'position': 'absolute', 'top': 50, 'left': 12};
object.bannerImage = {'height': 72, 'width': 200};
const BACKGROUND_MOD_SUBTLE = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_MOD_SUBTLE;
object.emptyBanner = {backgroundColor: BACKGROUND_MOD_SUBTLE};
const object6 = {'borderRadius': null, 'backgroundColor': null, 'height': 244, 'width': 200, 'overflow': 'hidden'};
object6.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.lg;
const CARD_BACKGROUND_DEFAULT = (importDefault(697) /* metro dependency 697: native */).colors.CARD_BACKGROUND_DEFAULT;
object6.backgroundColor = CARD_BACKGROUND_DEFAULT;
object.featuredServerContainer = object6;
return object;
}
function ICYMIServerRecommendationRow() { // fn#112583, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15077:3985, offset: 0x023d3405, size: 421 bytes, params: 1, frame: 29
var r0;
var jsxRuntimeEnv0_16Binding;
const Text = (TextModule).Text;
const intl = (IndexNativeModule).intl;
var string;
const t = (IndexNativeModule).t;
var items2;
const value2 = (require(566) /* metro dependency 566: flux */).useStateFromStoresArray([ICYMIStore], function() {
return ICYMIStore.getDiscoverableGuilds();
});
const value3 = env0_17();
if (value2.length === 0) {
r0 = null;
} else {
jsxRuntimeEnv0_16Binding = jsxRuntimeEnv0_16;
var viewBindingProps = {style: value3.container};
string = intl.string;
items2 = [
<Text
style={value3.title}
variant="heading-lg/semibold"
color="mobile-text-heading-primary"
>
{Reflect.apply(string, intl, [t.lv1tce])}
</Text>,
];
string = intl.string;
items2[1] = (
<Text
style={value3.subtitle}
variant="heading-sm/normal"
color="text-muted"
>
{Reflect.apply(string, intl, [t.x4OezN])}
</Text>
);
items2[2] = <RecommendedGuildsRow discoverableGuilds={value2} />;
r0 = (
<>
<View {...viewBindingProps}>
{items2}
</View>
{((Separator) => <Separator />)((require(14854) /* metro dependency 14854: ICYMIShared */).Separator)}
</>
);
}
return r0;
}
}
global.__d(_fun112569, 14880, [57, 5, 31, 27, 4502, 1867, 9569, 661, 33, 14815, 697, 566, 1423, 1418, 7599, 5475,
6819, 9580, 3857, 1244, 6593, 4573, 4578, 14854, 8671,
2]) /* metro module 14880, dependencies: [57, 5, 31, 27, 4502, 1867, 9569, 661, 33, 14815, 697, 566, 1423, 1418, 7599, 5475, 6819, 9580, 3857, 1244, 6593, 4573, 4578, 14854, 8671, 2] */;