Moves saveAttachment to a redux action

This commit is contained in:
Josh Perez 2022-12-14 13:12:04 -05:00 committed by GitHub
parent c8068cd501
commit b138774454
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 190 additions and 216 deletions

View file

@ -12,6 +12,7 @@ import { missingCaseError } from '../util/missingCaseError';
export type PropsType = {
hideToast: () => unknown;
i18n: LocalizerType;
openFileInFolder: (target: string) => unknown;
toast?: {
toastType: ToastType;
parameters?: ReplacementValuesType;
@ -23,6 +24,7 @@ const SHORT_TIMEOUT = 3 * SECOND;
export function ToastManager({
hideToast,
i18n,
openFileInFolder,
toast,
}: PropsType): JSX.Element | null {
if (toast === undefined) {
@ -117,6 +119,24 @@ export function ToastManager({
);
}
if (toastType === ToastType.FileSaved) {
return (
<Toast
onClose={hideToast}
toastAction={{
label: i18n('attachmentSavedShow'),
onClick: () => {
if (toast.parameters && 'fullPath' in toast.parameters) {
openFileInFolder(String(toast.parameters.fullPath));
}
},
}}
>
{i18n('attachmentSaved')}
</Toast>
);
}
if (toastType === ToastType.FileSize) {
return (
<Toast onClose={hideToast}>