fix: fix small ui issues after merge of multiple PRs

pull/3018/head
Audric Ackermann 1 year ago
parent ad9905d2ac
commit 571d593c38

@ -41,7 +41,7 @@
"unreadMessages": "Unread Messages", "unreadMessages": "Unread Messages",
"debugLogExplanation": "This log will be saved to your desktop.", "debugLogExplanation": "This log will be saved to your desktop.",
"reportIssue": "Report a Bug", "reportIssue": "Report a Bug",
"markAllAsRead": "Mark All as Read", "markAllAsRead": "Mark Read",
"incomingError": "Error handling incoming message", "incomingError": "Error handling incoming message",
"media": "Media", "media": "Media",
"mediaEmptyState": "No media", "mediaEmptyState": "No media",
@ -79,7 +79,7 @@
"typingAlt": "Typing animation for this conversation", "typingAlt": "Typing animation for this conversation",
"contactAvatarAlt": "Avatar for contact $name$", "contactAvatarAlt": "Avatar for contact $name$",
"downloadAttachment": "Download Attachment", "downloadAttachment": "Download Attachment",
"replyToMessage": "Reply to message", "replyToMessage": "Reply",
"replyingToMessage": "Replying to:", "replyingToMessage": "Replying to:",
"originalMessageNotFound": "Original message not found", "originalMessageNotFound": "Original message not found",
"you": "You", "you": "You",
@ -107,13 +107,10 @@
"deleteMessagesConfirmation": "Permanently delete the messages in this conversation?", "deleteMessagesConfirmation": "Permanently delete the messages in this conversation?",
"hideConversation": "Hide Conversation", "hideConversation": "Hide Conversation",
"hideNoteToSelfConfirmation": "Are you sure you want to hide your <b>Note to Self</b> conversation?", "hideNoteToSelfConfirmation": "Are you sure you want to hide your <b>Note to Self</b> conversation?",
"hideConversationFailed": "Failed to hide the Conversation!",
"hideConversationFailedPleaseTryAgain": "Unable to hide the conversation, please try again",
"deleteConversation": "Delete Conversation", "deleteConversation": "Delete Conversation",
"deleteConversationConfirmation": "Are you sure you want to delete your conversation with <b>$name$</b>?", "deleteConversationConfirmation": "Are you sure you want to delete your conversation with <b>$name$</b>?",
"deleteConversationFailed": "Failed to delete the Conversation!", "deleteConversationFailed": "Failed to delete the Conversation!",
"deleteConversationFailedPleaseTryAgain": "Unable to delete the conversation, please try again", "deleteConversationFailedPleaseTryAgain": "Unable to delete the conversation, please try again",
"hiding": "Hiding...",
"leaving": "Leaving...", "leaving": "Leaving...",
"deleted": "$count$ deleted", "deleted": "$count$ deleted",
"messageDeletedPlaceholder": "This message has been deleted", "messageDeletedPlaceholder": "This message has been deleted",
@ -126,6 +123,7 @@
"groupMembers": "Members", "groupMembers": "Members",
"moreInformation": "More information", "moreInformation": "More information",
"failed": "Failed", "failed": "Failed",
"failedToSendMessage": "Failed to send message",
"read": "Read", "read": "Read",
"resend": "Resend", "resend": "Resend",
"clear": "Clear", "clear": "Clear",

@ -554,7 +554,8 @@
justify-content: center; justify-content: center;
align-items: center; align-items: center;
flex-grow: 1; flex-grow: 1;
font-size: 28px; margin-top: var(--margins-sm);
font-size: 16px;
} }
// Module: Conversation List Item // Module: Conversation List Item

@ -132,7 +132,7 @@ export const MessageContentWithStatuses = (props: Props) => {
onDoubleClickCapture={onDoubleClickReplyToMessage} onDoubleClickCapture={onDoubleClickReplyToMessage}
dataTestId={dataTestId} dataTestId={dataTestId}
> >
<Flex container={true} flexDirection="column" flexShrink={0}> <Flex container={true} flexDirection="column" flexShrink={0} alignItems="flex-end">
<StyledMessageWithAuthor> <StyledMessageWithAuthor>
{!isDetailView && <MessageAuthorText messageId={messageId} />} {!isDetailView && <MessageAuthorText messageId={messageId} />}
<MessageContent messageId={messageId} isDetailView={isDetailView} /> <MessageContent messageId={messageId} isDetailView={isDetailView} />

@ -30,12 +30,11 @@ type Props = {
* - if the message is incoming: do not show anything (3) * - if the message is incoming: do not show anything (3)
* - if the message is outgoing: show the text for the last message, or a message sending, or in the error state. (4) * - if the message is outgoing: show the text for the last message, or a message sending, or in the error state. (4)
*/ */
export const MessageStatus = (props: Props) => { export const MessageStatus = ({ isDetailView, messageId, dataTestId }: Props) => {
const { messageId, isDetailView, dataTestId } = props; const status = useMessageStatus(messageId);
const status = useMessageStatus(props.messageId); const selected = useMessageExpirationPropsById(messageId);
const selected = useMessageExpirationPropsById(props.messageId);
if (!props.messageId || !selected || isDetailView) { if (!messageId || !selected || isDetailView) {
return null; return null;
} }
const isIncoming = selected.direction === 'incoming'; const isIncoming = selected.direction === 'incoming';
@ -79,15 +78,15 @@ const MessageStatusContainer = styled.div<{ isIncoming: boolean; isGroup: boolea
props.isGroup || !props.isIncoming ? 'var(--width-avatar-group-msg-list)' : 0}; props.isGroup || !props.isIncoming ? 'var(--width-avatar-group-msg-list)' : 0};
`; `;
const StyledStatusText = styled.div` const StyledStatusText = styled.div<{ textColor: string }>`
color: var(--text-secondary-color);
font-size: small; font-size: small;
color: ${props => props.textColor};
`; `;
const TextDetails = ({ text }: { text: string }) => { const TextDetails = ({ text, textColor }: { text: string; textColor: string }) => {
return ( return (
<> <>
<StyledStatusText>{text}</StyledStatusText> <StyledStatusText textColor={textColor}>{text}</StyledStatusText>
<SpacerXS /> <SpacerXS />
</> </>
); );
@ -154,7 +153,7 @@ const MessageStatusSending = ({ dataTestId }: Omit<Props, 'isDetailView'>) => {
isIncoming={false} isIncoming={false}
isGroup={false} isGroup={false}
> >
<TextDetails text={window.i18n('sending')} /> <TextDetails text={window.i18n('sending')} textColor="var(--text-secondary-color)" />
<IconNormal rotateDuration={2} iconType="sending" /> <IconNormal rotateDuration={2} iconType="sending" />
</MessageStatusContainer> </MessageStatusContainer>
); );
@ -193,7 +192,7 @@ const MessageStatusSent = ({ dataTestId, messageId }: Omit<Props, 'isDetailView'
isIncoming={false} isIncoming={false}
isGroup={isGroup} isGroup={isGroup}
> >
<TextDetails text={window.i18n('sent')} /> <TextDetails text={window.i18n('sent')} textColor="var(--text-secondary-color)" />
<IconForExpiringMessageId messageId={messageId} iconType="circleCheck" /> <IconForExpiringMessageId messageId={messageId} iconType="circleCheck" />
</MessageStatusContainer> </MessageStatusContainer>
); );
@ -221,7 +220,7 @@ const MessageStatusRead = ({
isIncoming={isIncoming} isIncoming={isIncoming}
isGroup={isGroup} isGroup={isGroup}
> >
<TextDetails text={window.i18n('read')} /> <TextDetails text={window.i18n('read')} textColor="var(--text-secondary-color)" />
<IconForExpiringMessageId messageId={messageId} iconType="doubleCheckCircleFilled" /> <IconForExpiringMessageId messageId={messageId} iconType="doubleCheckCircleFilled" />
</MessageStatusContainer> </MessageStatusContainer>
); );
@ -243,7 +242,7 @@ const MessageStatusError = ({ dataTestId }: Omit<Props, 'isDetailView'>) => {
isIncoming={false} isIncoming={false}
isGroup={isGroup} isGroup={isGroup}
> >
<TextDetails text={window.i18n('failed')} /> <TextDetails text={window.i18n('failedToSendMessage')} textColor="var(--danger-color)" />
<IconDanger iconType="error" /> <IconDanger iconType="error" />
</MessageStatusContainer> </MessageStatusContainer>
); );

@ -38,7 +38,7 @@ export const InteractionNotification = (props: PropsForInteractionNotification)
switch (interactionType) { switch (interactionType) {
case ConversationInteractionType.Hide: case ConversationInteractionType.Hide:
text = window.i18n('hideConversationFailedPleaseTryAgain'); // this can't happen
break; break;
case ConversationInteractionType.Leave: case ConversationInteractionType.Leave:
text = isCommunity text = isCommunity

@ -2,6 +2,7 @@ import React from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import { useRightOverlayMode } from '../../../hooks/useUI'; import { useRightOverlayMode } from '../../../hooks/useUI';
import { isRtlBody } from '../../../util/i18n';
import { Flex } from '../../basic/Flex'; import { Flex } from '../../basic/Flex';
import { OverlayRightPanelSettings } from './overlay/OverlayRightPanelSettings'; import { OverlayRightPanelSettings } from './overlay/OverlayRightPanelSettings';
import { OverlayDisappearingMessages } from './overlay/disappearing-messages/OverlayDisappearingMessages'; import { OverlayDisappearingMessages } from './overlay/disappearing-messages/OverlayDisappearingMessages';
@ -113,6 +114,8 @@ const ClosableOverlay = () => {
}; };
export const RightPanel = () => { export const RightPanel = () => {
const isRtlMode = isRtlBody();
return ( return (
<StyledRightPanel <StyledRightPanel
container={true} container={true}
@ -121,6 +124,7 @@ export const RightPanel = () => {
width={'var(--right-panel-width)'} width={'var(--right-panel-width)'}
height={'var(--right-panel-height)'} height={'var(--right-panel-height)'}
className="right-panel" className="right-panel"
style={{ direction: isRtlMode ? 'rtl' : 'initial' }}
> >
<ClosableOverlay /> <ClosableOverlay />
</StyledRightPanel> </StyledRightPanel>

@ -42,7 +42,6 @@ import { AttachmentTypeWithPath } from '../../../../types/Attachment';
import { getAbsoluteAttachmentPath } from '../../../../types/MessageAttachment'; import { getAbsoluteAttachmentPath } from '../../../../types/MessageAttachment';
import { Avatar, AvatarSize } from '../../../avatar/Avatar'; import { Avatar, AvatarSize } from '../../../avatar/Avatar';
import { Flex } from '../../../basic/Flex'; import { Flex } from '../../../basic/Flex';
import { SessionButton, SessionButtonColor, SessionButtonType } from '../../../basic/SessionButton';
import { SpacerMD } from '../../../basic/Text'; import { SpacerMD } from '../../../basic/Text';
import { PanelButtonGroup, PanelIconButton } from '../../../buttons'; import { PanelButtonGroup, PanelIconButton } from '../../../buttons';
import { MediaItemType } from '../../../lightbox/LightboxGallery'; import { MediaItemType } from '../../../lightbox/LightboxGallery';
@ -183,25 +182,6 @@ const HeaderItem = () => {
); );
}; };
const StyledLeaveButton = styled.div`
width: 100%;
.session-button {
margin-top: auto;
width: 100%;
min-height: calc(var(--composition-container-height) + 1px); // include border in height
flex-shrink: 0;
align-items: center;
border-top: 1px solid var(--border-color);
border-radius: 0px;
&:not(.disabled) {
&:hover {
background-color: var(--button-solid-background-hover-color);
}
}
}
`;
const StyledName = styled.h4` const StyledName = styled.h4`
padding-inline: var(--margins-md); padding-inline: var(--margins-md);
font-size: var(--font-size-md); font-size: var(--font-size-md);
@ -359,15 +339,14 @@ export const OverlayRightPanelSettings = () => {
<MediaGallery documents={documents} media={media} /> <MediaGallery documents={documents} media={media} />
{isGroup && ( {isGroup && (
<StyledLeaveButton> <PanelIconButton
<SessionButton text={leaveGroupString}
text={leaveGroupString} dataTestId="leave-group-button"
buttonColor={SessionButtonColor.Danger} disabled={isKickedFromGroup || left}
buttonType={SessionButtonType.Simple} onClick={() => void deleteConvoAction()}
disabled={isKickedFromGroup || left} color={'var(--danger-color)'}
onClick={deleteConvoAction} iconType={'delete'}
/> />
</StyledLeaveButton>
)} )}
</PanelButtonGroup> </PanelButtonGroup>
</> </>

@ -10,7 +10,8 @@ type Props = {
const StyledLabelContainer = styled(Flex)` const StyledLabelContainer = styled(Flex)`
div { div {
flex-grow: 1; min-width: 50%;
// we want 2 items per row and that's the easiest to make it happen
} }
`; `;
@ -23,7 +24,7 @@ export const AttachmentInfo = (props: Props) => {
label={`${window.i18n('fileId')}:`} label={`${window.i18n('fileId')}:`}
info={attachment?.id ? String(attachment.id) : window.i18n('notApplicable')} info={attachment?.id ? String(attachment.id) : window.i18n('notApplicable')}
/> />
<StyledLabelContainer container={true} flexDirection="row" justifyContent="space-between"> <StyledLabelContainer container={true} flexDirection="row" flexWrap="wrap">
<LabelWithInfo <LabelWithInfo
label={`${window.i18n('fileType')}:`} label={`${window.i18n('fileType')}:`}
info={ info={
@ -34,8 +35,6 @@ export const AttachmentInfo = (props: Props) => {
label={`${window.i18n('fileSize')}:`} label={`${window.i18n('fileSize')}:`}
info={attachment?.fileSize ? String(attachment.fileSize) : window.i18n('notApplicable')} info={attachment?.fileSize ? String(attachment.fileSize) : window.i18n('notApplicable')}
/> />
</StyledLabelContainer>
<StyledLabelContainer container={true} flexDirection="row" justifyContent="space-between">
<LabelWithInfo <LabelWithInfo
label={`${window.i18n('resolution')}:`} label={`${window.i18n('resolution')}:`}
info={ info={

@ -58,14 +58,7 @@ export const InteractionItem = (props: InteractionItemProps) => {
switch (interactionType) { switch (interactionType) {
case ConversationInteractionType.Hide: case ConversationInteractionType.Hide:
errorText = window.i18n('hideConversationFailed'); // if it's hidden or pending hiding, we don't show it any text
text =
interactionStatus === ConversationInteractionStatus.Error
? errorText
: interactionStatus === ConversationInteractionStatus.Start ||
interactionStatus === ConversationInteractionStatus.Loading
? window.i18n('hiding')
: text;
break; break;
case ConversationInteractionType.Leave: case ConversationInteractionType.Leave:
errorText = isCommunity errorText = isCommunity

@ -294,12 +294,6 @@ async function leaveGroupOrCommunityByConvoId(
onClickClose?: () => void onClickClose?: () => void
) { ) {
try { try {
await updateConversationInteractionState({
conversationId,
type: ConversationInteractionType.Leave,
status: ConversationInteractionStatus.Start,
});
if (onClickClose) { if (onClickClose) {
onClickClose(); onClickClose();
} }
@ -308,13 +302,20 @@ async function leaveGroupOrCommunityByConvoId(
await getConversationController().deleteCommunity(conversationId, { await getConversationController().deleteCommunity(conversationId, {
fromSyncMessage: false, fromSyncMessage: false,
}); });
} else { return;
await getConversationController().deleteClosedGroup(conversationId, {
fromSyncMessage: false,
sendLeaveMessage: true,
forceDeleteLocal,
});
} }
// for groups, we have a "leaving..." state that we don't need for communities.
// that's because communities can be left always, whereas for groups we need to send a leave message (and so have some encryption keypairs)
await updateConversationInteractionState({
conversationId,
type: ConversationInteractionType.Leave,
status: ConversationInteractionStatus.Start,
});
await getConversationController().deleteClosedGroup(conversationId, {
fromSyncMessage: false,
sendLeaveMessage: true,
forceDeleteLocal,
});
await clearConversationInteractionState({ conversationId }); await clearConversationInteractionState({ conversationId });
} catch (err) { } catch (err) {
window.log.warn(`showLeaveGroupByConvoId error: ${err}`); window.log.warn(`showLeaveGroupByConvoId error: ${err}`);

@ -347,6 +347,8 @@ export async function deleteMessagesByIdForEveryone(
const messageCount = selectedMessages.length; const messageCount = selectedMessages.length;
const moreThanOne = messageCount > 1; const moreThanOne = messageCount > 1;
const closeDialog = () => window.inboxStore?.dispatch(updateConfirmModal(null));
window.inboxStore?.dispatch( window.inboxStore?.dispatch(
updateConfirmModal({ updateConfirmModal({
title: window.i18n('deleteForEveryone'), title: window.i18n('deleteForEveryone'),
@ -359,8 +361,9 @@ export async function deleteMessagesByIdForEveryone(
await doDeleteSelectedMessages({ selectedMessages, conversation, deleteForEveryone: true }); await doDeleteSelectedMessages({ selectedMessages, conversation, deleteForEveryone: true });
// explicitly close modal for this case. // explicitly close modal for this case.
window.inboxStore?.dispatch(updateConfirmModal(null)); closeDialog();
}, },
onClickCancel: closeDialog,
closeAfterInput: false, closeAfterInput: false,
}) })
); );

@ -1435,7 +1435,8 @@ export class MessageModel extends Backbone.Model<MessageAttributes> {
switch (interactionType) { switch (interactionType) {
case ConversationInteractionType.Hide: case ConversationInteractionType.Hide:
return window.i18n('hideConversationFailed'); // there is no text for hiding changes
return '';
case ConversationInteractionType.Leave: case ConversationInteractionType.Leave:
return isCommunity return isCommunity
? window.i18n('leaveCommunityFailed') ? window.i18n('leaveCommunityFailed')

@ -519,7 +519,6 @@ async function leaveClosedGroup(groupId: string, fromSyncMessage: boolean) {
}); });
window?.log?.info(`We are leaving the group ${groupId}. Sending our leaving message.`); window?.log?.info(`We are leaving the group ${groupId}. Sending our leaving message.`);
// if we do not have a keypair for that group, we can't send our leave message, so just skip the message sending part // if we do not have a keypair for that group, we can't send our leave message, so just skip the message sending part
const wasSent = await getMessageQueue().sendToPubKeyNonDurably({ const wasSent = await getMessageQueue().sendToPubKeyNonDurably({
message: ourLeavingMessage, message: ourLeavingMessage,

@ -202,6 +202,7 @@ export type LocalizerKeys =
| 'failedResolveOns' | 'failedResolveOns'
| 'failedToAddAsModerator' | 'failedToAddAsModerator'
| 'failedToRemoveFromModerator' | 'failedToRemoveFromModerator'
| 'failedToSendMessage'
| 'faq' | 'faq'
| 'fileId' | 'fileId'
| 'fileSize' | 'fileSize'
@ -221,14 +222,11 @@ export type LocalizerKeys =
| 'hide' | 'hide'
| 'hideBanner' | 'hideBanner'
| 'hideConversation' | 'hideConversation'
| 'hideConversationFailed'
| 'hideConversationFailedPleaseTryAgain'
| 'hideMenuBarDescription' | 'hideMenuBarDescription'
| 'hideMenuBarTitle' | 'hideMenuBarTitle'
| 'hideNoteToSelfConfirmation' | 'hideNoteToSelfConfirmation'
| 'hideRequestBanner' | 'hideRequestBanner'
| 'hideRequestBannerDescription' | 'hideRequestBannerDescription'
| 'hiding'
| 'iAmSure' | 'iAmSure'
| 'image' | 'image'
| 'imageAttachmentAlt' | 'imageAttachmentAlt'

Loading…
Cancel
Save