fix: remove titles from toasts

as they have been removed from the guideline
pull/2963/head
Audric Ackermann 2 years ago
parent 8274712528
commit f9502b4bbe

@ -83,7 +83,6 @@
"replyingToMessage": "Replying to:",
"originalMessageNotFound": "Original message not found",
"you": "You",
"audioPermissionNeededTitle": "Microphone Access Required",
"audioPermissionNeeded": "You can enable microphone access under: Settings (Gear icon) => Privacy",
"image": "Image",
"audio": "Audio",
@ -332,9 +331,6 @@
"setPasswordInvalid": "Passwords do not match",
"changePasswordInvalid": "The old password you entered is incorrect",
"removePasswordInvalid": "Incorrect password",
"setPasswordTitle": "Password Set",
"changePasswordTitle": "Password Changed",
"removePasswordTitle": "Password Removed",
"setPasswordToastDescription": "Your password has been set. Please keep it safe.",
"changePasswordToastDescription": "Your password has been changed. Please keep it safe.",
"removePasswordToastDescription": "Your password has been removed.",
@ -362,7 +358,6 @@
"noContactsToAdd": "No contacts to add",
"noMembersInThisGroup": "No other members in this group",
"noModeratorsToRemove": "no admins to remove",
"onlyAdminCanRemoveMembers": "You are not the creator",
"onlyAdminCanRemoveMembersDesc": "Only the creator of the group can remove users",
"createAccount": "Create account",
"startInTrayTitle": "Keep in System Tray",
@ -486,12 +481,9 @@
"endCall": "End call",
"permissionsSettingsTitle": "Permissions",
"helpSettingsTitle": "Help",
"cameraPermissionNeededTitle": "Voice/Video Call permissions required",
"cameraPermissionNeeded": "You can enable the 'Voice and video calls' permission in the Privacy Settings.",
"unableToCall": "Cancel your ongoing call first",
"unableToCallTitle": "Cannot start new call",
"callMissed": "Missed call from $name$",
"callMissedTitle": "Call missed",
"noCameraFound": "No camera found",
"noAudioInputFound": "No audio input found",
"noAudioOutputFound": "No audio output found",

@ -17,23 +17,15 @@ export enum SessionToastType {
}
type Props = {
title: string;
description: string;
id?: string;
type?: SessionToastType;
icon?: SessionIconType;
description?: string;
closeToast?: any;
onToastClick?: () => void;
};
const TitleDiv = styled.div`
font-size: var(--font-size-md);
line-height: var(--font-size-md);
font-family: var(--font-default);
color: var(--text-primary-color);
text-overflow: ellipsis;
`;
const DescriptionDiv = styled.div`
font-size: var(--font-size-sm);
color: var(--text-secondary-color);
@ -72,7 +64,7 @@ function DescriptionPubkeysReplaced({ description }: { description: string }) {
}
export const SessionToast = (props: Props) => {
const { title, description, type, icon } = props;
const { description, type, icon } = props;
const toastDesc = description || '';
const toastIconSize = toastDesc ? 'huge' : 'medium';
@ -117,8 +109,7 @@ export const SessionToast = (props: Props) => {
flexDirection="column"
className="session-toast"
>
<TitleDiv>{title}</TitleDiv>
{toastDesc && <DescriptionPubkeysReplaced description={toastDesc} />}
<DescriptionPubkeysReplaced description={toastDesc} />
</Flex>
</Flex>
);

@ -1,16 +1,16 @@
/* eslint-disable @typescript-eslint/no-misused-promises */
import React from 'react';
import autoBind from 'auto-bind';
import React from 'react';
import { ToastUtils } from '../../session/utils';
import { Data } from '../../data/data';
import { SpacerSM } from '../basic/Text';
import { ToastUtils } from '../../session/utils';
import { sessionPassword } from '../../state/ducks/modalDialog';
import { LocalizerKeys } from '../../types/LocalizerKeys';
import { SessionButton, SessionButtonColor, SessionButtonType } from '../basic/SessionButton';
import { SessionWrapperModal } from '../SessionWrapperModal';
import { matchesHash, validatePassword } from '../../util/passwordUtils';
import { assertUnreachable } from '../../types/sqlSharedTypes';
import { matchesHash, validatePassword } from '../../util/passwordUtils';
import { SessionWrapperModal } from '../SessionWrapperModal';
import { SessionButton, SessionButtonColor, SessionButtonType } from '../basic/SessionButton';
import { SpacerSM } from '../basic/Text';
export type PasswordAction = 'set' | 'change' | 'remove' | 'enter';
@ -197,7 +197,6 @@ export class SessionPasswordDialog extends React.Component<Props, State> {
await window.setPassword(enteredPassword, null);
ToastUtils.pushToastSuccess(
'setPasswordSuccessToast',
window.i18n('setPasswordTitle'),
window.i18n('setPasswordToastDescription')
);
@ -237,7 +236,6 @@ export class SessionPasswordDialog extends React.Component<Props, State> {
ToastUtils.pushToastSuccess(
'setPasswordSuccessToast',
window.i18n('changePasswordTitle'),
window.i18n('changePasswordToastDescription')
);
@ -259,7 +257,6 @@ export class SessionPasswordDialog extends React.Component<Props, State> {
ToastUtils.pushToastWarning(
'setPasswordSuccessToast',
window.i18n('removePasswordTitle'),
window.i18n('removePasswordToastDescription')
);

@ -6,30 +6,28 @@ import { SessionSettingCategory } from '../../components/settings/SessionSetting
import { SectionType, showLeftPaneSection, showSettingsSection } from '../../state/ducks/section';
// if you push a toast manually with toast...() be sure to set the type attribute of the SessionToast component
export function pushToastError(id: string, title: string, description?: string) {
toast.error(
<SessionToast title={title} description={description} type={SessionToastType.Error} />,
{ toastId: id, updateId: id }
);
export function pushToastError(id: string, description: string) {
toast.error(<SessionToast description={description} type={SessionToastType.Error} />, {
toastId: id,
updateId: id,
});
}
export function pushToastWarning(id: string, title: string, description?: string) {
toast.warning(
<SessionToast title={title} description={description} type={SessionToastType.Warning} />,
{ toastId: id, updateId: id }
);
export function pushToastWarning(id: string, description: string) {
toast.warning(<SessionToast description={description} type={SessionToastType.Warning} />, {
toastId: id,
updateId: id,
});
}
export function pushToastInfo(
id: string,
title: string,
description?: string,
description: string,
onToastClick?: () => void,
delay?: number
) {
toast.info(
<SessionToast
title={title}
description={description}
type={SessionToastType.Info}
onToastClick={onToastClick}
@ -38,19 +36,9 @@ export function pushToastInfo(
);
}
export function pushToastSuccess(
id: string,
title: string,
description?: string,
icon?: SessionIconType
) {
export function pushToastSuccess(id: string, description: string, icon?: SessionIconType) {
toast.success(
<SessionToast
title={title}
description={description}
type={SessionToastType.Success}
icon={icon}
/>,
<SessionToast description={description} type={SessionToastType.Success} icon={icon} />,
{ toastId: id, updateId: id }
);
}
@ -64,7 +52,7 @@ export function pushLoadAttachmentFailure(message?: string) {
}
export function pushFileSizeError(limit: number, units: string) {
pushToastError('fileSizeWarning', window.i18n('fileSizeWarning'), `Max size: ${limit} ${units}`);
pushToastError('fileSizeWarning', `${window.i18n('fileSizeWarning')}: ${limit} ${units}`);
}
export function pushFileSizeErrorAsByte(bytesCount: number) {
@ -130,15 +118,11 @@ export function pushMessageDeleteForbidden() {
}
export function pushUnableToCall() {
pushToastError('unableToCall', window.i18n('unableToCallTitle'), window.i18n('unableToCall'));
pushToastError('unableToCall', window.i18n('unableToCall'));
}
export function pushedMissedCall(conversationName: string) {
pushToastInfo(
'missedCall',
window.i18n('callMissedTitle'),
window.i18n('callMissed', [conversationName])
);
pushToastInfo('missedCall', window.i18n('callMissed', [conversationName]));
}
const openPermissionsSettings = () => {
@ -150,7 +134,6 @@ export function pushedMissedCallCauseOfPermission(conversationName: string) {
const id = 'missedCallPermission';
toast.info(
<SessionToast
title={window.i18n('callMissedTitle')}
description={window.i18n('callMissedCausePermission', [conversationName])}
type={SessionToastType.Info}
onToastClick={openPermissionsSettings}
@ -160,17 +143,12 @@ export function pushedMissedCallCauseOfPermission(conversationName: string) {
}
export function pushedMissedCallNotApproved(displayName: string) {
pushToastInfo(
'missedCall',
window.i18n('callMissedTitle'),
window.i18n('callMissedNotApproved', [displayName])
);
pushToastInfo('missedCall', window.i18n('callMissedNotApproved', [displayName]));
}
export function pushVideoCallPermissionNeeded() {
pushToastInfo(
'videoCallPermissionNeeded',
window.i18n('cameraPermissionNeededTitle'),
window.i18n('cameraPermissionNeeded'),
openPermissionsSettings
);
@ -179,7 +157,6 @@ export function pushVideoCallPermissionNeeded() {
export function pushAudioPermissionNeeded() {
pushToastInfo(
'audioPermissionNeeded',
window.i18n('audioPermissionNeededTitle'),
window.i18n('audioPermissionNeeded'),
openPermissionsSettings
);
@ -210,28 +187,15 @@ export function someDeletionsFailed() {
}
export function pushDeleted(messageCount: number) {
pushToastSuccess(
'deleted',
window.i18n('deleted', [messageCount.toString()]),
undefined,
'check'
);
pushToastSuccess('deleted', window.i18n('deleted', [messageCount.toString()]), 'check');
}
export function pushCannotRemoveCreatorFromGroup() {
pushToastWarning(
'cannotRemoveCreatorFromGroup',
window.i18n('cannotRemoveCreatorFromGroup'),
window.i18n('cannotRemoveCreatorFromGroupDesc')
);
pushToastWarning('cannotRemoveCreatorFromGroup', window.i18n('cannotRemoveCreatorFromGroupDesc'));
}
export function pushOnlyAdminCanRemove() {
pushToastInfo(
'onlyAdminCanRemoveMembers',
window.i18n('onlyAdminCanRemoveMembers'),
window.i18n('onlyAdminCanRemoveMembersDesc')
);
pushToastInfo('onlyAdminCanRemoveMembers', window.i18n('onlyAdminCanRemoveMembersDesc'));
}
export function pushFailedToAddAsModerator() {
@ -275,5 +239,5 @@ export function pushMustBeApproved() {
}
export function pushRateLimitHitReactions() {
pushToastInfo('reactRateLimit', '', window?.i18n?.('rateLimitReactMessage')); // because otherwise test fails
pushToastInfo('reactRateLimit', window?.i18n?.('rateLimitReactMessage')); // "?." are needed for unit tests env
}

@ -64,21 +64,18 @@ function displayFailedInvitesForGroup(groupPk: GroupPubkeyType) {
case 1:
ToastUtils.pushToastWarning(
`invite-failed${groupPk}`,
window.i18n('inviteFailed'),
window.i18n('groupInviteFailedOne', [...thisGroupFailures.failedMembers, groupPk])
);
break;
case 2:
ToastUtils.pushToastWarning(
`invite-failed${groupPk}`,
window.i18n('inviteFailed'),
window.i18n('groupInviteFailedTwo', [...thisGroupFailures.failedMembers, groupPk])
);
break;
default:
ToastUtils.pushToastWarning(
`invite-failed${groupPk}`,
window.i18n('inviteFailed'),
window.i18n('groupInviteFailedOthers', [
thisGroupFailures.failedMembers[0],
`${thisGroupFailures.failedMembers.length - 1}`,

@ -128,8 +128,7 @@ export async function autoScaleAvatarBlob(file: File) {
} catch (e) {
ToastUtils.pushToastError(
'pickFileForAvatar',
'An error happened while picking/resizing the image',
e.message || ''
`An error happened while picking/resizing the image: "${e.message || ''}"`
);
window.log.error(e);
return null;

Loading…
Cancel
Save