77 lines
3.2 KiB
TypeScript
77 lines
3.2 KiB
TypeScript
// Metro module 9951 (f9952).
|
|
import { View } from "react-native";
|
|
import GuildStore from "../../../stores/GuildStore";
|
|
import { createStyles } from "../../../design/components/Styles/native/createStyles";
|
|
import Module712 from "../../../_bundle/Module712";
|
|
import { ChevronSmallRightIcon } from "../../../design/components/Icon/native/redesign/generated/ChevronSmallRightIcon";
|
|
import { useStateFromStores } from "../../../_bundle/Module589";
|
|
import GuildIcon, { GuildIconSizes } from "../../guild/native/GuildIcon";
|
|
import GroupDMAvatar from "../../group_dm/native/GroupDMAvatar";
|
|
import { AvatarSizes } from "../../../design/void/native";
|
|
import { ChatIcon } from "../../../design/components/Icon/native/redesign/generated/ChatIcon";
|
|
import useChannelName from "../../channel/useChannelName";
|
|
import { getChannelIconComponentWithGuild } from "../../../utils/native/ChannelUtils";
|
|
import { intl, t } from "../../../intl/index.native";
|
|
import { Text } from "../../../design/components/Text/native/Text";
|
|
let useStyles, ChannelName;
|
|
const HeaderIcon = function HeaderIcon(props) {
|
|
const channel = props.channel;
|
|
const styles = useStyles();
|
|
const stateFromStores = useStateFromStores([GuildStore], () => GuildStore.getGuild(channel.guild_id));
|
|
return stateFromStores != null ? <GuildIcon guild={stateFromStores} size={GuildIconSizes.XSMALL} /> : (channel == null ? void 0 : channel.isGroupDM()) ? <GroupDMAvatar channel={channel} size={AvatarSizes.XSMALL} /> : <View style={styles.dmIcon}>
|
|
<ChatIcon size="xxs" />
|
|
</View>;
|
|
};
|
|
ChannelName = function ChannelName(props) {
|
|
const channel2 = props.channel;
|
|
const styles = useStyles();
|
|
const stateFromStores = useStateFromStores([GuildStore], () => GuildStore.getGuild(channel2.guild_id));
|
|
const channelName = useChannelName(channel2, false);
|
|
const ChannelIconComponentWithGuild = getChannelIconComponentWithGuild(channel2, stateFromStores);
|
|
const r27 = channel2.isPrivate() || ChannelIconComponentWithGuild == null;
|
|
const r31 = channel2.isDM() ? intl.formatToPlainString(t.smD7XV, {
|
|
username: channelName
|
|
}) : channelName;
|
|
return <View style={styles.channelNameContainer}>
|
|
{r27 ? null : <ChannelIconComponentWithGuild style={styles.channelTypeIcon} size="xxs" />}
|
|
<Text style={styles.channelName} variant="text-md/semibold" color="mobile-text-heading-primary" lineClamp={1}>{r31}</Text>
|
|
</View>;
|
|
};
|
|
useStyles = createStyles({
|
|
cardHeader: {
|
|
flexDirection: "row",
|
|
alignItems: "center",
|
|
gap: 8
|
|
},
|
|
dmIcon: {
|
|
padding: 6,
|
|
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWEST,
|
|
borderRadius: Module712.radii.sm
|
|
},
|
|
channelNameContainer: {
|
|
flexDirection: "row",
|
|
alignItems: "center",
|
|
flexShrink: 1
|
|
},
|
|
channelName: {
|
|
flexShrink: 1
|
|
},
|
|
channelTypeIcon: {
|
|
marginRight: 4
|
|
},
|
|
actionsContainer: {
|
|
marginVertical: -4,
|
|
marginLeft: "auto"
|
|
}
|
|
});
|
|
export function ForLaterCardHeader(props) {
|
|
const { channel: channel3, actions } = props;
|
|
const styles = useStyles();
|
|
return <View style={styles.cardHeader}>
|
|
<HeaderIcon channel={channel3} />
|
|
{channel3.isPrivate() ? null : <ChevronSmallRightIcon size="xxs" />}
|
|
<ChannelName channel={channel3} />
|
|
<View style={styles.actionsContainer}>{actions}</View>
|
|
</View>;
|
|
}
|