43 lines
1.7 KiB
TypeScript
43 lines
1.7 KiB
TypeScript
// Metro module 8643 (f8644).
|
|
import { useState, useCallback } from "react";
|
|
import { Pressable, View } from "react-native";
|
|
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
|
|
import { GameProfileTrackActionActions } from "../../GameProfileAnalyticUtils";
|
|
import { intl, t } from "../../../../intl/index.native";
|
|
import { Text } from "../../../../design/components/Text/native/Text";
|
|
const useStyles = createStyles({
|
|
container: {
|
|
flexDirection: "column"
|
|
}
|
|
});
|
|
export default function GameProfileSummary(props) {
|
|
const { game, trackAction } = props;
|
|
const styles = useStyles();
|
|
const [state, setState] = useState(false);
|
|
const [state2, setState2] = useState(null);
|
|
const callback2 = useCallback((a0) => {
|
|
if (state2 == null) {
|
|
setState2(a0.nativeEvent.lines.length > 3);
|
|
}
|
|
}, [state2]);
|
|
const callback = useCallback(() => {
|
|
const r1 = !state;
|
|
trackAction(state ? GameProfileTrackActionActions.ShowLess : GameProfileTrackActionActions.ShowMore);
|
|
setState(r1);
|
|
}, [state, trackAction]);
|
|
let r17 = game?.summaryLocalized;
|
|
if (r17 == null) {
|
|
r17 = game?.description;
|
|
}
|
|
if (r17 == null) {
|
|
return null;
|
|
}
|
|
const accessibilityLabel = intl.string(state ? t["6MwJo/"] : t.lBeKY2);
|
|
return <View style={styles.container}>
|
|
<Text variant="text-md/normal" color="interactive-text-active" lineClamp={state ? void 0 : state2 == null ? void 0 : 3} onTextLayout={callback2}>{r17}</Text>
|
|
{state2 ? <Pressable onPress={callback} accessibilityRole="button" accessibilityLabel={accessibilityLabel}>
|
|
<Text variant="text-md/medium" color="text-brand">{accessibilityLabel}</Text>
|
|
</Pressable> : null}
|
|
</View>;
|
|
};
|