🎨 big answering buttons for conversations in direct messages

This commit is contained in:
Baptiste Lemoine 2019-12-23 12:41:49 +01:00
parent ff53301fdb
commit a43f67dd03
5 changed files with 66 additions and 63 deletions

View File

@ -1,23 +1,19 @@
import api, { getLinks } from '../api'; import api, { getLinks } from '../api';
import { import { importFetchedAccounts, importFetchedStatus, importFetchedStatuses } from './importer';
importFetchedAccounts,
importFetchedStatuses,
importFetchedStatus,
} from './importer';
export const CONVERSATIONS_MOUNT = 'CONVERSATIONS_MOUNT'; export const CONVERSATIONS_MOUNT = 'CONVERSATIONS_MOUNT';
export const CONVERSATIONS_UNMOUNT = 'CONVERSATIONS_UNMOUNT'; export const CONVERSATIONS_UNMOUNT = 'CONVERSATIONS_UNMOUNT';
export const CONVERSATIONS_FETCH_REQUEST = 'CONVERSATIONS_FETCH_REQUEST'; export const CONVERSATIONS_FETCH_REQUEST = 'CONVERSATIONS_FETCH_REQUEST';
export const CONVERSATIONS_FETCH_SUCCESS = 'CONVERSATIONS_FETCH_SUCCESS'; export const CONVERSATIONS_FETCH_SUCCESS = 'CONVERSATIONS_FETCH_SUCCESS';
export const CONVERSATIONS_FETCH_FAIL = 'CONVERSATIONS_FETCH_FAIL'; export const CONVERSATIONS_FETCH_FAIL = 'CONVERSATIONS_FETCH_FAIL';
export const CONVERSATIONS_UPDATE = 'CONVERSATIONS_UPDATE'; export const CONVERSATIONS_UPDATE = 'CONVERSATIONS_UPDATE';
export const CONVERSATIONS_READ = 'CONVERSATIONS_READ'; export const CONVERSATIONS_READ = 'CONVERSATIONS_READ';
export const CONVERSATIONS_DELETE_REQUEST = 'CONVERSATIONS_DELETE_REQUEST'; export const CONVERSATIONS_DELETE_REQUEST = 'CONVERSATIONS_DELETE_REQUEST';
export const CONVERSATIONS_DELETE_SUCCESS = 'CONVERSATIONS_DELETE_SUCCESS'; export const CONVERSATIONS_DELETE_SUCCESS = 'CONVERSATIONS_DELETE_SUCCESS';
export const CONVERSATIONS_DELETE_FAIL = 'CONVERSATIONS_DELETE_FAIL'; export const CONVERSATIONS_DELETE_FAIL = 'CONVERSATIONS_DELETE_FAIL';
export const mountConversations = () => ({ export const mountConversations = () => ({
type: CONVERSATIONS_MOUNT, type: CONVERSATIONS_MOUNT,
@ -30,7 +26,7 @@ export const unmountConversations = () => ({
export const markConversationRead = conversationId => (dispatch, getState) => { export const markConversationRead = conversationId => (dispatch, getState) => {
dispatch({ dispatch({
type: CONVERSATIONS_READ, type: CONVERSATIONS_READ,
id: conversationId, id : conversationId,
}); });
api(getState).post(`/api/v1/conversations/${conversationId}/read`); api(getState).post(`/api/v1/conversations/${conversationId}/read`);

View File

@ -6,41 +6,41 @@ import Icon from 'mastodon/components/icon';
export default class IconButton extends React.PureComponent { export default class IconButton extends React.PureComponent {
static propTypes = { static propTypes = {
className: PropTypes.string, className : PropTypes.string,
title: PropTypes.string.isRequired, title : PropTypes.string.isRequired,
icon: PropTypes.string.isRequired, icon : PropTypes.string.isRequired,
onClick: PropTypes.func, onClick : PropTypes.func,
onMouseDown: PropTypes.func, onMouseDown: PropTypes.func,
onKeyDown: PropTypes.func, onKeyDown : PropTypes.func,
onKeyPress: PropTypes.func, onKeyPress : PropTypes.func,
size: PropTypes.number, size : PropTypes.number,
active: PropTypes.bool, active : PropTypes.bool,
pressed: PropTypes.bool, pressed : PropTypes.bool,
expanded: PropTypes.bool, expanded : PropTypes.bool,
style: PropTypes.object, style : PropTypes.object,
activeStyle: PropTypes.object, activeStyle: PropTypes.object,
disabled: PropTypes.bool, disabled : PropTypes.bool,
inverted: PropTypes.bool, inverted : PropTypes.bool,
animate: PropTypes.bool, animate : PropTypes.bool,
overlay: PropTypes.bool, overlay : PropTypes.bool,
tabIndex: PropTypes.string, tabIndex : PropTypes.string,
}; };
static defaultProps = { static defaultProps = {
size: 18, size : 18,
active: false, active : false,
disabled: false, disabled: false,
animate: false, animate : false,
overlay: false, overlay : false,
tabIndex: '0', tabIndex: '0',
}; };
state = { state = {
activate: false, activate : false,
deactivate: false, deactivate: false,
} };
componentWillReceiveProps (nextProps) { componentWillReceiveProps(nextProps) {
if (!nextProps.animate) return; if (!nextProps.animate) return;
if (this.props.active && !nextProps.active) { if (this.props.active && !nextProps.active) {
@ -50,38 +50,38 @@ export default class IconButton extends React.PureComponent {
} }
} }
handleClick = (e) => { handleClick = (e) => {
e.preventDefault(); e.preventDefault();
if (!this.props.disabled) { if (!this.props.disabled) {
this.props.onClick(e); this.props.onClick(e);
} }
} };
handleKeyPress = (e) => { handleKeyPress = (e) => {
if (this.props.onKeyPress && !this.props.disabled) { if (this.props.onKeyPress && !this.props.disabled) {
this.props.onKeyPress(e); this.props.onKeyPress(e);
} }
} };
handleMouseDown = (e) => { handleMouseDown = (e) => {
if (!this.props.disabled && this.props.onMouseDown) { if (!this.props.disabled && this.props.onMouseDown) {
this.props.onMouseDown(e); this.props.onMouseDown(e);
} }
} };
handleKeyDown = (e) => { handleKeyDown = (e) => {
if (!this.props.disabled && this.props.onKeyDown) { if (!this.props.disabled && this.props.onKeyDown) {
this.props.onKeyDown(e); this.props.onKeyDown(e);
} }
} };
render () { render() {
const style = { const style = {
fontSize: `${this.props.size}px`, // fontSize: `${this.props.size}px`,
width: `${this.props.size * 1.28571429}px`, // width: `${this.props.size * 1.28571429}px`,
height: `${this.props.size * 1.28571429}px`, // height: `${this.props.size * 1.28571429}px`,
lineHeight: `${this.props.size}px`, // lineHeight: `${this.props.size}px`,
...this.props.style, ...this.props.style,
...(this.props.active ? this.props.activeStyle : {}), ...(this.props.active ? this.props.activeStyle : {}),
}; };
@ -128,8 +128,12 @@ export default class IconButton extends React.PureComponent {
tabIndex={tabIndex} tabIndex={tabIndex}
disabled={disabled} disabled={disabled}
> >
<Icon id={icon} fixedWidth aria-hidden='true' /> <Icon
</button> id={icon}
fixedWidth
aria-hidden='true'
/>
</button >
); );
} }

View File

@ -227,6 +227,8 @@ class Conversation extends ImmutablePureComponent {
items={menu} items={menu}
icon='ellipsis-h' icon='ellipsis-h'
direction='right' direction='right'
style={{ width: '15em' }}
size={18}
title={intl.formatMessage(messages.more)} title={intl.formatMessage(messages.more)}
/> />
</div > </div >

View File

@ -406,6 +406,10 @@
} }
} }
.autosuggest-textarea__textarea {
margin-bottom: 5px;
}
.autosuggest-textarea__textarea, .autosuggest-textarea__textarea,
.spoiler-input__input { .spoiler-input__input {
display: block; display: block;

View File

@ -33,31 +33,28 @@ $messagingBoxHeight: 20em;
} }
.conversation { .conversation {
&.focusable {
.conversation__content {
padding-right: 0;
}
.conversation_reply,
.icon-button {
&:hover { &:hover {
color: $ui-highlight-color;
background: mix($ui-base-color, $ui-secondary-color); background: mix($ui-base-color, $ui-secondary-color);
} }
}
.conversation_reply {
display: inline-block;
padding: 1em;
width: 15em;
&:hover {
color: $ui-highlight-color;
}
} }
.conversation_reply,
.icon-button,
.status__action-bar-dropdown { .status__action-bar-dropdown {
display: inline-block; display: inline-block;
padding: 1em; float: right;
width: 10em; width: 18em;
height: 3.2em;
&:hover { text-align: center;
color: $ui-highlight-color;
}
} }
} }