// Metro module 9305 (f9306).
import { useCallback, useMemo } from "react";
import { ActivityIndicator, ScrollView, View } from "react-native";
import ConversationsStore from "../../ConversationsStore";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useRoute } from "../../../../_bundle/Module1483";
import { useStateFromStores, useStateFromStoresObject } from "../../../../_bundle/Module589";
import { ConversationsAnalytics } from "../../ConversationsAnalytics";
import { closeConversationsAndJumpToMessage } from "./ConversationNavigatorUtils";
import { intl, t } from "../../../../intl/index.native";
import { Text } from "../../../../design/components/Text/native/Text";
import { Button } from "../../../../design/components/Button/native/Button.native";
import { ChatPreview } from "../../../../components_native/common/ChatPreview";
const useStyles = createStyles({
container: {
flex: 1,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW
},
pendingContent: {
flex: 1,
paddingVertical: Module712.space.PX_24,
alignItems: "center",
gap: Module712.space.PX_32,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW
}
});
export default function ConversationFocusScreen() {
let startMessageId, callback;
const styles = useStyles();
const params = useRoute().params;
const { channelId, conversationId } = params;
const stateFromStores = useStateFromStores([ConversationsStore], () => ConversationsStore.getHydratedMessages(channelId, conversationId), [channelId, conversationId]);
const stateFromStoresObject = useStateFromStoresObject([ConversationsStore], () => {
const conversationMetadata = ConversationsStore.getConversationMetadata(channelId, conversationId);
let fullyHydrated = conversationMetadata?.fullyHydrated;
if (fullyHydrated == null) {
fullyHydrated = false;
}
const r10 = {
fullyHydrated,
isFullFetchPending: ConversationsStore.isConversationFetchPending(conversationId, true),
startMessageId: null
};
let startMessageId2 = conversationMetadata == null ? void 0 : conversationMetadata.conversation.startMessageId;
if (startMessageId2 == null) {
startMessageId2 = null;
}
r10.startMessageId = startMessageId2;
return r10;
}, [channelId, conversationId]);
const { fullyHydrated, isFullFetchPending } = stateFromStoresObject;
startMessageId = stateFromStoresObject.startMessageId;
callback = useCallback((a0) => {
if (a0 === "footer_cta") {
ConversationsAnalytics.trackFocusModeDismissed({
channelId,
conversationId,
dismissReason: "jump_to_conversation"
});
}
}, [channelId, conversationId]);
const callback2 = useCallback(() => {
if (startMessageId != null) {
closeConversationsAndJumpToMessage(channelId, startMessageId);
}
}, [channelId, startMessageId]);
const memo = useMemo(() => ({
jumpToChatText: intl.string(t["bz/ik0"]),
jumpTargetId: startMessageId,
onBeforeJumpToMessage: callback
}), [startMessageId, callback]);
return !fullyHydrated && isFullFetchPending ?
: fullyHydrated ?
:
{intl.string(t.eylmYW)}
{startMessageId != null && }
;
};