Files
discord-decomp/modules/channel/native/ChannelPickerActionSheet.tsx
T
2026-11-01 12:12:55 +02:00

63 lines
3.1 KiB
TypeScript

// Metro module 10402 (f10403).
import RelationshipStore from "../../../stores/RelationshipStore";
import UserStore from "../../../stores/UserStore";
import useSafeAreaInsets_native from "../../safe_area/useSafeAreaInsets.native";
import { ActionSheetCloseButton } from "../../../design/components/Sheet/native/ActionSheetCloseButton.native";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import { BottomSheetTitleHeader } from "../../../design/components/Sheet/native/BottomSheetTitleHeader.native";
import { TableRadioRow } from "../../../design/components/TableRow/native/TableRadioRow.native";
import { TableRowIcon } from "../../../design/components/TableRow/native/TableRowIcon.native";
import Module10403 from "../../../_bundle/Module10403";
import { ActionSheet } from "../../../design/components/Sheet/native/ActionSheet.native";
import { BottomSheetScrollView } from "../../../_bundle/Module5245";
import { TableRadioGroup } from "../../../design/components/TableRow/native/TableRadioGroup.native";
import { getChannelIconWithGuild } from "../../../utils/native/ChannelUtils";
import { computeChannelName } from "../useChannelName";
export default function ChannelPickerActionSheet(props) {
let onClose;
let c17932_0 = props;
const bottom = useSafeAreaInsets_native().bottom;
const { header, guild, channels, onSelect, selectedChannel } = props;
const r2 = header != null;
let header2 = void 0;
if (r2) {
const title = header.title;
onClose = header.onClose;
header2 = <BottomSheetTitleHeader title={title} trailing={onClose != null ? <ActionSheetCloseButton onPress={() => {
ActionSheetActionCreators.hideActionSheet();
onClose();
}} /> : void 0} />;
}
const r37 = props.noChannelOptionLabel != null ? <TableRadioRow value="" label={props.noChannelOptionLabel} icon={<TableRowIcon source={Module10403} />} /> : void 0;
let defaultValue = selectedChannel?.id;
if (defaultValue == null) {
defaultValue = "";
}
return <ActionSheet scrollable header={header2}>
<BottomSheetScrollView contentContainerStyle={{
paddingBottom: bottom
}}>
<TableRadioGroup defaultValue={defaultValue} accessibilityLabel={header?.title} onChange={(event) => {
if (event === "") {
if (c17932_0.noChannelOptionLabel != null) {
ActionSheetActionCreators.hideActionSheet();
c17932_0.onSelect(null);
return void 0;
}
}
const r11 = channels.find((channel) => channel.id === event);
if (r11 != null) {
ActionSheetActionCreators.hideActionSheet();
onSelect(r11);
}
}} hasIcons>
{r37}
{channels.map((channel) => {
const channelIconWithGuild = getChannelIconWithGuild(channel, guild);
return <TableRadioRow key={channel.id} value={channel.id} label={computeChannelName(channel, UserStore, RelationshipStore)} icon={channelIconWithGuild != null ? <TableRowIcon source={channelIconWithGuild} /> : null} />;
})}
</TableRadioGroup>
</BottomSheetScrollView>
</ActionSheet>;
};