From 8ca99424ceeef4101dd5184de6197b2e0b320c7c Mon Sep 17 00:00:00 2001 From: hampus-fluxer Date: Tue, 6 Jan 2026 03:36:06 +0100 Subject: [PATCH] fix(mobile): add missing "mark as read" to community sheet (#43) --- .../bottomsheets/GuildHeaderBottomSheet.tsx | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/fluxer_app/src/components/bottomsheets/GuildHeaderBottomSheet.tsx b/fluxer_app/src/components/bottomsheets/GuildHeaderBottomSheet.tsx index 056f0c43..f0589ad3 100644 --- a/fluxer_app/src/components/bottomsheets/GuildHeaderBottomSheet.tsx +++ b/fluxer_app/src/components/bottomsheets/GuildHeaderBottomSheet.tsx @@ -21,6 +21,7 @@ import {Trans, useLingui} from '@lingui/react/macro'; import { BellIcon, BellSlashIcon, + BookOpenIcon, CheckIcon, CopyIcon, FolderPlusIcon, @@ -36,6 +37,7 @@ import React from 'react'; import * as ModalActionCreators from '~/actions/ModalActionCreators'; import {modal} from '~/actions/ModalActionCreators'; import * as TextCopyActionCreators from '~/actions/TextCopyActionCreators'; +import * as ReadStateActionCreators from '~/actions/ReadStateActionCreators'; import * as UserGuildSettingsActionCreators from '~/actions/UserGuildSettingsActionCreators'; import {Permissions} from '~/Constants'; import {CategoryCreateModal} from '~/components/modals/CategoryCreateModal'; @@ -57,6 +59,8 @@ import PermissionStore from '~/stores/PermissionStore'; import PresenceStore from '~/stores/PresenceStore'; import UserGuildSettingsStore from '~/stores/UserGuildSettingsStore'; import UserSettingsStore from '~/stores/UserSettingsStore'; +import ChannelStore from '~/stores/ChannelStore'; +import ReadStateStore from '~/stores/ReadStateStore'; import {getMutedText} from '~/utils/ContextMenuUtils'; import * as InviteUtils from '~/utils/InviteUtils'; import styles from './ChannelDetailsBottomSheet.module.css'; @@ -154,10 +158,33 @@ export const GuildHeaderBottomSheet: React.FC = obs onClose(); }; + const channels = ChannelStore.getGuildChannels(guild.id); + const hasGuildUnread = React.useMemo(() => channels.some((channel) => ReadStateStore.hasUnread(channel.id)), [channels]); + + const handleMarkAsRead = React.useCallback(() => { + const channelIds = channels + .filter((channel) => ReadStateStore.getUnreadCount(channel.id) > 0) + .map((channel) => channel.id); + + if (channelIds.length > 0) { + void ReadStateActionCreators.bulkAckChannels(channelIds); + } + + onClose(); + }, [channels, onClose]); + const menuGroups: Array = []; const quickActions = []; + if (hasGuildUnread) { + quickActions.push({ + icon: , + label: t`Mark as Read`, + onClick: handleMarkAsRead, + }); + } + if (canInvite) { quickActions.push({ icon: ,