68 lines
3.0 KiB
TypeScript
68 lines
3.0 KiB
TypeScript
// Metro module 11962 (f11963).
|
|
import { memo } from "react";
|
|
import { AnalyticEvents } from "../../../Constants";
|
|
import { createStyles } from "../../../design/components/Styles/native/createStyles";
|
|
import Module712 from "../../../_bundle/Module712";
|
|
import { Text } from "../../../design/components/Text/native/Text";
|
|
import { getBestActiveInput } from "../../../utils/native/ChatInputUtils";
|
|
import { handleTapCommandMention, handleLongPressCommandMention } from "../../markup/native/MarkupReactCommandRule";
|
|
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
|
|
import { collectChannelAnalyticsMetadata } from "../../app_analytics/AppAnalyticsUtils";
|
|
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
|
|
import navigateToLastChannel from "../../main_tabs_v2/native/navigateToLastChannel";
|
|
import { getApplicationCommandSection } from "../../application_commands/ApplicationCommandUtils";
|
|
import { ApplicationCommandTriggerLocations } from "../../application_commands/ApplicationCommandTypes";
|
|
const useStyles = createStyles({
|
|
commandClickable: {
|
|
color: Module712.colors.MENTION_FOREGROUND,
|
|
backgroundColor: Module712.colors.MENTION_BACKGROUND,
|
|
marginEnd: Module712.space.PX_12,
|
|
marginBottom: Module712.space.PX_12
|
|
}
|
|
});
|
|
const r45 = memo(function UserProfileAboutMeCardCommand(props) {
|
|
const { application, command, channel } = props;
|
|
return <Text variant="text-md/bold" onPress={() => {
|
|
const bestActiveInput = getBestActiveInput();
|
|
let currentText = bestActiveInput == null ? void 0 : bestActiveInput.getText();
|
|
if (currentText == null) {
|
|
currentText = "";
|
|
}
|
|
handleTapCommandMention({
|
|
channelId: channel.id,
|
|
currentText,
|
|
commandId: command.id,
|
|
commandName: command.displayName,
|
|
onOpenCustomKeyboard: (a0) => bestActiveInput == null ? void 0 : bestActiveInput.openCustomKeyboard(a0),
|
|
onSetCommand: () => {
|
|
AnalyticsUtils.track(AnalyticEvents.POPULAR_APPLICATION_COMMAND_CLICKED, {
|
|
application_id: application?.id,
|
|
command_id: command.id,
|
|
guild_id: channel.getGuildId(),
|
|
...collectChannelAnalyticsMetadata(channel)
|
|
});
|
|
ActionSheetActionCreators.hideActionSheet();
|
|
navigateToLastChannel();
|
|
if (bestActiveInput != null) {
|
|
bestActiveInput.openSystemKeyboard();
|
|
}
|
|
if (bestActiveInput != null) {
|
|
const applicationCommandManager = bestActiveInput.getApplicationCommandManager();
|
|
if (applicationCommandManager != null) {
|
|
applicationCommandManager.setCommand({
|
|
channelId: channel.id,
|
|
command,
|
|
section: application != null ? getApplicationCommandSection(application) : null,
|
|
location: ApplicationCommandTriggerLocations.POPULAR_COMMANDS
|
|
});
|
|
}
|
|
}
|
|
}
|
|
});
|
|
}} onLongPress={() => handleLongPressCommandMention(command.displayName, command.id)} style={useStyles().commandClickable}>
|
|
/
|
|
{command.displayName}
|
|
</Text>;
|
|
});
|
|
export default r45;
|