86 lines
3.5 KiB
TypeScript
86 lines
3.5 KiB
TypeScript
// Metro module 10547 (f10548).
|
|
import { View } from "react-native";
|
|
import ChannelStore from "../../../stores/ChannelStore";
|
|
import { Fonts } from "../../../Constants";
|
|
import { createStyles } from "../../../design/components/Styles/native/createStyles";
|
|
import Module712 from "../../../_bundle/Module712";
|
|
import { StreamEnded } from "../../../design/components/Illustration/native/redesign/generated/StreamEnded";
|
|
import { LegacyText } from "../../../design/void/native";
|
|
import { intl, t } from "../../../intl/index.native";
|
|
import { StreamFailed } from "../../../design/components/Illustration/native/redesign/generated/StreamFailed";
|
|
import { getErrorInfo, AVError } from "../../../modules/errors/av_errors/AVError";
|
|
import { useStateFromStores } from "../../../_bundle/Module589";
|
|
import useMountEffect from "../../../hooks/useMountEffect";
|
|
import { stopStream } from "../../../actions/StreamActionCreators";
|
|
import { encodeStreamKey } from "../../../modules/go_live/utils/StreamKeyUtils";
|
|
import { Text } from "../../../design/components/Text/native/Text";
|
|
import { BaseTextButton } from "../../../design/components/Button/native/BaseTextButton.native";
|
|
let c7088_8 = {
|
|
NONE: "NONE",
|
|
STREAM_ENDED: "STREAM_ENDED",
|
|
STREAM_FAILED: "STREAM_FAILED"
|
|
};
|
|
const useStyles = createStyles({
|
|
container: {
|
|
alignItems: "center",
|
|
justifyContent: "center",
|
|
backgroundColor: Module712.unsafe_rawColors.PRIMARY_700,
|
|
padding: 8
|
|
},
|
|
placeholderImage: {
|
|
marginBottom: 8,
|
|
width: "100%",
|
|
resizeMode: "contain"
|
|
},
|
|
placeholderText: {
|
|
color: Module712.unsafe_rawColors.WHITE,
|
|
fontFamily: Fonts.PRIMARY_SEMIBOLD,
|
|
fontSize: 16,
|
|
lineHeight: 20,
|
|
textAlign: "center"
|
|
},
|
|
buttonWrapper: {
|
|
marginTop: 16,
|
|
alignSelf: "center"
|
|
},
|
|
buttonPill: {
|
|
borderRadius: Module712.radii.round
|
|
}
|
|
});
|
|
export default function VideoEmptyState(props) {
|
|
const { type, style, avError, removeSplashImage, removeCloseButton, stream, ...props2 } = props;
|
|
const styles = useStyles();
|
|
const r31 = c7088_8.STREAM_ENDED === type ? <>
|
|
{removeSplashImage ? !removeSplashImage : <StreamEnded style={styles.placeholderImage} />}
|
|
<LegacyText style={styles.placeholderText}>
|
|
{intl.formatToMarkdownString(t["1Ww0Hi"], {})}
|
|
</LegacyText>
|
|
</> : c7088_8.STREAM_FAILED === type ? <>
|
|
{removeSplashImage ? !removeSplashImage : <StreamFailed style={styles.placeholderImage} />}
|
|
<LegacyText style={styles.placeholderText}>
|
|
{intl.string(t.rSlOep)}
|
|
</LegacyText>
|
|
</> : c7088_8.NONE === type ? null : void 0;
|
|
const errorCode = avError != null ? getErrorInfo(avError).errorCode : type === c7088_8.STREAM_FAILED ? getErrorInfo(AVError.STREAM_FAILED_TO_START).errorCode : null;
|
|
const stateFromStores = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(stream.channelId), [stream.channelId]);
|
|
useMountEffect(() => {
|
|
if (stateFromStores == null ? void 0 : stateFromStores.isGuildStageVoice()) {
|
|
stopStream(encodeStreamKey(stream));
|
|
}
|
|
});
|
|
return <View {...props2} style={[styles.container, style]}>
|
|
{r31}
|
|
{errorCode != null && <Text variant="text-sm/semibold" color="text-muted" selectable>
|
|
{intl.formatToPlainString(t.ejOT95, {
|
|
errorCode
|
|
})}
|
|
</Text>}
|
|
{removeCloseButton ? !removeCloseButton : <View style={styles.buttonWrapper}>
|
|
<BaseTextButton pillStyle={styles.buttonPill} variant="secondary" text={intl.string(t["4EGMWL"])} onPress={() => {
|
|
stopStream(encodeStreamKey(stream));
|
|
}} />
|
|
</View>}
|
|
</View>;
|
|
};
|
|
export { c7088_8 as VideoEmptyTypes };
|