82 lines
2.8 KiB
TypeScript
82 lines
2.8 KiB
TypeScript
// Metro module 15137 (f15138).
|
|
import { useMemo } from "react";
|
|
import { View } from "react-native";
|
|
import { createStyles } from "../../../design/components/Styles/native/createStyles";
|
|
import Module712 from "../../../_bundle/Module712";
|
|
import { getSingleColorGuildThemeGradientColors, getGuildThemePreset, getGuildThemePresetAppearance } from "../GuildThemePresets";
|
|
import GuildThemePreviewOverlay from "./GuildThemePreviewOverlay";
|
|
import useTheme from "../../../hooks/useTheme";
|
|
import Module4611 from "../../../_bundle/Module4611";
|
|
let useStyles;
|
|
const PreviewOverlay = function PreviewOverlay() {
|
|
return <View pointerEvents="none" style={useStyles().previewOverlay}>
|
|
<GuildThemePreviewOverlay />
|
|
</View>;
|
|
};
|
|
useStyles = createStyles({
|
|
previewArt: {
|
|
position: "relative",
|
|
width: 256,
|
|
aspectRatio: 1.5705521472392638,
|
|
overflow: "hidden",
|
|
borderRadius: Module712.radii.md,
|
|
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH
|
|
},
|
|
previewOverlay: {
|
|
position: "absolute",
|
|
top: 7.314,
|
|
left: 7.461,
|
|
width: 259.862,
|
|
height: 154.514
|
|
}
|
|
});
|
|
export default function GuildThemePreviewArt(props) {
|
|
const { themeSettings, style } = props;
|
|
const styles = useStyles();
|
|
const theme = useTheme();
|
|
let c21700_1 = theme;
|
|
const memo = useMemo(() => {
|
|
let r17;
|
|
L8: {
|
|
const r2 = themeSettings == null;
|
|
r17 = null;
|
|
if (!r2) {
|
|
const customUserThemeSettings = themeSettings.customUserThemeSettings;
|
|
if (customUserThemeSettings != null) {
|
|
const r10 = customUserThemeSettings.colors[0];
|
|
if (r10 != null) {
|
|
const colors = [...getSingleColorGuildThemeGradientColors(r10, c21700_1)];
|
|
let gradientAngle = customUserThemeSettings.gradientAngle;
|
|
if (gradientAngle == null) {
|
|
gradientAngle = 0;
|
|
}
|
|
r17 = {
|
|
colors,
|
|
angle: gradientAngle
|
|
};
|
|
break L8;
|
|
}
|
|
}
|
|
const guildThemePreset = getGuildThemePreset(themeSettings.presetId);
|
|
const r4 = guildThemePreset != null;
|
|
r17 = null;
|
|
if (r4) {
|
|
const guildThemePresetAppearance = getGuildThemePresetAppearance(guildThemePreset, c21700_1);
|
|
r17 = {
|
|
colors: guildThemePresetAppearance.colors.map((color) => color.hex),
|
|
locations: guildThemePresetAppearance.colors.map((color) => color.stop / 100),
|
|
angle: guildThemePresetAppearance.angle
|
|
};
|
|
}
|
|
}
|
|
}
|
|
return r17;
|
|
}, [themeSettings, theme]);
|
|
const style2 = [styles.previewArt, style];
|
|
return memo == null ? <View style={style2}>
|
|
<PreviewOverlay />
|
|
</View> : <Module4611 colors={memo.colors} locations={memo.locations} useAngle angle={memo.angle} style={style2}>
|
|
<PreviewOverlay />
|
|
</Module4611>;
|
|
};
|