Files
discord-decomp/modules/voice_panel/native/header/VoicePanelConsoleFacepile.tsx
T
2026-11-01 12:12:55 +02:00

56 lines
2.1 KiB
TypeScript

// Metro module 15951 (f15952).
import { useMemo, useCallback } from "react";
import { PlatformTypes } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import getConsoleIcon from "../../../game_console/native/getConsoleIcon";
import { intl, t } from "../../../../intl/index.native";
import useGameConsoleAccounts from "../../../game_console/useGameConsoleAccounts";
import { isNotNullish } from "../../../../utils/GlobalUtils";
import NativeView from "../../../core/native/NativeView";
import { SummarizedIconRow, Icon } from "../../../../design/void/native";
let useStyles;
const getConsoleInfo = function getConsoleInfo(a0) {
const type = a0.type;
if (PlatformTypes.XBOX === type) {
return {
icon: getConsoleIcon(a0.type),
color: Module712.unsafe_rawColors.PLATFORM_XBOX,
connectLabel: intl.string(t.QN7HXV),
connectSublabel: intl.string(t["M/Ld86"])
};
}
if (PlatformTypes.PLAYSTATION === type) {
return {
icon: getConsoleIcon(a0.type),
color: Module712.unsafe_rawColors.PLATFORM_PLAYSTATION,
connectLabel: intl.string(t["3qLlTS"]),
connectSublabel: intl.string(t["/uR9x1"])
};
}
return null;
};
useStyles = createStyles({
consoleIconContainer: {
borderRadius: Module712.radii.round,
padding: 8,
margin: -3,
borderWidth: 3,
borderColor: Module712.colors.BACKGROUND_BASE_LOW
},
consoleIcon: {
tintColor: Module712.colors.WHITE
}
});
export default function VoicePanelConsoleFacepile() {
const styles = useStyles();
const gameConsoleAccounts = useGameConsoleAccounts();
let c22638_1 = gameConsoleAccounts;
return <SummarizedIconRow items={useMemo(() => c22638_1.map(getConsoleInfo).filter(isNotNullish), [gameConsoleAccounts])} renderItem={useCallback((a0) => <NativeView style={[styles.consoleIconContainer, {
backgroundColor: a0.color
}]}>
<Icon style={styles.consoleIcon} size={Icon.Sizes.MEDIUM} source={a0.icon} />
</NativeView>, [styles])} offsetAmount={-3} />;
};
export { getConsoleInfo };