Skip to content

Commit

Permalink
Fix channel type detection
Browse files Browse the repository at this point in the history
  • Loading branch information
FieryFlames committed Mar 5, 2023
1 parent 4f54c0a commit b99c64c
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/ui/sheets/TypingActionSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,21 @@ const styles = StyleSheet.createThemedStyleSheet({
}
});

const channelType = {
"0": "channel",
"1": "dm",
"2": "channel",
"3": "dm",
// skipped GUILD_CATEGORY
"5": "channel",
"6": "channel",
"10": "thread",
"11": "thread",
"12": "thread",
"13": "channel"
// skipped GUILD_DIRECTORY
// skipped GUILD_FORUM
};

function TypingActionSheet({ channel }) {
const typingIds = useTypingUserIds(channel.id);
Expand All @@ -44,11 +59,11 @@ function TypingActionSheet({ channel }) {

return (<ActionSheet scrollable>
<BottomSheetScrollView contentContainerStyle={{ paddingBottom: 16 }}>
<ActionSheetTitleHeader title={`Users typing in ${channel.type ? "" : "#"}${channel.name}`} />
<ActionSheetTitleHeader title={`Users typing in ${channelType[channel.type] === "channel" ? "#" : ""}${channel.name}`} />
{typingUsers.length !== 0 ? typingUsers.map((user) =>
<FormRow
leading={<Avatar user={user} size="normal" guildId={channel.guild_id} />}
label={channel.type ? RelationshipStore.getNickname(user.id) : GuildMemberStore.getNick(channel.guild_id, user.id) ?? user.username}
label={(channelType[channel.type] === "dm" ? RelationshipStore.getNickname(user.id) : GuildMemberStore.getNick(channel.guild_id, user.id)) ?? user.username}
trailing={<FormArrow />}
onPress={() => showUserProfile({ userId: user.id, channelId: channel.id })}
/>
Expand All @@ -57,7 +72,7 @@ function TypingActionSheet({ channel }) {
source={getAssetIDByName(ThemeStore.theme === "light" ? "empty_channel_no_text_channels_light" : "empty_channel_no_text_channels_dark")}
style={{ width: 256, height: 128, resizeMode: "contain" }}
/>
<Text style={styles.text}>Nobody is typing in this {channel.type ? "DM" : "channel"} right now.</Text>
<Text style={styles.text}>Nobody is typing in this {channelType[channel.type] === "dm" ? channelType[channel.type].toUpperCase() : channelType[channel.type]} right now.</Text>
</View>}
</BottomSheetScrollView>
</ActionSheet>)
Expand Down

0 comments on commit b99c64c

Please sign in to comment.