diff --git a/_locales/en/messages.json b/_locales/en/messages.json index beeefcc030..7ffa548caf 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -42,6 +42,7 @@ "debugLogExplanation": "This log will be saved to your desktop.", "reportIssue": "Report a Bug", "markAllAsRead": "Mark All as Read", + "allMarkedAsRead": "All conversations marked read.", "incomingError": "Error handling incoming message", "media": "Media", "mediaEmptyState": "No media", diff --git a/ts/components/icon/SessionIconButton.tsx b/ts/components/icon/SessionIconButton.tsx index e92e6c7c58..ca8055e5ef 100644 --- a/ts/components/icon/SessionIconButton.tsx +++ b/ts/components/icon/SessionIconButton.tsx @@ -14,6 +14,7 @@ interface SProps extends SessionIconProps { dataTestId?: string; id?: string; style?: object; + title?: string; } const StyledSessionIconButton = styled.div<{ color?: string; isSelected?: boolean }>` @@ -55,6 +56,7 @@ const SessionIconButtonInner = React.forwardRef((props, id, dataTestId, style, + title } = props; const clickHandler = (e: React.MouseEvent) => { if (props.onClick) { @@ -65,6 +67,7 @@ const SessionIconButtonInner = React.forwardRef((props, return ( { } else if (type === SectionType.PathIndicator) { // Show Path Indicator Modal dispatch(onionPathModal({})); + } else if (type === SectionType.MarkAllAsRead) { + const controller = getConversationController(); + const convos = controller.getConversations().filter(conversation => { + return conversation.isApproved(); + }); + for (const convo of convos) { + await controller.get(convo.id).markAllAsRead(); + } + ToastUtils.pushToastSuccess('allMarkedRead', window.i18n('allMarkedAsRead')); } else { // message section dispatch(clearSearch()); @@ -111,6 +120,17 @@ const Section = (props: { type: SectionType }) => { isSelected={isSelected} /> ); + case SectionType.MarkAllAsRead: + return ( + + ); case SectionType.Settings: return ( {
+
diff --git a/ts/state/ducks/section.tsx b/ts/state/ducks/section.tsx index d1e1351e2f..0325a40e74 100644 --- a/ts/state/ducks/section.tsx +++ b/ts/state/ducks/section.tsx @@ -10,6 +10,7 @@ export enum SectionType { Profile, Message, Settings, + MarkAllAsRead, ColorMode, PathIndicator, } diff --git a/ts/types/LocalizerKeys.ts b/ts/types/LocalizerKeys.ts index 2aa7aff76b..770d58f603 100644 --- a/ts/types/LocalizerKeys.ts +++ b/ts/types/LocalizerKeys.ts @@ -383,6 +383,7 @@ export type LocalizerKeys = | 'cannotRemoveCreatorFromGroup' | 'editMenuCut' | 'markAllAsRead' + | 'allMarkedAsRead' | 'failedResolveOns' | 'showDebugLog' | 'declineRequestMessage'