mattermost-mobile/app/components/files_search/file_options/toasts.tsx
Ashish Dhama 100a760502
[MM-44655] : Add channel files screen (#7223)
* add channel files screen

* fix filtering

* refactor code and fix style

* add search and some refactoring

* fix lint

* refactoring

* move file filters to files directory

* fix dependecy

* UX fixes and minor memo dependency changes

* fix empty state on Ipad

* fix search issues

* fix lint error

* fix search issue

* fix loading on filter changes

* show different text if no files found when filter is applied

* feedback review

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
2023-04-14 18:33:11 -04:00

46 lines
1.3 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React from 'react';
import CopyPublicLink from '@screens/gallery/footer/copy_public_link';
import DownloadWithAction from '@screens/gallery/footer/download_with_action';
import type {GalleryAction, GalleryItemType} from '@typings/screens/gallery';
type Props = {
action: GalleryAction;
fileInfo: FileInfo | undefined;
setAction: (action: GalleryAction) => void;
}
const Toasts = ({
action,
fileInfo,
setAction,
}: Props) => {
const galleryItem = {...fileInfo, type: fileInfo?.mime_type.startsWith('image/') ? 'image' : 'file'} as GalleryItemType;
switch (action) {
case 'downloading':
return (
<DownloadWithAction
action={action}
galleryView={false}
item={galleryItem}
setAction={setAction}
/>
);
case 'copying':
return (
<CopyPublicLink
galleryView={false}
item={galleryItem}
setAction={setAction}
/>
);
default:
return null;
}
};
export default Toasts;