72 lines
2.6 KiB
TypeScript
72 lines
2.6 KiB
TypeScript
// Metro module 9015 (f9016).
|
|
import { useCallback } from "react";
|
|
import { View } from "react-native";
|
|
import { Permissions } from "../../../Constants";
|
|
import { createStyles } from "../../../design/components/Styles/native/createStyles";
|
|
import Module712 from "../../../_bundle/Module712";
|
|
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
|
|
import { intl, t } from "../../../intl/index.native";
|
|
import { has } from "../../../_bundle/HighLow";
|
|
import { Text } from "../../../design/components/Text/native/Text";
|
|
import { LegacyText } from "../../../design/void/native";
|
|
import { FormRow } from "../../../design/void/Form/native/index";
|
|
const useStyles = createStyles({
|
|
selectorGroup: {
|
|
display: "flex",
|
|
flexDirection: "column",
|
|
gap: 8
|
|
},
|
|
select: {
|
|
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWER,
|
|
borderRadius: Module712.radii.xs
|
|
},
|
|
label: {
|
|
color: Module712.colors.TEXT_SUBTLE,
|
|
fontWeight: "500"
|
|
},
|
|
error: {
|
|
color: Module712.unsafe_rawColors.RED_400
|
|
}
|
|
});
|
|
let c5899_10 = "GuildSelector";
|
|
export default function GuildSelector(props) {
|
|
const { error, selectedGuildId, onGuildChange, guilds, disabled } = props;
|
|
const styles = useStyles();
|
|
const callback = useCallback(() => {
|
|
const r16 = import("../../../components_native/common/ItemSelectorActionSheet");
|
|
const r25 = {
|
|
title: intl.string(t.oM4E1A),
|
|
items: guilds.filter((guild) => has(guild.permissions, Permissions.MANAGE_GUILD)).map((item) => ({
|
|
label: item.name,
|
|
value: item.id
|
|
})),
|
|
onItemSelect: (a0) => {
|
|
onGuildChange(a0);
|
|
ActionSheetActionCreators.hideActionSheet(c5899_10);
|
|
},
|
|
selectedItem: null,
|
|
hasIcons: false
|
|
};
|
|
let selectedItem = selectedGuildId;
|
|
if (selectedGuildId == null) {
|
|
selectedItem = void 0;
|
|
}
|
|
r25.selectedItem = selectedItem;
|
|
ActionSheetActionCreators.openLazy(r16, c5899_10, r25);
|
|
}, [guilds, onGuildChange, selectedGuildId]);
|
|
const r24 = guilds.find((guild) => guild.id === selectedGuildId);
|
|
const r42 = [<Text variant="eyebrow" color="text-default">
|
|
{intl.string(t["1DXFFd"])}
|
|
</Text>, error != null ? error !== "" ? <LegacyText style={styles.error}>{error}</LegacyText> : null : null, , ,];
|
|
let label = r24?.name;
|
|
if (label == null) {
|
|
label = intl.string(t.oM4E1A);
|
|
}
|
|
r42[2] = <FormRow label={label} disabled={disabled} trailing={<FormRow.Arrow />} DEPRECATED_style={styles.select} onPress={callback} />;
|
|
r42[3] = <LegacyText style={styles.label}>
|
|
{intl.format(t.t9Jm9o, {})}
|
|
</LegacyText>;
|
|
return <View style={styles.selectorGroup}>{r42}</View>;
|
|
};
|
|
export { useStyles };
|