Skip to content

Commit

Permalink
- change action types return
Browse files Browse the repository at this point in the history
- add align start to timestamp in response messages
- fix production build to not add the devtools
  • Loading branch information
mcallegari10 committed Apr 13, 2020
1 parent 7e17444 commit 841d3ce
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-chat-widget",
"version": "3.0.0-beta.4",
"version": "3.0.0-beta.5",
"description": "Chat web widget for React apps",
"main": "lib/index.js",
"repository": "[email protected]:Wolox/react-chat-widget.git",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
.rcw-response {
display: flex;
flex-direction: column;
align-items: flex-start;

.rcw-message-text {
@include message-bubble($grey-2);
Expand Down
22 changes: 11 additions & 11 deletions src/store/actions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,41 @@ import { ElementType } from 'react';
import * as actionsTypes from './types';
import { LinkParams } from '../types';

export function toggleChat(): actionsTypes.BehaviorActions {
export function toggleChat(): actionsTypes.ToggleChat {
return {
type: actionsTypes.TOGGLE_CHAT
};
}

export function toggleInputDisabled(): actionsTypes.BehaviorActions {
export function toggleInputDisabled(): actionsTypes.ToggleInputDisabled {
return {
type: actionsTypes.TOGGLE_INPUT_DISABLED
};
}

export function addUserMessage(text: string, id?: string): actionsTypes.MessagesActions {
export function addUserMessage(text: string, id?: string): actionsTypes.AddUserMessage {
return {
type: actionsTypes.ADD_NEW_USER_MESSAGE,
text,
id
};
}

export function addResponseMessage(text: string, id?: string): actionsTypes.MessagesActions {
export function addResponseMessage(text: string, id?: string): actionsTypes.AddResponseMessage {
return {
type: actionsTypes.ADD_NEW_RESPONSE_MESSAGE,
text,
id
};
}

export function toggleMsgLoader(): actionsTypes.BehaviorActions {
export function toggleMsgLoader(): actionsTypes.ToggleMsgLoader {
return {
type: actionsTypes.TOGGLE_MESSAGE_LOADER
}
}

export function addLinkSnippet(link: LinkParams, id?: string): actionsTypes.MessagesActions {
export function addLinkSnippet(link: LinkParams, id?: string): actionsTypes.AddLinkSnippet {
return {
type: actionsTypes.ADD_NEW_LINK_SNIPPET,
link,
Expand All @@ -50,7 +50,7 @@ export function renderCustomComponent(
props: any,
showAvatar: boolean,
id?: string
): actionsTypes.MessagesActions {
): actionsTypes.RenderCustomComponent {
return {
type: actionsTypes.ADD_COMPONENT_MESSAGE,
component,
Expand All @@ -60,27 +60,27 @@ export function renderCustomComponent(
};
}

export function dropMessages(): actionsTypes.MessagesActions {
export function dropMessages(): actionsTypes.DropMessages {
return {
type: actionsTypes.DROP_MESSAGES
};
}

export function hideAvatar(index: number): actionsTypes.MessagesActions {
export function hideAvatar(index: number): actionsTypes.HideAvatar {
return {
type: actionsTypes.HIDE_AVATAR,
index
};
}

export function setQuickButtons(buttons: Array<{ label: string, value: string | number }>): actionsTypes.QuickButtonsActions {
export function setQuickButtons(buttons: Array<{ label: string, value: string | number }>): actionsTypes.SetQuickButtons {
return {
type: actionsTypes.SET_QUICK_BUTTONS,
buttons
}
}

export function deleteMessages(count: number, id?: string): actionsTypes.MessagesActions {
export function deleteMessages(count: number, id?: string): actionsTypes.DeleteMessages {
return {
type: actionsTypes.DELETE_MESSAGES,
count,
Expand Down
2 changes: 1 addition & 1 deletion src/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ declare global {
}
}

const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const composeEnhancers = (process.env.NODE_ENV !== 'production' && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) || compose;
const reducer = combineReducers({ behavior, messages, quickButtons });

export default createStore(reducer, composeEnhancers());

0 comments on commit 841d3ce

Please sign in to comment.