Skip to content

Commit

Permalink
CRS-7: Adding types for newly exported components
Browse files Browse the repository at this point in the history
Fixes #135 #134 #133
  • Loading branch information
vishalnarkhede committed Jan 30, 2020
1 parent bb8b3e2 commit ff62035
Show file tree
Hide file tree
Showing 10 changed files with 296 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/components/AttachmentActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import PropTypes from 'prop-types';
export class AttachmentActions extends React.PureComponent {
static propTypes = {
// /** The id of the form input */
// id: PropTypes.string.isRequired,
id: PropTypes.string.isRequired,
/** The text for the form input */
text: PropTypes.string,
/** A list of actions */
Expand Down
7 changes: 0 additions & 7 deletions src/components/Audio.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import PropTypes from 'prop-types';

export class Audio extends React.Component {
static propTypes = {
handleClose: PropTypes.func,
/** Attachment object of audio type */
og: PropTypes.object,
};
Expand Down Expand Up @@ -58,12 +57,6 @@ export class Audio extends React.Component {
window.clearInterval(this.state.updateProgress);
}

_handleClose = (e) => {
if (this.props.handleClose) {
this.props.handleClose(e);
}
};

render() {
const { og } = this.props;
const audio = og;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Card.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import giphyLogo from '../assets/Poweredby_100px-White_VertText.png';
export class Card extends React.PureComponent {
static propTypes = {
/** Title returned by the OG scraper */
title: PropTypes.string.isRequired,
title: PropTypes.string,
/** Link returned by the OG scraper */
title_link: PropTypes.string,
/** The scraped url, used as a fallback if the OG-data doesn't include a link */
Expand Down
1 change: 1 addition & 0 deletions src/components/ChannelList.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ class ChannelList extends PureComponent {

// eslint-disable-next-line sonarjs/cognitive-complexity
handleEvent = async (e) => {
console.log(e);
if (e.type === 'user.presence.changed') {
let newChannels = this.state.channels;

Expand Down
2 changes: 0 additions & 2 deletions src/components/ChatAutoComplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ export class ChatAutoComplete extends PureComponent {
placeholder: PropTypes.string,
/** What loading component to use for the auto complete when loading results. */
LoadingIndicator: PropTypes.node,
/** function to set up your triggers for autocomplete(eg. '@' for mentions, '/' for commands) */
trigger: PropTypes.func,
/** Minimum number of Character */
minChar: PropTypes.number,
/** Array of [user object](https://getstream.io/chat/docs/#chat-doc-set-user). Used for mentions suggestions */
Expand Down
4 changes: 1 addition & 3 deletions src/components/InfiniteScroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import PropTypes from 'prop-types';

export class InfiniteScroll extends Component {
static propTypes = {
children: PropTypes.node.isRequired,
element: PropTypes.node,
hasMore: PropTypes.bool,
initialLoad: PropTypes.bool,
Expand Down Expand Up @@ -40,7 +39,6 @@ export class InfiniteScroll extends Component {
}

componentDidMount() {
this.pageLoaded = this.props.pageStart;
this.attachScrollListener();
}

Expand Down Expand Up @@ -173,7 +171,7 @@ export class InfiniteScroll extends Component {
this.detachScrollListener();
// Call loadMore after detachScrollListener to allow for non-async loadMore functions
if (typeof this.props.loadMore === 'function') {
this.props.loadMore((this.pageLoaded += 1));
this.props.loadMore();
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/components/Message.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export class Message extends Component {
onMentionsHover: PropTypes.func,
/** @see See [Channel Context](https://getstream.github.io/stream-chat-react/#channelcontext) */
openThread: PropTypes.func,
clearEditingState: PropTypes.func,
/**
* Additional props for underlying MessageInput component.
* Available props - https://getstream.github.io/stream-chat-react/#messageinput
Expand Down
3 changes: 1 addition & 2 deletions src/components/ReverseInfiniteScroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export class ReverseInfiniteScroll extends Component {
}

componentDidMount() {
this.pageLoaded = this.props.pageStart;
this.attachScrollListener();
}

Expand Down Expand Up @@ -179,7 +178,7 @@ export class ReverseInfiniteScroll extends Component {
//this.detachScrollListener();
// Call loadMore after detachScrollListener to allow for non-async loadMore functions
if (typeof this.props.loadMore === 'function') {
this.props.loadMore((this.pageLoaded += 1));
this.props.loadMore();
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/SimpleReactionsList.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import { defaultMinimalEmojis, emojiSetDef, emojiData } from '../utils';
export class SimpleReactionsList extends React.PureComponent {
static propTypes = {
reactions: PropTypes.array,
reaction_coutns: PropTypes.object,
renderReactions: PropTypes.func,
reaction_counts: PropTypes.object,
showTooltip: PropTypes.bool,
/** Provide a list of reaction options [{name: 'angry', emoji: 'angry'}] */
reactionOptions: PropTypes.array,
handleReaction: PropTypes.func,
};

static defaultProps = {
Expand Down
Loading

0 comments on commit ff62035

Please sign in to comment.