Moves saveAttachment to a redux action
This commit is contained in:
parent
c8068cd501
commit
b138774454
34 changed files with 190 additions and 216 deletions
|
@ -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}>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue