Files
discord-decomp/modules/guild_profile/native/components/GuildProfileGamesActionSheet.tsx
T
2026-11-01 12:12:55 +02:00

64 lines
3.0 KiB
TypeScript

// Metro module 11953 (f11954).
import { useCallback } from "react";
import { View } from "react-native";
import useOpenGameProfileModal from "../../../game_profile/hooks/useOpenGameProfileModal";
import { GameProfileSources } from "../../../game_profile/GameProfileAnalyticUtils";
import { TableRow } from "../../../../design/components/TableRow/native/TableRow.native";
import GameIcon from "./GameIcon";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { useAllGuildProfileGames } from "../../hooks/useGuildProfileGames";
import { useGuildProfileGameProfilesExperiment } from "../../GuildProfileGameProfilesExperiment.native";
import { useBottomSheetRef } from "../../../../design/components/Sheet/native/useBottomSheetRef";
import { intl, t } from "../../../../intl/index.native";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import { BottomSheet } from "../../../../design/components/Sheet/native/BottomSheet.native";
import { BottomSheetScrollView } from "../../../../_bundle/Module5245";
import { TableRowGroup } from "../../../../design/components/TableRow/native/TableRowGroup.native";
let useStyles;
const GuildProfileGameRow = function GuildProfileGameRow(props) {
const { game, activityLevel } = props;
let clickable = props.clickable;
const openGameProfileModal = useOpenGameProfileModal({
gameId: game.id,
source: GameProfileSources.GuildProfileGames,
trackEntryPointImpression: clickable
});
let c19287_0 = openGameProfileModal;
if (clickable) {
clickable = openGameProfileModal != null;
}
return <TableRow icon={<GameIcon game={game} activityLevel={activityLevel} />} label={game.name} arrow={clickable} onPress={clickable ? () => c19287_0() : void 0} />;
};
useStyles = createStyles({
container: {
padding: 16,
paddingBottom: 48
}
});
export default function GuildProfileGamesActionSheet(props) {
const profile = props.profile;
const styles = useStyles();
const { id, gameActivity } = profile;
const allGuildProfileGames = useAllGuildProfileGames(profile);
const enabled = useGuildProfileGameProfilesExperiment({
location: "guild_profile_games_action_sheet"
}).enabled;
const bottomSheetRef = useBottomSheetRef().bottomSheetRef;
const title = intl.format(t.vuAVo7, {
serverName: profile.name
}).toString();
return <BottomSheet ref={bottomSheetRef} scrollable onDismiss={useCallback(() => {
ActionSheetActionCreators.openLazy(import("./GuildProfileActionSheet"), `GuildProfileActionSheet:${id}`, {
guildId: id
});
}, [id])} startHeight={300}>
<BottomSheetScrollView>
<View style={styles.container}>
<TableRowGroup title={title} hasIcons>
{allGuildProfileGames.map((allGuildProfileGame) => <GuildProfileGameRow key={allGuildProfileGame.id} game={allGuildProfileGame} activityLevel={gameActivity[allGuildProfileGame.id]} clickable={enabled} />)}
</TableRowGroup>
</View>
</BottomSheetScrollView>
</BottomSheet>;
};