Implement click to save for document list
This commit is contained in:
parent
8ca5a391af
commit
b74b761255
11 changed files with 61 additions and 40 deletions
|
@ -3,10 +3,11 @@
|
|||
*/
|
||||
import React from 'react';
|
||||
|
||||
import { AttachmentType } from './types/AttachmentType';
|
||||
import { DocumentListItem } from './DocumentListItem';
|
||||
import { ItemClickEvent } from './events/ItemClickEvent';
|
||||
import { ItemClickEvent } from './types/ItemClickEvent';
|
||||
import { MediaGridItem } from './MediaGridItem';
|
||||
import { Message } from './propTypes/Message';
|
||||
import { Message } from './types/Message';
|
||||
import { missingCaseError } from '../../../util/missingCaseError';
|
||||
|
||||
const styles = {
|
||||
|
@ -30,7 +31,7 @@ const styles = {
|
|||
interface Props {
|
||||
i18n: (value: string) => string;
|
||||
header?: string;
|
||||
type: 'media' | 'documents';
|
||||
type: AttachmentType;
|
||||
messages: Array<Message>;
|
||||
onItemClick?: (event: ItemClickEvent) => void;
|
||||
}
|
||||
|
@ -82,11 +83,11 @@ export class AttachmentSection extends React.Component<Props, {}> {
|
|||
}
|
||||
|
||||
private createClickHandler = (message: Message) => () => {
|
||||
const { onItemClick } = this.props;
|
||||
const { onItemClick, type } = this.props;
|
||||
if (!onItemClick) {
|
||||
return;
|
||||
}
|
||||
|
||||
onItemClick({ message });
|
||||
onItemClick({ type, message });
|
||||
};
|
||||
}
|
||||
|
|
|
@ -6,11 +6,10 @@ import React from 'react';
|
|||
import moment from 'moment';
|
||||
|
||||
import { AttachmentSection } from './AttachmentSection';
|
||||
import { AttachmentType } from './types/AttachmentType';
|
||||
import { groupMessagesByDate } from './groupMessagesByDate';
|
||||
import { ItemClickEvent } from './events/ItemClickEvent';
|
||||
import { Message } from './propTypes/Message';
|
||||
|
||||
type AttachmentType = 'media' | 'documents';
|
||||
import { ItemClickEvent } from './types/ItemClickEvent';
|
||||
import { Message } from './types/Message';
|
||||
|
||||
interface Props {
|
||||
documents: Array<Message>;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
import React from 'react';
|
||||
|
||||
import { Message } from './propTypes/Message';
|
||||
import { Message } from './types/Message';
|
||||
|
||||
interface Props {
|
||||
message: Message;
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
/**
|
||||
* @prettier
|
||||
*/
|
||||
import { Message } from '../propTypes/Message';
|
||||
|
||||
export interface ItemClickEvent {
|
||||
message: Message;
|
||||
}
|
|
@ -4,7 +4,7 @@
|
|||
import moment from 'moment';
|
||||
import { compact, groupBy, sortBy } from 'lodash';
|
||||
|
||||
import { Message } from './propTypes/Message';
|
||||
import { Message } from './types/Message';
|
||||
// import { missingCaseError } from '../../../util/missingCaseError';
|
||||
|
||||
type StaticSectionType = 'today' | 'yesterday' | 'thisWeek' | 'thisMonth';
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
/**
|
||||
* @prettier
|
||||
*/
|
||||
export type AttachmentType = 'media' | 'documents';
|
|
@ -0,0 +1,10 @@
|
|||
/**
|
||||
* @prettier
|
||||
*/
|
||||
import { AttachmentType } from './AttachmentType';
|
||||
import { Message } from './Message';
|
||||
|
||||
export interface ItemClickEvent {
|
||||
message: Message;
|
||||
type: AttachmentType;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue